*** gs_ttf.ps.org Mon Apr 10 09:28:47 2000 --- gs_ttf.ps Mon Nov 20 14:40:13 2000 *************** *** 213,218 **** --- 213,258 ---- } for pop } def + % bsearch true + % bsearch false + % Search a value in a sorted array with a comparing procedure + % by using the method of binary searching + % Written by Taiji Yamada + % + % Examples + % + % [ 10 4 3 5 6 2 0 9 7 ] { lt } sort (array=) print dup == + % 6 (key=) print dup = + % { sub } bsearch { (index=) print = } if + % + % [ [10 0] [4 6] [3 7] [5 5] [6 4] [2 8] [0 10] [9 1] [7 3] ] + % { exch 0 get exch 0 get lt } sort (array=) print dup == + % 6 (key=) print dup = + % { exch 0 get exch sub } bsearch { (index=) print = } if + % + /bsearch { + 0 3 index length 1 sub % arr v proc l r + { % loop + 2 copy gt { 5 { pop } repeat false exit } if % false + 2 copy add 2 idiv % arr v proc l r i + dup 6 index exch get 5 index 5 index exec neg + % arr v proc l r i arr[i] v proc exec neg + % arr v proc l r i -cmp + dup 0 eq { % ifelse matched + % arr v proc l r i -cmp + pop 6 1 roll 5 { pop } repeat true exit % i true + } { + 0 lt { % ifelse % arr v proc l r i -cmp + 1 sub + exch pop % arr v proc l i-1 + } { + 1 add + 3 -1 roll pop exch % arr v proc i+1 r + } ifelse + } ifelse + } loop + } def + % Each procedure in this dictionary is called as follows: % proc /cmapformats mark *************** *** 244,250 **** /ecode endc i2 getu16 def numcodes scode firstcode sub % Hack for fonts that have only 0x0000 and 0xf000 ranges ! dup 16#e000 ge { 255 and } if exch sub 0 max ecode scode sub 1 add add exch 1 index add exch numcodes add /numcodes exch def --- 284,291 ---- /ecode endc i2 getu16 def numcodes scode firstcode sub % Hack for fonts that have only 0x0000 and 0xf000 ranges ! %dup 16#e000 ge { 255 and } if ! % just before line is obstructive to CJK fonts, so it was removed exch sub 0 max ecode scode sub 1 add add exch 1 index add exch numcodes add /numcodes exch def *************** *** 257,263 **** /ecode endc i2 getu16 def numcodes scode firstcode sub % Hack for fonts that have only 0x0000 and 0xf000 ranges ! dup 16#e000 ge { 255 and } if exch sub 0 max dup { 0 putglyph } repeat ecode scode sub 1 add add numcodes add /numcodes exch def /delta iddelta i2 gets16 def --- 298,305 ---- /ecode endc i2 getu16 def numcodes scode firstcode sub % Hack for fonts that have only 0x0000 and 0xf000 ranges ! %dup 16#e000 ge { 255 and } if ! % just before line is obstructive to CJK fonts, so it was removed exch sub 0 max dup { 0 putglyph } repeat ecode scode sub 1 add add numcodes add /numcodes exch def /delta iddelta i2 gets16 def *************** *** 359,364 **** --- 401,407 ---- (cvt ) { .readtable } (fpgm) 1 index (prep) 1 index + (GSUB) 1 index .dicttomark % Normally there would be a 'readonly' here, but the ttf2pf utility wants % to include the 'kern' table as well, so we leave the readtables dictionary *************** *** 401,413 **** --- 444,469 ---- } bind def % .loadttfonttables - + % .loadttfonttables - % extention by hideyuki % Pushes .loadttfontdict & scratch dict on d-stack. % Defines f, offsets, tables, tabdict, tabs. /.loadttfonttables { .loadttfontdict begin 40 dict begin + dup type /integertype eq % extention by hideyuki + { 1 sub } { 0 } ifelse /findex exch def /f exch def /offsets f 12 string readstring pop def + + % TrueType Collection File support + % Jan 11 2000: Hideyuki Suzuki + offsets 0 4 getinterval (ttcf) eq { + [ 1 1 offsets 8 getu32 { pop f 4 string readstring pop 0 getu32} for ] + dup findex get dup /ttcheader exch def exch length 4 mul 12 add sub + dup 0 gt { string f exch readstring pop } if pop + /offsets f 12 string readstring pop def + } { /ttcheader 0 def } ifelse + /tables f offsets 4 getu16 16 mul string readstring pop def /tabdict tables length 16 idiv dict def % tabs = tables we want to keep, sorted by file position. *************** *** 440,446 **** % - .readttdata - % Read data. Updates offsets, tabs; stores data in tabdict. /.readttdata { ! /fpos offsets length tables length add def /sfpos offsets length tabs length 16 mul add def offsets 4 tabs length putu16 tabs { --- 496,506 ---- % - .readttdata - % Read data. Updates offsets, tabs; stores data in tabdict. /.readttdata { ! ! % TrueType Collection File support ! % Jan 11 2000: Hideyuki Suzuki ! % /fpos offsets length tables length add def ! /fpos ttcheader offsets length tables length add add def /sfpos offsets length tabs length 16 mul add def offsets 4 tabs length putu16 tabs { *************** *** 623,628 **** --- 683,689 ---- /fontname 1 index def /FontInfo mark } ifelse + DEBUG { (fontname ) print fontname = } if % Stack: ... /FontInfo mark key1 value1 ... post null ne { /ItalicAngle post 4 gets32 65536.0 div *************** *** 722,728 **** /CIDFontType 2 /CIDSystemInfo mark /Registry (Adobe) ! /Ordering (Japan1) % adhoc /Supplement 0 .dicttomark /CharStrings mark /.notdef 0 .dicttomark --- 783,789 ---- /CIDFontType 2 /CIDSystemInfo mark /Registry (Adobe) ! /Ordering (Japan1) % adhoc, please see .definecjkvttcidfont. /Supplement 0 .dicttomark /CharStrings mark /.notdef 0 .dicttomark *************** *** 763,766 **** --- 824,1367 ---- mark .ttkeys .definettcidfont + } bind def + + % + % Jan 10 2000: Hideyuki Suzuki + % Mar 30 2000: Taiji Yamada + % + + currentglobal + true setglobal + /Generic /Category findresource + dup length 1 add dict copy + dup /InstanceType /dicttype put + /TrueType exch /Category defineresource pop + setglobal + + % - .getgsub - + % Defines gsubh, gsubv, gsubh2v and also defines gsubver, gsubfmt + % in the case that GSUB table has 'Single Substitution Format 2' + % which is formally used for vertically oriented glyphs such as CJK fonts. + % Written by Hideyuki Suzuki + % Modified by Taiji Yamada + % + % [GSUB - The Glyph Substitution Table] + % Index Size Type Name of Entry + % ----------------------------------- + % 0 4 Fixed Version + % 4 2 Offset ScriptList + % 6 2 Offset FeatureList + % 8 2 Offset LookupList + % + % [Single Substitution Format 2, Subtable at LookupList] + % Index Size Type Name of Entry + % ----------------------------------- + % 0 2 uint16 SubstFormat + % 4 2 Offset Coverage(--) + % 6 2 uint16 GlyphCount + % 8 2 GlyphID Substitute(vertically oriented glyphs) + % -- 2 uint16 SubstFormat + % +2 2 uint16 GlyphCount(same as above GlyphCount) + % +4 2 GlyphID GlyphArray(horizontally oriented glyphs) + % ----------------------------------- + % References + % 1. http://www.microsoft.com/typography/OTSPEC/gsub.htm + % + /.getgsub { + /gsubhog null def + /gsubvog null def + /gsubh2v null def + tabdict /GSUB .knownget { % if + dup /gsubver exch 0 getu32 def + %dup /gsubosl exch 4 getu16 12 add def + %dup /gsubofl exch 6 getu16 12 add def + dup /gsuboll exch 8 getu16 12 add def + DEBUG { + (gsubver: ) print gsubver = + %(gsubosl: ) print gsubosl = + %(gsubofl: ) print gsubofl = + (gsuboll: ) print gsuboll = + } if + dup /gsubfmt exch gsuboll 0 add getu16 def + DEBUG { + (gsubfmt: ) print gsubfmt = + } if + % gsubver 16#00010000 eq { % ifelse + gsubfmt 2 eq { % ifelse + dup /gsubocv exch gsuboll 2 add getu16 def + dup /gsubglc exch gsuboll 4 add getu16 def + dup /gsubvog exch gsuboll 6 add gsubglc getinterval def + dup /gsubhog exch gsuboll gsubocv add 4 add gsubglc getinterval def + DEBUG { + (gsubocv: ) print gsubocv = + (gsubglc: ) print gsubglc = + + (gsubhog->gsubvog ) = + 0 2 gsubhog length 2 sub { % for + dup + gsubhog exch getu16 =only + (->) =only + gsubvog exch getu16 = + } for + } if + false { % ifelse rapid version without level2 operators + true 2 2 gsubhog length 2 sub { % for + dup 2 sub gsubhog exch getu16 exch gsubhog exch getu16 gt { % if + pop false exit + } if + } for + /gsubh2v [ 0 2 gsubhog length 2 sub { % for + [ exch dup gsubhog exch getu16 exch gsubvog exch getu16 ] + } for ] + 3 -1 roll not { % if array must be sorted + { % procedure + exch 0 get exch 0 get lt + } sort + } if def + } { % else rapid version with <<,>> operators + /gsubtmp 5 string def + /gsubh2v << 0 2 gsubhog length 2 sub { + dup gsubhog exch getu16 gsubtmp cvs cvn + exch gsubvog exch getu16 + } for >> def + } ifelse + } { + %(UNKNOWN GSUB FORMAT.) = flush + } ifelse + % } { + % (ILLEGAL GSUB VERSION.) = flush + % } ifelse + pop + } if + } bind def + + % glyphid .gsublookup glyphid + % modified by Taiji Yamada and Hideyuki Suzuki + /.gsublookup { + gsubhog null ne gsubvog null ne and { % if + % % dull version + % 0 2 gsubhog length 2 sub { % for + % gsubhog 1 index getu16 2 index eq { % if + % exch pop gsubvog exch getu16 exit + % } if + % pop + % } for + % rapid version + false { % ifelse rapid version without level2 operators + gsubh2v 1 index { exch 0 get exch sub } bsearch { % if glyphid matched + gsubh2v exch get 1 get exch pop + } if + } { % else rapid version with <<,>> operators + dup gsubh2v exch gsubtmp cvs cvn .knownget { exch pop } if + } ifelse + } if + } bind def + + % - .getos2 - + % Defines os2ver, os2cp1, os2cp2 + % to detect the kind of CID with the OS/2 table of a TrueType font. + % Written by Taiji Yamada + % + % [OS/2 - OS/2 and Windows Metrics] + % Index Size Type Name of Entry + % ----------------------------------- + % 0 2 USHORT version + % 2 2 SHORT xAvgCharWidth + % 4 2 USHORT usWeightClass + % 6 2 USHORT usWidthClass + % 8 2 SHORT fsType + % 10 2 SHORT ySubscriptXSize + % 12 2 SHORT ySubscriptYSize + % 14 2 SHORT ySubscriptXOffset + % 16 2 SHORT ySubscriptYOffset + % 18 2 SHORT ySuperscriptXSize + % 20 2 SHORT ySuperscriptYSize + % 22 2 SHORT ySuperscriptXOffset + % 24 2 SHORT ySuperscriptYOffset + % 26 2 SHORT yStrikeoutSize + % 28 2 SHORT yStrikeoutPosition + % 30 2 SHORT sFamilyClass + % 32 10 BYTE panose[10] + % 42 4 ULONG ulUnicodeRange1 + % 46 4 ULONG ulUnicodeRange2 + % 50 4 ULONG ulUnicodeRange3 + % 54 4 ULONG ulUnicodeRange4 + % 58 4 CHAR achVendID[4] + % 62 2 USHORT fsSelection + % 64 2 USHORT usFirstCharIndex + % 66 2 USHORT usLastCharIndex + % 68 2 SHORT sTypoAscender + % 70 2 SHORT sTypoDescender + % 72 2 SHORT sTypoLineGap + % 74 2 USHORT usWinAscent + % 76 2 USHORT usWinDescent + % 78 4 ULONG ulCodePageRange1 + % 82 4 ULONG ulCodePageRange2 + % 86 2 SHORT sxHeight + % 88 2 SHORT sCapHeight + % 90 2 USHORT usDefaultChar + % 92 2 USHORT usBreakChar + % 94 2 USHORT usMaxContext + % ----------------------------------- + % References + % 1. http://www.microsoft.com/typography/OTSPEC/os2.htm + % + /.getos2 { + /os2ver 0 def + tabdict (OS/2) cvn .knownget { % if + dup /os2ver exch 0 getu16 def + os2ver 0 gt { % if + %dup /os2typ exch 8 gets16 def + %dup /os2fam exch 30 gets16 def + dup /os2ur1 exch 42 getu32 def + dup /os2ur2 exch 46 getu32 def + dup /os2ur3 exch 50 getu32 def + dup /os2ur4 exch 54 getu32 def + %dup /os2sel exch 62 getu16 def + %dup /os2fci exch 64 getu16 def + %dup /os2lci exch 64 getu16 def + dup /os2cp1 exch 78 getu32 def + dup /os2cp2 exch 82 getu32 def + DEBUG { + /tmp 64 string def + (os2ver: ) print os2ver 2 tmp cvrs = + %(os2typ: ) print os2typ 2 tmp cvrs = + %(os2fam: ) print os2fam 2 tmp cvrs = + (os2ur1: ) print os2ur1 2 tmp cvrs = + (os2ur2: ) print os2ur2 2 tmp cvrs = + (os2ur3: ) print os2ur3 2 tmp cvrs = + (os2ur4: ) print os2ur4 2 tmp cvrs = + %(os2sel: ) print os2sel 2 tmp cvrs = + %(os2fci: ) print os2fci 2 tmp cvrs = + %(os2lci: ) print os2lci 2 tmp cvrs = + (os2cp1: ) print os2cp1 2 tmp cvrs = + (os2cp2: ) print os2cp2 2 tmp cvrs = + [ + [ 1 0 bitshift (Latin 1) ] + [ 1 1 bitshift (Latin 2) ] + [ 1 2 bitshift (Cyrillic) ] + [ 1 3 bitshift (Greek) ] + [ 1 4 bitshift (Turkish) ] + [ 1 5 bitshift (Hebrew) ] + [ 1 6 bitshift (Arabic) ] + [ 1 7 bitshift (Baltic) ] + [ 1 8 bitshift (Vietnamese) ] + [ 1 16 bitshift (Thai) ] + [ 1 17 bitshift (Japanese) ] + [ 1 18 bitshift (Simplified Chinese) ] + [ 1 19 bitshift (Korean Wansung) ] + [ 1 20 bitshift (Traditional Chinese) ] + [ 1 21 bitshift (Korean Johab) ] + [ 1 31 bitshift (Symbol) ] + ] { % forall + dup 0 get os2cp1 and 0 gt { % if + (CodePage: ) print 1 get = + } if + } forall + } if + } if + pop + } if + } bind def + + /.cjkvttencoding { + cmapsub 0 4 getinterval false + [ % Detect the kind of CID with the cmap table of a TrueType font. + % In the case that PlatformID and EncodingID indicate Unicode, + % determining is reserved until the detection with the OS/2 table. + % Written by Taiji Yamada + % + % [cmap - Character Mapping Table] + % PlatformID EncodingID Description + % --------------------------------- + % <0003> <0000> Symbol + % <0003> <0001> Unicode + % <0003> <0002> ShiftJIS + % <0003> <0003> Big5 + % <0003> <0004> PRC + % <0003> <0005> Wansung + % <0003> <0006> Johab + % --------------------------------- + % References + % 1. ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/ + % 2. http://www.microsoft.com/typography/OTSPEC/cmap.htm + % 3. http://www.microsoft.com/OpenType/unicode/cscp.htm + % 4. http://www.aihara.co.jp/~taiji/tops/ + % + [ <00030001> /Identity ] + [ <00030002> /Adobe-Japan1-ShiftJIS ] + [ <00030003> /Adobe-CNS1-Big5 ] + [ <00030004> /Adobe-GB1-PRC ] + [ <00030005> /Adobe-Korea1-Wansung ] + [ <00030006> /Adobe-Korea1-Johab ] + ] { % forall + exch { % ifelse + pop true + } { + dup 0 get 2 index eq { % ifelse + 1 get true + } { + pop false + } ifelse + } ifelse + } forall + { % ifelse + exch pop dup /Identity eq os2ver 0 gt and { % ifelse + pop os2cp1 false + [ % Detect the kind of CID by using CodePage ranges of the OS/2 table. + % Written by Taiji Yamada + % + % [Microsoft CodePage and Bit Masks] + % Bit CP Description + % ------------------------- + % 8 1258 Vietnamese + % 17 932 Japanese + % 18 936 Simplified Chinese + % 19 949 Korean Wansung + % 20 950 Traditional Chinese + % 21 1361 Korean Johab + % ------------------------- + % References + % 1. http://www.microsoft.com/typography/OTSPEC/os2.htm + % 2. ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/ + % 3. http://www.microsoft.com/OpenType/unicode/cscp.htm + % 4. http://www.aihara.co.jp/~taiji/tops/ + % + [ 1 20 bitshift /Adobe-CNS1-Unicode ] + [ 1 18 bitshift /Adobe-GB1-Unicode ] + [ 1 17 bitshift /Adobe-Japan1-Unicode ] + [ 1 19 bitshift /Adobe-Korea1-Unicode ] + [ 1 21 bitshift /Adobe-Korea1-Unicode ] + %[ 1 8 bitshift /Adobe-Vietnam1-Unicode ] + ] { % forall + exch { % ifelse + pop true + } { + dup 0 get 2 index and 0 gt { % ifelse + 1 get true + } { + pop false + } ifelse + } ifelse + } forall + { % ifelse + exch pop + DEBUG { (CID: ) print dup = } if + 6 -2 roll pop pop + /CIDSystemInfo mark + /Registry 3 index /TrueType findresource /Registry get + /Ordering 5 index /TrueType findresource /Ordering get + /Supplement 7 index /TrueType findresource /Supplement get + .dicttomark + 6 2 roll + /vdcmap 1 index /TrueType findresource /VerticalDuplicateCodeMap get def + /vcmap 1 index /TrueType findresource /VerticalCodeMap get def + /dcmap 1 index /TrueType findresource /DuplicateCodeMap get def + /TrueType findresource /Code get true + } { + pop false + } ifelse + } { + dup /Identity eq { % if the Unicode font has an old OS/2 table + pop + %/Adobe-CNS1-Unicode + %/Adobe-GB1-Unicode + /Adobe-Japan1-Unicode % defaults for old TrueType fonts + %/Adobe-Korea1-Unicode + } if + DEBUG { (CID: ) print dup = } if + 6 -2 roll pop pop + /CIDSystemInfo mark + /Registry 3 index /TrueType findresource /Registry get + /Ordering 5 index /TrueType findresource /Ordering get + /Supplement 7 index /TrueType findresource /Supplement get + .dicttomark + 6 2 roll + /vdcmap 1 index /TrueType findresource /VerticalDuplicateCodeMap get def + /vcmap 1 index /TrueType findresource /VerticalCodeMap get def + /dcmap 1 index /TrueType findresource /DuplicateCodeMap get def + /TrueType findresource /Code get true + } ifelse + } { + pop false + } ifelse + } bind def + + /.ttcidencoding { + .ttcidcode + DEBUG { (CID: ) print dup = } if + 6 -2 roll pop pop + /CIDSystemInfo mark + /Registry 3 index /TrueType findresource /Registry get + /Ordering 5 index /TrueType findresource /Ordering get + /Supplement 7 index /TrueType findresource /Supplement get + .dicttomark + 6 2 roll + /vdcmap 1 index /TrueType findresource /VerticalDuplicateCodeMap get def + /vcmap 1 index /TrueType findresource /VerticalCodeMap get def + /dcmap 1 index /TrueType findresource /DuplicateCodeMap get def + /TrueType findresource /Code get true + } bind def + + % -mark- ... .definecjkvttcidfont + /.definecjkvttcidfont { + /CIDFontName fontname + /CIDFontType 2 + /CIDSystemInfo mark + /Registry (Adobe) % If .ttencoding can't detect these entries, + /Ordering (Japan1) % these values are used for the defaults. + /Supplement 0 % noted by taiji@aihara.co.jp + .dicttomark + /CharStrings mark /.notdef 0 .dicttomark + % Now read cmap information for real TrueType fonts + % modified by hideyuki@sat.t.u-tokyo.ac.jp + /cmapglyphs cmaptab cmaparray def + % DEBUG { (cmapglyphs: length=) print cmapglyphs length = } if + mark .ttencoding { % ifelse + % DEBUG { (ttencoding: length=) print dup length = } if + 0 1 2 index length 1 sub { % for + % mark Code[] cid Code[cid] Code[cid]>length {} {} ifelse + dup 2 index exch get dup cmapglyphs length gt { % ifelse + % DEBUG { (code>length ) print dup = } if + pop pop 0 % mark Code[] 0 + } { + % DEBUG { + % (cid: ) print 1 index =only + % /tmp 8 string def ( Code: ) print dup 16 tmp cvrs =only + % } if + cmapglyphs exch get % mark Code[] cid gid + % DEBUG { ( gid: ) print dup =only } if + true { dup cmapglyphs 0 get eq { % if default glyph + dcmap 2 index { exch 0 get exch sub } bsearch { % if duplicate cid + % mark Code[] cid gid i + 2 1 dcmap 3 index get length 1 sub { % for + % mark Code[] cid gid i DCMap[i,j] + dcmap 2 index get exch get + % DEBUG { + % /tmp 8 string def ( Code-) print dup 16 tmp cvrs =only + % } if + dup cmapglyphs length gt { + pop % mark Code[] cid gid i + } { + % mark Code[] cid gid' i + cmapglyphs exch get 3 -1 roll pop exch + % DEBUG { ( gid-) print 1 index =only } if + } ifelse + 1 index cmapglyphs 0 get ne { exit } if + } for + pop % mark Code[] cid gid' + } if + } if } if + vcmap 2 index { exch 0 get exch sub } bsearch { % if + pop + true { dup cmapglyphs 0 get eq { % if default glyph + vdcmap 2 index { exch 0 get exch sub } bsearch { % if duplicate cid + % mark Code[] cid gid i + 2 1 vdcmap 3 index get length 1 sub { % for + % mark Code[] cid gid i VDCMap[i,j] + vdcmap 2 index get exch get + % DEBUG { + % /tmp 8 string def ( Code|) print dup 16 tmp cvrs =only + % } if + dup cmapglyphs length gt { + pop % mark Code[] cid gid i + } { + % mark Code[] cid gid' i + cmapglyphs exch get 3 -1 roll pop exch + % DEBUG { ( gid|) print 1 index =only } if + } ifelse + 1 index cmapglyphs 0 get ne { exit } if + } for + pop % mark Code[] cid gid' + } if + } if } if + .gsublookup + % DEBUG { ( gid: ) print dup =only } if + } if + % DEBUG { () = } if + exch pop % mark Code[] gid + } ifelse + exch + } for + pop + } { + 0 1 cmapglyphs length 1 sub { % for + cmapglyphs exch get + } for + } ifelse + counttomark /cidcount exch def + cidcount maxstring le { + % Use a single string. + cidcount .makecidmap exch pop + } { + % We must use 2 strings. + maxstring .makecidmap counttomark 1 add 1 roll + counttomark .makecidmap exch pop exch 2 array astore + } ifelse + /CIDMap exch + /CIDCount cidcount + /GDBytes 2 + .dicttomark + end end dup /CIDFontName get exch /CIDFont defineresource + } bind def + + % Load a TrueType font from a file as a CIDFontType 2 font. + % + % .loadcjkvttcidfont + % .loadcjkvttcidfont + % detect a kind of CID and encode a TrueType font to a CID-Keyed font. + % + % .loadcjkvttcidfont + % .loadcjkvttcidfont + % load a TrueType font and encode it with the kind of CID described + % in which is one of resources in /Resource/TrueType/. + /.loadcjkvttcidfont { + dup type /nametype eq not { % ifelse + /.ttcidcode null def + /.ttencoding { .cjkvttencoding } bind def + } { + /.ttcidcode exch def + /.ttencoding { .ttcidencoding } bind def + } ifelse + .loadttfonttables + .makesfnts + .getcmap % we need a cmap for real TrueType fonts (by hideyuki) + .getgsub + .getos2 % we need an OS/2 table for CJKV TrueType fonts (by taiji) + mark + .ttkeys + .definecjkvttcidfont + } bind def + + % Open and load a TrueType font from a file as a Type 42 font. + % .openttfont + % .openttfont + /.openttfont { + dup type /integertype eq not { % ifelse + (r) file + } { + exch (r) file exch + } ifelse + .loadttfont + } bind def + + % Open and load a TrueType font from a file as a CIDFontType 2 font. + % .openttcidfont + % .openttcidfont + % .openttcidfont + % .openttcidfont + /.openttcidfont { + dup type /nametype eq not { % ifelse + /.ttcidcode null def + } { + /.ttcidcode exch def + } ifelse + dup type /integertype eq not { % ifelse + (r) file + } { + exch (r) file exch + } ifelse + .ttcidcode null eq not { .ttcidcode } if + .loadcjkvttcidfont } bind def