(self, s, prop, ismath)
| 44 | return urllib.parse.quote(f"{font.postscript_name}-{glyph:x}") |
| 45 | |
| 46 | def get_text_width_height_descent(self, s, prop, ismath): |
| 47 | fontsize = prop.get_size_in_points() |
| 48 | |
| 49 | if ismath == "TeX": |
| 50 | return TexManager().get_text_width_height_descent(s, fontsize) |
| 51 | |
| 52 | scale = fontsize / self.FONT_SCALE |
| 53 | |
| 54 | if ismath: |
| 55 | prop = prop.copy() |
| 56 | prop.set_size(self.FONT_SCALE) |
| 57 | width, height, descent, *_ = \ |
| 58 | self.mathtext_parser.parse(s, 72, prop) |
| 59 | return width * scale, height * scale, descent * scale |
| 60 | |
| 61 | font = self._get_font(prop) |
| 62 | font.set_text(s, 0.0, flags=LoadFlags.NO_HINTING) |
| 63 | w, h = font.get_width_height() |
| 64 | w /= 64.0 # convert from subpixels |
| 65 | h /= 64.0 |
| 66 | d = font.get_descent() |
| 67 | d /= 64.0 |
| 68 | return w * scale, h * scale, d * scale |
| 69 | |
| 70 | def get_text_path(self, prop, s, ismath=False, *, features=None, language=None): |
| 71 | """ |
no test coverage detected