Skip to content

Commit 8c2711f

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 69cb1e6 commit 8c2711f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎lib/matplotlib/mathtext.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ def get_sized_alternatives_for_symbol(self, fontname, sym):
889889
fontname, sym)
890890
return [(fontname, sym)]
891891

892+
892893
class DejaVuFonts(UnicodeFonts):
893894
use_cmex = False
894895

@@ -898,6 +899,7 @@ def __init__(self, *args, **kwargs):
898899
self.cm_fallback = StixFonts(*args, **kwargs)
899900
else:
900901
self.cm_fallback = StixSansFonts(*args, **kwargs)
902+
self.bakoma = BakomaFonts(*args, **kwargs)
901903
TruetypeFonts.__init__(self, *args, **kwargs)
902904
self.fontmap = {}
903905
# Include Stix sized alternatives for glyphs
@@ -913,6 +915,16 @@ def __init__(self, *args, **kwargs):
913915
self.fontmap[key] = fullpath
914916
self.fontmap[name] = fullpath
915917

918+
def _get_glyph(self, fontname, font_class, sym, fontsize):
919+
""" Override prime symbol to use Bakoma """
920+
if sym == r'\prime':
921+
return self.bakoma._get_glyph(fontname,
922+
font_class, sym, fontsize)
923+
else:
924+
return super(DejaVuFonts, self)._get_glyph(fontname,
925+
font_class, sym, fontsize)
926+
927+
916928
class DejaVuSerifFonts(DejaVuFonts):
917929
"""
918930
A font handling class for the DejaVu Serif fonts

0 commit comments

Comments
 (0)