dvips尝试对这种字体做什么?

时间:2016-11-17 03:14:24

标签: postscript

我的postscript解释器在运行由typecheck生成的以下程序时definefont发出dvips错误。在我看来,两个重要的过程是/D/E,它们似乎是:将六角形字符串解码为更方便的格式,并分别安装字体。

现在,xpost和我混淆的部分都在`/ E':

/E{pop nn A
definefont setfont}

其中nn是准备安装的字体字典,但A定义为:

/A{dup}

dup?现在我很困惑。 PLRM将definefont描述为

  

字体 definefont font
   key cidfont definefont cidfont

那么-font- -font-应该做什么?我是否错误地检查了一个密钥的字典?

%!PS-Adobe-2.0
%%Creator: dvips(k) 5.993 Copyright 2013 Radical Eye Software
%%Title: test.dvi
%%CreationDate: Tue Nov 15 11:07:44 2016
%%Pages: 2
%%PageOrder: Ascend
%%BoundingBox: 0 0 596 842
%%DocumentPaperSizes: a4
%%EndComments
%DVIPSWebPage: (www.radicaleye.com)
%DVIPSCommandLine: dvips -o test.ps test.dvi
%DVIPSParameters: dpi=600
%DVIPSSource:  TeX output 2016.11.15:1107
%%BeginProcSet: tex.pro 0 0
%!
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72
mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0
0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{
landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize
mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[
matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round
exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{
statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0]
N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin
/FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array
/BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2
array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N
df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A
definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get
}B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub}
B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr
1 add N}if}B/CharBuilder{save 3 1 roll S A/base get 2 index get S
/BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy
setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]{Ci}imagemask
restore}B/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn
/BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put
}if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{
bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A
mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{
SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{
userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X
1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4
index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N
/dir 0 def/dyy{/dir 0 def}B/dyt{/dir 1 def}B/dty{/dir 2 def}B/dtt{/dir 3
def}B/p{dir 2 eq{-90 rotate show 90 rotate}{dir 3 eq{-90 rotate show 90
rotate}{show}ifelse}ifelse}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0
N/Ry 0 N/V{}B/RV/v{/Ry X/Rx X V}B statusdict begin/product where{pop
false[(Display)(NeXT)(LaserWriter 16/600)]{A length product length le{A
length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}
forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{
BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat
{BDot}imagemask grestore}}ifelse B/QV{gsave newpath transform round exch
round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0
rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B
/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}
B/g{0 M}B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p
-3 w}B/n{p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{
0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end

%%EndProcSet
TeXDict begin 39158280 55380996 1000 600 600 (test.dvi)
@start
%DVIPSBitmapFont: Fa cmsy10 12 1
/Fa 1 68 df<0000000001FE00000000001FFF8000000001FFFFC000000007FFFFC00000
001FFFFFE00000007FFFFFE0000001FE01FFE0000003F0007FE000000FC0003FE000001F
00003FE000003E00003FC000007C00003FC00000F800003F800001F000003F800003F000
007F800007E000007F00000FC00000FF00001F800000FE00001F800000FE00003F000001
FC00007F000001FC0000FE000003F80000FE000003F00001FC000007C00001FC00000700
0003F8000000000003F8000000000007F8000000000007F000000000000FF00000000000
0FF000000000000FE000000000001FE000000000001FE000000000001FC000000000003F
C000000000003FC000000000003FC000000000007FC000000000007F8000000000007F80
00000000007F8000000000007F800000000000FF800000000000FF800000000000FF8000
00000000FF800000000000FF800000000000FF800000000000FF800000000000FF800000
000000FF800000000000FFC00000000000FFC00000000000FFC00000001E00FFC0000000
3E007FE0000000FC007FE0000001F8007FF0000003F0007FF0000003E0003FF8000007C0
003FFC00000F80001FFE00001F00001FFF00003E00000FFFC000FC00000FFFF803F00000
07FFFFFFE0000003FFFFFF80000001FFFFFE00000000FFFFF8000000003FFFC000000000
07FC0000000033487FC534>67 D E
%EndDVIPSBitmapFont
%DVIPSBitmapFont: Fb cmr12 12 4
/Fb 4 85 df<000030000000F0000001F0000003F000001FF00000FFF000FFFFF000FFE7
F000FF07F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0000007
F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0000007
F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0000007
F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0000007
F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0000007
F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0000007F000000F
F800001FFC007FFFFFFF7FFFFFFF7FFFFFFF204278C131>49 D<0003FE0000001FFFC000
007FFFF00001F80FFC0003C001FE00078000FF000E00007F801C00003FC01C00001FE038
00001FF03000000FF07000000FF860000007F86C000007F8FF000007FCFF800007FCFFC0
0007FCFFC00003FCFFC00003FCFFC00003FCFFC00003FC7F800007FC3F000007FC000000
07FC00000007F800000007F80000000FF80000000FF00000001FF00000001FE00000001F
E00000003FC00000007F800000007F00000000FF00000000FE00000001FC00000003F800
000007F000000007E00000000FC00000001F800000003F000000007C00000000F8000000
00F000000001E000000003C000000007800000000F00000C001E00000C003C00000C0038
000018007000001800E000001801C0000018038000003807000000300E000000701FFFFF
FFF01FFFFFFFF03FFFFFFFF07FFFFFFFF0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE026427BC1
31>I<00000000C00000000000000001E00000000000000001E00000000000000001E000
00000000000003F00000000000000003F00000000000000003F00000000000000007F800
00000000000007F80000000000000007F8000000000000000FFC000000000000000FFC00
0000000000000FFC0000000000000019FE0000000000000019FE0000000000000019FE00
00000000000030FF0000000000000030FF0000000000000070FF80000000000000607F80
000000000000607F80000000000000E07FC0000000000000C03FC0000000000000C03FC0
000000000001C03FE0000000000001801FE0000000000001801FE0000000000003001FF0
000000000003000FF0000000000003000FF0000000000006000FF80000000000060007F8
0000000000060007F800000000000C0003FC00000000000C0003FC00000000000C0003FC
0000000000180001FE0000000000180001FE0000000000180001FE0000000000300000FF
0000000000300000FF0000000000700000FF80000000006000007F80000000006000007F
8000000000E000007FC000000000FFFFFFFFC000000000FFFFFFFFC000000001FFFFFFFF
E0000000018000001FE0000000018000001FE0000000030000001FF0000000030000000F
F0000000030000000FF0000000060000000FF80000000600000007F80000000600000007
F80000000C00000003FC0000000C00000003FC0000000C00000003FC0000001800000001
FE0000001800000001FE0000001800000001FE0000003000000000FF0000003000000000
FF0000007800000000FF800000F800000000FF800001FC00000000FFC0000FFF00000003
FFE000FFFFE000007FFFFFC0FFFFE000007FFFFFC0FFFFE000007FFFFFC042477DC649>
65 D<3FFFFFFFFFFFFFF83FFFFFFFFFFFFFF83FFFFFFFFFFFFFF83FF0001FF8001FF83F
80000FF00003F83E00000FF00000F87C00000FF000007C7800000FF000003C7800000FF0
00003C7000000FF000001C7000000FF000001C7000000FF000001C6000000FF000000C60
00000FF000000C6000000FF000000C6000000FF000000C6000000FF000000CC000000FF0
000006C000000FF0000006C000000FF0000006C000000FF0000006C000000FF000000600
00000FF00000000000000FF00000000000000FF00000000000000FF00000000000000FF0
0000000000000FF00000000000000FF00000000000000FF00000000000000FF000000000
00000FF00000000000000FF00000000000000FF00000000000000FF00000000000000FF0
0000000000000FF00000000000000FF00000000000000FF00000000000000FF000000000
00000FF00000000000000FF00000000000000FF00000000000000FF00000000000000FF0
0000000000000FF00000000000000FF00000000000000FF00000000000000FF000000000
00000FF00000000000000FF00000000000000FF00000000000000FF00000000000000FF0
0000000000000FF00000000000000FF00000000000000FF00000000000000FF000000000
00000FF00000000000000FF00000000000000FF00000000000000FF00000000000000FF0
0000000000001FF80000000000007FFE0000000001FFFFFFFF80000001FFFFFFFF800000
01FFFFFFFF80003F447DC346>84 D E
%EndDVIPSBitmapFont
end
%%EndProlog
%%BeginSetup
%%Feature: *Resolution 600dpi
TeXDict begin
%%BeginPaperSize: a4
/setpagedevice where
{ pop << /PageSize [595 842] >> setpagedevice }
{ /a4 where { pop a4 } if }
ifelse
%%EndPaperSize
 end
%%EndSetup
%%Page: 1 1
TeXDict begin 1 0 bop 404 573 a Fb(T)33 b Fa(C)1852 5637
y Fb(1)p eop end
%%Page: 2 2
TeXDict begin 2 1 bop 404 573 a Fb(A)1852 5637 y(2)p
eop end
%%Trailer

userdict /end-hook known{end-hook}if
%%EOF

为了完整起见,这是我的definefont代码。我坚持认为密钥是一个名字是错误的吗?

/definefont { % /fontname -dict-
    dup type /dicttype ne
    2 index type /nametype ne or {
        /definefont cvx /typecheck signalerror
    } if
    {   
        dup /FontType known not {stop} if
        dup /FontMatrix known not {stop} if
        dup /Encoding known not {stop} if
        dup /BuildChar known not {stop} if
    } stopped {
        /definefont cvx /invalidfont signalerror
    } if
    dup /FontName known not {
        dup /FontName 3 index put 
    } if
    FontDirectory exch 2 index exch put 
    findfont
} def 

奖励绕口令和问题:为什么手动设置/manualfeed而不是拨打setmanualfeed

1 个答案:

答案 0 :(得分:2)

技术上,键不必是名称对象。

他们通常但他们并非必须如此。例如,可能有理由将整数用作字典中的键。所以我不得不说,从技术上讲,你坚持认为密钥是名称对象是不正确的。

请参阅第三版PLRM的第3.3.9节“字典对象”第41页,其中包含:

  

键通常是名称对象。 PostScript语法和   解释器针对这种最常见的情况进行了优化。但是,一把钥匙   可以是除null之外的任何PostScript对象(稍后定义)。

我并不是说在这种情况下它是明智的,请注意你,或者甚至可能是故意的。使用自身作为键来引用字典并不是很聪明。

至于为什么设置manualfeed,你会看到它在statusdict中设置它,所以这是一个旧的1级实现(2级及以上将使用setpagedevice)。供应商没有很好地指定或一致地实现1级中的设备控制,因此您可以在旧式代码中看到许多这样的变体。

我猜可能很久以前dvips重写了2级: - )