10000 Backport PR #13677 on branch v3.0.x (Log all failures to extract font properties.) by meeseeksmachine · Pull Request #13692 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Backport PR #13677 on branch v3.0.x (Log all failures to extract font properties.) #13692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,23 +490,25 @@ def createFontList(fontfiles, fontext='ttf'):
continue
try:
prop = afmFontProperty(fpath, font)
except KeyError:
except KeyError as exc:
_log.info("Could not extract properties for %s: %s",
fpath, exc)
continue
else:
try:
font = ft2font.FT2Font(fpath)
except RuntimeError:
_log.info("Could not open font file %s", fpath)
except (OSError, RuntimeError) as exc:
_log.info("Could not open font file %s: %s", fpath, exc)
continue
except UnicodeError:
_log.info("Cannot handle unicode filenames")
continue
except OSError:
_log.info("IO error - cannot open font file %s", fpath)
continue
try:
prop = ttfFontProperty(font)
except (KeyError, RuntimeError, ValueError, NotImplementedError):
except (KeyError, RuntimeError, ValueError,
NotImplementedError) as exc:
_log.info("Could not extract properties for %s: %s",
fpath, exc)
continue

fontlist.append(prop)
Expand Down
0