|
From: <md...@us...> - 2010-09-21 20:16:34
|
Revision: 8713
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8713&view=rev
Author: mdboom
Date: 2010-09-21 20:16:28 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
Merged revisions 8711-8712 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v1_0_maint
........
r8711 | mdboom | 2010-09-20 12:58:14 -0400 (Mon, 20 Sep 2010) | 2 lines
Fix clipped text in example.
........
r8712 | mdboom | 2010-09-21 16:13:25 -0400 (Tue, 21 Sep 2010) | 2 lines
If a font file is looked up in the cache, but that font file no longer exists on disk, rebuild the cache.
........
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/accented_text.py
trunk/matplotlib/lib/matplotlib/font_manager.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /branches/v1_0_maint:1-8708 /trunk/matplotlib:1-7315
+ /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /branches/v1_0_maint:1-8712 /trunk/matplotlib:1-7315
Modified: trunk/matplotlib/examples/pylab_examples/accented_text.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/accented_text.py 2010-09-21 20:13:25 UTC (rev 8712)
+++ trunk/matplotlib/examples/pylab_examples/accented_text.py 2010-09-21 20:16:28 UTC (rev 8713)
@@ -11,6 +11,7 @@
"""
from pylab import *
+axes([0.1, 0.15, 0.8, 0.75])
plot(range(10))
title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}\breve{i}\bar{A}\tilde{n}\vec{q}$', fontsize=20)
Modified: trunk/matplotlib/lib/matplotlib/font_manager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/font_manager.py 2010-09-21 20:13:25 UTC (rev 8712)
+++ trunk/matplotlib/lib/matplotlib/font_manager.py 2010-09-21 20:16:28 UTC (rev 8713)
@@ -1169,7 +1169,7 @@
return abs(sizeval1 - sizeval2) / 72.0
def findfont(self, prop, fontext='ttf', directory=None,
- fallback_to_default=True):
+ fallback_to_default=True, rebuild_if_missing=True):
"""
Search the font list for the font that most closely matches
the :class:`FontProperties` *prop*.
@@ -1257,6 +1257,16 @@
(prop, best_font.name, best_font.fname, best_score))
result = best_font.fname
+ if not os.path.isfile(result):
+ if rebuild_if_missing:
+ verbose.report(
+ 'findfont: Found a missing font file. Rebuilding cache.')
+ _rebuild()
+ return fontManager.findfont(
+ prop, fontext, directory, True, False)
+ else:
+ raise ValueError("No valid font could be found")
+
if directory is None:
font_cache[hash(prop)] = result
return result
@@ -1280,6 +1290,16 @@
return result
return False
+fontManager = None
+
+_fmcache = os.path.join(get_configdir(), 'fontList.cache')
+
+def _rebuild():
+ global fontManager
+ fontManager = FontManager()
+ pickle_dump(fontManager, _fmcache)
+ verbose.report("generated new fontManager")
+
# The experimental fontconfig-based backend.
if USE_FONTCONFIG and sys.platform != 'win32':
import re
@@ -1317,16 +1337,6 @@
return result
else:
- _fmcache = os.path.join(get_configdir(), 'fontList.cache')
-
- fontManager = None
-
- def _rebuild():
- global fontManager
- fontManager = FontManager()
- pickle_dump(fontManager, _fmcache)
- verbose.report("generated new fontManager")
-
try:
fontManager = pickle_load(_fmcache)
if (not hasattr(fontManager, '_version') or
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|