From: <md...@us...> - 2008-10-22 17:29:49
|
Revision: 6295 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6295&view=rev Author: mdboom Date: 2008-10-22 17:29:41 +0000 (Wed, 22 Oct 2008) Log Message: ----------- Fix alignment of Unicode strings in PS backend. Thanks, Stan West. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008-10-22 15:27:24 UTC (rev 6294) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008-10-22 17:29:41 UTC (rev 6295) @@ -669,7 +669,8 @@ fontsize = prop.get_size_in_points() scale = 0.001*fontsize - thisx, thisy = 0, 0 + thisx = 0 + thisy = font.get_str_bbox_and_descent(s)[4] * scale last_name = None lines = [] for c in s: @@ -705,16 +706,18 @@ else: font = self._get_font_ttf(prop) + font.set_text(s, 0, flags=LOAD_NO_HINTING) + self.track_characters(font, s) self.set_color(*gc.get_rgb()) self.set_font(font.get_sfnt()[(1,0,0,6)], prop.get_size_in_points()) - self.track_characters(font, s) cmap = font.get_charmap() lastgind = None #print 'text', s lines = [] - thisx, thisy = 0,0 + thisx = 0 + thisy = font.get_descent() / 64.0 for c in s: ccode = ord(c) gind = cmap.get(ccode) @@ -739,11 +742,11 @@ thetext = '\n'.join(lines) ps = """gsave - %(x)f %(y)f translate - %(angle)f rotate - %(thetext)s - grestore - """ % locals() +%(x)f %(y)f translate +%(angle)f rotate +%(thetext)s +grestore +""" % locals() self._pswriter.write(ps) def draw_mathtext(self, gc, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |