10000 Use prime symbol from bakoma · matplotlib/matplotlib@be43ee5 · GitHub
[go: up one dir, main page]

Skip to content

Commit be43ee5

Browse files
committed
Use prime symbol from bakoma
see comments in #4873 and #4987: Primes in stix and DejaVu are already superscripted, so the TeX way of setting a prime as $f^\prime$ results in doubly-superscripted primes. For consistency with TeX, here we use the CM prime symbol.
1 parent 9a99bd5 commit be43ee5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/mathtext.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ def get_sized_alternatives_for_symbol(self, fontname, sym):
876876
fontname, sym)
877877
return [(fontname, sym)]
878878

879+
879880
class DejaVuFonts(UnicodeFonts):
880881
use_cmex = False
881882

@@ -885,6 +886,7 @@ def __init__(self, *args, **kwargs):
885886
self.cm_fallback = StixFonts(*args, **kwargs)
886887
else:
887888
self.cm_fallback = StixSansFonts(*args, **kwargs)
889+
self.bakoma = BakomaFonts(*args, **kwargs)
888890
TruetypeFonts.__init__(self, *args, **kwargs)
889891
self.fontmap = {}
890892
# Include Stix sized alternatives for glyphs
@@ -900,6 +902,16 @@ def __init__(self, *args, **kwargs):
900902
self.fontmap[key] = fullpath
901903
self.fontmap[name] = fullpath
902904

905+
def _get_glyph(self, fontname, font_class, sym, fontsize):
906+
""" Override prime symbol to use Bakoma """
907+
if sym == r'\prime':
908+
return self.bakoma._get_glyph(fontname,
909+
font_class, sym, fontsize)
910+
else:
911+
return super(DejaVuFonts, self)._get_glyph(fontname,
912+
font_class, sym, fontsize)
913+
914+
903915
class DejaVuSerifFonts(DejaVuFonts):
904916
"""
905917
A font handling class for the DejaVu Serif fonts

0 commit comments

Comments
 (0)
0