1
- from typing import BinaryIO , Literal
1
+ from typing import BinaryIO , Literal , TypedDict , overload
2
2
3
3
import numpy as np
4
4
from numpy .typing import NDArray
@@ -42,6 +42,122 @@ SCALABLE: int
42
42
SFNT : int
43
43
VERTICAL : int
44
44
45
+ class _SfntHeadDict (TypedDict ):
46
+ version : tuple [int , int ]
47
+ fontRevision : tuple [int , int ]
48
+ checkSumAdjustment : int
49
+ magicNumber : int
50
+ flags : int
51
+ unitsPerEm : int
52
+ created : tuple [int , int ]
53
+ modified : tuple [int , int ]
54
+ xMin : int
55
+ yMin : int
56
+ xMax : int
57
+ yMax : int
58
+ macStyle : int
59
+ lowestRecPPEM : int
60
+ fontDirectionHint : int
61
+ indexToLocFormat : int
62
+ glyphDataFormat : int
63
+
64
+ class _SfntMaxpDict (TypedDict ):
65
+ version : tuple [int , int ]
66
+ numGlyphs : int
67
+ maxPoints : int
68
+ maxContours : int
69
+ maxComponentPoints : int
70
+ maxComponentContours : int
71
+ maxZones : int
72
+ maxTwilightPoints : int
73
+ maxStorage : int
74
+ maxFunctionDefs : int
75
+ maxInstructionDefs : int
76
+ maxStackElements : int
77
+ maxSizeOfInstructions : int
78
+ maxComponentElements : int
79
+ maxComponentDepth : int
80
+
81
+ class _SfntOs2Dict (TypedDict ):
82
+ version : int
83
+ xAvgCharWidth : int
84
+ usWeightClass : int
85
+ usWidthClass : int
86
+ fsType : int
87
+ ySubscriptXSize : int
88
+ ySubscriptYSize : int
89
+ ySubscriptXOffset : int
90
+ ySubscriptYOffset : int
91
+ ySuperscriptXSize : int
92
+ ySuperscriptYSize : int
93
+ ySuperscriptXOffset : int
94
+ ySuperscriptYOffset : int
95
+ yStrikeoutSize : int
96
+ yStrikeoutPosition : int
97
+ sFamilyClass : int
98
+ panose : bytes
99
+ ulCharRange : tuple [int , int , int , int ]
100
+ achVendID : bytes
101
+ fsSelection : int
102
+ fsFirstCharIndex : int
103
+ fsLastCharIndex : int
104
+
105
+ class _SfntHheaDict (TypedDict ):
106
+ version : tuple [int , int ]
107
+ ascent : int
108
+ descent : int
109
+ lineGap : int
110
+ advanceWidthMax : int
111
+ minLeftBearing : int
112
+ minRightBearing : int
113
+ xMaxExtent : int
114
+ caretSlopeRise : int
115
+ caretSlopeRun : int
116
+ caretOffset : int
117
+ metricDataFormat : int
118
+ numOfLongHorMetrics : int
119
+
120
+ class _SfntVheaDict (TypedDict ):
121
+ version : tuple [int , int ]
122
+ vertTypoAscender : int
123
+ vertTypoDescender : int
124
+ vertTypoLineGap : int
125
+ advanceHeightMax : int
126
+ minTopSideBearing : int
127
+ minBottomSizeBearing : int
128
+ yMaxExtent : int
129
+ caretSlopeRise : int
130
+ caretSlopeRun : int
131
+ caretOffset : int
132
+ metricDataFormat : int
133
+ numOfLongVerMetrics : int
134
+
135
+ class _SfntPostDict (TypedDict ):
136
+ format : tuple [int , int ]
137
+ italicAngle : tuple [int , int ]
138
+ underlinePosition : int
139
+ underlineThickness : int
140
+ isFixedPitch : int
141
+ minMemType42 : int
142
+ maxMemType42 : int
143
+ minMemType1 : int
144
+ maxMemType1 : int
145
+
146
+ class _SfntPcltDict (TypedDict ):
147
+ version : tuple [int , int ]
148
+ fontNumber : int
149
+ pitch : int
150
+ xHeight : int
151
+ style : int
152
+ typeFamily : int
153
+ capHeight : int
154
+ symbolSet : int
155
+ typeFace : bytes
156
+ characterComplement : bytes
157
+ strokeWeight : int
158
+ widthType : int
159
+ serifStyle : int
160
+
45
161
class FT2Font :
46
162
ascender : int
47
163
bbox : tuple [int , int , int , int ]
@@ -92,9 +208,20 @@ class FT2Font:
92
208
self ,
93
209
) -> tuple [str , str , str , str , str , int , int , int , int ]: ...
94
210
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 ]: ...
211
+ @overload
212
+ def get_sfnt_table (self , name : Literal ["head" ]) -> _SfntHeadDict | None : ...
213
+ @overload
214
+ def get_sfnt_table (self , name : Literal ["maxp" ]) -> _SfntMaxpDict | None : ...
215
+ @overload
216
+ def get_sfnt_table (self , name : Literal ["OS/2" ]) -> _SfntOs2Dict | None : ...
217
+ @overload
218
+ def get_sfnt_table (self , name : Literal ["hhea" ]) -> _SfntHheaDict | None : ...
219
+ @overload
220
+ def get_sfnt_table (self , name : Literal ["vhea" ]) -> _SfntVheaDict | None : ...
221
+ @overload
222
+ def get_sfnt_table (self , name : Literal ["post" ]) -> _SfntPostDict | None : ...
223
+ @overload
224
+ def get_sfnt_table (self , name : Literal ["pclt" ]) -> _SfntPcltDict | None : ...
98
225
def get_width_height (self ) -> tuple [int , int ]: ...
99
226
def get_xys (self , antialiased : bool = ...) -> NDArray [np .float64 ]: ...
100
227
def load_char (self , charcode : int , flags : int = ...) -> Glyph : ...
@@ -122,4 +249,5 @@ class Glyph:
122
249
vertBearingY : int
123
250
vertAdvance : int
124
251
252
+ @property
125
253
def bbox (self ) -> tuple [int , int , int , int ]: ...
0 commit comments