@@ -447,7 +447,7 @@ def _write_svgfonts(self):
447447 glyph = font .load_char (char , flags = LOAD_NO_HINTING )
448448 verts , codes = font .get_path ()
449449 path = Path (verts , codes )
450- path_data = self ._convert_path (path , None )
450+ path_data = self ._convert_path (path )
451451 # name = font.get_glyph_name(char)
452452 writer .element (
453453 'glyph' ,
@@ -479,7 +479,7 @@ def option_image_nocomposite(self):
479479 """
480480 return rcParams ['svg.image_noscale' ]
481481
482- def _convert_path (self , path , transform , clip = None , simplify = None ):
482+ def _convert_path (self , path , transform = None , clip = None , simplify = None ):
483483 if clip :
484484 clip = (0.0 , 0.0 , self .width , self .height )
485485 else :
@@ -798,24 +798,23 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath):
798798 y -= ((font .get_descent () / 64.0 ) *
799799 (prop .get_size_in_points () / text2path .FONT_SCALE ))
800800
801- _flip = Affine2D ().scale (1.0 , - 1.0 )
802-
803801 if glyph_map_new :
804802 writer .start ('defs' )
805803 for char_id , glyph_path in glyph_map_new .iteritems ():
806804 path = Path (* glyph_path )
807- path_data = self ._convert_path (path , _flip , simplify = False )
805+ path_data = self ._convert_path (path , simplify = False )
808806 writer .element ('path' , id = char_id , d = path_data )
809807 writer .end ('defs' )
810808
811809 glyph_map .update (glyph_map_new )
812810
813811 attrib = {}
814812 attrib ['style' ] = generate_css (style )
813+ font_scale = fontsize / text2path .FONT_SCALE
815814 attrib ['transform' ] = generate_transform ([
816815 ('translate' , (x , y )),
817816 ('rotate' , (- angle ,)),
818- ('scale' , (fontsize / text2path . FONT_SCALE , ))])
817+ ('scale' , (font_scale , - font_scale ))])
819818
820819 writer .start ('g' , attrib = attrib )
821820 for glyph_id , xposition , yposition , scale in glyph_info :
@@ -851,19 +850,19 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath):
851850 path_data = ""
852851 else :
853852 path = Path (* glyph_path )
854- path_data = self ._convert_path (path , None , simplify = False )
853+ path_data = self ._convert_path (path , simplify = False )
855854 writer .element ('path' , id = char_id , d = path_data )
856855 writer .end ('defs' )
857856
858857 glyph_map .update (glyph_map_new )
859858
860859 attrib = {}
860+ font_scale = fontsize / text2path .FONT_SCALE
861861 attrib ['style' ] = generate_css (style )
862862 attrib ['transform' ] = generate_transform ([
863863 ('translate' , (x , y )),
864864 ('rotate' , (- angle ,)),
865- ('scale' , (fontsize / text2path .FONT_SCALE ,
866- - fontsize / text2path .FONT_SCALE ))])
865+ ('scale' , (font_scale , - font_scale ))])
867866
868867 writer .start ('g' , attrib = attrib )
869868 for char_id , xposition , yposition , scale in glyph_info :
@@ -879,7 +878,7 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath):
879878
880879 for verts , codes in rects :
881880 path = Path (verts , codes )
882- path_data = self ._convert_path (path , None , simplify = False )
881+ path_data = self ._convert_path (path , simplify = False )
883882 writer .element ('path' , d = path_data )
884883
885884 writer .end ('g' )
0 commit comments