Revision: 6941
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6941&view=rev
Author:   mdboom
Date:     2009-02-27 13:30:13 +0000 (Fri, 27 Feb 2009)

Log Message:
-----------
Fix glyph alignment with STIX mathtext

Modified Paths:
--------------
    branches/v0_98_5_maint/src/ft2font.cpp

Modified: branches/v0_98_5_maint/src/ft2font.cpp
===================================================================
--- branches/v0_98_5_maint/src/ft2font.cpp      2009-02-26 20:20:47 UTC (rev 
6940)
+++ branches/v0_98_5_maint/src/ft2font.cpp      2009-02-27 13:30:13 UTC (rev 
6941)
@@ -1256,8 +1256,14 @@
     throw Py::TypeError("Usage: draw_glyph_to_bitmap(bitmap, x,y,glyph)");
   FT2Image* im = static_cast<FT2Image*>(args[0].ptr());
 
-  long x = Py::Int(args[1]);
-  long y = Py::Int(args[2]);
+  double xd = Py::Float(args[1]);
+  double yd = Py::Float(args[2]);
+  long x = (long)mpl_round(xd);
+  long y = (long)mpl_round(yd);
+  FT_Vector sub_offset;
+  sub_offset.x = int((xd - (double)x) * 64.0);
+  sub_offset.y = int((yd - (double)y) * 64.0);
+
   if (!Glyph::check(args[3].ptr()))
     throw Py::TypeError("Usage: draw_glyph_to_bitmap(bitmap, x,y,glyph)");
   Glyph* glyph = static_cast<Glyph*>(args[3].ptr());
@@ -1267,7 +1273,7 @@
 
   error = FT_Glyph_To_Bitmap(&glyphs[glyph->glyphInd],
                             ft_render_mode_normal,
-                            0,  //no additional translation
+                            &sub_offset,  //no additional translation
                             1   //destroy image;
                             );
   if (error)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to