Draw the text by converting them to paths using `.TextToPath`. This private helper supports the same parameters as `~.RendererBase.draw_text`; setting *ismath* to "TeX" triggers TeX rendering.
(self, gc, x, y, s, prop, angle, ismath, mtext)
| 543 | self._draw_text_as_path(gc, x, y, s, prop, angle, ismath, mtext) |
| 544 | |
| 545 | def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath, mtext): |
| 546 | """ |
| 547 | Draw the text by converting them to paths using `.TextToPath`. |
| 548 | |
| 549 | This private helper supports the same parameters as |
| 550 | `~.RendererBase.draw_text`; setting *ismath* to "TeX" triggers TeX |
| 551 | rendering. |
| 552 | """ |
| 553 | if mtext is not None: |
| 554 | features = mtext.get_fontfeatures() |
| 555 | language = mtext.get_language() |
| 556 | else: |
| 557 | features = language = None |
| 558 | text2path = self._text2path |
| 559 | fontsize = self.points_to_pixels(prop.get_size_in_points()) |
| 560 | verts, codes = text2path.get_text_path(prop, s, ismath=ismath, |
| 561 | features=features, language=language) |
| 562 | path = Path(verts, codes) |
| 563 | if self.flipy(): |
| 564 | width, height = self.get_canvas_width_height() |
| 565 | transform = (Affine2D() |
| 566 | .scale(fontsize / text2path.FONT_SCALE) |
| 567 | .rotate_deg(angle) |
| 568 | .translate(x, height - y)) |
| 569 | else: |
| 570 | transform = (Affine2D() |
| 571 | .scale(fontsize / text2path.FONT_SCALE) |
| 572 | .rotate_deg(angle) |
| 573 | .translate(x, y)) |
| 574 | color = gc.get_rgb() |
| 575 | gc.set_linewidth(0.0) |
| 576 | self.draw_path(gc, path, transform, rgbFace=color) |
| 577 | |
| 578 | def get_text_width_height_descent(self, s, prop, ismath): |
| 579 | """ |
no test coverage detected