@@ -660,6 +660,7 @@ class BakomaFonts(TruetypeFonts):
660
660
661
661
def __init__ (self , * args , ** kwargs ):
662
662
self ._stix_fallback = StixFonts (* args , ** kwargs )
663
+ self .name = "Computer Modern"
663
664
664
665
TruetypeFonts .__init__ (self , * args , ** kwargs )
665
666
self .fontmap = {}
@@ -769,18 +770,19 @@ class UnicodeFonts(TruetypeFonts):
769
770
770
771
def __init__ (self , * args , ** kwargs ):
771
772
# This must come first so the backend's owner is set correctly
772
- _fallback_rc = rcParams ['mathtext.fallback' ]
773
+ fallback_rc = rcParams ['mathtext.fallback' ]
773
774
if rcParams ['mathtext.fallback_to_cm' ] is not None :
774
775
if rcParams ['mathtext.fallback_to_cm' ]:
775
- _fallback_rc = 'cm'
776
+ fallback_rc = 'cm'
776
777
else :
777
- _fallback_rc = None
778
+ fallback_rc = None
778
779
779
- if _fallback_rc == 'stix' :
780
+
781
+ if fallback_rc == 'stix' :
780
782
self .cm_fallback = StixFonts (* args , ** kwargs )
781
- elif _fallback_rc == 'stixsans' :
783
+ elif fallback_rc == 'stixsans' :
782
784
self .cm_fallback = StixSansFonts (* args , ** kwargs )
783
- elif _fallback_rc == 'cm' :
785
+ elif fallback_rc == 'cm' :
784
786
self .cm_fallback = BakomaFonts (* args , ** kwargs )
785
787
else :
786
788
self .cm_fallback = None
@@ -856,13 +858,9 @@ def _get_glyph(self, fontname, font_class, sym, fontsize, math=True):
856
858
857
859
if not found_symbol :
858
860
if self .cm_fallback :
859
- if type (self .cm_fallback ) is BakomaFonts :
860
- _log .warning ("Substituting with a symbol from Computer "
861
- "Modern." )
862
- elif type (self .cm_fallback ) is StixFonts :
863
- _log .warning ("Substituting with a symbol from STIX." )
864
- elif type (self .cm_fallback ) is StixSansFonts :
865
- _log .warning ("Substituting with a symbol from STIX Sans." )
861
+ _log .warning ("Substituting with a symbol from {}" .format (
862
+ self .cm_fallback .name ))
863
+
866
864
if (fontname in ('it' , 'regular' )
867
865
and isinstance (self .cm_fallback , StixFonts )):
868
866
fontname = 'rm'
@@ -1004,6 +1002,7 @@ class StixFonts(UnicodeFonts):
1004
1002
def __init__ (self , * args , ** kwargs ):
1005
1003
TruetypeFonts .__init__ (self , * args , ** kwargs )
1006
1004
self .fontmap = {}
1005
+ self .name = "STIX"
1007
1006
for key , name in self ._fontmap .items ():
1008
1007
fullpath = findfont (name )
1009
1008
self .fontmap [key ] = fullpath
@@ -1080,6 +1079,9 @@ class StixSansFonts(StixFonts):
1080
1079
A font handling class for the STIX fonts (that uses sans-serif
1081
1080
characters by default).
1082
1081
"""
1082
+ def __init__ (self , * args , ** kwargs ):
1083
+ StixFonts .__init__ (self , * args , ** kwargs )
1084
+ self .name = "STIXSans"
1083
1085
_sans = True
1084
1086
1085
1087
0 commit comments