% Copyright (C) 2001-2018 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or % implied. % % This software is distributed under license and may not be copied, % modified or distributed except as expressly authorized under the terms % of the license contained in the file LICENSE in this distribution. % % Refer to licensing information at http://www.artifex.com or contact % Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, % CA 94945, U.S.A., +1(415)492-9861, for further information. % % Type 1 font support code. % The standard representation for PostScript compatible fonts is described % in the book "Adobe Type 1 Font Format", published by Adobe Systems Inc. /t1_glyph_equivalence mark % Exported for pf2afm.ps /Odblacute /Ohungarumlaut /Udblacute /Uhungarumlaut /odblacute /ohungarumlaut /udblacute /uhungarumlaut .dicttomark def % Define an augmented version of .buildfont1 that inserts UnderlinePosition % and UnderlineThickness entries in FontInfo if they aren't there already, % and FontBBox isn't degenerate. % (This works around the incorrect assumption, made by many word processors, % that these entries are present in the built-in fonts.) % Also add alternative names to some glyphs. /.buildfont1 { .currentglobal 3 1 roll dup .gcheck .setglobal dup .fontbbox { pop pop pop pop dup /FontInfo known not { .growfontdict dup /FontInfo 2 dict put } if dup dup /FontInfo get dup dup /UnderlinePosition known exch /UnderlineThickness known and { pop pop % entries already present } { dup length 2 add dict .copydict dup /UnderlinePosition known not { dup /UnderlinePosition 3 index /FontBBox get 1 get 2 div put % 1/2 the font descent } if dup /UnderlineThickness known not { dup /UnderlineThickness 3 index /FontBBox get dup 3 get exch 1 get sub 20 div put % 1/20 the font height } if 1 index /FontInfo get wcheck not { readonly } if /FontInfo exch put } ifelse } if % We want to skip this process if we've already done it, and % not do it for embedded fonts. dup /.AGLprocessed~GS known not 1 index /PathLoad known and { dup /CharStrings get % Provide all known aliases for each glyph if % substitution is allowed (pf2afm.ps has code % to disables it by modifying t1_glyph_equivalence). t1_glyph_equivalence length 0 ne { % 16 byte scratch string % 16 bytes is arbitrary, but should be large enough to hold any "uniXXXX" style name //ReverseAdobeGlyphList //AdobeGlyphList 3 -1 roll % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) dup { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) gname cstring exch dup % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname gname 4 index exch .knownget { //true} { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname dup length 16 gt { //false } { % if we couldn't derive the code point from the AGL, we might derive it % from a formatted "uniXXXX" name. dup <00000000000000000000000000000000> cvs dup flush (uni) anchorsearch { % as luck would have it, we can just replace the "uni" with "16#" % to get something we can convert to a number pop pop dup 0 (16#) putinterval {cvi} .internalstopped { pop //false} { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname cpoint dup 5 index exch known { //true } { pop //false } ifelse } ifelse } { pop pop //false} ifelse } ifelse } ifelse { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname cpoint % loop through the array of names for this codepoint % if the CharStrings dict doesn't contain an entry for the name % create one. 5 index exch .knownget { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname aglnames(array) { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname aglname dup 4 index exch known not { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname aglname CFFDEBUG { (\nsetting alias: ) print dup ==only ( to be the same as glyph: ) print 1 index //== exec } if 3 index exch 3 index .forceput % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname }executeonly {pop} ifelse } executeonly forall pop pop } executeonly { pop pop pop } ifelse } executeonly { % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname pop pop } ifelse } executeonly forall 3 1 roll pop pop } executeonly if pop dup /.AGLprocessed~GS //true .forceput } executeonly if %% We need to excute the C .buildfont1 in a stopped context so that, if there %% are errors we can put the stack back sanely and exit. Otherwise callers won't %% be able to execute this redefinied .buildfont1 in a stopped context and still %% usefully continue (because the stack will be altered, which it shold not be). %% %% Uncovered working on bug #696306 and fixed as part of that bug. %% {//.buildfont1} stopped 4 3 roll .setglobal {//.buildfont1 $error /errorname get signalerror} if } .bind executeonly def % hide .forceput % If the diskfont feature isn't included, define a dummy .loadfontdict. /.loadfontdict where { pop } { /.loadfontdict 0 dict readonly def } ifelse /.loadfontfile % <file> .loadfontfile - { mark exch % In order to load fonts reliably, we should push systemdict % here. However, Ed Taft says that Adobe implementations % push userdict and nothing else! % We really would just like systemdict on the stack, % but fonts produced by Fontographer require a writable dictionary. % However, we can't use any of the other well-known dictionaries % (such as userdict), since the whole point of pushing systemdict % is to make sure that nothing important has been redefined. /userdict .systemvar begin % We can't just use `run', because we want to check for .PFB files. currentpacking { //false setpacking .loadfont1 //true setpacking } { .loadfont1 } ifelse end { stop } if cleartomark } bind def % container for CloseSource flag (default //true to prevent buildup of file handles) /closesourcedict mark /CloseSource //true .dicttomark readonly def /.loadfont1 { % <file> .loadfont1 <errorflag> { % We would like to use `false /PFBDecode filter', % but this occasionally produces a whitespace character as % the first of an eexec section, so we can't do it. % Also, since the real input file never reaches EOF if we are using % a PFBDecode filter (the filter stops just after reading the last % character), we must explicitly close the real file in this case. % Since the file might leave garbage on the operand stack, % we have to create a procedure to close the file reliably. dup read not { -1 } if 2 copy unread 16#80 eq { dup //closesourcedict //true /PFBDecode filter cvx exch .currentresourcefile eq { dup /.execasresource .systemvar } { {exec} } ifelse 2 index cvlit /closefile .systemvar 3 .execn } { cvx exec } ifelse } stopped } bind def % undefine a dict that is only used internally, and is immediately bound currentdict /closesourcedict .undef % Here are the BuildChar and BuildGlyph implementation for Type 1 fonts. % The names %Type1BuildChar and %Type1BuildGlyph are known to the interpreter. % The real work is done in an operator: % <font> <code|name> <name> <charstring> .type1execchar - (%Type1BuildChar) cvn { % <font> <code> %Type1BuildChar - 1 index /Encoding get 1 index get .type1build .type1execchar } bind def (%Type1BuildGlyph) cvn { % <font> <name> %Type1BuildGlyph - dup .type1build .type1execchar } bind def % Note: this procedure is used for both Type 1 and Type 2 fonts. /.type1build { % <font> <code|name> <name> .type1build % <font> <code|name> <name> <charstring> 2 index begin dup CharStrings exch .knownget not { 2 copy eq { exch pop /.notdef exch } if QUIET not { (Substituting .notdef for ) print =string cvs print ( in the font ) print 1 index /FontName get = flush } { pop } ifelse /.notdef CharStrings /.notdef get } if end } bind def 1183615869 internaldict begin % CCRun is an undocumented procedure provided for Type 4 and Type 0 fonts. % Apparently there are two different argument lists for CCRun. % Handling the one with the extra Private dictionary requires fabricating % a Type 1 font on the fly, since we aren't currently prepared to parse the % dictionary any other way. /CCRun { % <font> <code|name> <charstring> CCRun - % <font> <code|name> <charstring> <Private> CCRun - dup type /dicttype eq { dup 4 index /Private .knownget { ne } { pop //true } ifelse { % The Private dictionary was supplied, and is different % from the Private dictionary of the font. Fabricate a % Type 1 font with this Private dictionary. Most of the % font entries are arbitrary or not needed. .currentglobal //false .setglobal 10 dict exch .setglobal begin /Private exch def /FontType 1 def /FontMatrix 3 index /FontMatrix get def /Encoding 3 index /Encoding .knownget not { StandardEncoding } if def /FontBBox 3 index /FontBBox .knownget not { {0 0 0 0} } if def /PaintType 0 def /CharStrings 1 dict dup /.notdef () put def 3 -1 roll pop () currentdict end .buildfont1 exch pop 3 1 roll } { pop } ifelse } if 1 index dup type /integertype eq { 3 index /Encoding get exch get } if exch .type1execchar } bind def % setweightvector is an undocumented procedure that force writes % weight vector to the font. Do extra checks for safety. /setweightvector { % <font> <vector> setweightvector - dup type dup /arraytype ne exch /packedarraytype ne and 2 index type /dicttype ne or { /setweightvector cvx /typecheck signalerror } if 1 index /FontType known not { /setweightvector cvx /invalidfont signalerror } if dup gcheck 2 index gcheck not and { /setweightvector cvx /invalidaccess signalerror } if 2 copy /WeightVector exch .forceput .setweightvector } .bind executeonly odef end % Register the font types for definefont. buildfontdict 1 /.buildfont1 cvx put buildfontdict 4 /.buildfont4 cvx put % Add Type 2 support if applicable. /.buildfont2 where not { (%END2) .skipeof } if pop (%Type2BuildChar) cvn { % <font> <code> %Type2BuildChar - 1 index /Encoding get 1 index get .type1build .type2execchar } bind def (%Type2BuildGlyph) cvn { % <font> <name> %Type2BuildGlyph - dup .type1build .type2execchar } bind def buildfontdict 2 /.buildfont2 cvx put %END2
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
FAPIcidfmap | File | 1.45 KB | 0644 |
|
FAPIconfig | File | 815 B | 0644 |
|
FAPIfontmap | File | 1.43 KB | 0644 |
|
FCOfontmap-PCLPS2 | File | 2.79 KB | 0644 |
|
Fontmap | File | 109 B | 0644 |
|
Fontmap.GS | File | 11.79 KB | 0644 |
|
cidfmap | File | 2.11 KB | 0644 |
|
gs_agl.ps | File | 212.91 KB | 0644 |
|
gs_btokn.ps | File | 11.9 KB | 0644 |
|
gs_cet.ps | File | 3.4 KB | 0644 |
|
gs_cff.ps | File | 6.71 KB | 0644 |
|
gs_cidcm.ps | File | 16.43 KB | 0644 |
|
gs_ciddc.ps | File | 8.31 KB | 0644 |
|
gs_cidfm.ps | File | 7.14 KB | 0644 |
|
gs_cidfn.ps | File | 13.22 KB | 0644 |
|
gs_cidtt.ps | File | 5.7 KB | 0644 |
|
gs_cmap.ps | File | 17.94 KB | 0644 |
|
gs_cspace.ps | File | 5.84 KB | 0644 |
|
gs_dbt_e.ps | File | 2.08 KB | 0644 |
|
gs_diskn.ps | File | 6.68 KB | 0644 |
|
gs_dpnxt.ps | File | 4.74 KB | 0644 |
|
gs_dps.ps | File | 8.15 KB | 0644 |
|
gs_dps1.ps | File | 4.57 KB | 0644 |
|
gs_dps2.ps | File | 8.28 KB | 0644 |
|
gs_dscp.ps | File | 3.85 KB | 0644 |
|
gs_epsf.ps | File | 8.62 KB | 0644 |
|
gs_fapi.ps | File | 15.13 KB | 0644 |
|
gs_fntem.ps | File | 11.04 KB | 0644 |
|
gs_fonts.ps | File | 44.83 KB | 0644 |
|
gs_frsd.ps | File | 3.07 KB | 0644 |
|
gs_icc.ps | File | 2.99 KB | 0644 |
|
gs_il1_e.ps | File | 2.66 KB | 0644 |
|
gs_img.ps | File | 24.28 KB | 0644 |
|
gs_init.ps | File | 89.73 KB | 0644 |
|
gs_l2img.ps | File | 5.74 KB | 0644 |
|
gs_lev2.ps | File | 43.65 KB | 0644 |
|
gs_ll3.ps | File | 18.51 KB | 0644 |
|
gs_mex_e.ps | File | 3.75 KB | 0644 |
|
gs_mgl_e.ps | File | 2.13 KB | 0644 |
|
gs_mro_e.ps | File | 2.45 KB | 0644 |
|
gs_pdf_e.ps | File | 1.52 KB | 0644 |
|
gs_pdfwr.ps | File | 31.68 KB | 0644 |
|
gs_res.ps | File | 40.08 KB | 0644 |
|
gs_resmp.ps | File | 21.94 KB | 0644 |
|
gs_setpd.ps | File | 38.25 KB | 0644 |
|
gs_statd.ps | File | 13.6 KB | 0644 |
|
gs_std_e.ps | File | 3.07 KB | 0644 |
|
gs_sym_e.ps | File | 3.03 KB | 0644 |
|
gs_trap.ps | File | 2.85 KB | 0644 |
|
gs_ttf.ps | File | 61.82 KB | 0644 |
|
gs_typ32.ps | File | 4.45 KB | 0644 |
|
gs_typ42.ps | File | 1.98 KB | 0644 |
|
gs_type1.ps | File | 12.12 KB | 0644 |
|
gs_wan_e.ps | File | 1.53 KB | 0644 |
|
pdf_base.ps | File | 50.68 KB | 0644 |
|
pdf_draw.ps | File | 166.95 KB | 0644 |
|
pdf_font.ps | File | 88.77 KB | 0644 |
|
pdf_main.ps | File | 120.23 KB | 0644 |
|
pdf_ops.ps | File | 71.77 KB | 0644 |
|
pdf_rbld.ps | File | 18.96 KB | 0644 |
|
pdf_sec.ps | File | 24.15 KB | 0644 |
|
xlatmap | File | 1.73 KB | 0644 |
|