Skip to content

Commit 82f1cc6

Browse files
committed
mathtext: fix normal/italic usage in STIXFonts
1 parent 7f0ec40 commit 82f1cc6

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/matplotlib/_mathtext.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ def _get_glyph(self, fontname: str, font_class: str,
493493
# same as LaTeX does.
494494
# This was previously mapped via `latex_to_bakoma`.
495495
fontname = "rm"
496-
497496
slanted = (fontname == "it")
498497
font = self._get_font(fontname)
499498
if font is not None:
@@ -846,7 +845,7 @@ def _map_virtual_font(self, fontname: str, font_class: str,
846845
fontname = mpl.rcParams['mathtext.default']
847846

848847
# Fix some incorrect glyphs.
849-
if fontname in ('rm', 'it'):
848+
if fontname in ('rm', 'it', 'normal'):
850849
uniindex = stix_glyph_fixes.get(uniindex, uniindex)
851850

852851
# Handle private use area glyphs
@@ -1852,6 +1851,10 @@ def font(self) -> str:
18521851
def font(self, name: str) -> None:
18531852
if name in ('rm', 'it', 'bf', 'bfit'):
18541853
self.font_class = name
1854+
if name == 'normal':
1855+
# workaround to keep hardcoded maps in _mathtext_data.py
1856+
# font_class is exclusively used by STIXFonts
1857+
self.font_class = 'it'
18551858
self._font = name
18561859

18571860
def get_current_underline_thickness(self) -> float:

lib/matplotlib/_mathtext_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,7 @@
13401340
"\N{DOUBLE-STRUCK CAPITAL PI}"),
13411341
("\N{GREEK CAPITAL LETTER SIGMA}",
13421342
"\N{GREEK CAPITAL LETTER SIGMA}",
1343-
"it",
1343+
"rm",
13441344
"\N{DOUBLE-STRUCK N-ARY SUMMATION}"), # \Sigma (not in beta STIX fonts)
13451345
("\N{GREEK SMALL LETTER GAMMA}",
13461346
"\N{GREEK SMALL LETTER GAMMA}",

0 commit comments

Comments
 (0)