diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2023-04-19 14:08:14 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2023-04-19 14:23:14 +0100 |
commit | 7c8ea1623b22247145a438ab2bf081b697e5dc19 (patch) | |
tree | d341a00ec14ad22c16c16f49566be64d2a34b4fe | |
parent | 563c3714b8cef948f11bf85ffa29640e2e04139f (diff) | |
download | ghostpdl-7c8ea1623b22247145a438ab2bf081b697e5dc19.tar.gz |
Bug 706594: Postscript - Type 1 glyph name equivalence "mapping"
When we load a Type 1 font from a font file (i.e. not an embedded font), we use
the Adobe Glyph List to find if a glyph name has other names (based on the
Unicode code point).
For example, "/ocyrillic" is code point 0x43e, which also commonly maps to the
name "/afii10080".
Previously, use used "forall" to interate through the CharStrings dictionary,
but that causes two problems. Firstly, and most importantly, when we write new
entries to that dictionary, if the dictionary has to be extended, it ends up
messing with the "forall" indexing. Secondly, it means we do work than necessary
because we potentially seek out equivalents for names we've just added.
To improve this, populate an array with the original names from the CharStrings
dictionary, and iterate through that - thus the changing contents of the
dictionary doesn't matter.
-rw-r--r-- | Resource/Init/gs_type1.ps | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Resource/Init/gs_type1.ps b/Resource/Init/gs_type1.ps index d696a1539..f17a3f11b 100644 --- a/Resource/Init/gs_type1.ps +++ b/Resource/Init/gs_type1.ps @@ -75,9 +75,10 @@ % 16 bytes is arbitrary, but should be large enough to hold any "uniXXXX" style name //ReverseAdobeGlyphList //AdobeGlyphList 3 -1 roll % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) - dup - { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) gname cstring - exch dup % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname gname + [ 1 index {pop} forall ] % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) [ glyph names ] + { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) gname + 1 index 1 index get % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname + exch dup 4 index exch .knownget { //true} { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname @@ -86,7 +87,7 @@ { % if we couldn't derive the code point from the AGL, we might derive it % from a formatted "uniXXXX" name. - dup <00000000000000000000000000000000> cvs dup flush (uni) anchorsearch + dup (0000000000000000) cvs dup (uni) anchorsearch { % as luck would have it, we can just replace the "uni" with "16#" % to get something we can convert to a number |