~ubuntu-branches/ubuntu/hardy/ghostscript/hardy

« back to all changes in this revision

Viewing changes to debian/patches/14_gs-cjk_big_cmap_post_table.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2008-02-06 17:41:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080206174122-ivzhywwxv491h1of
Tags: 8.61.dfsg.1-1ubuntu1
* Merge from debian unstable, remaining changes:
  - gs-esp and gs-common depend only on ghostscript, not on ghostscript-x,
    as gs-esp had already split off gs-esp-x in Ubuntu
  - Updated the KRGB patch from HP to the newest upstream version with
    added checks for null forward device in the graphic procedures to fix
    segfault bug LP: #69905 and corrected "force banding" code in gsijs_open
    for small images (IE: hagaki in landscape).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -e
 
2
## 14_gs-cjk_big_cmap_post_table.dpatch by Masayuki Hatta <mhatta@debian.org>
 
3
##
 
4
## All lines beginning with \`## DP:' are a description of the patch.
 
5
## DP: Support big post table for CMaps
 
6
 
 
7
if [ $# -ne 1 ]; then
 
8
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
 
9
    exit 1
 
10
fi
 
11
case "$1" in
 
12
        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
 
13
;;
 
14
        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
 
15
        *)
 
16
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
 
17
                exit 1;;
 
18
esac
 
19
 
 
20
exit 0
 
21
 
 
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
 
25
@@ -273,6 +273,54 @@
 
26
   } for pop exch pop
 
27
 } bind def
 
28
 
 
29
+/.biglength { % <str>|<array of str> .biglength <integer>
 
30
+  dup type /arraytype eq { 0 exch { length add } forall } { length } ifelse
 
31
+} bind def
 
32
+
 
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
 
38
+  } for pop
 
39
+} bind def
 
40
+
 
41
+% <str>|<array of str> <index> <count> .biggetinterval <str>|<array of str>
 
42
+/.biggetinterval {
 
43
+  3 dict begin
 
44
+  2 index type /arraytype eq {
 
45
+    /c exch def
 
46
+    /i exch def
 
47
+    [ exch {
 
48
+      dup length /l exch def
 
49
+      i c add l gt {
 
50
+        i l lt {
 
51
+          i l i sub getinterval
 
52
+          /c i c add l sub def
 
53
+          /i 0 def
 
54
+        } {
 
55
+          pop
 
56
+          /i i l sub def
 
57
+        } ifelse
 
58
+      } {
 
59
+        i c getinterval exit
 
60
+      } ifelse
 
61
+    } forall
 
62
+    ] dup .biglength 65535 le { concats } if
 
63
+  } { getinterval } ifelse
 
64
+  end
 
65
+} bind def
 
66
+
 
67
+% <str>|<array of str> <index> getu16 <integer>
 
68
+/.biggetu16 {
 
69
+  2 .biggetinterval 0 getu16
 
70
+} bind def
 
71
+
 
72
+% <str>|<array of str> <index> getu32 <integer>
 
73
+/.biggetu32 {
 
74
+  4 .biggetinterval 0 getu32
 
75
+} bind def
 
76
+
 
77
 % Each procedure in this dictionary is called as follows:
 
78
 %       <encodingtable> proc <glypharray>
 
79
 /cmapformats mark
 
80
@@ -363,14 +411,14 @@
 
81
   } bind
 
82
   4 {          % Microsoft/Adobe segmented mapping.
 
83
     /etab exch def
 
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!
 
90
     2 add
 
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:
 
99
     pop
 
100
@@ -382,8 +430,8 @@
 
101
     /numcodes 0 def /glyphs 0 0 2 nseg2 3 sub {
 
102
                % Stack: /glyphs numglyphs i2
 
103
       /i2 exch def
 
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
 
111
@@ -404,8 +452,8 @@
 
112
     /numcodes 0 def /code 0 def
 
113
     0 2 nseg2 3 sub {
 
114
       /i2 exch 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 =
 
128
       } if
 
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
 
132
        { putglyph } for
 
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
 
139
        } for
 
140
       } ifelse
 
141
@@ -448,12 +496,12 @@
 
142
 
 
143
 % <cmaptab> cmaparray <glypharray>
 
144
 /cmaparray {
 
145
-  dup 0 getu16 cmapformats exch .knownget {
 
146
+  dup 0 .biggetu16 cmapformats exch .knownget {
 
147
     TTFDEBUG {
 
148
-      (cmap: format ) print 1 index 0 getu16 = flush
 
149
+      (cmap: format ) print 1 index 0 .biggetu16 = flush
 
150
     } if exec
 
151
   } {
 
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
 
155
   } ifelse
 
156
   TTFDEBUG {
 
157
@@ -591,7 +639,7 @@
 
158
 % Adobe requirement that each sfnts entry have even length.
 
159
 /readtables mark
 
160
        % Ordinary tables
 
161
-  (cmap) //call.readtable
 
162
+  (cmap) //call.readbigtable
 
163
   (head) 1 index
 
164
   (hhea) 1 index
 
165
   (maxp) 1 index
 
166
@@ -964,10 +1012,21 @@
 
167
   } ifelse
 
168
                % Stack: ... /FontInfo mark key1 value1 ...
 
169
   post null ne {
 
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
 
178
+     } {
 
179
+       /posttable post def
 
180
+     } ifelse
 
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
 
189
   } if
 
190
   counttomark 0 ne { .dicttomark } { pop pop } ifelse
 
191
   /XUID [orgXUID 42 curxuid]
 
192
@@ -1026,22 +1085,22 @@
 
193
     } if
 
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)
 
200
       TTFDEBUG {
 
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
 
205
       } if
 
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)
 
210
           TTFDEBUG {
 
211
             (Choosen a cmap for platform=) print 3 index =only
 
212
             ( encoding=) print 2 index =
 
213
           } if
 
214
           /cmapsub 1 index def
 
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)