@@ -447,7 +447,7 @@ def _write_svgfonts(self):
447
447
glyph = font .load_char (char , flags = LOAD_NO_HINTING )
448
448
verts , codes = font .get_path ()
449
449
path = Path (verts , codes )
450
- path_data = self ._convert_path (path , None )
450
+ path_data = self ._convert_path (path )
451
451
# name = font.get_glyph_name(char)
452
452
writer .element (
453
453
'glyph' ,
@@ -479,7 +479,7 @@ def option_image_nocomposite(self):
479
479
"""
480
480
return rcParams ['svg.image_noscale' ]
481
481
482
- def _convert_path (self , path , transform , clip = None , simplify = None ):
482
+ def _convert_path (self , path , transform = None , clip = None , simplify = None ):
483
483
if clip :
484
484
clip = (0.0 , 0.0 , self .width , self .height )
485
485
else :
@@ -798,24 +798,23 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath):
798
798
y -= ((font .get_descent () / 64.0 ) *
799
799
(prop .get_size_in_points () / text2path .FONT_SCALE ))
800
800
801
- _flip = Affine2D ().scale (1.0 , - 1.0 )
802
-
803
801
if glyph_map_new :
804
802
writer .start ('defs' )
805
803
for char_id , glyph_path in glyph_map_new .iteritems ():
806
804
path = Path (* glyph_path )
807
- path_data = self ._convert_path (path , _flip , simplify = False )
805
+ path_data = self ._convert_path (path , simplify = False )
808
806
writer .element ('path' , id = char_id , d = path_data )
809
807
writer .end ('defs' )
810
808
811
809
glyph_map .update (glyph_map_new )
812
810
813
811
attrib = {}
814
812
attrib ['style' ] = generate_css (style )
813
+ font_scale = fontsize / text2path .FONT_SCALE
815
814
attrib ['transform' ] = generate_transform ([
816
815
('translate' , (x , y )),
817
816
('rotate' , (- angle ,)),
818
- ('scale' , (fontsize / text2path . FONT_SCALE , ))])
817
+ ('scale' , (font_scale , - font_scale ))])
819
818
820
819
writer .start ('g' , attrib = attrib )
821
820
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):
851
850
path_data = ""
852
851
else :
853
852
path = Path (* glyph_path )
854
- path_data = self ._convert_path (path , None , simplify = False )
853
+ path_data = self ._convert_path (path , simplify = False )
855
854
writer .element ('path' , id = char_id , d = path_data )
856
855
writer .end ('defs' )
857
856
858
857
glyph_map .update (glyph_map_new )
859
858
860
859
attrib = {}
860
+ font_scale = fontsize / text2path .FONT_SCALE
861
861
attrib ['style' ] = generate_css (style )
862
862
attrib ['transform' ] = generate_transform ([
863
863
('translate' , (x , y )),
864
864
('rotate' , (- angle ,)),
865
- ('scale' , (fontsize / text2path .FONT_SCALE ,
866
- - fontsize / text2path .FONT_SCALE ))])
865
+ ('scale' , (font_scale , - font_scale ))])
867
866
868
867
writer .start ('g' , attrib = attrib )
869
868
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):
879
878
880
879
for verts , codes in rects :
881
880
path = Path (verts , codes )
882
- path_data = self ._convert_path (path , None , simplify = False )
881
+ path_data = self ._convert_path (path , simplify = False )
883
882
writer .element ('path' , d = path_data )
884
883
885
884
writer .end ('g' )
0 commit comments