📄 gs_cff.ps
字号:
dup 391 lt { StandardStrings } { 391 sub strings } ifelse exch get
} def
/idname { % <sid> idname <name>
idstring dup type /nametype ne { cvn } if
} def
% ------ Top dictionary ------ %
/offput { % <offset> <proc> offput -
currentdict exch aload length 1 add packedarray cvx
offsets 3 1 roll put
} def
/queueput { % <font> <proc> queueput -
16#7fffffff offsets { pop .min } forall
pos sub nextstring
3 1 roll aload length 2 add packedarray cvx
[ queued aload pop counttomark 2 add -1 roll ]
/queued exch store
} def
/xxput { % <value> <key> <dict> xxput -
3 1 roll exch put
} def
/putfi { % <value> <key> putfi -
FontInfo xxput
} def
/xdef { % <value> <key> xdef -
exch def
} def
/topdictops mark
12 { exit }
0 { idstring /version putfi }
1 { idstring /Notice putfi }
32 { idstring /Copyright putfi }
2 { idstring /FullName putfi }
3 { idstring /FamilyName putfi }
4 { idstring /Weight putfi }
33 { 0 ne /isFixedPitch putfi }
34 { /ItalicAngle putfi }
35 { /UnderlinePosition putfi }
36 { /UnderlineThickness putfi }
37 { /PaintType xdef }
38 { /CharstringType xdef }
39 { counttomark array astore /FontMatrix xdef }
13 { /UniqueID xdef }
5 { counttomark array astore /FontBBox xdef }
40 { /StrokeWidth xdef }
14 { counttomark array astore /XUID xdef }
15 {
dup StandardCharsets length lt {
StandardCharsets exch get /charset xdef
} {
{ queuecharset } offput
} ifelse
}
16 {
dup StandardEncodings length lt {
/Encoding xdef
} {
{ queueEncoding } offput
} ifelse
}
17 { { readCharStrings } offput }
18 { exch /readPrivate cvx 2 packedarray offput }
.dicttomark readonly def
/readCharStrings { % <font> readCharStrings -
/CharStringArray Index put
} def
% ------ Charsets and encodings ------ %
% Note: formats 1 and 2 can overflow the operand stack.
% We'll fix this if it ever becomes necessary.
/charsetformats [
{ [ 0 CharStringArray length 1 sub { sid } repeat ]
}
{ [ 0 CharStringArray length 1 sub {
dup 0 eq { pop exit } if
sid card8 1 add 2 index .min { exch 1 sub 1 index 1 add } repeat pop
} loop ]
}
{ [ 0 CharStringArray length 1 sub {
dup 0 eq { pop exit } if
sid card16 1 add 2 index .min { exch 1 sub 1 index 1 add } repeat pop
} loop ]
}
] readonly def
/queuecharset { % <font> queuecharset -
{ readcharset } queueput
} def
/readcharset { % <data> <font> readcharset -
begin 0 () /SubFileDecode filter /f exch store
charsetformats next get exec /charset exch def end
} def
/encodingformats [
{ 1 1 next { next exch Encoding 3 1 roll put } for
}
{ 1 next {
next next 1 add {
% Stack: gid code
Encoding 1 index 3 index put
exch 1 add exch 1 add
} repeat pop
} repeat pop
}
] readonly def
/queueEncoding { % <font> queueEncoding -
{ readEncoding } queueput
} def
/readEncoding { % <data> <font> readEncoding -
begin 0 () /SubFileDecode filter /f exch store
/Encoding [ 256 { /.notdef } repeat ] def
next encodingformats 1 index 127 and get exec
128 ge {
% Read supplementary encodings.
next {
Encoding next sid idname put
} repeat
} if end
} def
% ------ Private dictionary ------ %
/deltarray { % -mark- <num1> ... deltarray <num1'> ...
0 counttomark 1 sub { counttomark -1 roll add dup } repeat pop
counttomark array astore
} def
/privatedictops mark
12 { exit }
6 { deltarray /BlueValues xdef }
7 { deltarray /OtherBlues xdef }
8 { deltarray /FamilyBlues xdef }
9 { deltarray /FamilyOtherBlues xdef }
41 { /BlueScale xdef }
42 { /BlueShift xdef }
43 { /BlueFuzz xdef }
10 { 1 array astore /StdHW xdef }
11 { 1 array astore /StdVW xdef }
44 { deltarray /StemSnapH xdef }
45 { deltarray /StemSnapV xdef }
46 { 0 ne /ForceBold xdef }
47 { /ForceBoldThreshold xdef }
48 { /lenIV xdef }
49 { /LanguageGroup xdef }
50 { /ExpansionFactor xdef }
51 { /initialRandomSeed xdef }
19 { { readSubrs } offput }
20 { /defaultWidthX xdef }
21 { /nominalWidthX xdef }
% Multiple Master fonts only
59 { /NDV xdef }
60 { /CDV xdef }
61 { /lenBuildCharArray xdef }
.dicttomark readonly def
/readPrivate { % <font> <size> readPrivate -
exch 1 index f exch () /SubFileDecode filter /f exch def
/Private get begin //privatedictops Dict end
/f cff def advance
} def
% ------ Main program ------ %
% We need to pass the file as a parameter for the sake of the PDF
% interpreter.
/StartData { % <resname> <nbytes> StartData -
currentfile exch () /SubFileDecode filter ReadData
} def
/ReadData { % <resname> <file> ReadData -
% Initialize.
30 dict begin
/cff exch def
/pos 0 def
/resname exch cvlit def
% Read the header.
/f cff def
/vmajor next def
/vminor next def
/hdrsize next def
/aoffsize next def
% Read the Indexes.
/names Index def
/topdicts Index def
/strings Index def
/gsubrs Index def
% Read the top Dicts.
/offsets 50 dict def
/queued [] def
/opdict null def % reserve a slot
/fonts [ topdicts {
0 () /SubFileDecode filter /f exch def
40 dict begin
% Preload defaults that differ from PostScript defaults,
% or that are required.
/FontType 1 def
/PaintType 0 def
/CharstringType 2 def
/FontMatrix [0.001 0 0 0.001 0 0] def
/charset StandardCharsets 0 get def
/Encoding 0 def
/FontInfo 10 dict
dup /UnderlinePosition -100 put
dup /UnderlineThickness 50 put
def
/Private 20 dict
gsubrs length 0 ne { dup /GlobalSubrs gsubrs put } if
def
//topdictops Dict
currentdict end
} forall ] def
% Read other tables with queued offsets.
DEBUG { offsets length =only ( offsets) = flush } if
{ /f cff def
offsets pos 2 copy .knownget not { pop pop exit } if
3 1 roll undef exec
} loop
offsets length 0 ne {
(Error: missing tables at ) print [ offsets { pop } forall ] ==
(Current position is ) print pos ==
flush stop
} if
% Process out-of-order tables.
DEBUG { queued length =only ( queued) = flush } if
queued { exec } forall
% Update Encoding and CharStrings.
fonts {
begin
% Construct the real Encoding.
% The value of Encoding is either a number, for predefined
% encodings, or an array of mixed GIDs and names.
/Encoding mark Encoding
DEBUG { (Encoding: ) print dup === flush } if
dup type /integertype eq {
StandardEncodings exch get { idname } forall
} {
{
dup type /integertype eq { charset exch get idname } if
} forall
} ifelse .packtomark def
% Construct the CharStrings.
% Note that they may only correspond to an initial
% subset of the charset.
/CharStrings charset length CharStringArray length .min dict def
DEBUG {
charset length =only ( charset ) print
CharStringArray length =only ( CharStringArray) =
charset == flush
} if
0 1 CharStrings maxlength 1 sub {
dup CharStringArray exch get
exch charset exch get idstring
CharStrings xxput
} for
% Remove unwanted entries.
currentdict /charset undef
currentdict /CharStringArray undef
end
} forall
% Wrap up.
resname mark 0 1 fonts length 1 sub {
DEBUG { dup =only ( ) print flush } if
dup names exch get
DEBUG { dup == flush } if
exch fonts exch get
dup /FontName 3 index put
1 index exch definefont
} for .dicttomark
end % temporary dict
end % FontSetInit ProcSet
/FontSet defineresource pop
} bind def
% ---------------- Resource category definition ---------------- %
currentdict end readonly
languagelevel exch 2 .setlanguagelevel
/FontSet /Generic /Category findresource dup length dict .copydict
/Category defineresource pop
/FontSetInit exch /ProcSet defineresource pop
.setlanguagelevel
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -