diff options
Diffstat (limited to 'Master/tlpkg/tlgs/Resource/Init/pdf_font.ps')
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/pdf_font.ps | 154 |
1 files changed, 83 insertions, 71 deletions
diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps index a9511570ec2..feaf0d036ac 100644 --- a/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps +++ b/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps @@ -68,7 +68,7 @@ pdfdict begin { 3 copy put pop 1 add } ifelse } forall pop -} bdef +} bind executeonly def /good_encoding_names << /MacRomanEncoding 0 /MacExpertEncoding 0 /WinAnsiEncoding 0 @@ -130,7 +130,7 @@ pdfdict begin ( Output may be incorrect.\n) pdfformaterror } ifelse - } bdef + } bind executeonly def currentdict /good_encoding_names undef currentdict /known_symbolic_fonts undef @@ -146,7 +146,7 @@ currentdict /known_symbolic_fonts undef } if } if pop -} bind def +} bind executeonly def % Define a font using it's FontName as the key. % Adjust a font according to the Encoding and Widths in the font resource. @@ -166,7 +166,7 @@ currentdict /known_symbolic_fonts undef /Helvetica findfont }if } if -} bind def +} bind executeonly def % Get the (possibly modified) encoding of a font. /getfontencoding { % <font-resource> <font> getfontencoding @@ -213,7 +213,7 @@ currentdict /known_symbolic_fonts undef } ifelse } ifelse } ifelse -} bdef +} bind executeonly def % Returns true if the current glyph is in the Differences array at % the specified index value. This is needed because the Widths @@ -240,7 +240,7 @@ currentdict /known_symbolic_fonts undef % stack: true false index glyphname % or : false index glyphname at_index pop pop pop -} bdef +} bind executeonly def /unique_name { % <dict> </root> unique_name </unique> % @@ -262,7 +262,7 @@ currentdict /known_symbolic_fonts undef pop } for exch pop cvn % /root0 -} bdef +} bind executeonly def % Get the metrics of a font, if specified. /getfontmetrics { % <font-resource> <font> <Encoding|null> getfontmetrics @@ -397,7 +397,7 @@ currentdict /known_symbolic_fonts undef } { //null //null } ifelse -} bdef +} bind executeonly def currentdict /unique_name undef currentdict /match_in_diff undef @@ -408,20 +408,20 @@ currentdict /match_in_diff undef pop dup userdict exch /.lastToUnicode exch put exch pop - } bdef + } bind executeonly def /CIDSystemInfo { ( **** Warning: ToUnicode CMap has invalid syntax near CIDSystemInfo.\n) pdfformatwarning /CIDSystemInfo - } bdef % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed. + } bind executeonly def % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed. /CMapName { ( **** Warning: ToUnicode CMap has no CMapName.\n\ See the comment to revision 6201 in gs/doc/ps2pdf.htm#Problems .\n) pdfformatwarning /CMap1 % arbitrary, PDF defineresource tolerates non-unique names - } bdef % A work around incorrect ToUnicode CMap generated by GS before rev. 6201. + } bind executeonly def % A work around incorrect ToUnicode CMap generated by GS before rev. 6201. % Split large ranges into smaller chunks to stay withing the limits % of various PS% objects and speed up operand stack manipulation, @@ -448,7 +448,7 @@ currentdict /match_in_diff undef mark } ifelse } loop - } bdef + } bind executeonly def currentdict end readonly def /string2number % <string> string2number <number> @@ -457,7 +457,7 @@ currentdict end readonly def 3 2 roll 256 mul add exch % v+n*256 () } for pop % N -} bind def +} bind executeonly def /copy&def % <key> <value> <bool> copy&def - { @@ -474,7 +474,7 @@ currentdict end readonly def setglobal } if def -} bind def +} bind executeonly def /.convert_ToUnicode-into-g2u % <GlyphNames2Unicode> <Encoding|null> <CMap> .convert_ToUnicode-into-g2u - { @@ -578,14 +578,14 @@ currentdict end readonly def CMAPDEBUG { (.convert_ToUnicode-into-g2u end) = } if -} bind def +} bind executeonly def /.DoToUnicode? { /IgnoreToUnicode where {/IgnoreToUnicode get not} {//true} ifelse -} bind def +} bind executeonly def /.processToUnicode % <font-resource> <font-dict> <encoding|null> .processToUnicode - { @@ -718,7 +718,7 @@ currentdict end readonly def {pop pop pop} ifelse -} bind def +} bind executeonly def currentdict /.DoToUnicode? .forceundef @@ -768,7 +768,7 @@ setglobal 4 2 roll .growput } ifelse } ifelse -} bind def +} bind executeonly def % Add original font to cache to prevent adjustfont to accumulate changes. /pdfaddcachedfont { % <font_name> pdfaddcachedfont <font> @@ -776,7 +776,7 @@ setglobal dup gcheck { //.pdforigfontcache_g } {.pdforigfontcache_l} ifelse 4 2 roll % font d name font put % font -} bind def +} bind executeonly def /.remove_font_name_prefix { % <name> .remove_font_name_prefix <name> dup .namestring (+) search { @@ -792,7 +792,7 @@ setglobal } { pop } ifelse -} bind def +} bind executeonly def % Find a font (except for embedded ones), and adjust its encoding if necessary. /.pdfdfndict mark @@ -965,18 +965,18 @@ setglobal } ifelse } ifelse exch pop -} bdef +} bind executeonly def % ---------------- Type 1 fonts ---------------- % /buildType1 % <Type1-font-resource> buildType1 <font> { dup /BaseFont get pdffindfont - } bdef + } bind executeonly def % Read an embedded Type 1 font. /readfontfilter { % <proc> readfontfilter <filter> 0 () /SubFileDecode filter -} bdef +} bind executeonly def % Adobe Acrobat doesn't skip space characters after eexec /eexec_pdf_param_dict mark @@ -1051,12 +1051,12 @@ setglobal } ifelse } if prev_definefont - } bdef + } bind executeonly def /undef_proc_warning { /Repaired //true store % flag that we have warnings UndefProcList exch 2 copy .knownget { 1 add } { 1 } ifelse put - } bdef + } bind executeonly def /missing-type1-procs 6 dict begin /-| { string currentfile exch readstring pop /-| //undef_proc_warning exec } executeonly bdef @@ -1080,7 +1080,7 @@ setglobal currentfile flushfile % Skip the trailer after return from eexec, bug 690701. { currentdict end //missing-type1-procs eq { exit } if } loop { stop } if - } bdef + } bind executeonly def /readonly-op-dict << /stringtype 0 @@ -1094,7 +1094,7 @@ setglobal ( **** Warning: Type 1 font applies operator readonly to an invalid object type.\n) pdfformatwarning } if - } bdef + } bind executeonly def /prev_get /get load def @@ -1110,14 +1110,14 @@ setglobal prev_get } ifelse } ifelse - } bdef + } bind executeonly def /prev_begin /begin load def /begin { dup //systemdict eq { pop 0 dict } if prev_begin - } bdef + } bind executeonly def { /undef_proc_warning /missing-type1-procs /readonly-op-dict } { currentdict exch undef } forall @@ -1152,7 +1152,7 @@ currentdict /eexec_pdf_param_dict .undef PDFfile file-position setfileposition count stack-count sub { pop } repeat topFontDict end end - } bdef + } bind executeonly def % ---------------- Type 3 fonts ---------------- % @@ -1241,7 +1241,7 @@ currentdict /eexec_pdf_param_dict .undef } bdef dup currentdict Encoding .processToUnicode currentdict end .completefont exch pop -} bdef +} bind executeonly def /.adjustcharwidth { % <wx> <wy> .adjustcharwidth <wx'> <wy'> % Enforce the metrics, in glyph space, to the values found in the PDF Font object % - force wy == 0 (assumed, and not stored in the PDF font) @@ -1258,7 +1258,7 @@ currentdict /eexec_pdf_param_dict .undef exch pop Widths CharCode FirstChar sub get exch } if end } if -} bdef +} bind executeonly def % ---------------- TrueType fonts ---------------- % @@ -1318,7 +1318,7 @@ currentdict /eexec_pdf_param_dict .undef } { pdffindfont } ifelse -} bdef +} bind executeonly def % Read an embedded TrueType font. /readtruetype { % <font-resource> <stream-dict> readtruetype <font> @@ -1328,6 +1328,18 @@ currentdict /eexec_pdf_param_dict .undef % Stack: filepos fontres stream 1 index /CIDSystemInfo oknown { 1 index /CIDSystemInfo get dup type /packedarraytype eq {exec}if + dup /Registry known not { + ( **** Warning: a CIDFont's CIDSystemInfo is missing the required Registry entry\n) pdfformatwarning + dup /Registry (Adobe) put + } if + dup /Ordering known not { + ( **** Warning: a CIDFont's CIDSystemInfo is missing the required Ordering entry\n) pdfformatwarning + dup /Ordering (Identity) put + } if + dup /Supplement known not { + ( **** Warning: a CIDFont's CIDSystemInfo is missing the required Supplement entry\n) pdfformatwarning + dup /Supplement 0 put + } if 3 1 roll 1 index /Subtype knownoget { /CIDFontType2 ne { @@ -1371,7 +1383,7 @@ currentdict /eexec_pdf_param_dict .undef PDFfile 3 -1 roll setfileposition % Ignore both the Encoding and the Widths. exch pop -} bdef +} bind executeonly def % ---------------- Type 0 fonts ---------------- % @@ -1413,7 +1425,7 @@ currentdict /eexec_pdf_param_dict .undef end % CMap end % CIDInit ProcSet exch .setglobal -} bdef +} bind executeonly def /CMap_read_dict 3 dict begin /defineresource % <name> <dict> <cat-name> defineresource <dict> @@ -1421,20 +1433,20 @@ currentdict /eexec_pdf_param_dict .undef pop /.last_CMap_def 1 index store exch pop - } bdef + } bind executeonly def /CIDSystemInfo { ( **** Error: CMap has invalid syntax near CIDSystemInfo.\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror /CIDSystemInfo - } bdef % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed. + } bind executeonly def % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed. /CMapName { ( **** Error: CMap has no CMapName.\n\ See the comment to revision 6201 in gs/doc/ps2pdf.htm#Problems .\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror /CMap1 % arbitrary, PDF defineresource tolerates non-unique names - } bdef % A work around incorrect ToUnicode CMap generated by GS before rev. 6201. + } bind executeonly def % A work around incorrect ToUnicode CMap generated by GS before rev. 6201. currentdict end readonly def % Read an embedded stream that we *hope* is a PostScript CMap. According @@ -1451,7 +1463,7 @@ currentdict end readonly def currentdict end dup /CMapName get exch /CMap defineresource end -} bdef +} bind executeonly def % Read embedded CMap stream. % if the <wmode> parameter is null, it indicates there is no WMode, and we @@ -1475,7 +1487,7 @@ currentdict end readonly def { currentdict end //CMap_read_dict eq { exit } if } loop dup /.last_CMap_def undef /CMap defineresource -} bdef +} bind executeonly def currentdict /CMap_read_dict undef @@ -1536,7 +1548,7 @@ currentdict /CMap_read_dict undef pop } ifelse } if exch pop -} bdef +} bind executeonly def % ---------------- CIDFontType0/2 fonts ---------------- % @@ -1589,7 +1601,7 @@ currentdict /CMap_read_dict undef dup /CDevProc 1 index /CIDWProc load /exec load 3 packedarray cvx put exch pop -} bdef +} bind executeonly def /.pdfMakeInternalMTXArray { % <mtx_array> <item_size> .pdfConvertInternalW <mtx_array'> % convert /W or /W2 to internal expression @@ -1645,10 +1657,10 @@ currentdict /CMap_read_dict undef [ { putMTXEntry Mi1 type get exec i Msize ge { exit } if } loop ] end -} def +} executeonly def -/.pdfMakeInternalW { dup length 0 gt { oforce_recursive 1 .pdfMakeInternalMTXArray } if } def -/.pdfMakeInternalW2 { dup length 0 gt { oforce_recursive 3 .pdfMakeInternalMTXArray } if } def +/.pdfMakeInternalW { dup length 0 gt { oforce_recursive 1 .pdfMakeInternalMTXArray } if } executeonly def +/.pdfMakeInternalW2 { dup length 0 gt { oforce_recursive 3 .pdfMakeInternalMTXArray } if } executeonly def /.pdfGetMTXByCID { % <internalMTXArray> <cid> % .pdfGetMTXByCID @@ -1668,7 +1680,7 @@ currentdict /CMap_read_dict undef { exit } if } forall dup type /arraytype eq { exch pop //true } { pop //false } ifelse -} def +} executeonly def % Apply the [D]W[2] metrics to a character before displaying. /CIDWProc { % <w0x> <w0y> <llx> <lly> <urx> <ury> @@ -1776,7 +1788,7 @@ currentdict /CMap_read_dict undef 11 -1 roll pop % Stack: <w0x'> <w0y'> <llx> <lly> <urx> <ury> <w1x'> <w1y'> <vx'> <vy'> end % recover currentdict -} def +} executeonly def % <string> <match> tailmatch ==> <pre> true % ==> <string> false @@ -1789,7 +1801,7 @@ currentdict /CMap_read_dict undef } { pop //false } ifelse -} bind def +} bind executeonly def /makeboldfont { 16 dict begin @@ -1830,7 +1842,7 @@ currentdict /CMap_read_dict undef currentdict end dup /CIDFontName get exch /CIDFont defineresource -} bind def +} bind executeonly def % <CIDFont-resource> <CIDFontName> findCIDFont <CIDFont-resource> <font> % CIDFont-resource is not modified. @@ -2014,15 +2026,15 @@ currentdict /CMap_read_dict undef } if /findresource cvx /undefined signalerror } loop -} bdef +} bind executeonly def /buildCIDType0 { % <CIDFontType0-font-resource> buildCIDType0 <font> dup /BaseFont get findCIDFont exch pop -} bdef +} bind executeonly def /buildCIDType2 { % <CIDFontType2-font-resource> buildCIDType2 <font> dup /BaseFont get findCIDFont exch pop -} bdef +} bind executeonly def /processCIDToGIDMap { % <fontres> <cidfont> processCIDToGIDMap <fontres> <cidfont> 1 index /CIDToGIDMap knownoget { @@ -2055,7 +2067,7 @@ currentdict /CMap_read_dict undef } ifelse 3 2 roll PDFfile exch setfileposition } if -} bdef +} bind executeonly def % Adjust a CIDFontType0 DW[2] in the font resource. /adjustCIDType0 { % <font-resource> <font> adjustfont <font'> @@ -2067,7 +2079,7 @@ currentdict /CMap_read_dict undef addCIDmetrics dup /CIDFontName get exch /CIDFont defineresource } ifelse -} bind def +} bind executeonly def % Adjust a CIDFontType2 DW[2] and CIDToGIDMap in the font resource. /adjustCIDType2 { % <font-resource> <font> adjustfont <font'> @@ -2082,7 +2094,7 @@ currentdict /CMap_read_dict undef } if dup /CIDFontName get exch /CIDFont defineresource } ifelse -} bind def +} bind executeonly def % ---------------- Other embedded fonts ---------------- % @@ -2108,7 +2120,7 @@ currentdict /CMap_read_dict undef closefile closefile pop PDFfile 3 -1 roll setfileposition pop pop -} bdef +} bind executeonly def % Read an embedded CFF CIDFont. /readCIDFontType0C { % <font-resource> <stream-dict> readCIDFontType0C <font> @@ -2126,7 +2138,7 @@ currentdict /CMap_read_dict undef % Use the FontName, rather than the BaseFont, here. dup /FontDescriptor oget /FontName oget /CIDFont findresource addCIDmetrics dup /CIDFontName get exch /CIDFont defineresource -} bdef +} bind executeonly def % Read an embedded OpenType font. /readOTTOfont { % <font-resource> <stream-dict> readOTTOfont <font> @@ -2184,7 +2196,7 @@ currentdict /CMap_read_dict undef closefile closefile pop pop % font res pos PDFfile exch setfileposition % font res pop % font -} bdef +} bind executeonly def % ---------------- Font lookup ---------------- % @@ -2216,10 +2228,10 @@ currentdict /CMap_read_dict undef % Bind a proc and define n names % /name ... /name {proc} n bndef - /bndef - { exch bind exch + { exch bind executeonly exch { dup 3 1 roll def } repeat pop - } bdef + } bind executeonly def % <res> run-fonttypeproc <font> /run-fonttypeproc { @@ -2232,7 +2244,7 @@ currentdict /CMap_read_dict undef 2 copy /Subtype exch put } if //fonttypeprocs exch get exec -} bdef +} bind executeonly def % Prototype for all procedures: <res> <desc> <stream> foo <font> /font_tag_dict 13 dict begin @@ -2241,19 +2253,19 @@ currentdict /CMap_read_dict undef /no_stream { pop pop run-fonttypeproc - } bdef + } bind executeonly def /bad_stream { ( **** Error: Error reading font stream, attempting to load the font using its name\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror //no_stream exec - } bdef + } bind executeonly def <8001> % PFB { dup /PFB //true put exch pop readtype1 - } bdef + } bind executeonly def (%!PS) (%!Fo) % Type1 { exch pop readtype1 @@ -2276,7 +2288,7 @@ currentdict /CMap_read_dict undef (OTTO) { exch pop readOTTOfont - } bdef + } bind executeonly def currentdict end readonly def currentdict /bndef undef @@ -2311,7 +2323,7 @@ currentdict /bndef undef 16#7FFFFFFF and xor % object_number CRC<newhash> xor % final hashed value -}bind def +}bind executeonly def % Either patch or create a new XUID based on the existing % XUID or UniqueID and incorporating the PDF object number @@ -2344,7 +2356,7 @@ currentdict /bndef undef .completefont } ifelse } ifelse -} bind def +} bind executeonly def /resourcefont % <font-resource> resourcefont <font> { @@ -2489,7 +2501,7 @@ currentdict /bndef undef dup 3 1 roll /PSFont exch put } ifelse dup checkGlyphNames2Unicode -} bdef +} bind executeonly def currentdict /font_tag_dict .undef currentdict /fonttypeprocs .undef @@ -2499,7 +2511,7 @@ drawopdict begin /d0 { currentcolor currentcolorspace .swapcolors setcolorspace setcolor .swapcolors .adjustcharwidth setcharwidth - } bdef + } bind executeonly def /d1 { 2 copy % ... llx lly urx ury | urx ury 0 ne exch 0 ne % ... llx lly urx ury | ury!=0 urx!=0 @@ -2511,7 +2523,7 @@ drawopdict begin } { 6 -2 roll .adjustcharwidth 6 2 roll setcachedevice } ifelse - } bdef + } bind executeonly def /Tf { 1 index Page /Font rget { dup type /dicttype eq { @@ -2550,7 +2562,7 @@ drawopdict begin Tf } ifelse } ifelse - } bdef + } bind executeonly def end end % pdfdict |