textpath.pyi 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. from matplotlib.font_manager import FontProperties
  2. from matplotlib.ft2font import FT2Font
  3. from matplotlib.mathtext import MathTextParser, VectorParse
  4. from matplotlib.path import Path
  5. import numpy as np
  6. from typing import Literal
  7. class TextToPath:
  8. FONT_SCALE: float
  9. DPI: float
  10. mathtext_parser: MathTextParser[VectorParse]
  11. def __init__(self) -> None: ...
  12. def get_text_width_height_descent(
  13. self, s: str, prop: FontProperties, ismath: bool | Literal["TeX"]
  14. ) -> tuple[float, float, float]: ...
  15. def get_text_path(
  16. self, prop: FontProperties, s: str, ismath: bool | Literal["TeX"] = ...
  17. ) -> list[np.ndarray]: ...
  18. def get_glyphs_with_font(
  19. self,
  20. font: FT2Font,
  21. s: str,
  22. glyph_map: dict[str, tuple[np.ndarray, np.ndarray]] | None = ...,
  23. return_new_glyphs_only: bool = ...,
  24. ) -> tuple[
  25. list[tuple[str, float, float, float]],
  26. dict[str, tuple[np.ndarray, np.ndarray]],
  27. list[tuple[list[tuple[float, float]], list[int]]],
  28. ]: ...
  29. def get_glyphs_mathtext(
  30. self,
  31. prop: FontProperties,
  32. s: str,
  33. glyph_map: dict[str, tuple[np.ndarray, np.ndarray]] | None = ...,
  34. return_new_glyphs_only: bool = ...,
  35. ) -> tuple[
  36. list[tuple[str, float, float, float]],
  37. dict[str, tuple[np.ndarray, np.ndarray]],
  38. list[tuple[list[tuple[float, float]], list[int]]],
  39. ]: ...
  40. def get_glyphs_tex(
  41. self,
  42. prop: FontProperties,
  43. s: str,
  44. glyph_map: dict[str, tuple[np.ndarray, np.ndarray]] | None = ...,
  45. return_new_glyphs_only: bool = ...,
  46. ) -> tuple[
  47. list[tuple[str, float, float, float]],
  48. dict[str, tuple[np.ndarray, np.ndarray]],
  49. list[tuple[list[tuple[float, float]], list[int]]],
  50. ]: ...
  51. text_to_path: TextToPath
  52. class TextPath(Path):
  53. def __init__(
  54. self,
  55. xy: tuple[float, float],
  56. s: str,
  57. size: float | None = ...,
  58. prop: FontProperties | None = ...,
  59. _interpolation_steps: int = ...,
  60. usetex: bool = ...,
  61. ) -> None: ...
  62. def set_size(self, size: float | None) -> None: ...
  63. def get_size(self) -> float | None: ...
  64. # These are read only... there actually are protections in the base class, so probably can be deleted...
  65. @property # type: ignore[misc]
  66. def vertices(self) -> np.ndarray: ... # type: ignore[override]
  67. @property # type: ignore[misc]
  68. def codes(self) -> np.ndarray: ... # type: ignore[override]