Hallo,

I'm try to use MathTextParser output for cairo in my wxpython gui. Works well 
under ubunutu linux (maybe dublicated font) but fails under windows 
(screenshot: http://www.ubuntu-pics.de/bild/62985/auswahl_017_RC86gk.png ).

How to tell cairo to use the font file from mpl-data?

Here some code:

from matplotlib.mathtext import MathTextParser
from matplotlib.font_manager import ttfFontProperty
import wx
import wx.lib.wxcairo
import cairo

#...
MPC = MathTextParser("Cairo")
dc = wx.BufferedPaintDC(self)
ctx = wx.lib.wxcairo.ContextFromDC(dc)
#...
width, height, descent, glyphs, rects = 
self.mathtext_parser.parse(r"$a_0+a_1\xi+a_2\xi^2+a_3\xi^3$",dpi,prop)
#...

for font, fontsize, s, ox, oy in glyphs:
   #...
   fontProp = ttfFontProperty(font)
   #...
   ctx.select_font_face (fontProp.name,
                         self.fontangles [fontProp.style],
                         self.fontweights[fontProp.weight])

   #...
   ctx.show_text(s.encode("utf-8"))
   #...
#...

greetz

Frank

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

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

Reply via email to