2016-11-17 45 views
1

我的後記解釋器在運行由dvips生成的以下程序時在definefont中出現typecheck錯誤。在我看來,這兩個重要的過程是/D/E,它們似乎是:將hexstring解碼爲更方便的格式,並分別安裝字體。dvips試圖對這種字體做什麼?

現在在哪兒都xpost,我感到困惑的部分是在'/ E':

/E{pop nn A 
definefont setfont} 

其中nn是字體字典準備安裝,但A被定義爲:

/A{dup} 

dup?現在我很困惑。 PLRM描述definefont作爲

關鍵字體definefont字體
關鍵的CIDFontdefinefont的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

對於一個更具可讀性的序幕,看到https://www.tug.org/svn/texlive/trunk/建立/源極/ texk/dvipsk/tex.lpro?修訂= 18107&視圖=標記。不幸的是,沒有關於'/ A'的評論。 – lhf

+0

謝謝,這有助於我的下一個問題:'CharBuilder'中的'save ... restore'放棄了'setcachedevice'存儲的dx dy數據。乙酰膽鹼! –

回答

2

技術上的鍵不一定是名稱對象。

他們通常是但他們不一定非要。例如,可以有理由在數字字典中使用整數作爲鍵。所以我不得不說,從技術上講,你堅持把關鍵作爲名稱對象是不正確的。

參見3.3.9節字典對象第三版PLRM,它說的41頁:

密鑰通常命名對象。 PostScript語法和 解釋器針對這種最常見的情況進行了優化。但是,鍵 可以是任何除null之外的PostScript對象(稍後定義)。

我不是說在這種情況下它的合理性會引起你的注意,甚至可能是故意的。將字典引用爲關鍵字並不是很聰明。

至於爲什麼設置manualfeed,你會看到它設置爲statusdict,所以這是一箇舊的1級實現(2級及以上將使用setpagedevice)。第一級中的設備控制沒有得到很好的規定,或者供應商始終如一地執行,所以你會在老式代碼中看到很多像這樣的變體。

我猜它可能是早就過一次dvips不得不重寫到2級:-)

+0

謝謝。我將測試從'/ nametype ne'改爲'/ nulltype eq'。對下一個錯誤...! –