8000 Use prime symbol from bakoma · zblz/matplotlib@8d7e98b · GitHub
[go: up one dir, main page]

Skip to content

Commit 8d7e98b

Browse files
committed
Use prime symbol from bakoma
see comments in matplotlib#4873 and matplotlib#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 47338c9 commit 8d7e98b

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
@@ -885,6 +885,7 @@ def get_sized_alternatives_for_symbol(self, fontname, sym):
885885
fontname, sym)
886886
return [(fontname, sym)]
887887

888+
888889
class DejaVuFonts(UnicodeFonts):
889890
use_cmex = False
890891

@@ -894,6 +895,7 @@ def __init__(self, *args, **kwargs):
894895
self.cm_fallback = StixFonts(*args, **kwargs)
895896
else:
896897
self.cm_fallback = StixSansFonts(*args, **kwargs)
898+
self.bakoma = BakomaFonts(*args, **kwargs)
897899
TruetypeFonts.__init__(self, *args, **kwargs)
898900
self.fontmap = {}
899901
# Include Stix sized alternatives for glyphs
@@ -909,6 +911,16 @@ def __init__(self, *args, **kwargs):
909911
self.fontmap[key] = fullpath
910912
self.fontmap[name] = fullpath
911913

914+
def _get_glyph(self, fontname, font_class, sym, fontsize):
915+
""" Override prime symbol to use Bakoma """
916+
if sym == r'\prime':
917+
return self.bakoma._get_glyph(fontname,
918+
font_class, sym, fontsize)
919+
else:
920+
return super(DejaVuFonts, self)._get_glyph(fontname,
921+
font_class, sym, fontsize)
922+
923+
912924
class DejaVuSerifFonts(DejaVuFonts):
913925
"""
914926
A font handling class for the DejaVu Serif fonts

0 commit comments

Comments
 (0)
0