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

Function _text_metrics

lib/matplotlib/text.py:116–125  ·  view source on GitHub ↗
(text, fontprop, ismath, dpi)

Source from the content-addressed store, hash-verified

114 @functools.lru_cache(4096)
115 # dpi is unused, but participates in cache invalidation (via the renderer).
116 def _text_metrics(text, fontprop, ismath, dpi):
117 # this should never happen under normal use, but this is a better error to
118 # raise than an AttributeError on `None`
119 if (local_renderer := renderer_ref()) is None:
120 raise RuntimeError(
121 "Trying to get text metrics for a renderer that no longer exists. "
122 "This should never happen and is evidence of a bug elsewhere."
123 )
124 # do the actual method call we need and return the result
125 return local_renderer.get_text_width_height_descent(text, fontprop, ismath)
126
127 # stash the function for later use.
128 _cache[input_renderer] = _text_metrics

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…