Skip to content

Instantly share code, notes, and snippets.

@zmwangx
Created October 8, 2017 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmwangx/23cdfc41fd7387013a95c8f684c59bd5 to your computer and use it in GitHub Desktop.
Save zmwangx/23cdfc41fd7387013a95c8f684c59bd5 to your computer and use it in GitHub Desktop.
matplotlib patch for using Songti SC (from Songti.ttc) on macOS
diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py
index 9602db7..1ddec34 100644
--- a/lib/matplotlib/font_manager.py
+++ b/lib/matplotlib/font_manager.py
@@ -66,7 +66,7 @@ except ImportError:
from backports.functools_lru_cache import lru_cache
-USE_FONTCONFIG = False
+USE_FONTCONFIG = True
verbose = matplotlib.verbose
font_scalings = {
@@ -163,7 +163,7 @@ def get_fontext_synonyms(fontext):
Return a list of file extensions extensions that are synonyms for
the given file extension *fileext*.
"""
- return {'ttf': ('ttf', 'otf'),
+ return {'ttf': ('ttf', 'ttc', 'otf'),
'otf': ('ttf', 'otf'),
'afm': ('afm',)}[fontext]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment