From 05c310554cc3af7cf0cca55ea741acfd7559acb0 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Fri, 27 Jan 2006 11:47:44 +0000 Subject: [PATCH] - Support reading a big cmap/post table from a TrueType font. --- ghostscript-big-cmap-post.patch | 205 ++++++++++++++++++++++++++++++++ ghostscript.spec | 7 ++ 2 files changed, 212 insertions(+) create mode 100644 ghostscript-big-cmap-post.patch diff --git a/ghostscript-big-cmap-post.patch b/ghostscript-big-cmap-post.patch new file mode 100644 index 0000000..a8b6dc3 --- /dev/null +++ b/ghostscript-big-cmap-post.patch @@ -0,0 +1,205 @@ +diff -ruN espgs-8.15.1.orig/lib/gs_ttf.ps espgs-8.15.1/lib/gs_ttf.ps +--- espgs-8.15.1.orig/lib/gs_ttf.ps 2005-08-12 04:57:14.000000000 +0900 ++++ espgs-8.15.1/lib/gs_ttf.ps 2006-01-26 13:28:18.000000000 +0900 +@@ -261,6 +261,54 @@ + } for pop exch pop + } bind def + ++/.biglength { % | .biglength ++ dup type /arraytype eq { 0 exch { length add } forall } { length } ifelse ++} bind def ++ ++/concats { % [str ...] concats str ++ () exch dup length 1 sub -1 0 { ++ 1 index exch get dup type /stringtype ne { dup length string cvs } if ++ 3 -1 roll exch dup length 2 index length add string ++ dup dup 4 2 roll copy length 4 -1 roll putinterval exch ++ } for pop ++} bind def ++ ++% | .biggetinterval | ++/.biggetinterval { ++ 3 dict begin ++ 2 index type /arraytype eq { ++ /c exch def ++ /i exch def ++ [ exch { ++ dup length /l exch def ++ i c add l gt { ++ i l lt { ++ i l i sub getinterval ++ /c i c add l sub def ++ /i 0 def ++ } { ++ pop ++ /i i l sub def ++ } ifelse ++ } { ++ i c getinterval exit ++ } ifelse ++ } forall ++ ] dup .biglength 65535 le { concats } if ++ } { getinterval } ifelse ++ end ++} bind def ++ ++% | getu16 ++/.biggetu16 { ++ 2 .biggetinterval 0 getu16 ++} bind def ++ ++% | getu32 ++/.biggetu32 { ++ 4 .biggetinterval 0 getu32 ++} bind def ++ + % Each procedure in this dictionary is called as follows: + % proc + /cmapformats mark +@@ -351,14 +399,14 @@ + } bind + 4 { % Microsoft/Adobe segmented mapping. + /etab exch def +- /nseg2 etab 6 getu16 def +- 14 /endc etab 2 index nseg2 getinterval def ++ /nseg2 etab 6 .biggetu16 def ++ 14 /endc etab 2 index nseg2 .biggetinterval def + % The Apple TrueType documentation omits the 2-byte + % 'reserved pad' that follows the endCount vector! + 2 add +- nseg2 add /startc etab 2 index nseg2 getinterval def +- nseg2 add /iddelta etab 2 index nseg2 getinterval def +- nseg2 add /idroff etab 2 index nseg2 getinterval def ++ nseg2 add /startc etab 2 index nseg2 .biggetinterval def ++ nseg2 add /iddelta etab 2 index nseg2 .biggetinterval def ++ nseg2 add /idroff etab 2 index nseg2 .biggetinterval def + % The following hack allows us to properly handle + % idiosyncratic fonts that start at 0xf000: + pop +@@ -370,8 +418,8 @@ + /numcodes 0 def /glyphs 0 0 2 nseg2 3 sub { + % Stack: /glyphs numglyphs i2 + /i2 exch def +- /scode startc i2 getu16 def +- /ecode endc i2 getu16 def ++ /scode startc i2 .biggetu16 def ++ /ecode endc i2 .biggetu16 def + numcodes scode firstcode sub + % Hack for fonts that have only 0x0000 and 0xf000 ranges + %dup 16#e000 ge { 255 and } if +@@ -392,8 +440,8 @@ + /numcodes 0 def /code 0 def + 0 2 nseg2 3 sub { + /i2 exch def +- /scode startc i2 getu16 def +- /ecode endc i2 getu16 def ++ /scode startc i2 .biggetu16 def ++ /ecode endc i2 .biggetu16 def + numcodes scode firstcode sub + % Hack for fonts that have only 0x0000 and 0xf000 ranges + %dup 16#e000 ge { 255 and } if +@@ -405,15 +453,15 @@ + (scode=) print scode =only + ( ecode=) print ecode =only + ( delta=) print delta =only +- ( droff=) print idroff i2 getu16 = ++ ( droff=) print idroff i2 .biggetu16 = + } if +- idroff i2 getu16 dup 0 eq { ++ idroff i2 .biggetu16 dup 0 eq { + pop scode delta add 65535 and 1 ecode delta add 65535 and + { putglyph } for + } { % The +2 is for the 'reserved pad'. + /gloff exch 14 nseg2 3 mul add 2 add i2 add add def + 0 1 ecode scode sub { +- 2 mul gloff add etab exch getu16 ++ 2 mul gloff add etab exch .biggetu16 + dup 0 ne { delta add 65535 and } if putglyph + } for + } ifelse +@@ -436,12 +484,12 @@ + + % cmaparray + /cmaparray { +- dup 0 getu16 cmapformats exch .knownget { ++ dup 0 .biggetu16 cmapformats exch .knownget { + TTFDEBUG { +- (cmap: format ) print 1 index 0 getu16 = flush ++ (cmap: format ) print 1 index 0 .biggetu16 = flush + } if exec + } { +- (Can't handle format ) print 0 getu16 = flush ++ (Can't handle format ) print 0 .biggetu16 = flush + 0 1 255 { } for 256 packedarray + } ifelse + TTFDEBUG { +@@ -513,13 +561,13 @@ + % Adobe requirement that each sfnts entry have even length. + /readtables mark + % Ordinary tables +- (cmap) { .readtable } ++ (cmap) { .readbigtable } + (head) 1 index + (hhea) 1 index + (maxp) 1 index + (name) 1 index + (OS/2) 1 index +- (post) 1 index ++ (post) { .readbigtable } + (vhea) 1 index + % Big tables + (glyf) { .readbigtable } +@@ -860,10 +908,17 @@ + } ifelse + % Stack: ... /FontInfo mark key1 value1 ... + post null ne { +- /ItalicAngle post 4 gets32 65536.0 div +- /isFixedPitch post 12 getu32 0 ne +- /UnderlinePosition post 8 gets16 upem div +- /UnderlineThickness post 10 gets16 upem div ++ post type /arraytype eq { ++ % this post table is a big table. /post should be [(...) ...] ++ % data we actually need here should be first one in array. ++ /posttable post 1 get def ++ } { ++ /posttable post def ++ } ifelse ++ /ItalicAngle posttable 4 gets32 65536.0 div ++ /isFixedPitch posttable 12 getu32 0 ne ++ /UnderlinePosition posttable 8 gets16 upem div ++ /UnderlineThickness posttable 10 gets16 upem div + } if + counttomark 0 ne { .dicttomark } { pop pop } ifelse + /XUID [orgXUID 42 curxuid] +@@ -922,22 +977,22 @@ + } if + tabdict /cmap get % bool [] i PlatID SpecID (cmap) + dup /cmaptab exch def % temporary +- 0 1 2 index 2 getu16 1 sub { % bool [] i PlatID SpecID (cmap) j +- 8 mul 4 add 1 index exch 8 getinterval % bool [] i PlatID SpecID (cmap) (cmapsub) ++ 0 1 2 index 2 .biggetu16 1 sub { % bool [] i PlatID SpecID (cmap) j ++ 8 mul 4 add 1 index exch 8 .biggetinterval % bool [] i PlatID SpecID (cmap) (cmapsub) + TTFDEBUG { +- (cmap: platform ) print dup 0 getu16 =only +- ( encoding ) print dup 2 getu16 = flush ++ (cmap: platform ) print dup 0 .biggetu16 =only ++ ( encoding ) print dup 2 .biggetu16 = flush + } if +- dup 0 getu16 4 index eq { +- dup 2 getu16 3 index eq { % bool [] i PlatID SpecID (cmap) (cmapsub) ++ dup 0 .biggetu16 4 index eq { ++ dup 2 .biggetu16 3 index eq { % bool [] i PlatID SpecID (cmap) (cmapsub) + TTFDEBUG { + (Choosen a cmap for platform=) print 3 index =only + ( encoding=) print 2 index = + } if + /cmapsub 1 index def +- dup 4 getu32 % bool [] i PlatID SpecID (cmap) (cmapsub) p +- cmaptab length 1 index sub % bool [] i PlatID SpecID (cmap) (cmapsub) p l +- cmaptab 3 1 roll getinterval ++ dup 4 .biggetu32 % bool [] i PlatID SpecID (cmap) (cmapsub) p ++ cmaptab .biglength 1 index sub % bool [] i PlatID SpecID (cmap) (cmapsub) p l ++ cmaptab 3 1 roll .biggetinterval + /cmaptab exch def % bool [] i PlatID SpecID (cmap) (cmapsub) + 5 index 5 index 1 add get % bool [] i PlatID SpecID (cmap) (cmapsub) /Decoding + /Decoding exch def % bool [] i PlatID SpecID (cmap) (cmapsub) diff --git a/ghostscript.spec b/ghostscript.spec index e397f43..0453d75 100644 --- a/ghostscript.spec +++ b/ghostscript.spec @@ -26,6 +26,7 @@ Patch6: ghostscript-pagesize.patch Patch7: ghostscript-noopt.patch Patch8: ghostscript-use-external-freetype.patch Patch9: ghostscript-split-font-configuration.patch +Patch10: ghostscript-big-cmap-post.patch Requires: zlib, libpng, glib2 Requires: urw-fonts >= 1.1, ghostscript-fonts @@ -102,6 +103,9 @@ A GTK-enabled version of Ghostscript, called 'gsx'. # Allow separated font configuration (bug #161187). %patch9 -p1 -b .split-font-configuration +# Support reading a big cmap/post table from a TrueType font. +%patch10 -p1 -b .big-cmap-post + # Convert manual pages to UTF-8 from8859_1() { iconv -f iso-8859-1 -t utf-8 < "$1" > "${1}_" @@ -259,6 +263,9 @@ rm -rf $RPM_BUILD_ROOT %postun -p /sbin/ldconfig %changelog +* Fri Jan 27 2006 Tim Waugh +- Support reading a big cmap/post table from a TrueType font. + * Fri Dec 09 2005 Jesse Keating - rebuilt