(text, fontprop, ismath, dpi)
| 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…