|
|
cdbc42 |
From faa88c94e36ae1c51ca75c1a8eee87d7148156e3 Mon Sep 17 00:00:00 2001
|
|
|
cdbc42 |
From: Damon McDougall <damon.mcdougall@gmail.com>
|
|
|
cdbc42 |
Date: Mon, 17 Dec 2012 10:15:48 -0600
|
|
|
cdbc42 |
Subject: [PATCH 1/5] Make font_manager ignore KeyErrors for bad fonts
|
|
|
cdbc42 |
|
|
|
cdbc42 |
Signed-off-by: John Kacur <jkacur@redhat.com>
|
|
|
cdbc42 |
---
|
|
|
cdbc42 |
lib/matplotlib/font_manager.py | 10 ++++++++--
|
|
|
cdbc42 |
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
cdbc42 |
|
|
|
cdbc42 |
diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py
|
|
|
cdbc42 |
index 4ba6f80d0145..f9418dc5b4bd 100644
|
|
|
cdbc42 |
--- a/lib/matplotlib/font_manager.py
|
|
|
cdbc42 |
+++ b/lib/matplotlib/font_manager.py
|
|
|
cdbc42 |
@@ -565,7 +565,10 @@ def createFontList(fontfiles, fontext='ttf'):
|
|
|
cdbc42 |
except RuntimeError:
|
|
|
cdbc42 |
verbose.report("Could not parse font file %s"%fpath)
|
|
|
cdbc42 |
continue
|
|
|
cdbc42 |
- prop = afmFontProperty(fpath, font)
|
|
|
cdbc42 |
+ try:
|
|
|
cdbc42 |
+ prop = afmFontProperty(fpath, font)
|
|
|
cdbc42 |
+ except KeyError:
|
|
|
cdbc42 |
+ continue
|
|
|
cdbc42 |
else:
|
|
|
cdbc42 |
try:
|
|
|
cdbc42 |
font = ft2font.FT2Font(str(fpath))
|
|
|
cdbc42 |
@@ -576,7 +579,10 @@ def createFontList(fontfiles, fontext='ttf'):
|
|
|
cdbc42 |
verbose.report("Cannot handle unicode filenames")
|
|
|
cdbc42 |
#print >> sys.stderr, 'Bad file is', fpath
|
|
|
cdbc42 |
continue
|
|
|
cdbc42 |
- prop = ttfFontProperty(font)
|
|
|
cdbc42 |
+ try:
|
|
|
cdbc42 |
+ prop = ttfFontProperty(font)
|
|
|
cdbc42 |
+ except KeyError:
|
|
|
cdbc42 |
+ continue
|
|
|
cdbc42 |
|
|
|
cdbc42 |
fontlist.append(prop)
|
|
|
cdbc42 |
return fontlist
|
|
|
cdbc42 |
--
|
|
|
cdbc42 |
2.20.1
|
|
|
cdbc42 |
|