2
## 14_gs-cjk_big_cmap_post_table.dpatch by Masayuki Hatta <mhatta@debian.org>
4
## All lines beginning with \`## DP:' are a description of the patch.
5
## DP: Support big post table for CMaps
8
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
12
-patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
14
-unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
16
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
22
diff -urN gs-gpl-8.54.dfsg.1.orig/lib/gs_ttf.ps gs-gpl-8.54.dfsg.1/lib/gs_ttf.ps
23
--- gs-gpl-8.54.dfsg.1.orig/lib/gs_ttf.ps 2006-10-15 17:58:21.000000000 +0900
24
+++ gs-gpl-8.54.dfsg.1/lib/gs_ttf.ps 2006-10-15 18:20:47.000000000 +0900
29
+/.biglength { % <str>|<array of str> .biglength <integer>
30
+ dup type /arraytype eq { 0 exch { length add } forall } { length } ifelse
33
+/concats { % [str ...] concats str
34
+ () exch dup length 1 sub -1 0 {
35
+ 1 index exch get dup type /stringtype ne { dup length string cvs } if
36
+ 3 -1 roll exch dup length 2 index length add string
37
+ dup dup 4 2 roll copy length 4 -1 roll putinterval exch
41
+% <str>|<array of str> <index> <count> .biggetinterval <str>|<array of str>
44
+ 2 index type /arraytype eq {
48
+ dup length /l exch def
51
+ i l i sub getinterval
52
+ /c i c add l sub def
59
+ i c getinterval exit
62
+ ] dup .biglength 65535 le { concats } if
63
+ } { getinterval } ifelse
67
+% <str>|<array of str> <index> getu16 <integer>
69
+ 2 .biggetinterval 0 getu16
72
+% <str>|<array of str> <index> getu32 <integer>
74
+ 4 .biggetinterval 0 getu32
77
% Each procedure in this dictionary is called as follows:
78
% <encodingtable> proc <glypharray>
82
4 { % Microsoft/Adobe segmented mapping.
84
- /nseg2 etab 6 getu16 def
85
- 14 /endc etab 2 index nseg2 getinterval def
86
+ /nseg2 etab 6 .biggetu16 def
87
+ 14 /endc etab 2 index nseg2 .biggetinterval def
88
% The Apple TrueType documentation omits the 2-byte
89
% 'reserved pad' that follows the endCount vector!
91
- nseg2 add /startc etab 2 index nseg2 getinterval def
92
- nseg2 add /iddelta etab 2 index nseg2 getinterval def
93
- nseg2 add /idroff etab 2 index nseg2 getinterval def
94
+ nseg2 add /startc etab 2 index nseg2 .biggetinterval def
95
+ nseg2 add /iddelta etab 2 index nseg2 .biggetinterval def
96
+ nseg2 add /idroff etab 2 index nseg2 .biggetinterval def
97
% The following hack allows us to properly handle
98
% idiosyncratic fonts that start at 0xf000:
101
/numcodes 0 def /glyphs 0 0 2 nseg2 3 sub {
102
% Stack: /glyphs numglyphs i2
104
- /scode startc i2 getu16 def
105
- /ecode endc i2 getu16 def
106
+ /scode startc i2 .biggetu16 def
107
+ /ecode endc i2 .biggetu16 def
108
numcodes scode firstcode sub
109
% Hack for fonts that have only 0x0000 and 0xf000 ranges
110
%dup 16#e000 ge { 255 and } if
112
/numcodes 0 def /code 0 def
115
- /scode startc i2 getu16 def
116
- /ecode endc i2 getu16 def
117
+ /scode startc i2 .biggetu16 def
118
+ /ecode endc i2 .biggetu16 def
119
numcodes scode firstcode sub
120
% Hack for fonts that have only 0x0000 and 0xf000 ranges
121
%dup 16#e000 ge { 255 and } if
122
@@ -417,15 +465,15 @@
123
(scode=) print scode =only
124
( ecode=) print ecode =only
125
( delta=) print delta =only
126
- ( droff=) print idroff i2 getu16 =
127
+ ( droff=) print idroff i2 .biggetu16 =
129
- idroff i2 getu16 dup 0 eq {
130
+ idroff i2 .biggetu16 dup 0 eq {
131
pop scode delta add 65535 and 1 ecode delta add 65535 and
133
} { % The +2 is for the 'reserved pad'.
134
/gloff exch 14 nseg2 3 mul add 2 add i2 add add def
135
0 1 ecode scode sub {
136
- 2 mul gloff add etab exch getu16
137
+ 2 mul gloff add etab exch .biggetu16
138
dup 0 ne { delta add 65535 and } if putglyph
141
@@ -448,12 +496,12 @@
143
% <cmaptab> cmaparray <glypharray>
145
- dup 0 getu16 cmapformats exch .knownget {
146
+ dup 0 .biggetu16 cmapformats exch .knownget {
148
- (cmap: format ) print 1 index 0 getu16 = flush
149
+ (cmap: format ) print 1 index 0 .biggetu16 = flush
152
- (Can't handle format ) print 0 getu16 = flush
153
+ (Can't handle format ) print 0 .biggetu16 = flush
154
0 1 255 { } for 256 packedarray
158
% Adobe requirement that each sfnts entry have even length.
161
- (cmap) //call.readtable
162
+ (cmap) //call.readbigtable
166
@@ -964,10 +1012,21 @@
168
% Stack: ... /FontInfo mark key1 value1 ...
170
- /ItalicAngle first_post_string 4 gets32 65536.0 div
171
- /isFixedPitch first_post_string 12 getu32 0 ne
172
- /UnderlinePosition first_post_string 8 gets16 upem div
173
- /UnderlineThickness first_post_string 10 gets16 upem div
174
+ post type /arraytype eq {
175
+ % this post table is a big table. /post should be [(...) ...]
176
+ % data we actually need here should be first one in array.
177
+ /posttable post 1 get def
179
+ /posttable post def
181
+% /ItalicAngle first_post_string 4 gets32 65536.0 div
182
+% /isFixedPitch first_post_string 12 getu32 0 ne
183
+% /UnderlinePosition first_post_string 8 gets16 upem div
184
+% /UnderlineThickness first_post_string 10 gets16 upem div
185
+ /ItalicAngle posttable 4 gets32 65536.0 div
186
+ /isFixedPitch posttable 12 getu32 0 ne
187
+ /UnderlinePosition posttable 8 gets16 upem div
188
+ /UnderlineThickness posttable 10 gets16 upem div
190
counttomark 0 ne { .dicttomark } { pop pop } ifelse
191
/XUID [orgXUID 42 curxuid]
192
@@ -1026,22 +1085,22 @@
194
tabdict /cmap get % bool [] i PlatID SpecID (cmap)
195
dup /cmaptab exch def % temporary
196
- 0 1 2 index 2 getu16 1 sub { % bool [] i PlatID SpecID (cmap) j
197
- 8 mul 4 add 1 index exch 8 getinterval % bool [] i PlatID SpecID (cmap) (cmapsub)
198
+ 0 1 2 index 2 .biggetu16 1 sub { % bool [] i PlatID SpecID (cmap) j
199
+ 8 mul 4 add 1 index exch 8 .biggetinterval % bool [] i PlatID SpecID (cmap) (cmapsub)
201
- (cmap: platform ) print dup 0 getu16 =only
202
- ( encoding ) print dup 2 getu16 = flush
203
+ (cmap: platform ) print dup 0 .biggetu16 =only
204
+ ( encoding ) print dup 2 .biggetu16 = flush
206
- dup 0 getu16 4 index eq {
207
- dup 2 getu16 3 index eq { % bool [] i PlatID SpecID (cmap) (cmapsub)
208
+ dup 0 .biggetu16 4 index eq {
209
+ dup 2 .biggetu16 3 index eq { % bool [] i PlatID SpecID (cmap) (cmapsub)
211
(Choosen a cmap for platform=) print 3 index =only
212
( encoding=) print 2 index =
215
- dup 4 getu32 % bool [] i PlatID SpecID (cmap) (cmapsub) p
216
- cmaptab length 1 index sub % bool [] i PlatID SpecID (cmap) (cmapsub) p l
217
- cmaptab 3 1 roll getinterval
218
+ dup 4 .biggetu32 % bool [] i PlatID SpecID (cmap) (cmapsub) p
219
+ cmaptab .biglength 1 index sub % bool [] i PlatID SpecID (cmap) (cmapsub) p l
220
+ cmaptab 3 1 roll .biggetinterval
221
/cmaptab exch def % bool [] i PlatID SpecID (cmap) (cmapsub)
222
5 index 5 index 1 add get % bool [] i PlatID SpecID (cmap) (cmapsub) /Decoding
223
/Decoding exch def % bool [] i PlatID SpecID (cmap) (cmapsub)