Revision: 3706
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3706&view=rev
Author:   mdboom
Date:     2007-08-13 08:19:11 -0700 (Mon, 13 Aug 2007)

Log Message:
-----------
Make horizontal line drawing more consistent across all backends.
Fix but in ft2font glyph rendering for glyphs with a left offset.

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/mathtext.py
    trunk/matplotlib/src/ft2font.cpp

Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-13 14:32:15 UTC (rev 
3705)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-13 15:19:11 UTC (rev 
3706)
@@ -253,9 +253,7 @@
 
     def render_rect_filled(self, x1, y1, x2, y2):
         font = self.fonts_object.get_fonts()[0]
-        font.draw_rect_filled(
-            int(x1 + 0.5), int(y1 + 0.5) - 1,
-            int(x2 - 0.5), int(y2 - 0.5) - 1)
+        font.draw_rect_filled(x1, y1, x2, y2 - 1)
 
     def get_results(self):
         return (self.width,
@@ -329,7 +327,7 @@
 
     def render_rect_filled(self, x1, y1, x2, y2):
         self.svg_rects.append(
-            (x1, self.height - y2, x2 - x1, y2 - y1))
+            (x1, self.height - y1 + 1, x2 - x1, y2 - y1))
 
     def get_results(self):
         svg_elements = Bunch(svg_glyphs = self.svg_glyphs,
@@ -559,8 +557,7 @@
 
     def get_underline_thickness(self, font, fontsize, dpi):
         cached_font = self._get_font(font)
-        cached_font.font.set_size(fontsize, dpi)
-        return max(1.0, cached_font.font.underline_thickness / 64.0)
+        return max(1.0, cached_font.font.underline_thickness / 64.0 / fontsize 
* 10.0)
 
     def get_kern(self, font1, sym1, fontsize1,
                  font2, sym2, fontsize2, dpi):
@@ -1102,10 +1099,18 @@
         self.height = metrics.ymax - metrics.ymin
         self.depth = 0
 
+    def shrink(self):
+        Char.shrink(self)
+        self._update_metrics()
+        
+    def grow(self):
+        Char.grow(self)
+        self._update_metrics()
+        
     def render(self, x, y):
         """Render the character to the canvas"""
         self.font_output.render_glyph(
-            x, y + (self._metrics.ymax - self.height),
+            x - self._metrics.xmin, y + self._metrics.ymin,
             self.font, self.c, self.fontsize, self.dpi)
         
 class List(Box):
@@ -2264,8 +2269,8 @@
         metrics = state.font_output.get_metrics(
             state.font, '=', state.fontsize, state.dpi)
         shift = (cden.height -
-                 (metrics.ymax + metrics.ymin) / 2 +
-                 thickness * 2.5)
+                 ((metrics.ymax + metrics.ymin) / 2 -
+                  thickness * 3.0))
         vlist.shift_amount = shift
 
         hlist = Hlist([vlist, Hbox(thickness * 2.)])
@@ -2316,7 +2321,6 @@
                        # Negative kerning to put root over tick
                        Kern(-check.width * 0.5), 
                        check,                    # Check
-                       Kern(-thickness * 0.3),   # Push check into rule 
slightly
                        rightside])               # Body
         return [hlist]
     

Modified: trunk/matplotlib/src/ft2font.cpp
===================================================================
--- trunk/matplotlib/src/ft2font.cpp    2007-08-13 14:32:15 UTC (rev 3705)
+++ trunk/matplotlib/src/ft2font.cpp    2007-08-13 15:19:11 UTC (rev 3706)
@@ -1219,7 +1219,7 @@
 
   FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyphs[glyph->glyphInd];
 
-  draw_bitmap( &bitmap->bitmap, x, y);
+  draw_bitmap( &bitmap->bitmap, x + bitmap->left, y);
   return Py::Object();
 }
 


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

Reply via email to