8000 Merge pull request #4274 from mdboom/angstrom · matplotlib/matplotlib@e262edb · GitHub
[go: up one dir, main page]

Skip to content

Commit e262edb

Browse files
committed
Merge pull request #4274 from mdboom/angstrom
FIX : Angstrom symbol rendering
2 parents 775b7f4 + 1ed438a commit e262edb

12 files changed

+388
-7
lines changed

lib/matplotlib/_mathtext_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,7 @@
22812281
'obar' : 9021,
22822282
'supseteq' : 8839,
22832283
'nu' : 957,
2284-
'AA' : 8491,
2284+
'AA' : 197,
22852285
'AE' : 198,
22862286
'models' : 8871,
22872287
'ominus' : 8854,

lib/matplotlib/mathtext.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,7 +2475,7 @@ def unknown_symbol(self, s, loc, toks):
24752475
# The first 2 entires in the tuple are (font, char, sizescale) for
24762476
# the two symbols under and over. The third element is the space
24772477
# (in multiples of underline height)
2478-
r'AA' : ( ('rm', 'A', 1.0), (None, '\circ', 0.5), 0.0),
2478+
r'AA' : ( ('it', 'A', 1.0), (None, '\circ', 0.5), 0.0),
24792479
}
24802480

24812481
def c_over_c(self, s, loc, toks):
@@ -2532,7 +2532,8 @@ def c_over_c(self, s, loc, toks):
25322532
r'.' : r'\combiningdotabove',
25332533
r'^' : r'\circumflexaccent',
25342534
r'overrightarrow' : r'\rightarrow',
2535-
r'overleftarrow' : r'\leftarrow'
2535+
r'overleftarrow' : r'\leftarrow',
2536+
r'mathring' : r'\circ'
25362537
}
25372538

25382539
_wide_accents = set(r"widehat widetilde widebar".split())
@@ -2546,11 +2547,14 @@ def accent(self, s, loc, toks):
25462547
raise ParseFatalException("Error parsing accent")
25472548
accent, sym = toks[0]
25482549
if accent in self._wide_accents:
2549-
accent = AutoWidthChar(
2550+
accent_box = AutoWidthChar(
25502551
'\\' + accent, sym.width, state, char_class=Accent)
25512552
else:
2552-
accent = Accent(self._accent_map[accent], state)
2553-
centered = HCentered([accent])
2553+
accent_box = Accent(self._accent_map[accent], state)
2554+
if accent == 'mathring':
2555+
accent_box.shrink()
2556+
accent_box.shrink()
2557+
centered = HCentered([Hbox(sym.width / 4.0), accent_box])
25542558
centered.hpack(sym.width, 'exactly')
25552559
return Vlist([
25562560
centered,
Binary file not shown.
Loading
Lines changed: 141 additions & 0 deletions
Loading
Binary file not shown.
Loading
Lines changed: 124 additions & 0 deletions
Loading
Binary file not shown.
Loading

0 commit comments

Comments
 (0)
0