File tree 1 file changed +8
-4
lines changed 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -315,19 +315,23 @@ def MathtextBackendAgg():
315
315
class MathtextBackendPs (MathtextBackend ):
316
316
def __init__ (self ):
317
317
self .pswriter = StringIO ()
318
+ self .lastfont = None
318
319
319
320
def render_glyph (self , ox , oy , info ):
320
321
oy = self .height - oy + info .offset
321
322
postscript_name = info .postscript_name
322
323
fontsize = info .fontsize
323
324
symbol_name = info .symbol_name
324
325
325
- # TODO: Optimize out the font changes
326
-
327
- ps = """/%(postscript_name)s findfont
326
+ if (postscript_name , fontsize ) != self .lastfont :
327
+ ps = """/%(postscript_name)s findfont
328
328
%(fontsize)s scalefont
329
329
setfont
330
- %(ox)f %(oy)f moveto
330
+ """ % locals ()
331
+ self .lastfont = postscript_name , fontsize
332
+ self .pswriter .write (ps )
333
+
334
+ ps = """%(ox)f %(oy)f moveto
331
335
/%(symbol_name)s glyphshow\n
332
336
""" % locals ()
333
337
self .pswriter .write (ps )
You can’t perform that action at this time.
0 commit comments