Created attachment 13676 [details] Cheltenham Font File (.sft/pcletto format) For several years I have successfully used macro files stored in the deemed 0:/pcl/macros/ directory. As a result, I am able to use the same coding and documents with our actual HP LaserJets and with GhostPCL. This works wonderfully well and I am grateful that GhostPCL includes this capability. I recently have needed to use a few PCLETTO (.sft) fonts and had hope to store them in the defined 0:/fonts/ directory, as is generally done on a physical LaserJet with PJL. Much like is the process with selecting disk-resident macros, I 'Set' the current numeric font ID [<ESC>*c<numericID>D], then I 'Associate' that numeric font ID with the corresponding (.sft) disk font residing in 0:/fonts/ using the Alphanumeric ID command [<ESC>&n10W<0x01>mySFTFont], and finally I 'Select' the numeric font ID [<ESC>(<numericID>X]. I cannot get the Alphanumeric ID command to locate the SFT font file. I have tried (without success) using all the following storage locations: 0:/fonts/ 0:/pcl/ 0:/pcl/macros/ 0: /windows/fonts/ Unfortunately, I cannot get the font file to 'associate' in order to be selected. I understand that GhostPCL does not use the LaserJet/PJL method that includes storing font ID and attribute associations in the 'pclResourceFile' (located in 0:/pcl/macros/) as do the physical LaserJets, but I thought that since GhostPCL can find and use disk-resident macros, it should be able to find and use disk-resident 'SFT' fonts. The test font file is valid (CheltRoman), since we are able to download the contents of that same file as part of a .pcl job and GhostPCL will process and use it correctly. This is done using the [<ESC>*c<numericID>D / <font file contents> / <ESC>*5F / <ESC>(<numericID>X] sequence. My current workaround is to store the .SFT font files in the 0:/pcl/macros/ directory. Then, I treat that file as a macro which is 'set', 'associated' and then 'called' in the middle of the [<ESC>*c<numericID>D / <font file contents> / <ESC>*5F / <ESC>(<numericID>X] sequence. This method permits me to use the font without having to include it in the actual print-time .pcl file. Although 'wrapping' the font inside a macro works to select disk-based soft fonts, it is not quite as convenient or as efficient as it would be if the Alphanumeric ID Command would locate the font and 'associate' it. I have looked through the source, and it appears the Alphanumeric ID command is fully supported (except for the '52' pclResourceFile function), but at other points I can't make out exactly where it expects fonts referred by it to be located. I've also looked at the code referencing Cartridge and SIMM fonts, but this seems to be a different issue, although there is a good chance that I am mistaken on that point. For your reference, I have attached the test .sft font file, (CheltRoman), a working example of wrapping the font in a macro call (macroselectcheltfont.pcl), and a failing example of how font selection is requested to work (failedcheltselect.pcl). Thanks for taking a look at these, and for setting me straight if I have mis-understood how these things should work with GhostPCL. Also, please accept my apology if this issue was corrected in a later version of GhostPCL. I had looked at the revisions since 8.71 and could find no mention of this issue, though.
Created attachment 13677 [details] Working Example of Macro with 'wrapped' Font Call
Created attachment 13678 [details] Failing Example of Alphanumeric Associate Font Function
Yes, only macros are implemented. As mentioned in the document ghostpdl.pdf PJL is not complete. I'll make it an enhancement and bountiable (https://ghostscript.com/Bug_bounty_program.html)
Coincidentally a potential customer has requested this, so we should fix it with higher priority, changing to P2. The code in pcl/pcsfont.c:pcl_find_resource() was intended to work for both macros and soft fonts, but only supports macros now. There is a reference to the soft font dictionary in the procedure, that is where the fonts should be stored. The font implementation should parallel the implemented macro code so this shouldn't be very difficult to do. Hugh Hood's setup (Comment 1 + attachments) can be used to guide the implementation.
Created attachment 13967 [details] proposed patch This patch against the current code seems to work with the provided font. The pcl_find_resource() has gotten a bit complex with support for this feature and I might refactor it a bit. The OP reported having "a few PCLETTO" files, it would be useful to test this new patch with those font files, either by integrating this patch and testing or submitting the PCLETTO files to this bug so we can test.
(In reply to Henry Stiles from comment #4) > Coincidentally a potential customer has requested this, so we should fix it > with higher priority, changing to P2. > > The code in pcl/pcsfont.c:pcl_find_resource() was intended to work for both > macros and soft fonts, but only supports macros now. There is a reference > to the soft font dictionary in the procedure, that is where the fonts should > be stored. The font implementation should parallel the implemented macro > code so this shouldn't be very difficult to do. > > Hugh Hood's setup (Comment 1 + attachments) can be used to guide the > implementation. There will be a correction to the patch as well but testing would still be valuable.
Created attachment 13968 [details] fixed patch Refactors and fixes previously noted problem.
Created attachment 13977 [details] Aachen PCLETTO (.sft) Soft Font
Created attachment 13978 [details] Copperplate PCLETTO (.sft) Soft Font
Thank you, Henry, for continuing to improve the functionality of GhostPCL. As requested in Comment #5, attached are (2) additional PCLETTO (.sft) soft font files: 1. AachenBT-Roman_10U.sft Bitstream Aachen Font - PCL Typeface Family #8363 and, 2. Copperplate_10U.sft Linotype Copperplate Font - PCL Typeface Family #12462 While I realize that GhostPCL does not presently utilize the 'pclResourceFile' (for the purpose of allowing font selection via Typeface Family #), I included that information for completeness, and perhaps a future enhancement may add such additional functionality. Please advise if I may supply anything else for testing.
Fixed with: commit cea2da4aae1edbf6aef128f44962cfe8baa5c728 Author: Henry Stiles <henry.stiles@artifex.com> Date: Thu Jul 13 16:02:16 2017 -0600 Fixes Bug 697900 - No support for disk resident fonts. Support added for using PCL font resources from the PJL file system. Macros have always been supported and using a font wrapped in a macro as a workaround works, but this isn't quite correct or convenient. Also refactoring and better error handling for alphanumeric key support.