summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Resource/Init/gs_ttf.ps54
1 files changed, 22 insertions, 32 deletions
diff --git a/Resource/Init/gs_ttf.ps b/Resource/Init/gs_ttf.ps
index c6c93e2d6..72323bca5 100644
--- a/Resource/Init/gs_ttf.ps
+++ b/Resource/Init/gs_ttf.ps
@@ -741,11 +741,16 @@ currentdict /woff_tag_dict .undef
741 % so we have to pre-process and find the highest index used. 741 % so we have to pre-process and find the highest index used.
742 % We start with a base value of numglyphs as it's most common, 742 % We start with a base value of numglyphs as it's most common,
743 % and we can safely have a array that's too large. 743 % and we can safely have a array that's too large.
744 numglyphs postglyphs 744 % Rather than parse out the indices twice, we store them in an
745 0 1 numglyphs 1 sub 745 % array on the stack, which we then reuse, overwriting entries
746 { 746 % as we go later on.
747 2 mul 34 add 1 index exch 2 //getinterval_from_stringarray exec 747 numglyphs array numglyphs postglyphs
748 dup 0 get 8 bitshift exch 1 get add 258 sub dup 3 index gt 748 0 1 numglyphs 1 sub {
749 dup 2 mul 34 add 2 index exch 2 //getinterval_from_stringarray exec
750 dup 0 get 8 bitshift exch 1 get add
751 dup 5 index exch
752 4 -1 roll exch put
753 258 sub dup 3 index gt
749 % if we find a reference to an index higher than the value 754 % if we find a reference to an index higher than the value
750 % already on the stack, replace the value on the stack 755 % already on the stack, replace the value on the stack
751 { 3 -1 roll pop 2 1 roll} {pop} ifelse 756 { 3 -1 roll pop 2 1 roll} {pop} ifelse
@@ -801,36 +806,21 @@ currentdict /woff_tag_dict .undef
801 pop 806 pop
802 } ifelse 807 } ifelse
803 } if 808 } if
804 809 % Loop through the array of name indices we created above.
805 numglyphs array 0 1 numglyphs 1 sub { 810 % This loop replaces name index in the array with the name
806 dup 2 mul 34 add postglyphs exch 2 //getinterval_from_stringarray exec 811 % it references.
807 dup 0 get 8 bitshift exch 1 get add dup 258 lt { 812 0 1 2 index length 1 sub {
813 dup 2 index exch get dup 258 lt {
808 MacGlyphEncoding exch get 814 MacGlyphEncoding exch get
809 } { 815 } {
810 % If the index we read from the table is outside the range of glyph 816 258 sub postnames exch get
811 % names available, just use the /.notdef name, and carry on 817 % At least some of Microsoft's TrueType fonts use incorrect
812 dup 32768 ge exch 258 sub dup postnames length ge 818 % (Adobe-incompatible) names for some glyphs.
813 3 -1 roll or { 819 % Correct for this here.
814 % According to the published TrueType spec, such values are 820 postremap 1 index .knownget { exch pop } if
815 % "reserved for future use", but at least some PDF files
816 % produced by the Adobe PDF library contain entries with a
817 % value of 16#ffff.
818 TTFDEBUG {
819 dup postnames length ge {
820 ( *** warning: glyph index past end of 'post' table) = flush
821 } if
822 } if
823 pop /.notdef
824 }
825 {
826 postnames exch get
827 % At least some of Microsoft's TrueType fonts use incorrect
828 % (Adobe-incompatible) names for some glyphs.
829 % Correct for this here.
830 postremap 1 index .knownget { exch pop } if
831 } ifelse
832 } ifelse 821 } ifelse
833 2 index 3 1 roll put 822 2 index 3 1 roll
823 put
834 } for 824 } for
835 825
836 .broken_post { 826 .broken_post {