From: <evi...@us...> - 2009-07-23 21:32:28
|
Revision: 7289 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7289&view=rev Author: evilguru Date: 2009-07-23 21:32:21 +0000 (Thu, 23 Jul 2009) Log Message: ----------- Use svn:external to pull-in mathtex. Modified Paths: -------------- branches/mathtex/lib/matplotlib/sphinxext/mathmpl.py Added Paths: ----------- branches/mathtex/lib/mathtex/ Property Changed: ---------------- branches/mathtex/ Property changes on: branches/mathtex ___________________________________________________________________ Added: svn:externals + lib/mathtex http://mathtex.googlecode.com/svn/trunk/ Modified: branches/mathtex/lib/matplotlib/sphinxext/mathmpl.py =================================================================== --- branches/mathtex/lib/matplotlib/sphinxext/mathmpl.py 2009-07-23 18:25:39 UTC (rev 7288) +++ branches/mathtex/lib/matplotlib/sphinxext/mathmpl.py 2009-07-23 21:32:21 UTC (rev 7289) @@ -9,10 +9,7 @@ from docutils.parsers.rst import directives import warnings -from matplotlib import rcParams -from matplotlib.mathtext import MathTextParser -rcParams['mathtext.fontset'] = 'cm' -mathtext_parser = MathTextParser("Bitmap") +from mathtex.mathtex_main import Mathtex # Define LaTeX math node: class latex_math(nodes.General, nodes.Element): @@ -44,21 +41,18 @@ # This uses mathtext to render the expression def latex2png(latex, filename, fontset='cm'): latex = "$%s$" % latex - orig_fontset = rcParams['mathtext.fontset'] - rcParams['mathtext.fontset'] = fontset - if os.path.exists(filename): - depth = mathtext_parser.get_depth(latex, dpi=100) - else: + + m = Mathtex(latex, 'bakoma') + + if not os.path.exists(filename): try: - depth = mathtext_parser.to_png(filename, latex, dpi=100) + m.save(filename) except: warnings.warn("Could not render math expression %s" % latex, Warning) - depth = 0 - rcParams['mathtext.fontset'] = orig_fontset sys.stdout.write("#") sys.stdout.flush() - return depth + return m.depth # LaTeX to HTML translation stuff: def latex2html(node, source): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |