我有一个用纯 TeX 编写的文档,我使用 dvips 和 ps2pdf 将其生成 PDF 文件。假设该文档的 A 版本如下所示。
\input epsf
\newbox\fb \newbox\cb
\setbox\fb\hbox{\epsfxsize=0pt \epsfysize=0pt \epsfbox{test.eps}}%
%\setbox\cb\hbox{foo bar baz quux foo bar baz quux foo bar baz quux
%foo bar baz quux foo bar baz quux foo bar baz quux}%
\topinsert \ifvoid\cb \else$$\hbox{\hsize=\the\wd\fb
\vbox{\noindent{\bf Figure}:\enspace \unhbox\cb}}$$\fi
$$\box\fb$$\endinsert
\bye
让文档的 B 版本与 A 版本的区别只在于取消注释以下行
%\setbox\cb\hbox{foo bar baz quux foo bar baz quux foo bar baz quux
%foo bar baz quux foo bar baz quux foo bar baz quux}%
当我生成文档的 B 版本时,出现了意想不到的副作用:图形中的字体发生了变化!为什么?
这是 A 版 PDF 文件的图像。
这是 B 版 PDF 文件的图像。
我正在使用 kerTeX (http://www.kergis.com/en/kertex.html)。
以下是@ShreevatsaR 要求的“test.eps”的内容。
%!PS-Adobe-3.0
%%DocumentNeededResources: font CMR10
%%+ font CMBX10
%%+ font CMSL10
%%+ font CMBXSL10
%%+ font CMSY10 CMBSY10 CMMI10
%%DocumentMedia: letter 612 792 0 () ()
%%Title: R Graphics Output
%%Creator: R Software
%%Pages: (atend)
%%Orientation: Portrait
%%BoundingBox: 90 252 522 540
%%EndComments
%%BeginProlog
/bp { gs sRGB gs } def
% begin .ps.prolog
/gs { gsave } bind def
/gr { grestore } bind def
/ep { showpage gr gr } bind def
/m { moveto } bind def
/l { rlineto } bind def
/np { newpath } bind def
/cp { closepath } bind def
/f { fill } bind def
/o { stroke } bind def
/c { newpath 0 360 arc } bind def
/r { 4 2 roll moveto 1 copy 3 -1 roll exch 0 exch rlineto 0 rlineto -1 mul 0 exch rlineto closepath } bind def
/p1 { stroke } bind def
/p2 { gsave bg fill grestore newpath } bind def
/p3 { gsave bg fill grestore stroke } bind def
/p6 { gsave bg eofill grestore newpath } bind def
/p7 { gsave bg eofill grestore stroke } bind def
/t { 5 -2 roll moveto gsave rotate
1 index stringwidth pop
mul neg 0 rmoveto show grestore } bind def
/ta { 4 -2 roll moveto gsave rotate show } bind def
/tb { 2 -1 roll 0 rmoveto show } bind def
/cl { grestore gsave newpath 3 index 3 index moveto 1 index
4 -1 roll lineto exch 1 index lineto lineto
closepath clip newpath } bind def
/rgb { setrgbcolor } bind def
/s { scalefont setfont } bind def
% end .ps.prolog
/sRGB { [ /CIEBasedABC
<< /DecodeLMN
[ { dup 0.03928 le
{12.92321 div}
{0.055 add 1.055 div 2.4 exp }
ifelse
} bind dup dup
]
/MatrixLMN [0.412457 0.212673 0.019334
0.357576 0.715152 0.119192
0.180437 0.072175 0.950301]
/WhitePoint [0.9505 1.0 1.0890]
>>
] setcolorspace } bind def
/srgb { setcolor } bind def
% begin encoding
/TeXtextEncoding [
/minus /Delta /Theta /Lambda /Xi /Pi /Sigma /Upsilon
/Phi /Psi /Omega /ff /fi /fl /ffi /ffl
/dotlessi /dotlessj /grave /acute /caron /breve /macron /ring
/cedilla /germandbls /ae /oe /oslash /AE /OE /Oslash
/space /exclam /quotedblright /numbersign /dollar /percent /ampersand /quoteright
/parenleft /parenright /asterisk /plus /comma /minus /period /slash
/zero /one /two /three /four /five /six /seven
/eight /nine /colon /semicolon /exclamdown /equal /questiondown /question
/at /A /B /C /D /E /F /G
/H /I /J /K /L /M /N /O
/P /Q /R /S /T /U /V /W
/X /Y /Z /bracketleft /quotedblleft /bracketright /circumflex /dotaccent
/quoteleft /a /b /c /d /e /f /g
/h /i /j /k /l /m /n /o
/p /q /r /s /t /u /v /w
/x /y /z /endash /emdash /hungarumlaut /tilde /dieresis
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
]
def
% end encoding
% begin encoding
/SymbolEncoding [
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/space /exclam /universal /numbersign /existential /percent /ampersand /suchthat
/parenleft /parenright /asteriskmath /plus /comma /minus /period /slash
/zero /one /two /three /four /five /six /seven
/eight /nine /colon /semicolon /less /equal /greater /question
/congruent /Alpha /Beta /Chi /Delta /Epsilon /Phi /Gamma
/Eta /Iota /theta1 /Kappa /Lambda /Mu /Nu /Omicron
/Pi /Theta /Rho /Sigma /Tau /Upsilon /sigma1 /Omega
/Xi /Psi /Zeta /bracketleft /therefore /bracketright /perpendicular /underscore
/radicalex /alpha /beta /chi /delta /epsilon /phi /gamma
/eta /iota /phi1 /kappa /lambda /mu /nu /omicron
/pi /theta /rho /sigma /tau /upsilon /omega1 /omega
/xi /psi /zeta /braceleft /bar /braceright /similar /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/Euro /Upsilon1 /minute /lessequal /fraction /infinity /florin /club
/diamond /heart /spade /arrowboth /arrowleft /arrowup /arrowright /arrowdown
/degree /plusminus /second /greaterequal /multiply /proportional /partialdiff /bullet
/divide /notequal /equivalence /approxequal /ellipsis /arrowvertex /arrowhorizex /carriagereturn
/aleph /Ifraktur /Rfraktur /weierstrass /circlemultiply /circleplus /emptyset /intersection
/union /propersuperset /reflexsuperset /notsubset /propersubset /reflexsubset /element /notelement
/angle /gradient /registerserif /copyrightserif /trademarkserif /product /radical /dotmath
/logicalnot /logicaland /logicalor /arrowdblboth /arrowdblleft /arrowdblup /arrowdblright /arrowdbldown
/lozenge /angleleft /registersans /copyrightsans /trademarksans /summation /parenlefttp /parenleftex
/parenleftbt /bracketlefttp /bracketleftex /bracketleftbt /bracelefttp /braceleftmid /braceleftbt /braceex
/.notdef /angleright /integral /integraltp /integralex /integralbt /parenrighttp /parenrightex
/parenrightbt /bracketrighttp /bracketrightex /bracketrightbt /bracerighttp /bracerightmid /bracerightbt /.notdef
] def
% end encoding
/mergefonts
{ /targetencoding exch def
/fontarray exch def
fontarray 0 get dup maxlength dict begin
{ 1 index /FID ne { def } { pop pop } ifelse } forall
% Create a new dictionary
/CharStrings 256 dict def
% Add a definition of .notdef
fontarray
{ /CharStrings get dup /.notdef known
{ /.notdef get /result exch def exit }
{ pop } ifelse
} forall
CharStrings /.notdef result put
% Add in the other definitions
targetencoding
{ /code exch def
% Check that it is not a .notdef
code /.notdef eq
{ /.notdef }
{ fontarray
{ /CharStrings get dup code known
{ code get /result exch def /found true def exit }
{ pop /found false def } ifelse
} forall
% define character if it was found and accumulate encoding
found { CharStrings code result put code } { /.notdef } ifelse
} ifelse
} forall
% grab new encoding off of stack
256 array astore /Encoding exch def
% Undefine some local variables
currentdict /fontarray undef
currentdict /targetencoding undef
currentdict /code undef
currentdict /result undef
currentdict /found undef
% Leave new font on the stack
currentdict
end
} def
%%IncludeResource: font CMR10
%%IncludeResource: font CMSY10
[ /CMR10 findfont /CMSY10 findfont ] TeXtextEncoding mergefonts
/Font1 exch definefont pop
%%IncludeResource: font CMBX10
%%IncludeResource: font CMBSY10
[ /CMBX10 findfont /CMBSY10 findfont ] TeXtextEncoding mergefonts
/Font2 exch definefont pop
%%IncludeResource: font CMSL10
[ /CMSL10 findfont /CMSY10 findfont ] TeXtextEncoding mergefonts
/Font3 exch definefont pop
%%IncludeResource: font CMBXSL10
[ /CMBXSL10 findfont /CMBSY10 findfont ] TeXtextEncoding mergefonts
/Font4 exch definefont pop
%%IncludeResource: font CMMI10
[ /CMR10 findfont /CMSY10 findfont /CMMI10 findfont ] SymbolEncoding mergefonts
/Font5 exch definefont pop
%%EndProlog
%%Page: 1 1
bp
90.00 252.00 522.00 540.00 cl
/Font1 findfont 10 s
0 0 0 srgb
289.44 255.60 (normal quan) 0 ta
-0.270 (tile) tb gr
100.80 385.70 (sample quan) 90 ta
-0.270 (tile) tb gr
139.20 301.20 508.80 538.80 cl
/Font1 findfont 10 s
0 0 0 srgb
152.89 306.42 (A) .5 0 t
308.33 442.25 (B) .5 0 t
324.00 442.25 (C) .5 0 t
495.11 526.59 (D) .5 0 t
414.26 519.09 (AB) .5 0 t
348.43 460.53 (A) 0 ta
-0.270 (C) tb gr
292.21 434.92 (BC) .5 0 t
233.74 398.09 (AD) .5 0 t
275.07 431.25 (BD) .5 0 t
372.93 475.25 (CD) .5 0 t
204.43 365.20 (ABC) .5 0 t
443.57 522.75 (ABD) .5 0 t
328.49 449.53 (A) 0 ta
-0.270 (CD) tb gr
256.08 423.92 (BCD) .5 0 t
391.92 500.86 (ABCD) .5 0 t
90.00 252.00 522.00 540.00 cl
/Font1 findfont 10 s
0 0 0 srgb
230.70 279.60 (-1) .5 0 t
324.00 279.60 (0) .5 0 t
417.30 279.60 (1) .5 0 t
124.80 310.00 (-10) .5 90 t
124.80 383.33 (-5) .5 90 t
124.80 456.67 (0) .5 90 t
124.80 530.00 (5) .5 90 t
139.20 301.20 508.80 538.80 cl
0 0 0 srgb
0.75 setlinewidth
[] 0 setdash
1 setlinecap
1 setlinejoin
10.00 setmiterlimit
np
139.20 372.42 m
348.63 167.58 l
o
ep
%%Trailer
%%Pages: 1
%%EOF
答案1
请注意,该文件可能带有.eps
扩展名,但它不是 EPS 文件。标题是
%!PS-Adobe-3.0
但它应该是
%!PS-Adobe-3.0 EPSF-3.0
EPS 文件是受限制的PostScript 版本保证了一定程度的“封装”,这基本上意味着您描述的问题不会发生,并且文件可以包含在不同的文档中并具有相同的外观,并且不会影响文档的其余部分。
大多数 tex“eps”包含机制实际上并不检查文件是否满足 EPS 文件的所有要求,并且将包含任意 PostScript 内容。通常,只要文件满足或几乎满足 EPS 的要求,它就会起作用,但在这里你不会那么幸运,包含的文件具有外部字体依赖性。
如果您仍然可以访问该 postscript 文件的源,最简单的方法就是将其重新保存为 EPS 格式。