8000 Merge pull request #5612 from zblz/dejavu-display-symbols · notmatthancock/matplotlib@a77bb83 · GitHub
[go: up one dir, main page]

Skip to content

Commit a77bb83

Browse files
committed
Merge pull request matplotlib#5612 from zblz/dejavu-display-symbols
mathtext: Use DejaVu display symbols when available
1 parent 50112a7 commit a77bb83

File tree

68 files changed

+3388
-2979
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3388
-2979
lines changed

lib/matplotlib/mathtext.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,15 @@ def _get_glyph(self, fontname, font_class, sym, fontsize):
906906
return self.bakoma._get_glyph(fontname,
907907
font_class, sym, fontsize)
908908
else:
909+
# check whether the glyph is available in the display font
910+
uniindex = get_unicode_index(sym)
911+
font = self._get_font('ex')
912+
if font is not None:
913+
glyphindex = font.get_char_index(uniindex)
914+
if glyphindex != 0:
915+
return super(DejaVuFonts, self)._get_glyph('ex',
916+
font_class, sym, fontsize)
917+
# otherwise return regular glyph
909918
return super(DejaVuFonts, self)._get_glyph(fontname,
910919
font_class, sym, fontsize)
911920

@@ -921,6 +930,7 @@ class DejaVuSerifFonts(DejaVuFonts):
921930
'bf' : 'DejaVu Serif:weight=bold',
922931
'sf' : 'DejaVu Sans',
923932
'tt' : 'DejaVu Sans Mono',
933+
'ex' : 'DejaVu Serif Display',
924934
}
925935

926936
class DejaVuSansFonts(DejaVuFonts):
@@ -934,6 +944,7 @@ class DejaVuSansFonts(DejaVuFonts):
934944
'bf' : 'DejaVu Sans:weight=bold',
935945
'sf' : 'DejaVu Sans',
936946
'tt' : 'DejaVu Sans Mono',
947+
'ex' : 'DejaVu Sans Display',
937948
}
938949

939950
class StixFonts(UnicodeFonts):
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_18.svg

Lines changed: 43 additions & 43 deletions
Loading
Binary file not shown.
Loading

0 commit comments

Comments
 (0)
0