Seite 1 von 1

matplotlib Schrift in cairo nutzen

Verfasst: Freitag 14. Mai 2010, 17:48
von IoI
Hallo,

ich versuche die mit MathTextParser aus der matplotlib erstellte Cairo-Ausgabe darzustellen. Unter Linux auch kein Problem (wahrscheinlich Schrift doppelt vorhanden), aber Windows ist die Schriftart unbekannt.

Wie kann ich in Cairo die Schrift von der matplotlib (mpl-data) einbinden?

Bild

Code: Alles auswählen

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"))
   #...
#...

Re: matplotlib Schrift in cairo nutzen

Verfasst: Samstag 15. Mai 2010, 08:37
von mkesper
Schau mal nach den Einstellungen unter http://matplotlib.sourceforge.net/users ... izing.html.

Re: matplotlib Schrift in cairo nutzen

Verfasst: Sonntag 16. Mai 2010, 16:44
von IoI
Da habe ich nichts gefunden. Ich möchte die Schrift von matplotlib in cario nutzen