@@ -645,7 +645,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
645
645
if mpl .rcParams ['ps.useafm' ]:
646
646
font = self ._get_font_afm (prop )
647
647
scale = 0.001 * prop .get_size_in_points ()
648
-
648
+ stream = []
649
649
thisx = 0
650
650
last_name = None # kerns returns 0 for None.
651
651
xs_names = []
@@ -661,6 +661,9 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
661
661
thisx += kern * scale
662
662
xs_names .append ((thisx , name ))
663
663
thisx += width * scale
664
+ ps_name = (font .postscript_name
665
+ .encode ("ascii" , "replace" ).decode ("ascii" ))
666
+ stream .append ((ps_name , xs_names ))
664
667
665
668
else :
666
669
font = self ._get_font_ttf (prop )
@@ -680,11 +683,11 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
680
683
# append the last entry
681
684
stream .append (curr_stream )
682
685
683
- for ps_name , xs_names in stream :
684
- self .set_font (ps_name , prop .get_size_in_points (), False )
685
- thetext = "\n " .join (f"{ x :f} 0 m /{ name :s} glyphshow"
686
- for x , name in xs_names )
687
- self ._pswriter .write (f"""\
686
+ for ps_name , xs_names in stream :
687
+ self .set_font (ps_name , prop .get_size_in_points (), False )
688
+ thetext = "\n " .join (f"{ x :f} 0 m /{ name :s} glyphshow"
689
+ for x , name in xs_names )
690
+ self ._pswriter .write (f"""\
688
691
gsave
689
692
{ self ._get_clip_cmd (gc )}
690
693
{ x :f} { y :f} translate
0 commit comments