Bug 697900 - Alphanumeric ID Command Unable to Locate Disk-Resident SFT Font
Summary: Alphanumeric ID Command Unable to Locate Disk-Resident SFT Font
Status: RESOLVED FIXED
Alias: None
Product: GhostPCL
Classification: Unclassified
Component: PCL interpreter (show other bugs)
Version: 8.71
Hardware: Macintosh MacOS X
: P2 enhancement
Assignee: Henry Stiles
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-14 10:05 UTC by Hugh Hood
Modified: 2017-07-17 07:11 UTC (History)
2 users (show)

See Also:
Customer:
Word Size: ---


Attachments
Cheltenham Font File (.sft/pcletto format) (50.12 KB, application/octet-stream)
2017-05-14 10:05 UTC, Hugh Hood
Details
Working Example of Macro with 'wrapped' Font Call (210 bytes, application/octet-stream)
2017-05-14 10:06 UTC, Hugh Hood
Details
Failing Example of Alphanumeric Associate Font Function (361 bytes, application/octet-stream)
2017-05-14 10:07 UTC, Hugh Hood
Details
proposed patch (6.37 KB, patch)
2017-07-13 15:18 UTC, Henry Stiles
Details | Diff
fixed patch (8.63 KB, patch)
2017-07-13 19:19 UTC, Henry Stiles
Details | Diff
Aachen PCLETTO (.sft) Soft Font (16.35 KB, application/octet-stream)
2017-07-15 20:23 UTC, Hugh Hood
Details
Copperplate PCLETTO (.sft) Soft Font (45.43 KB, application/octet-stream)
2017-07-15 20:25 UTC, Hugh Hood
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hugh Hood 2017-05-14 10:05:35 UTC
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.
Comment 1 Hugh Hood 2017-05-14 10:06:45 UTC
Created attachment 13677 [details]
Working Example of Macro with 'wrapped' Font Call
Comment 2 Hugh Hood 2017-05-14 10:07:25 UTC
Created attachment 13678 [details]
Failing Example of Alphanumeric Associate Font Function
Comment 3 Henry Stiles 2017-05-14 16:37:24 UTC
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)
Comment 4 Henry Stiles 2017-05-17 13:29:54 UTC
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.
Comment 5 Henry Stiles 2017-07-13 15:18:24 UTC
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.
Comment 6 Henry Stiles 2017-07-13 15:46:30 UTC
(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.
Comment 7 Henry Stiles 2017-07-13 19:19:48 UTC
Created attachment 13968 [details]
fixed patch

Refactors and fixes previously noted problem.
Comment 8 Hugh Hood 2017-07-15 20:23:57 UTC
Created attachment 13977 [details]
Aachen PCLETTO (.sft) Soft Font
Comment 9 Hugh Hood 2017-07-15 20:25:04 UTC
Created attachment 13978 [details]
Copperplate PCLETTO (.sft) Soft Font
Comment 10 Hugh Hood 2017-07-15 21:43:33 UTC
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.
Comment 11 Henry Stiles 2017-07-17 07:11:47 UTC
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.