Revision: 4441
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4441&view=rev
Author:   mdboom
Date:     2007-11-26 07:31:54 -0800 (Mon, 26 Nov 2007)

Log Message:
-----------
Fix colored text in SVG backend.

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/backends/backend_svg.py

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py     2007-11-26 
15:30:12 UTC (rev 4440)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py     2007-11-26 
15:31:54 UTC (rev 4441)
@@ -246,14 +246,11 @@
         font.set_text(s, 0.0, flags=LOAD_NO_HINTING)
         y -= font.get_descent() / 64.0
         
-        thetext = escape_xml_text(s)
-        fontfamily = font.family_name
-        fontstyle = prop.get_style()
         fontsize = prop.get_size_in_points()
         color = rgb2hex(gc.get_rgb())
 
         if rcParams['svg.embed_char_paths']:
-            svg = ['<g transform="']
+            svg = ['<g style="fill: %s" transform="' % color]
             if angle != 0:
                 svg.append('translate(%s,%s)rotate(%1.1f)' % (x,y,-angle))
             elif x != 0 or y != 0:
@@ -288,6 +285,10 @@
             svg.append('</g>\n')
             svg = ''.join(svg)
         else:
+            thetext = escape_xml_text(s)
+            fontfamily = font.family_name
+            fontstyle = prop.get_style()
+
             style = 'font-size: %f; font-family: %s; font-style: %s; fill: 
%s;'%(fontsize, fontfamily,fontstyle, color)
             if angle!=0:
                 transform = 'transform="translate(%s,%s) rotate(%1.1f) 
translate(%s,%s)"' % (x,y,-angle,-x,-y)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to