@@ -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
@@ -1356,36 +1356,39 @@ def pstoeps(tmpfile, bbox=None, rotated=False):
13561356# The usage comments use the notation of the operator summary
13571357# in the PostScript Language reference manual.
13581358psDefs = [
1359- # name proc *d* -
1360- "/d { bind def } bind def" ,
1359+ # name proc *_d* -
1360+ # Note that this cannot be bound to /d, because when embedding a Type3 font
1361+ # we may want to define a "d" glyph using "/d{...} d" which would locally
1362+ # overwrite the definition.
1363+ "/_d { bind def } bind def" ,
13611364 # x y *m* -
1362- "/m { moveto } d " ,
1365+ "/m { moveto } _d " ,
13631366 # x y *l* -
1364- "/l { lineto } d " ,
1367+ "/l { lineto } _d " ,
13651368 # x y *r* -
1366- "/r { rlineto } d " ,
1369+ "/r { rlineto } _d " ,
13671370 # x1 y1 x2 y2 x y *c* -
1368- "/c { curveto } d " ,
1371+ "/c { curveto } _d " ,
13691372 # *cl* -
1370- "/cl { closepath } d " ,
1373+ "/cl { closepath } _d " ,
13711374 # *ce* -
1372- "/ce { closepath eofill } d " ,
1375+ "/ce { closepath eofill } _d " ,
13731376 # w h x y *box* -
13741377 """/box {
13751378 m
13761379 1 index 0 r
13771380 0 exch r
13781381 neg 0 r
13791382 cl
1380- } d """ ,
1383+ } _d """ ,
13811384 # w h x y *clipbox* -
13821385 """/clipbox {
13831386 box
13841387 clip
13851388 newpath
1386- } d """ ,
1389+ } _d """ ,
13871390 # wx wy llx lly urx ury *setcachedevice* -
1388- "/sc { setcachedevice } d " ,
1391+ "/sc { setcachedevice } _d " ,
13891392]
13901393
13911394
0 commit comments