Skip to content

Commit 2a66d49

Browse files
committed
handle mathnormal
1 parent 05b5993 commit 2a66d49

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

lib/matplotlib/_mathtext.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -855,19 +855,19 @@ def _is_greek_lowercase(codepoint: CharacterCodeType) -> bool:
855855
if _is_digit(uniindex):
856856
# handle digits
857857
_alphabet_map = {
858+
'normal': 'up',
858859
'rm': 'up',
859-
'it': 'up', # convention! digits always upright - not handled in Parser
860+
'it': 'it',
860861
'tt': 'tt',
861862
'sf': 'sfup',
862863
'bf': 'bfup',
863864
'bfit': 'bfup',
864865
'bb': 'bb',
865866
}
866867
alphabet = _alphabet_map.get(fontname, 'up')
867-
alphabet_lut = unicode_math_lut.get(alphabet, {})
868-
new_uniindex = alphabet_lut.get(uniindex, uniindex)
869868
elif _is_latin_uppercase(uniindex) or _is_latin_lowercase(uniindex):
870869
_alphabet_map = {
870+
'normal': 'it',
871871
'rm': 'up',
872872
'cal': 'scr',
873873
'it': 'it',
@@ -880,20 +880,31 @@ def _is_greek_lowercase(codepoint: CharacterCodeType) -> bool:
880880
'scr': 'scr'
881881
}
882882
alphabet = _alphabet_map.get(fontname, 'up')
883-
alphabet_lut = unicode_math_lut.get(alphabet, {})
884-
new_uniindex = alphabet_lut.get(uniindex, uniindex)
885-
elif _is_greek_uppercase(uniindex) or _is_greek_lowercase(uniindex):
883+
elif _is_greek_uppercase(uniindex):
884+
_alphabet_map = {
885+
'normal': 'up',
886+
'rm': 'up',
887+
'it': 'it',
888+
'bf': 'bfup',
889+
'bfit': 'bfit',
890+
}
891+
alphabet = _alphabet_map.get(fontname, 'up')
892+
elif _is_greek_lowercase(uniindex):
886893
_alphabet_map = {
894+
'normal': 'it',
887895
'rm': 'up',
888896
'it': 'it',
889897
'bf': 'bfup',
890898
'bfit': 'bfit',
891899
}
892900
alphabet = _alphabet_map.get(fontname, 'up')
901+
else:
902+
alphabet = 'up'
903+
904+
if (alphabet != 'up'):
893905
alphabet_lut = unicode_math_lut.get(alphabet, {})
894906
new_uniindex = alphabet_lut.get(uniindex, uniindex)
895907
else:
896-
alphabet = 'up'
897908
new_uniindex = uniindex
898909

899910
slanted = (alphabet == 'it') or sym in self._slanted_symbols

0 commit comments

Comments
 (0)