From 40e68999928c725dd7217b5e0f3d328d0733443b Mon Sep 17 00:00:00 2001 From: Robert Kern Date: Fri, 15 Jun 2018 13:59:03 -0700 Subject: [PATCH 1/3] BUG: Ignore X11 fonts on macOS X11 installations on macOS routinely include a `Vera.ttf` font that does not support Unicode. Fixes #151 --- kiva/fonttools/font_manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kiva/fonttools/font_manager.py b/kiva/fonttools/font_manager.py index e0aa18599..0e1886da3 100644 --- a/kiva/fonttools/font_manager.py +++ b/kiva/fonttools/font_manager.py @@ -445,11 +445,14 @@ def findSystemFonts(fontpaths=None, fontext='ttf'): if len(ext) > 1 and ext[1:].lower() in fontexts: fontfiles[f] = 1 else: - fontpaths = x11FontDirectory() # check for OS X & load its fonts if present if sys.platform == 'darwin': + fontpaths = [] for f in OSXInstalledFonts(fontext=fontext): fontfiles[f] = 1 + else: + # Otherwise, check X11. + fontpaths = x11FontDirectory() for f in get_fontconfig_fonts(fontext): fontfiles[f] = 1 From 78cfc38c438780929d51180fe00cf91c11648437 Mon Sep 17 00:00:00 2001 From: Robert Kern Date: Fri, 15 Jun 2018 14:23:16 -0700 Subject: [PATCH 2/3] REPO: Ignore test crud --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index a4d0fefb2..63e9a1b31 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,11 @@ kiva/quartz/CTFont.c # Auto-generated version info enable/_version.py kiva/_version.py + +# Unclean test crud. +arc.png +arc_to.png +dash.bmp +sun.test_*.bmp +text_image.test_*.bmp +.hypothesis/ From df37290251357a4091f1e59380173b3fc05b4814 Mon Sep 17 00:00:00 2001 From: Robert Kern Date: Fri, 15 Jun 2018 14:25:41 -0700 Subject: [PATCH 3/3] BUG: Alias modern family to sans-serif Otherwise `Font('modern')` will be interpreted as trying to find a typeface actually named "modern". This construction mostly occurs in tests, not real code, which tends to go through the `KivaFontTrait()` which parses `'modern'` to refer to the sans-serif family in any case. --- kiva/fonttools/font_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kiva/fonttools/font_manager.py b/kiva/fonttools/font_manager.py index 0e1886da3..f0e20f8df 100644 --- a/kiva/fonttools/font_manager.py +++ b/kiva/fonttools/font_manager.py @@ -109,7 +109,7 @@ } font_family_aliases = set(['serif', 'sans-serif', 'sans serif', 'cursive', - 'fantasy', 'monospace', 'sans']) + 'fantasy', 'monospace', 'sans', 'modern']) # OS Font paths MSFolders = \ @@ -1138,7 +1138,7 @@ def score_family(self, families, family2): for i, family1 in enumerate(families): family1 = family1.lower() if family1 in font_family_aliases: - if family1 in ('sans', 'sans serif'): + if family1 in ('sans', 'sans serif', 'modern'): family1 = 'sans-serif' options = preferred_fonts[family1] options = [x.lower() for x in options]