Revision: 4046
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4046&view=rev
Author:   mdboom
Date:     2007-10-29 07:30:51 -0700 (Mon, 29 Oct 2007)

Log Message:
-----------
Fixing bug in font rendering -- the patented freetype hinter appears
to be unable to deal with the non-square hinting grid hack.

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
    trunk/matplotlib/lib/matplotlib/mathtext.py

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py     2007-10-29 
13:40:42 UTC (rev 4045)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py     2007-10-29 
14:30:51 UTC (rev 4046)
@@ -82,7 +82,7 @@
 from matplotlib.cbook import enumerate, is_string_like, exception_to_str
 from matplotlib.figure import Figure
 from matplotlib.font_manager import findfont
-from matplotlib.ft2font import FT2Font, LOAD_DEFAULT
+from matplotlib.ft2font import FT2Font, LOAD_FORCE_AUTOHINT
 from matplotlib.mathtext import MathTextParser
 from matplotlib.transforms import lbwh_to_bbox
 
@@ -196,9 +196,9 @@
         font = self._get_agg_font(prop)
         if font is None: return None
         if len(s) == 1 and ord(s) > 127:
-            font.load_char(ord(s), flags=LOAD_DEFAULT)
+            font.load_char(ord(s), flags=LOAD_FORCE_AUTOHINT)
         else:
-            font.set_text(s, 0, flags=LOAD_DEFAULT)
+            font.set_text(s, 0, flags=LOAD_FORCE_AUTOHINT)
         font.draw_glyphs_to_bitmap()
 
         #print x, y, int(x), int(y)
@@ -231,7 +231,7 @@
                 self.mathtext_parser.parse(s, self.dpi.get(), prop)
             return width, height, descent
         font = self._get_agg_font(prop)
-        font.set_text(s, 0.0, flags=LOAD_DEFAULT)  # the width and height of 
unrotated string
+        font.set_text(s, 0.0, flags=LOAD_FORCE_AUTOHINT)  # the width and 
height of unrotated string
         w, h = font.get_width_height()
         d = font.get_descent()
         w /= 64.0  # convert from subpixels

Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-10-29 13:40:42 UTC (rev 
4045)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-10-29 14:30:51 UTC (rev 
4046)
@@ -143,7 +143,7 @@
 from matplotlib.afm import AFM
 from matplotlib.cbook import enumerate, iterable, Bunch, 
get_realpath_and_stat, \
     is_string_like
-from matplotlib.ft2font import FT2Font, FT2Image, KERNING_DEFAULT, 
LOAD_DEFAULT, LOAD_NO_HINTING
+from matplotlib.ft2font import FT2Font, FT2Image, KERNING_DEFAULT, 
LOAD_FORCE_AUTOHINT, LOAD_NO_HINTING
 from matplotlib.font_manager import findfont, FontProperties
 from matplotlib._mathtext_data import latex_to_bakoma, \
         latex_to_standard, tex2uni, type12uni, tex2type1, uni2type1, \
@@ -306,7 +306,7 @@
                 self.fonts_object.get_used_characters())
 
     def get_hinting_type(self):
-        return LOAD_DEFAULT
+        return LOAD_FORCE_AUTOHINT
 
 def MathtextBackendAgg():
     return MathtextBackendBbox(MathtextBackendAggRender())


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

Reply via email to