@@ -475,6 +475,14 @@ class UnicodeFonts(TruetypeFonts):
475
475
symbol can not be found in the font.
476
476
"""
477
477
478
+ # Some glyphs are not present in the `cmr10` font, and must be brought in
479
+ # from `cmsy10`. Map the Unicode indices of those glyphs to the indices at
480
+ # which they are found in `cmsy10`.
481
+ _cmr10_substitutions = {
482
+ 0x00D7 : 0x00A3 , # Multiplication sign.
483
+ 0x2212 : 0x00A1 , # Minus sign.
484
+ }
485
+
478
486
def __init__ (self , * args , ** kwargs ):
479
487
# This must come first so the backend's owner is set correctly
480
488
fallback_rc = mpl .rcParams ['mathtext.fallback' ]
@@ -541,11 +549,11 @@ def _get_glyph(self, fontname, font_class, sym):
541
549
found_symbol = False
542
550
font = self ._get_font (new_fontname )
543
551
if font is not None :
544
- if font . family_name == "cmr10" and uniindex == 0x2212 :
545
- # minus sign exists in cmsy10 (not cmr10)
552
+ if ( uniindex in self . _cmr10_substitutions
553
+ and font . family_name == " cmr10" ):
546
554
font = get_font (
547
555
cbook ._get_data_path ("fonts/ttf/cmsy10.ttf" ))
548
- uniindex = 0xa1
556
+ uniindex = self . _cmr10_substitutions [ uniindex ]
549
557
glyphindex = font .get_char_index (uniindex )
550
558
if glyphindex != 0 :
551
559
found_symbol = True
0 commit comments