@@ -180,12 +180,12 @@ def _font_to_ps_type3(font_path, glyph_ids):
180180 2 copy known not {pop /.notdef} if
181181 true 3 1 roll get exec
182182 end
183- } d
183+ } _d
184184
185185/BuildChar {
186186 1 index /Encoding get exch get
187187 1 index /BuildGlyph get exec
188- } d
188+ } _d
189189
190190FontName currentdict end definefont pop
191191"""
@@ -208,7 +208,7 @@ def _font_to_ps_type3(font_path, glyph_ids):
208208 # decomposer always explicitly moving to the closing point
209209 # first).
210210 [b"m" , b"l" , b"" , b"c" , b"" ], True ).decode ("ascii" )
211- + "ce} d "
211+ + "ce} _d "
212212 )
213213
214214 return preamble + "\n " .join (entries ) + postamble
@@ -1338,36 +1338,39 @@ def pstoeps(tmpfile, bbox=None, rotated=False):
13381338# The usage comments use the notation of the operator summary
13391339# in the PostScript Language reference manual.
13401340psDefs = [
1341- # name proc *d* -
1342- "/d { bind def } bind def" ,
1341+ # name proc *_d* -
1342+ # Note that this cannot be bound to /d, because when embedding a Type3 font
1343+ # we may want to define a "d" glyph using "/d{...} d" which would locally
1344+ # overwrite the definition.
1345+ "/_d { bind def } bind def" ,
13431346 # x y *m* -
1344- "/m { moveto } d " ,
1347+ "/m { moveto } _d " ,
13451348 # x y *l* -
1346- "/l { lineto } d " ,
1349+ "/l { lineto } _d " ,
13471350 # x y *r* -
1348- "/r { rlineto } d " ,
1351+ "/r { rlineto } _d " ,
13491352 # x1 y1 x2 y2 x y *c* -
1350- "/c { curveto } d " ,
1353+ "/c { curveto } _d " ,
13511354 # *cl* -
1352- "/cl { closepath } d " ,
1355+ "/cl { closepath } _d " ,
13531356 # *ce* -
1354- "/ce { closepath eofill } d " ,
1357+ "/ce { closepath eofill } _d " ,
13551358 # w h x y *box* -
13561359 """/box {
13571360 m
13581361 1 index 0 r
13591362 0 exch r
13601363 neg 0 r
13611364 cl
1362- } d """ ,
1365+ } _d """ ,
13631366 # w h x y *clipbox* -
13641367 """/clipbox {
13651368 box
13661369 clip
13671370 newpath
1368- } d """ ,
1371+ } _d """ ,
13691372 # wx wy llx lly urx ury *setcachedevice* -
1370- "/sc { setcachedevice } d " ,
1373+ "/sc { setcachedevice } _d " ,
13711374]
13721375
13731376
0 commit comments