@@ -603,7 +603,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath):
603
603
if rcParams ['svg.embed_char_paths' ]:
604
604
new_chars = []
605
605
for c in s :
606
- path = self ._add_char_def (prop , c )
606
+ path = self ._add_char_def (prop , ord ( c ) )
607
607
if path is not None :
608
608
new_chars .append (path )
609
609
if len (new_chars ):
@@ -628,7 +628,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath):
628
628
lastgind = None
629
629
currx = 0
630
630
for c in s :
631
- charnum = self ._get_char_def_id (prop , c )
631
+ charnum = self ._get_char_def_id (prop , ord ( c ) )
632
632
ccode = ord (c )
633
633
gind = cmap .get (ccode )
634
634
if gind is None :
@@ -680,13 +680,13 @@ def _add_char_def(self, prop, char):
680
680
font = prop
681
681
font .set_size (self .FONT_SCALE , 72 )
682
682
ps_name = font .get_sfnt ()[(1 ,0 ,0 ,6 )]
683
- char_id = urllib .quote ('%s-%d' % (ps_name , ord ( char ) ))
683
+ char_id = urllib .quote ('%s-%d' % (ps_name , char ))
684
684
char_num = self ._char_defs .get (char_id , None )
685
685
if char_num is not None :
686
686
return None
687
687
688
688
path_data = []
689
- glyph = font .load_char (ord ( char ) , flags = LOAD_NO_HINTING )
689
+ glyph = font .load_char (char , flags = LOAD_NO_HINTING )
690
690
currx , curry = 0.0 , 0.0
691
691
for step in glyph .path :
692
692
if step [0 ] == 0 : # MOVE_TO
@@ -724,7 +724,7 @@ def _get_char_def_id(self, prop, char):
724
724
font = prop
725
725
font .set_size (self .FONT_SCALE , 72 )
726
726
ps_name = font .get_sfnt ()[(1 ,0 ,0 ,6 )]
727
- char_id = urllib .quote ('%s-%d' % (ps_name , ord ( char ) ))
727
+ char_id = urllib .quote ('%s-%d' % (ps_name , char ))
728
728
return self ._char_defs [char_id ]
729
729
730
730
def _draw_mathtext (self , gc , x , y , s , prop , angle ):
@@ -742,8 +742,8 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle):
742
742
743
743
if rcParams ['svg.embed_char_paths' ]:
744
744
new_chars = []
745
- for font , fontsize , thetext , new_x , new_y_mtc , metrics in svg_glyphs :
746
- path = self ._add_char_def (font , thetext )
745
+ for font , fontsize , char , new_x , new_y_mtc , metrics in svg_glyphs :
746
+ path = self ._add_char_def (font , char )
747
747
if path is not None :
748
748
new_chars .append (path )
749
749
if len (new_chars ):
@@ -760,8 +760,8 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle):
760
760
svg .append ('translate(%f,%f)' % (x , y ))
761
761
svg .append ('">\n ' )
762
762
763
- for font , fontsize , thetext , new_x , new_y_mtc , metrics in svg_glyphs :
764
- charid = self ._get_char_def_id (font , thetext )
763
+ for font , fontsize , char , new_x , new_y_mtc , metrics in svg_glyphs :
764
+ charid = self ._get_char_def_id (font , char )
765
765
766
766
svg .append ('<use xlink:href="#%s" transform="translate(%f,%f)scale(%f)"/>\n ' %
767
767
(charid , new_x , - new_y_mtc , fontsize / self .FONT_SCALE ))
0 commit comments