Revision: 8338
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8338&view=rev
Author:   mdboom
Date:     2010-05-27 12:43:32 +0000 (Thu, 27 May 2010)

Log Message:
-----------
Fix bug where Truetype fonts were being used to calculate text metrics, even 
when rcParam['text.usetex'] is True.

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

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py     2010-05-26 
15:03:34 UTC (rev 8337)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py     2010-05-27 
12:43:32 UTC (rev 8338)
@@ -162,7 +162,7 @@
         # texmanager more efficient.  It is not meant to be used
         # outside the backend
         """
-        if ismath=='TeX':
+        if rcParams['text.usetex']:
             # todo: handle props
             size = prop.get_size_in_points()
             texmanager = self.get_texmanager()

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py     2010-05-26 
15:03:34 UTC (rev 8337)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py     2010-05-27 
12:43:32 UTC (rev 8338)
@@ -800,7 +800,7 @@
         return self.width, self.height
 
     def get_text_width_height_descent(self, s, prop, ismath):
-        if ismath == "TeX":
+        if rcParams['text.usetex']:
             size = prop.get_size_in_points()
             texmanager = self._text2path.get_texmanager()
             fontsize = prop.get_size_in_points()

Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py     2010-05-26 15:03:34 UTC (rev 
8337)
+++ trunk/matplotlib/lib/matplotlib/text.py     2010-05-27 12:43:32 UTC (rev 
8338)
@@ -565,27 +565,24 @@
                 else:
                     renderer.draw_tex(gc, x, y, clean_line,
                                       self._fontproperties, angle)
-            gc.restore()
-            renderer.close_group('text')
-            return
+        else:
+            for line, wh, x, y in info:
+                x = x + posx
+                y = y + posy
+                if renderer.flipy():
+                    y = canvash-y
+                clean_line, ismath = self.is_math_text(line)
 
-        for line, wh, x, y in info:
-            x = x + posx
-            y = y + posy
-            if renderer.flipy():
-                y = canvash-y
-            clean_line, ismath = self.is_math_text(line)
+                if self.get_path_effects():
+                    for path_effect in self.get_path_effects():
+                        path_effect.draw_text(renderer, gc, x, y, clean_line,
+                                              self._fontproperties, angle,
+                                              ismath=ismath)
+                else:
+                    renderer.draw_text(gc, x, y, clean_line,
+                                       self._fontproperties, angle,
+                                       ismath=ismath)
 
-            if self.get_path_effects():
-                for path_effect in self.get_path_effects():
-                    path_effect.draw_text(renderer, gc, x, y, clean_line,
-                                          self._fontproperties, angle,
-                                          ismath=ismath)
-            else:
-                renderer.draw_text(gc, x, y, clean_line,
-                                   self._fontproperties, angle,
-                                   ismath=ismath)
-
         gc.restore()
         renderer.close_group('text')
 


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

------------------------------------------------------------------------------

_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to