(self, s, dpi, prop, antialiased, load_glyph_flags)
| 87 | |
| 88 | @functools.lru_cache(50) |
| 89 | def _parse_cached(self, s, dpi, prop, antialiased, load_glyph_flags): |
| 90 | if prop is None: |
| 91 | prop = FontProperties() |
| 92 | fontset_class = _api.getitem_checked( |
| 93 | self._font_type_mapping, fontset=prop.get_math_fontfamily()) |
| 94 | fontset = fontset_class(prop, load_glyph_flags) |
| 95 | fontsize = prop.get_size_in_points() |
| 96 | |
| 97 | if self._parser is None: # Cache the parser globally. |
| 98 | self.__class__._parser = _mathtext.Parser() |
| 99 | |
| 100 | box = self._parser.parse(s, fontset, fontsize, dpi) |
| 101 | output = _mathtext.ship(box) |
| 102 | if self._output_type == "vector": |
| 103 | return output.to_vector() |
| 104 | elif self._output_type == "raster": |
| 105 | return output.to_raster(antialiased=antialiased) |
| 106 | |
| 107 | |
| 108 | def math_to_image(s, filename_or_obj, prop=None, dpi=None, format=None, |
no test coverage detected