SF.net SVN: matplotlib:[7281] branches/mathtex/lib/matplotlib/backends/ backend_qt.py

2009-07-22 Thread evilguru
Revision: 7281
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7281&view=rev
Author:   evilguru
Date: 2009-07-22 10:54:35 + (Wed, 22 Jul 2009)

Log Message:
---
Remove the mathtext include from the Qt3 backend.

Modified Paths:
--
branches/mathtex/lib/matplotlib/backends/backend_qt.py

Modified: branches/mathtex/lib/matplotlib/backends/backend_qt.py
===
--- branches/mathtex/lib/matplotlib/backends/backend_qt.py  2009-07-21 
19:30:28 UTC (rev 7280)
+++ branches/mathtex/lib/matplotlib/backends/backend_qt.py  2009-07-22 
10:54:35 UTC (rev 7281)
@@ -10,7 +10,6 @@
  FigureManagerBase, FigureCanvasBase, NavigationToolbar2, cursors
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.figure import Figure
-from matplotlib.mathtext import MathTextParser
 from matplotlib.widgets import SubplotTool
 
 try:


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

--
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[7283] branches/mathtex/lib/matplotlib/backends/ backend_macosx.py

2009-07-22 Thread evilguru
Revision: 7283
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7283&view=rev
Author:   evilguru
Date: 2009-07-22 13:47:42 + (Wed, 22 Jul 2009)

Log Message:
---
Port the OS X backend over. I am unable to test this at the current time.

Modified Paths:
--
branches/mathtex/lib/matplotlib/backends/backend_macosx.py

Modified: branches/mathtex/lib/matplotlib/backends/backend_macosx.py
===
--- branches/mathtex/lib/matplotlib/backends/backend_macosx.py  2009-07-22 
13:08:41 UTC (rev 7282)
+++ branches/mathtex/lib/matplotlib/backends/backend_macosx.py  2009-07-22 
13:47:42 UTC (rev 7283)
@@ -9,11 +9,11 @@
 from matplotlib.cbook import maxdict
 from matplotlib.figure import Figure
 from matplotlib.path import Path
-from matplotlib.mathtext import MathTextParser
 from matplotlib.colors import colorConverter
 
+from mathtex.mathtex_main import Mathtex
+from mathtex.backends.backend_image import MathtexBackendImage
 
-
 from matplotlib.widgets import SubplotTool
 
 import matplotlib
@@ -77,7 +77,7 @@
 nrows, ncols, data = im.as_rgba_str()
 self.gc.draw_image(x, y, nrows, ncols, data, bbox, clippath, 
clippath_trans)
 im.flipud_out()
-
+
 def draw_tex(self, gc, x, y, s, prop, angle):
 # todo, handle props, angle, origins
 size = prop.get_size_in_points()
@@ -91,10 +91,12 @@
 gc.draw_mathtext(x, y, angle, Z)
 
 def _draw_mathtext(self, gc, x, y, s, prop, angle):
-ox, oy, width, height, descent, image, used_characters = \
-self.mathtext_parser.parse(s, self.dpi, prop)
-gc.draw_mathtext(x, y, angle, 255 - image.as_array())
+m = Mathtex(s, rcParams['mathtext.fontset'], 
prop.get_size_in_points(), self.dpi)
+b = MathtexBackendImage()
+m.render_to_backend(b)
 
+gc.draw_mathtext(x, y, angle, 255 - b.image.as_array())
+
 def draw_text(self, gc, x, y, s, prop, angle, ismath=False):
 if ismath:
self._draw_mathtext(gc, x, y, s, prop, angle)
@@ -115,9 +117,9 @@
renderer=self)
 return w, h, d
 if ismath:
-ox, oy, width, height, descent, fonts, used_characters = \
-self.mathtext_parser.parse(s, self.dpi, prop)
-return width, height, descent
+m = Mathtex(s, rcParams['mathtext.fontset'],
+prop.get_size_in_points(), self.dpi)
+return m.width, m.height, m.depth
 family =  prop.get_family()
 weight = prop.get_weight()
 style = prop.get_style()
@@ -128,7 +130,7 @@
 
 def flipy(self):
 return False
-
+
 def points_to_pixels(self, points):
 return points/72.0 * self.dpi
 
@@ -168,7 +170,7 @@
 _macosx.GraphicsContext.set_clip_path(self, path)
 
 
-#
+#
 # The following functions and classes are for pylab and implement
 # window/figure managers, etc...
 #
@@ -281,7 +283,7 @@
 self.toolbar = NavigationToolbar2Mac(canvas)
 else:
 self.toolbar = None
-if self.toolbar is not None: 
+if self.toolbar is not None:
 self.toolbar.update()
 
 def notify_axes_change(fig):
@@ -300,7 +302,7 @@
 Gcf.destroy(self.num)
 
 class NavigationToolbarMac(_macosx.NavigationToolbar):
- 
+
 def __init__(self, canvas):
 self.canvas = canvas
 basedir = os.path.join(matplotlib.rcParams['datapath'], "images")
@@ -331,7 +333,7 @@
 assert magic=="P6"
 assert len(imagedata)==width*height*3 # 3 colors in RGB
 return (width, height, imagedata)
-
+
 def panx(self, direction):
 axes = self.canvas.figure.axes
 selected = self.get_active()
@@ -401,9 +403,9 @@
 _macosx.NavigationToolbar2.set_message(self, message.encode('utf-8'))
 
 
-#
+#
 # Now just provide the standard names that backend.__init__ is expecting
-# 
+#
 
 
 


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

--
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[7286] branches/mathtex/lib/matplotlib/backends/ backend_ps.py

2009-07-22 Thread evilguru
Revision: 7286
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7286&view=rev
Author:   evilguru
Date: 2009-07-22 13:58:18 + (Wed, 22 Jul 2009)

Log Message:
---
Really fix the PS alignment issues with mathtex.

Modified Paths:
--
branches/mathtex/lib/matplotlib/backends/backend_ps.py

Modified: branches/mathtex/lib/matplotlib/backends/backend_ps.py
===
--- branches/mathtex/lib/matplotlib/backends/backend_ps.py  2009-07-22 
13:54:55 UTC (rev 7285)
+++ branches/mathtex/lib/matplotlib/backends/backend_ps.py  2009-07-22 
13:58:18 UTC (rev 7286)
@@ -755,7 +755,7 @@
 
 # Glyphs
 for ox, oy, info in m.glyphs:
-oy = m.height - m.depth - oy + info.offset
+oy = (m.height + m.depth) - oy + info.offset
 postscript_name = info.postscript_name
 fontsize= info.fontsize
 symbol_name = info.symbol_name
@@ -775,7 +775,7 @@
 
 # Rects
 for x1, y1, x2, y2 in m.rects:
-ps = "%f %f %f %f rectfill\n" % (x1, m.height - m.depth - y2, x2 - 
x1, y2 - y1)
+ps = "%f %f %f %f rectfill\n" % (x1, (m.height + m.depth) - y2, x2 
- x1, y2 - y1)
 textwriter.write(ps)
 
 self.set_color(*gc.get_rgb())


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

--
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins