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

Method _make_space

lib/matplotlib/_mathtext.py:2356–2369  ·  view source on GitHub ↗
(self, percentage: float)

Source from the content-addressed store, hash-verified

2354 return [hlist]
2355
2356 def _make_space(self, percentage: float) -> Kern:
2357 # In TeX, an em (the unit usually used to measure horizontal lengths)
2358 # is not the width of the character 'm'; it is the same in different
2359 # font styles (e.g. roman or italic). Mathtext, however, uses 'm' in
2360 # the normal style so that horizontal spaces don't depend on the
2361 # current font style.
2362 # TODO: this should be read from the font file
2363 state = self.get_state()
2364 key = (state.font, state.fontsize, state.dpi)
2365 width = self._em_width_cache.get(key)
2366 if width is None:
2367 width = state.fontset.get_quad('normal', state.fontsize, state.dpi)
2368 self._em_width_cache[key] = width
2369 return Kern(width * percentage)
2370
2371 _space_widths = {
2372 r'\,': 0.16667, # 3/18 em = 3 mu

Callers 5

spaceMethod · 0.95
customspaceMethod · 0.95
symbolMethod · 0.95
operatornameMethod · 0.95
subsuperMethod · 0.95

Calls 4

get_stateMethod · 0.95
KernClass · 0.85
getMethod · 0.45
get_quadMethod · 0.45

Tested by

no test coverage detected