Revision: 3675 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3675&view=rev Author: mdboom Date: 2007-08-06 11:50:00 -0700 (Mon, 06 Aug 2007)
Log Message: ----------- Fix bug when rendering special XML characters (such as < > &) in SVG 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-08-06 18:49:19 UTC (rev 3674) +++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-08-06 18:50:00 UTC (rev 3675) @@ -11,6 +11,8 @@ from matplotlib.ft2font import FT2Font, KERNING_UNFITTED, KERNING_DEFAULT, KERNING_UNSCALED from matplotlib.mathtext import math_parse_s_ft2font_svg +from xml.sax.saxutils import escape as escape_xml_text + backend_version = __version__ def new_figure_manager(num, *args, **kwargs): @@ -239,7 +241,7 @@ font = self._get_font(prop) - thetext = '%s' % s + thetext = escape_xml_text(s) fontfamily = font.family_name fontstyle = font.style_name fontsize = prop.get_size_in_points() @@ -369,10 +371,7 @@ curr_x,curr_y = 0.0,0.0 for font, fontsize, thetext, new_x, new_y_mtc, metrics in svg_glyphs: - if rcParams["mathtext.mathtext2"]: - new_y = new_y_mtc - height - else: - new_y = - new_y_mtc + new_y = - new_y_mtc svg.append('<tspan style="font-size: %f; font-family: %s"' % (fontsize, font.family_name)) @@ -387,6 +386,8 @@ if dy != 0.0: svg.append(' dy="%f"' % dy) + thetext = escape_xml_text(thetext) + svg.append('>%s</tspan>\n' % thetext) curr_x = new_x + xadvance 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: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins