@@ -180,12 +180,12 @@ def _font_to_ps_type3(font_path, glyph_ids):
180
180
2 copy known not {pop /.notdef} if
181
181
true 3 1 roll get exec
182
182
end
183
- } d
183
+ } _d
184
184
185
185
/BuildChar {
186
186
1 index /Encoding get exch get
187
187
1 index /BuildGlyph get exec
188
- } d
188
+ } _d
189
189
190
190
FontName currentdict end definefont pop
191
191
"""
@@ -208,7 +208,7 @@ def _font_to_ps_type3(font_path, glyph_ids):
208
208
# decomposer always explicitly moving to the closing point
209
209
# first).
210
210
[b"m" , b"l" , b"" , b"c" , b"" ], True ).decode ("ascii" )
211
- + "ce} d "
211
+ + "ce} _d "
212
212
)
213
213
214
214
return preamble + "\n " .join (entries ) + postamble
@@ -1356,36 +1356,39 @@ def pstoeps(tmpfile, bbox=None, rotated=False):
1356
1356
# The usage comments use the notation of the operator summary
1357
1357
# in the PostScript Language reference manual.
1358
1358
psDefs = [
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" ,
1361
1364
# x y *m* -
1362
- "/m { moveto } d " ,
1365
+ "/m { moveto } _d " ,
1363
1366
# x y *l* -
1364
- "/l { lineto } d " ,
1367
+ "/l { lineto } _d " ,
1365
1368
# x y *r* -
1366
- "/r { rlineto } d " ,
1369
+ "/r { rlineto } _d " ,
1367
1370
# x1 y1 x2 y2 x y *c* -
1368
- "/c { curveto } d " ,
1371
+ "/c { curveto } _d " ,
1369
1372
# *cl* -
1370
- "/cl { closepath } d " ,
1373
+ "/cl { closepath } _d " ,
1371
1374
# *ce* -
1372
- "/ce { closepath eofill } d " ,
1375
+ "/ce { closepath eofill } _d " ,
1373
1376
# w h x y *box* -
1374
1377
"""/box {
1375
1378
m
1376
1379
1 index 0 r
1377
1380
0 exch r
1378
1381
neg 0 r
1379
1382
cl
1380
- } d """ ,
1383
+ } _d """ ,
1381
1384
# w h x y *clipbox* -
1382
1385
"""/clipbox {
1383
1386
box
1384
1387
clip
1385
1388
newpath
1386
- } d """ ,
1389
+ } _d """ ,
1387
1390
# wx wy llx lly urx ury *setcachedevice* -
1388
- "/sc { setcachedevice } d " ,
1391
+ "/sc { setcachedevice } _d " ,
1389
1392
]
1390
1393
1391
1394
0 commit comments