MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / accent

Method accent

lib/matplotlib/_mathtext.py:2480–2501  ·  view source on GitHub ↗
(self, toks: ParseResults)

Source from the content-addressed store, hash-verified

2478 _wide_accents = set(r"widehat widetilde widebar".split())
2479
2480 def accent(self, toks: ParseResults) -> T.Any:
2481 state = self.get_state()
2482 thickness = state.get_current_underline_thickness()
2483 accent = toks["accent"]
2484 sym = toks["sym"]
2485 accent_box: Node
2486 if accent in self._wide_accents:
2487 accent_box = AutoWidthChar(
2488 '\\' + accent, sym.width, state, char_class=Accent)
2489 centered = HCentered([accent_box])
2490 else:
2491 accent_box = Accent(self._accent_map[accent], state)
2492 if accent == 'mathring':
2493 accent_box.shrink()
2494 accent_box.shrink()
2495 centered = HCentered([Hbox(sym.width / 4.0), accent_box])
2496 centered.hpack(sym.width, 'exactly')
2497 return Vlist([
2498 centered,
2499 Vbox(0., thickness * 2.0),
2500 Hlist([sym])
2501 ])
2502
2503 def function(self, s: str, loc: int, toks: ParseResults) -> T.Any:
2504 hlist = self.operatorname(s, loc, toks)

Callers

nothing calls this directly

Calls 11

get_stateMethod · 0.95
shrinkMethod · 0.95
AutoWidthCharClass · 0.85
HCenteredClass · 0.85
AccentClass · 0.85
HboxClass · 0.85
VlistClass · 0.85
VboxClass · 0.85
HlistClass · 0.85
hpackMethod · 0.80

Tested by

no test coverage detected