Revision: 3756
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3756&view=rev
Author: mdboom
Date: 2007-08-30 06:51:10 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Reduce Ps files sizes when using mathtext
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-30 13:41:52 UTC (rev
3755)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-30 13:51:10 UTC (rev
3756)
@@ -315,6 +315,7 @@
class MathtextBackendPs(MathtextBackend):
def __init__(self):
self.pswriter = StringIO()
+ self.lastfont = None
def render_glyph(self, ox, oy, info):
oy = self.height - oy + info.offset
@@ -322,12 +323,15 @@
fontsize = info.fontsize
symbol_name = info.symbol_name
- # TODO: Optimize out the font changes
-
- ps = """/%(postscript_name)s findfont
+ if (postscript_name, fontsize) != self.lastfont:
+ ps = """/%(postscript_name)s findfont
%(fontsize)s scalefont
setfont
-%(ox)f %(oy)f moveto
+""" % locals()
+ self.lastfont = postscript_name, fontsize
+ self.pswriter.write(ps)
+
+ ps = """%(ox)f %(oy)f moveto
/%(symbol_name)s glyphshow\n
""" % locals()
self.pswriter.write(ps)
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins