|
1 | | -# This is generated from a compiled module, and as such is very generic |
2 | | -# This could be more specific. Docstrings for this module are light |
| 1 | +from typing import BinaryIO, Literal |
3 | 2 |
|
4 | | -from typing import Any |
| 3 | +import numpy as np |
| 4 | +from numpy.typing import NDArray |
5 | 5 |
|
| 6 | +__freetype_build_type__: str |
| 7 | +__freetype_version__: str |
6 | 8 | BOLD: int |
7 | 9 | EXTERNAL_STREAM: int |
8 | 10 | FAST_GLYPHS: int |
@@ -41,54 +43,83 @@ SFNT: int |
41 | 43 | VERTICAL: int |
42 | 44 |
|
43 | 45 | class FT2Font: |
44 | | - ascender: Any |
45 | | - bbox: Any |
46 | | - descender: Any |
47 | | - face_flags: Any |
48 | | - family_name: Any |
49 | | - fname: Any |
50 | | - height: Any |
51 | | - max_advance_height: Any |
52 | | - max_advance_width: Any |
53 | | - num_charmaps: Any |
54 | | - num_faces: Any |
55 | | - num_fixed_sizes: Any |
56 | | - num_glyphs: Any |
57 | | - postscript_name: Any |
58 | | - scalable: Any |
59 | | - style_flags: Any |
60 | | - style_name: Any |
61 | | - underline_position: Any |
62 | | - underline_thickness: Any |
63 | | - units_per_EM: Any |
64 | | - def __init__(self, *args, **kwargs) -> None: ... |
65 | | - def _get_fontmap(self, *args, **kwargs) -> Any: ... |
66 | | - def clear(self, *args, **kwargs) -> Any: ... |
67 | | - def draw_glyph_to_bitmap(self, *args, **kwargs) -> Any: ... |
68 | | - def draw_glyphs_to_bitmap(self, *args, **kwargs) -> Any: ... |
69 | | - def get_bitmap_offset(self, *args, **kwargs) -> Any: ... |
70 | | - def get_char_index(self, *args, **kwargs) -> Any: ... |
71 | | - def get_charmap(self, *args, **kwargs) -> Any: ... |
72 | | - def get_descent(self, *args, **kwargs) -> Any: ... |
73 | | - def get_glyph_name(self, *args, **kwargs) -> Any: ... |
74 | | - def get_image(self, *args, **kwargs) -> Any: ... |
75 | | - def get_kerning(self, *args, **kwargs) -> Any: ... |
76 | | - def get_name_index(self, *args, **kwargs) -> Any: ... |
77 | | - def get_num_glyphs(self, *args, **kwargs) -> Any: ... |
78 | | - def get_path(self, *args, **kwargs) -> Any: ... |
79 | | - def get_ps_font_info(self, *args, **kwargs) -> Any: ... |
80 | | - def get_sfnt(self, *args, **kwargs) -> Any: ... |
81 | | - def get_sfnt_table(self, *args, **kwargs) -> Any: ... |
82 | | - def get_width_height(self, *args, **kwargs) -> Any: ... |
83 | | - def get_xys(self, *args, **kwargs) -> Any: ... |
84 | | - def load_char(self, *args, **kwargs) -> Any: ... |
85 | | - def load_glyph(self, *args, **kwargs) -> Any: ... |
86 | | - def select_charmap(self, *args, **kwargs) -> Any: ... |
87 | | - def set_charmap(self, *args, **kwargs) -> Any: ... |
88 | | - def set_size(self, *args, **kwargs) -> Any: ... |
89 | | - def set_text(self, *args, **kwargs) -> Any: ... |
| 46 | + ascender: int |
| 47 | + bbox: tuple[int, int, int, int] |
| 48 | + descender: int |
| 49 | + face_flags: int |
| 50 | + family_name: str |
| 51 | + fname: str |
| 52 | + height: int |
| 53 | + max_advance_height: int |
| 54 | + max_advance_width: int |
| 55 | + num_charmaps: int |
| 56 | + num_faces: int |
| 57 | + num_fixed_sizes: int |
| 58 | + num_glyphs: int |
| 59 | + postscript_name: str |
| 60 | + scalable: bool |
| 61 | + style_flags: int |
| 62 | + style_name: str |
| 63 | + underline_position: int |
| 64 | + underline_thickness: int |
| 65 | + units_per_EM: int |
90 | 66 |
|
91 | | -class FT2Image: |
92 | | - def __init__(self, *args, **kwargs) -> None: ... |
93 | | - def draw_rect(self, *args, **kwargs) -> Any: ... |
94 | | - def draw_rect_filled(self, *args, **kwargs) -> Any: ... |
| 67 | + def __init__( |
| 68 | + self, |
| 69 | + filename: str | BinaryIO, |
| 70 | + hinting_factor: int = ..., |
| 71 | + *, |
| 72 | + _fallback_list: list[FT2Font] | None = ..., |
| 73 | + _kerning_factor: int = ... |
| 74 | + ) -> None: ... |
| 75 | + def _get_fontmap(self, string: str) -> dict[str, FT2Font]: ... |
| 76 | + def clear(self) -> None: ... |
| 77 | + def draw_glyph_to_bitmap( |
| 78 | + self, image: FT2Image, x: float, y: float, glyph: Glyph, antialiased: bool = ... |
| 79 | + ) -> None: ... |
| 80 | + def draw_glyphs_to_bitmap(self, antialiased: bool = ...) -> None: ... |
| 81 | + def get_bitmap_offset(self) -> tuple[int, int]: ... |
| 82 | + def get_char_index(self, codepoint: int) -> int: ... |
| 83 | + def get_charmap(self) -> dict[int, int]: ... |
| 84 | + def get_descent(self) -> int: ... |
| 85 | + def get_glyph_name(self, index: int) -> str: ... |
| 86 | + def get_image(self) -> NDArray[np.uint8]: ... |
| 87 | + def get_kerning(self, left: int, right: int, mode: int) -> int: ... |
| 88 | + def get_name_index(self, name: str) -> int: ... |
| 89 | + def get_num_glyphs(self) -> int: ... |
| 90 | + def get_path(self) -> tuple[NDArray[np.float64], NDArray[np.int8]]: ... |
| 91 | + def get_ps_font_info( |
| 92 | + self, |
| 93 | + ) -> tuple[str, str, str, str, str, int, int, int, int]: ... |
| 94 | + def get_sfnt(self) -> dict[tuple[int, int, int, int], bytes]: ... |
| 95 | + def get_sfnt_table( |
| 96 | + self, name: Literal["head", "maxp", "OS/2", "hhea", "vhea", "post", "pclt"] |
| 97 | + ) -> dict[str, tuple[int, int, int, int] | tuple[int, int] | int | bytes]: ... |
| 98 | + def get_width_height(self) -> tuple[int, int]: ... |
| 99 | + def get_xys(self, antialiased: bool = ...) -> NDArray[np.float64]: ... |
| 100 | + def load_char(self, charcode: int, flags: int = ...) -> Glyph: ... |
| 101 | + def load_glyph(self, glyphindex: int, flags: int = ...) -> Glyph: ... |
| 102 | + def select_charmap(self, i: int) -> None: ... |
| 103 | + def set_charmap(self, i: int) -> None: ... |
| 104 | + def set_size(self, ptsize: float, dpi: float) -> None: ... |
| 105 | + def set_text( |
| 106 | + self, string: str, angle: float = ..., flags: int = ... |
| 107 | + ) -> NDArray[np.float64]: ... |
| 108 | + |
| 109 | +class FT2Image: # TODO: When updating mypy>=1.4, subclass from Buffer. |
| 110 | + def __init__(self, width: float, height: float) -> None: ... |
| 111 | + def draw_rect(self, x0: float, y0: float, x1: float, y1: float) -> None: ... |
| 112 | + def draw_rect_filled(self, x0: float, y0: float, x1: float, y1: float) -> None: ... |
| 113 | + |
| 114 | +class Glyph: |
| 115 | + width: int |
| 116 | + height: int |
| 117 | + horiBearingX: int |
| 118 | + horiBearingY: int |
| 119 | + horiAdvance: int |
| 120 | + linearHoriAdvance: int |
| 121 | + vertBearingX: int |
| 122 | + vertBearingY: int |
| 123 | + vertAdvance: int |
| 124 | + |
| 125 | + def bbox(self) -> tuple[int, int, int, int]: ... |
0 commit comments