From: <md...@us...> - 2007-12-03 13:20:29
|
Revision: 4557 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4557&view=rev Author: mdboom Date: 2007-12-03 05:20:19 -0800 (Mon, 03 Dec 2007) Log Message: ----------- Fix missing font file error. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-12-03 08:22:16 UTC (rev 4556) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-12-03 13:20:19 UTC (rev 4557) @@ -16,8 +16,19 @@ s = r'$\mathcal{R}\prod_{i=\alpha\mathcal{B}}^\infty a_i\sin(2 \pi f x_i)$' - The fonts \cal, \rm, \it, and \tt are allowed. + Different fonts may be selected: + \mathcal Calligraphic fonts + \mathrm Roman (upright) font + \mathit Italic font + \mathtt Typewriter (monospaced) font, similar to Courier + Additionally, if using the STIX fonts: + \mathbb Blackboard (double-struck) font + \mathcircled Circled characters + \mathfrak Fraktur (Gothic-style) font + \mathscr Script (cursive) font + \mathsf Sans-serif font + The following accents are provided: \hat, \breve, \grave, \bar, \acute, \tilde, \vec, \dot, \ddot. All of them have the same syntax, eg to make an overbar you do \bar{o} or to make an o umlaut @@ -541,10 +552,7 @@ cached_font = self._fonts.get(basename) if cached_font is None: - try: - font = FT2Font(basename) - except RuntimeError: - return None + font = FT2Font(basename) cached_font = self.CachedFont(font) self._fonts[basename] = cached_font self._fonts[font.postscript_name] = cached_font @@ -652,13 +660,20 @@ if fontname in self.fontmap and latex_to_bakoma.has_key(sym): basename, num = latex_to_bakoma[sym] slanted = (basename == "cmmi10") or sym in self._slanted_symbols - cached_font = self._get_font(basename) - symbol_name = cached_font.font.get_glyph_name(num) - num = cached_font.glyphmap[num] + try: + cached_font = self._get_font(basename) + except RuntimeError: + pass + else: + symbol_name = cached_font.font.get_glyph_name(num) + num = cached_font.glyphmap[num] elif len(sym) == 1: slanted = (fontname == "it") - cached_font = self._get_font(fontname) - if cached_font is not None: + try: + cached_font = self._get_font(fontname) + except RuntimeError: + pass + else: num = ord(sym) gid = cached_font.charmap.get(num) if gid is not None: @@ -795,9 +810,12 @@ new_fontname = 'rm' slanted = (new_fontname == 'it') or sym in self._slanted_symbols - cached_font = self._get_font(new_fontname) found_symbol = False - if cached_font is not None: + try: + cached_font = self._get_font(new_fontname) + except RuntimeError: + pass + else: try: glyphindex = cached_font.charmap[uniindex] found_symbol = True This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |