8000 Merge pull request #18721 from anntzer/latex_to_cmex · matplotlib/matplotlib@9a65a7d · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a65a7d

Browse files
authored
Merge pull request #18721 from anntzer/latex_to_cmex
Remove the use_cmex font fallback mechanism.
2 parents e7601e0 + b1691d9 commit 9a65a7d

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

lib/matplotlib/_mathtext.py

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
import matplotlib as mpl
2121
from . import cbook
2222
from ._mathtext_data import (
23-
latex_to_bakoma, latex_to_cmex, latex_to_standard, stix_virtual_fonts,
24-
tex2uni)
23+
latex_to_bakoma, latex_to_standard, stix_virtual_fonts, tex2uni)
2524
from .afm import AFM
2625
from .font_manager import FontProperties, findfont, get_font
2726
from .ft2font import KERNING_DEFAULT
@@ -452,7 +451,7 @@ class UnicodeFonts(TruetypeFonts):
452451
This class will "fallback" on the Bakoma fonts when a required
453452
symbol can not be found in the font.
454453
"""
455-
use_cmex = True
454+
use_cmex = True # Unused; delete once mathtext becomes private.
456455

457456
def __init__(self, *args, **kwargs):
458457
# This must come first so the backend's owner is set correctly
@@ -497,22 +496,13 @@ def _map_virtual_font(self, fontname, font_class, uniindex):
497496
return fontname, uniindex
498497

499498
def _get_glyph(self, fontname, font_class, sym, fontsize, math=True):
500-
found_symbol = False
501-
502-
if self.use_cmex:
503-
uniindex = latex_to_cmex.get(sym)
504-
if uniindex is not None:
505-
fontname = 'ex'
506-
found_symbol = True
507-
508-
if not found_symbol:
509-
try:
510-
uniindex = get_unicode_index(sym, math)
511-
found_symbol = True
512-
except ValueError:
513-
uniindex = ord('?')
514-
_log.warning(
515-
"No TeX to unicode mapping for {!a}.".format(sym))
499+
try:
500+
uniindex = get_unicode_index(sym, math)
501+
found_symbol = True
502+
except ValueError:
503+
uniindex = ord('?')
504+
found_symbol = False
505+
_log.warning("No TeX to unicode mapping for {!a}.".format(sym))
516506

517507
fontname, uniindex = self._map_virtual_font(
518508
fontname, font_class, uniindex)
@@ -574,7 +564,7 @@ def get_sized_alternatives_for_symbol(self, fontname, sym):
574564

575565

576566
class DejaVuFonts(UnicodeFonts):
577-
use_cmex = False
567+
use_cmex = False # Unused; delete once mathtext becomes private.
578568

579569
def __init__(self, *args, **kwargs):
580570
# This must come first so the backend's owner is set correctly
@@ -677,7 +667,7 @@ class StixFonts(UnicodeFonts):
677667
4: 'STIXSizeFourSym',
678668
5: 'STIXSizeFiveSym',
679669
}
680-
use_cmex = False
670+
use_cmex = False # Unused; delete once mathtext becomes private.
681671
cm_fallback = False
682672
_sans = False
683673

lib/matplotlib/_mathtext_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
'\\_' : ('cmtt10', 0x5f)
237237
}
238238

239-
latex_to_cmex = {
239+
latex_to_cmex = { # Unused; delete once mathtext becomes private.
240240
r'\__sqrt__' : 112,
241241
r'\bigcap' : 92,
242242
r'\bigcup' : 91,

0 commit comments

Comments
 (0)
0