1 | #![allow (non_camel_case_types)] |
2 | #![allow (non_snake_case)] |
3 | #![allow (non_upper_case_globals)] |
4 | #![deny (missing_copy_implementations)] |
5 | |
6 | use libc::{ |
7 | c_char, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, ptrdiff_t, size_t, |
8 | }; |
9 | |
10 | mod tt_tables; |
11 | pub use crate::tt_tables::*; |
12 | |
13 | // Basic Data Types |
14 | pub type FT_Byte = c_uchar; |
15 | pub type FT_Bytes = *const FT_Byte; |
16 | pub type FT_Char = c_char; |
17 | pub type FT_Int = c_int; |
18 | pub type FT_UInt = c_uint; |
19 | pub type FT_Int16 = c_short; |
20 | pub type FT_UInt16 = c_ushort; |
21 | pub type FT_Int32 = i32; |
22 | pub type FT_UInt32 = u32; |
23 | pub type FT_Int64 = i64; |
24 | pub type FT_UInt64 = u64; |
25 | pub type FT_Short = c_short; |
26 | pub type FT_UShort = c_ushort; |
27 | pub type FT_Long = c_long; |
28 | pub type FT_ULong = c_ulong; |
29 | pub type FT_Bool = c_uchar; |
30 | pub type FT_Offset = size_t; |
31 | pub type FT_PtrDist = ptrdiff_t; |
32 | pub type FT_String = c_char; |
33 | pub type FT_Tag = FT_UInt32; |
34 | pub type FT_Error = c_int; |
35 | pub type FT_Fixed = c_long; |
36 | pub type FT_Pointer = *mut c_void; |
37 | pub type FT_Pos = c_long; |
38 | pub type FT_FWord = c_short; |
39 | pub type FT_UFWord = c_ushort; |
40 | pub type FT_F2Dot14 = c_short; |
41 | pub type FT_F26Dot6 = c_long; |
42 | pub type FT_Generic_Finalizer = extern "C" fn(*mut c_void); |
43 | pub type FT_StreamDesc = *mut c_void; |
44 | pub type FT_Stream_IoFunc = extern "C" fn(FT_Stream, c_ulong, *mut c_uchar, c_ulong) -> c_ulong; |
45 | pub type FT_Stream_CloseFunc = extern "C" fn(FT_Stream); |
46 | pub type FT_Alloc_Func = extern "C" fn(FT_Memory, c_long) -> *mut c_void; |
47 | pub type FT_Free_Func = extern "C" fn(FT_Memory, *mut c_void); |
48 | pub type FT_Realloc_Func = extern "C" fn(FT_Memory, c_long, c_long, *mut c_void) -> *mut c_void; |
49 | pub type FT_Outline_MoveToFunc = extern "C" fn(to: *const FT_Vector, user: *mut c_void) -> c_int; |
50 | pub type FT_Outline_LineToFunc = extern "C" fn(to: *const FT_Vector, user: *mut c_void) -> c_int; |
51 | pub type FT_Outline_ConicToFunc = |
52 | extern "C" fn(control: *const FT_Vector, to: *const FT_Vector, user: *mut c_void) -> c_int; |
53 | pub type FT_Outline_CubicToFunc = extern "C" fn( |
54 | control1: *const FT_Vector, |
55 | control2: *const FT_Vector, |
56 | to: *const FT_Vector, |
57 | user: *mut c_void, |
58 | ) -> c_int; |
59 | pub type FT_SpanFunc = |
60 | extern "C" fn(y: c_int, count: c_int, spans: *const FT_Span, user: *mut c_void); |
61 | pub type FT_Raster_BitTest_Func = extern "C" fn(y: c_int, x: c_int, user: *mut c_void) -> c_int; |
62 | pub type FT_Raster_BitSet_Func = extern "C" fn(y: c_int, x: c_int, user: *mut c_void); |
63 | |
64 | pub trait FTErrorMethods { |
65 | fn succeeded(&self) -> bool; |
66 | } |
67 | |
68 | impl FTErrorMethods for FT_Error { |
69 | fn succeeded(&self) -> bool { |
70 | *self == 0 |
71 | } |
72 | } |
73 | |
74 | // Structs |
75 | #[repr (C)] |
76 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq, Default)] |
77 | pub struct FT_Vector { |
78 | pub x: FT_Pos, |
79 | pub y: FT_Pos, |
80 | } |
81 | |
82 | #[repr (C)] |
83 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq, Default)] |
84 | pub struct FT_BBox { |
85 | pub xMin: FT_Pos, |
86 | pub yMin: FT_Pos, |
87 | pub xMax: FT_Pos, |
88 | pub yMax: FT_Pos, |
89 | } |
90 | |
91 | #[repr (C)] |
92 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
93 | pub struct FT_Matrix { |
94 | pub xx: FT_Fixed, |
95 | pub xy: FT_Fixed, |
96 | pub yx: FT_Fixed, |
97 | pub yy: FT_Fixed, |
98 | } |
99 | |
100 | #[repr (C)] |
101 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
102 | pub struct FT_UnitVector { |
103 | pub x: FT_F2Dot14, |
104 | pub y: FT_F2Dot14, |
105 | } |
106 | |
107 | #[repr (C)] |
108 | #[derive (Debug, Hash, PartialEq, Eq)] |
109 | #[allow (missing_copy_implementations)] |
110 | pub struct FT_Bitmap { |
111 | pub rows: c_int, |
112 | pub width: c_int, |
113 | pub pitch: c_int, |
114 | pub buffer: *mut c_uchar, |
115 | pub num_grays: c_short, |
116 | pub pixel_mode: c_char, |
117 | pub palette_mode: c_char, |
118 | pub palette: *mut c_void, |
119 | } |
120 | |
121 | #[repr (C)] |
122 | #[derive (Debug, Hash, PartialEq, Eq)] |
123 | #[allow (missing_copy_implementations)] |
124 | pub struct FT_Data { |
125 | pub pointer: *const FT_Byte, |
126 | pub length: FT_Int, |
127 | } |
128 | |
129 | #[repr (C)] |
130 | #[derive (Debug, Hash, PartialEq, Eq)] |
131 | #[allow (missing_copy_implementations)] |
132 | pub struct FT_Generic { |
133 | pub data: *mut c_void, |
134 | pub finalizer: FT_Generic_Finalizer, |
135 | } |
136 | |
137 | #[repr (C)] |
138 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
139 | pub struct FT_Size_Metrics { |
140 | pub x_ppem: FT_UShort, |
141 | pub y_ppem: FT_UShort, |
142 | |
143 | pub x_scale: FT_Fixed, |
144 | pub y_scale: FT_Fixed, |
145 | |
146 | pub ascender: FT_Pos, |
147 | pub descender: FT_Pos, |
148 | pub height: FT_Pos, |
149 | pub max_advance: FT_Pos, |
150 | } |
151 | |
152 | #[repr (C)] |
153 | #[derive (Debug, Hash, PartialEq, Eq)] |
154 | #[allow (missing_copy_implementations)] |
155 | pub struct FT_Outline { |
156 | pub n_contours: c_short, |
157 | pub n_points: c_short, |
158 | |
159 | pub points: *mut FT_Vector, |
160 | pub tags: *mut c_char, |
161 | pub contours: *mut c_short, |
162 | |
163 | pub flags: c_int, |
164 | } |
165 | |
166 | #[repr (C)] |
167 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
168 | pub struct FT_Glyph_Metrics { |
169 | pub width: FT_Pos, |
170 | pub height: FT_Pos, |
171 | |
172 | pub horiBearingX: FT_Pos, |
173 | pub horiBearingY: FT_Pos, |
174 | pub horiAdvance: FT_Pos, |
175 | |
176 | pub vertBearingX: FT_Pos, |
177 | pub vertBearingY: FT_Pos, |
178 | pub vertAdvance: FT_Pos, |
179 | } |
180 | |
181 | #[repr (C)] |
182 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
183 | pub struct FT_Parameter { |
184 | pub tag: FT_ULong, |
185 | pub data: FT_Pointer, |
186 | } |
187 | |
188 | #[repr (C)] |
189 | #[derive (Debug, Hash, PartialEq, Eq)] |
190 | #[allow (missing_copy_implementations)] |
191 | pub struct FT_Open_Args { |
192 | pub flags: FT_UInt, |
193 | pub memory_base: *const FT_Byte, |
194 | pub memory_size: FT_Long, |
195 | pub pathname: *mut FT_String, |
196 | pub stream: FT_Stream, |
197 | pub driver: FT_Module, |
198 | pub num_params: FT_Int, |
199 | pub params: *mut FT_Parameter, |
200 | } |
201 | |
202 | #[repr (C)] |
203 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
204 | pub struct FT_Bitmap_Size { |
205 | pub height: FT_Short, |
206 | pub width: FT_Short, |
207 | |
208 | pub size: FT_Pos, |
209 | |
210 | pub x_ppem: FT_Pos, |
211 | pub y_ppem: FT_Pos, |
212 | } |
213 | |
214 | #[repr (C)] |
215 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
216 | pub struct TT_OS2 { |
217 | pub version: FT_UShort, |
218 | pub xAvgCharWidth: FT_Short, |
219 | pub usWeightClass: FT_UShort, |
220 | pub usWidthClass: FT_UShort, |
221 | pub fsType: FT_UShort, |
222 | pub ySubscriptXSize: FT_Short, |
223 | pub ySubscriptYSize: FT_Short, |
224 | pub ySubscriptXOffset: FT_Short, |
225 | pub ySubscriptYOffset: FT_Short, |
226 | pub ySuperscriptXSize: FT_Short, |
227 | pub ySuperscriptYSize: FT_Short, |
228 | pub ySuperscriptXOffset: FT_Short, |
229 | pub ySuperscriptYOffset: FT_Short, |
230 | pub yStrikeoutSize: FT_Short, |
231 | pub yStrikeoutPosition: FT_Short, |
232 | pub sFamilyClass: FT_Short, |
233 | |
234 | pub panose: [FT_Byte; 10], |
235 | |
236 | pub ulUnicodeRange1: FT_ULong, /* Bits 0-31 */ |
237 | pub ulUnicodeRange2: FT_ULong, /* Bits 32-63 */ |
238 | pub ulUnicodeRange3: FT_ULong, /* Bits 64-95 */ |
239 | pub ulUnicodeRange4: FT_ULong, /* Bits 96-127 */ |
240 | |
241 | pub achVendID: [FT_Char; 4], |
242 | |
243 | pub fsSelection: FT_UShort, |
244 | pub usFirstCharIndex: FT_UShort, |
245 | pub usLastCharIndex: FT_UShort, |
246 | pub sTypoAscender: FT_Short, |
247 | pub sTypoDescender: FT_Short, |
248 | pub sTypoLineGap: FT_Short, |
249 | pub usWinAscent: FT_UShort, |
250 | pub usWinDescent: FT_UShort, |
251 | |
252 | /* only version 1 tables */ |
253 | pub ulCodePageRange1: FT_ULong, /* Bits 0-31 */ |
254 | pub ulCodePageRange2: FT_ULong, /* Bits 32-63 */ |
255 | |
256 | /* only version 2 tables */ |
257 | pub sxHeight: FT_Short, |
258 | pub sCapHeight: FT_Short, |
259 | pub usDefaultChar: FT_UShort, |
260 | pub usBreakChar: FT_UShort, |
261 | pub usMaxContext: FT_UShort, |
262 | } |
263 | |
264 | #[repr (C)] |
265 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
266 | pub struct TT_Postscript { |
267 | pub formatType: FT_Fixed, |
268 | pub italicAngle: FT_Fixed, |
269 | pub underlinePosition: FT_Short, |
270 | pub underlineThickness: FT_Short, |
271 | pub isFixedPitch: FT_ULong, |
272 | pub minMemType42: FT_ULong, |
273 | pub maxMemType42: FT_ULong, |
274 | pub minMemType1: FT_ULong, |
275 | pub maxMemType1: FT_ULong, |
276 | /* Glyph names follow in the 'post' table, but we don't */ |
277 | /* load them by default. */ |
278 | } |
279 | |
280 | #[repr (C)] |
281 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
282 | pub struct FT_Span { |
283 | pub x: c_short, |
284 | pub len: c_ushort, |
285 | pub coverage: c_uchar, |
286 | } |
287 | |
288 | #[repr (C)] |
289 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
290 | pub struct FT_MM_Axis { |
291 | pub name: *mut FT_String, |
292 | pub minimum: FT_Long, |
293 | pub maximum: FT_Long, |
294 | } |
295 | |
296 | #[repr (C)] |
297 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
298 | pub struct FT_Multi_Master { |
299 | pub num_axis: FT_UInt, |
300 | pub num_designs: FT_UInt, |
301 | pub axis: [FT_MM_Axis; 4], |
302 | } |
303 | |
304 | #[repr (C)] |
305 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
306 | pub struct FT_Var_Axis { |
307 | pub name: *mut FT_String, |
308 | pub minimum: FT_Fixed, |
309 | pub def: FT_Fixed, |
310 | pub maximum: FT_Fixed, |
311 | pub tag: FT_ULong, |
312 | pub strid: FT_UInt, |
313 | } |
314 | |
315 | #[repr (C)] |
316 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
317 | pub struct FT_Var_Named_Style { |
318 | pub coords: *mut FT_Fixed, |
319 | pub strid: FT_UInt, |
320 | pub psid: FT_UInt, |
321 | } |
322 | |
323 | #[repr (C)] |
324 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
325 | pub struct FT_MM_Var { |
326 | pub num_axis: FT_UInt, |
327 | pub num_designs: FT_UInt, |
328 | pub num_namedstyles: FT_UInt, |
329 | pub axis: *mut FT_Var_Axis, |
330 | pub namedstyle: *mut FT_Var_Named_Style, |
331 | } |
332 | |
333 | #[repr (C)] |
334 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
335 | pub struct FT_SfntName { |
336 | pub platform_id: FT_UShort, |
337 | pub encoding_id: FT_UShort, |
338 | pub language_id: FT_UShort, |
339 | pub name_id: FT_UShort, |
340 | |
341 | pub string: *mut FT_Byte, /* this string is *not* null-terminated! */ |
342 | pub string_len: FT_UInt, /* in bytes */ |
343 | } |
344 | |
345 | #[repr (C)] |
346 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
347 | pub struct FT_SfntLangTag { |
348 | pub string: *mut FT_Byte, |
349 | pub string_len: FT_UInt, |
350 | } |
351 | |
352 | // Enums |
353 | |
354 | pub type enum_FT_Sfnt_Tag_ = c_uint; |
355 | pub const ft_sfnt_head: u32 = 0_u32; |
356 | pub const ft_sfnt_maxp: u32 = 1_u32; |
357 | pub const ft_sfnt_os2: u32 = 2_u32; |
358 | pub const ft_sfnt_hhea: u32 = 3_u32; |
359 | pub const ft_sfnt_vhea: u32 = 4_u32; |
360 | pub const ft_sfnt_post: u32 = 5_u32; |
361 | pub const ft_sfnt_pclt: u32 = 6_u32; |
362 | pub const ft_sfnt_max: u32 = 7_u32; |
363 | pub type FT_Sfnt_Tag = enum_FT_Sfnt_Tag_; |
364 | |
365 | pub type FT_Pixel_Mode = c_uint; |
366 | pub const FT_PIXEL_MODE_NONE: FT_Pixel_Mode = 0; |
367 | pub const FT_PIXEL_MODE_MONO: FT_Pixel_Mode = 1; |
368 | pub const FT_PIXEL_MODE_GRAY: FT_Pixel_Mode = 2; |
369 | pub const FT_PIXEL_MODE_GRAY2: FT_Pixel_Mode = 3; |
370 | pub const FT_PIXEL_MODE_GRAY4: FT_Pixel_Mode = 4; |
371 | pub const FT_PIXEL_MODE_LCD: FT_Pixel_Mode = 5; |
372 | pub const FT_PIXEL_MODE_LCD_V: FT_Pixel_Mode = 6; |
373 | pub const FT_PIXEL_MODE_BGRA: FT_Pixel_Mode = 7; |
374 | pub const FT_PIXEL_MODE_MAX: FT_Pixel_Mode = 8; |
375 | |
376 | pub type FT_Glyph_Format = c_uint; |
377 | pub const FT_GLYPH_FORMAT_NONE: FT_Glyph_Format = 0; |
378 | pub const FT_GLYPH_FORMAT_COMPOSITE: FT_Glyph_Format = 1668246896; |
379 | pub const FT_GLYPH_FORMAT_BITMAP: FT_Glyph_Format = 1651078259; |
380 | pub const FT_GLYPH_FORMAT_OUTLINE: FT_Glyph_Format = 1869968492; |
381 | pub const FT_GLYPH_FORMAT_PLOTTER: FT_Glyph_Format = 1886154612; |
382 | |
383 | pub type FT_Render_Mode = c_uint; |
384 | pub const FT_RENDER_MODE_NORMAL: FT_Render_Mode = 0; |
385 | pub const FT_RENDER_MODE_LIGHT: FT_Render_Mode = 1; |
386 | pub const FT_RENDER_MODE_MONO: FT_Render_Mode = 2; |
387 | pub const FT_RENDER_MODE_LCD: FT_Render_Mode = 3; |
388 | pub const FT_RENDER_MODE_LCD_V: FT_Render_Mode = 4; |
389 | pub const FT_RENDER_MODE_SDF: FT_Render_Mode = 5; |
390 | pub const FT_RENDER_MODE_MAX: FT_Render_Mode = FT_RENDER_MODE_SDF + 1; |
391 | |
392 | pub type FT_LcdFilter = c_uint; |
393 | pub const FT_LCD_FILTER_NONE: FT_LcdFilter = 0; |
394 | pub const FT_LCD_FILTER_DEFAULT: FT_LcdFilter = 1; |
395 | pub const FT_LCD_FILTER_LIGHT: FT_LcdFilter = 3; |
396 | pub const FT_LCD_FILTER_LEGACY1: FT_LcdFilter = 3; |
397 | pub const FT_LCD_FILTER_LEGACY: FT_LcdFilter = 16; |
398 | pub const FT_LCD_FILTER_MAX: FT_LcdFilter = 17; |
399 | |
400 | pub type FT_Encoding = c_uint; |
401 | pub const FT_ENCODING_NONE: FT_Encoding = 0; |
402 | pub const FT_ENCODING_MS_SYMBOL: FT_Encoding = 1937337698; |
403 | pub const FT_ENCODING_UNICODE: FT_Encoding = 1970170211; |
404 | pub const FT_ENCODING_SJIS: FT_Encoding = 1936353651; |
405 | pub const FT_ENCODING_GB2312: FT_Encoding = 1734484000; |
406 | pub const FT_ENCODING_BIG5: FT_Encoding = 1651074869; |
407 | pub const FT_ENCODING_WANSUNG: FT_Encoding = 2002873971; |
408 | pub const FT_ENCODING_JOHAB: FT_Encoding = 1785686113; |
409 | pub const FT_ENCODING_MS_SJIS: FT_Encoding = 1936353651; |
410 | pub const FT_ENCODING_MS_GB2312: FT_Encoding = 1734484000; |
411 | pub const FT_ENCODING_MS_BIG5: FT_Encoding = 1651074869; |
412 | pub const FT_ENCODING_MS_WANSUNG: FT_Encoding = 2002873971; |
413 | pub const FT_ENCODING_MS_JOHAB: FT_Encoding = 1785686113; |
414 | pub const FT_ENCODING_ADOBE_STANDARD: FT_Encoding = 1094995778; |
415 | pub const FT_ENCODING_ADOBE_EXPERT: FT_Encoding = 1094992453; |
416 | pub const FT_ENCODING_ADOBE_CUSTOM: FT_Encoding = 1094992451; |
417 | pub const FT_ENCODING_ADOBE_LATIN_1: FT_Encoding = 1818326065; |
418 | pub const FT_ENCODING_OLD_LATIN_2: FT_Encoding = 1818326066; |
419 | pub const FT_ENCODING_APPLE_ROMAN: FT_Encoding = 1634889070; |
420 | |
421 | pub type FT_Size_Request_Type = c_uint; |
422 | pub const FT_SIZE_REQUEST_TYPE_NOMINAL: FT_Size_Request_Type = 0; |
423 | pub const FT_SIZE_REQUEST_TYPE_REAL_DIM: FT_Size_Request_Type = 1; |
424 | pub const FT_SIZE_REQUEST_TYPE_BBOX: FT_Size_Request_Type = 2; |
425 | pub const FT_SIZE_REQUEST_TYPE_CELL: FT_Size_Request_Type = 3; |
426 | pub const FT_SIZE_REQUEST_TYPE_SCALES: FT_Size_Request_Type = 4; |
427 | pub const FT_SIZE_REQUEST_TYPE_MAX: FT_Size_Request_Type = 5; |
428 | |
429 | pub type FT_Kerning_Mode = c_uint; |
430 | pub const FT_KERNING_DEFAULT: FT_Kerning_Mode = 0; |
431 | pub const FT_KERNING_UNFITTED: FT_Kerning_Mode = 1; |
432 | pub const FT_KERNING_UNSCALED: FT_Kerning_Mode = 2; |
433 | |
434 | pub type FT_Glyph_BBox_Mode = c_uint; |
435 | pub const FT_GLYPH_BBOX_UNSCALED: FT_Glyph_BBox_Mode = 0; |
436 | pub const FT_GLYPH_BBOX_SUBPIXELS: FT_Glyph_BBox_Mode = 0; |
437 | pub const FT_GLYPH_BBOX_GRIDFIT: FT_Glyph_BBox_Mode = 1; |
438 | pub const FT_GLYPH_BBOX_TRUNCATE: FT_Glyph_BBox_Mode = 2; |
439 | pub const FT_GLYPH_BBOX_PIXELS: FT_Glyph_BBox_Mode = 3; |
440 | |
441 | pub type FT_Stroker_LineJoin = c_uint; |
442 | pub const FT_STROKER_LINEJOIN_ROUND: FT_Stroker_LineJoin = 0; |
443 | pub const FT_STROKER_LINEJOIN_BEVEL: FT_Stroker_LineJoin = 1; |
444 | pub const FT_STROKER_LINEJOIN_MITER_VARIABLE: FT_Stroker_LineJoin = 2; |
445 | pub const FT_STROKER_LINEJOIN_MITER: FT_Stroker_LineJoin = 2; |
446 | pub const FT_STROKER_LINEJOIN_MITER_FIXED: FT_Stroker_LineJoin = 3; |
447 | |
448 | pub type FT_Stroker_LineCap = c_uint; |
449 | pub const FT_STROKER_LINECAP_BUTT: FT_Stroker_LineCap = 0; |
450 | pub const FT_STROKER_LINECAP_ROUND: FT_Stroker_LineCap = 1; |
451 | pub const FT_STROKER_LINECAP_SQUARE: FT_Stroker_LineCap = 2; |
452 | |
453 | pub type FT_StrokerBorder = c_uint; |
454 | pub const FT_STROKER_BORDER_LEFT: FT_StrokerBorder = 0; |
455 | pub const FT_STROKER_BORDER_RIGHT: FT_StrokerBorder = 1; |
456 | |
457 | pub type FT_Orientation = c_uint; |
458 | pub const FT_ORIENTATION_TRUETYPE: FT_Orientation = 0; |
459 | pub const FT_ORIENTATION_POSTSCRIPT: FT_Orientation = 1; |
460 | pub const FT_ORIENTATION_NONE: FT_Orientation = 2; |
461 | pub const FT_ORIENTATION_FILL_RIGHT: FT_Orientation = FT_ORIENTATION_TRUETYPE; |
462 | pub const FT_ORIENTATION_FILL_LEFT: FT_Orientation = FT_ORIENTATION_POSTSCRIPT; |
463 | |
464 | // Constants |
465 | pub const FT_FACE_FLAG_SCALABLE: FT_Long = 1; |
466 | pub const FT_FACE_FLAG_FIXED_SIZES: FT_Long = 1 << 1; |
467 | pub const FT_FACE_FLAG_FIXED_WIDTH: FT_Long = 1 << 2; |
468 | pub const FT_FACE_FLAG_SFNT: FT_Long = 1 << 3; |
469 | pub const FT_FACE_FLAG_HORIZONTAL: FT_Long = 1 << 4; |
470 | pub const FT_FACE_FLAG_VERTICAL: FT_Long = 1 << 5; |
471 | pub const FT_FACE_FLAG_KERNING: FT_Long = 1 << 6; |
472 | pub const FT_FACE_FLAG_FAST_GLYPHS: FT_Long = 1 << 7; |
473 | pub const FT_FACE_FLAG_MULTIPLE_MASTERS: FT_Long = 1 << 8; |
474 | pub const FT_FACE_FLAG_GLYPH_NAMES: FT_Long = 1 << 9; |
475 | pub const FT_FACE_FLAG_EXTERNAL_STREAM: FT_Long = 1 << 10; |
476 | pub const FT_FACE_FLAG_HINTER: FT_Long = 1 << 11; |
477 | pub const FT_FACE_FLAG_CID_KEYED: FT_Long = 1 << 12; |
478 | pub const FT_FACE_FLAG_TRICKY: FT_Long = 1 << 13; |
479 | pub const FT_FACE_FLAG_COLOR: FT_Long = 1 << 14; |
480 | |
481 | pub const FT_STYLE_FLAG_ITALIC: FT_Long = 1; |
482 | pub const FT_STYLE_FLAG_BOLD: FT_Long = 1 << 1; |
483 | |
484 | pub const FT_OPEN_MEMORY: FT_UInt = 0x1; |
485 | pub const FT_OPEN_STREAM: FT_UInt = 0x2; |
486 | pub const FT_OPEN_PATHNAME: FT_UInt = 0x4; |
487 | pub const FT_OPEN_DRIVER: FT_UInt = 0x8; |
488 | pub const FT_OPEN_PARAMS: FT_UInt = 0x10; |
489 | |
490 | pub const FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS: FT_UInt = 1; |
491 | pub const FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES: FT_UInt = 2; |
492 | pub const FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID: FT_UInt = 4; |
493 | pub const FT_SUBGLYPH_FLAG_SCALE: FT_UInt = 8; |
494 | pub const FT_SUBGLYPH_FLAG_XY_SCALE: FT_UInt = 0x40; |
495 | pub const FT_SUBGLYPH_FLAG_2X2: FT_UInt = 0x80; |
496 | pub const FT_SUBGLYPH_FLAG_USE_MY_METRICS: FT_UInt = 0x200; |
497 | |
498 | pub const FT_LOAD_DEFAULT: FT_Int32 = 0x0; |
499 | pub const FT_LOAD_NO_SCALE: FT_Int32 = 0x1; |
500 | pub const FT_LOAD_NO_HINTING: FT_Int32 = 0x1 << 1; |
501 | pub const FT_LOAD_RENDER: FT_Int32 = 0x1 << 2; |
502 | pub const FT_LOAD_NO_BITMAP: FT_Int32 = 0x1 << 3; |
503 | pub const FT_LOAD_VERTICAL_LAYOUT: FT_Int32 = 0x1 << 4; |
504 | pub const FT_LOAD_FORCE_AUTOHINT: FT_Int32 = 0x1 << 5; |
505 | pub const FT_LOAD_CROP_BITMAP: FT_Int32 = 0x1 << 6; |
506 | pub const FT_LOAD_PEDANTIC: FT_Int32 = 0x1 << 7; |
507 | pub const FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH: FT_Int32 = 0x1 << 9; |
508 | pub const FT_LOAD_NO_RECURSE: FT_Int32 = 0x1 << 10; |
509 | pub const FT_LOAD_IGNORE_TRANSFORM: FT_Int32 = 0x1 << 11; |
510 | pub const FT_LOAD_MONOCHROME: FT_Int32 = 0x1 << 12; |
511 | pub const FT_LOAD_LINEAR_DESIGN: FT_Int32 = 0x1 << 13; |
512 | pub const FT_LOAD_NO_AUTOHINT: FT_Int32 = 0x1 << 15; |
513 | // Bits 16..19 are used by `FT_LOAD_TARGET` |
514 | pub const FT_LOAD_COLOR: FT_Int32 = 0x1 << 20; |
515 | |
516 | pub const FT_LOAD_TARGET_NORMAL: FT_Int32 = (FT_RENDER_MODE_NORMAL << 16) as FT_Int32; |
517 | pub const FT_LOAD_TARGET_LIGHT: FT_Int32 = (FT_RENDER_MODE_LIGHT << 16) as FT_Int32; |
518 | pub const FT_LOAD_TARGET_MONO: FT_Int32 = (FT_RENDER_MODE_MONO << 16) as FT_Int32; |
519 | pub const FT_LOAD_TARGET_LCD: FT_Int32 = (FT_RENDER_MODE_LCD << 16) as FT_Int32; |
520 | pub const FT_LOAD_TARGET_LCD_V: FT_Int32 = (FT_RENDER_MODE_LCD_V << 16) as FT_Int32; |
521 | |
522 | pub const FT_FSTYPE_INSTALLABLE_EMBEDDING: FT_UShort = 0x0000; |
523 | pub const FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING: FT_UShort = 0x0002; |
524 | pub const FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING: FT_UShort = 0x0004; |
525 | pub const FT_FSTYPE_EDITABLE_EMBEDDING: FT_UShort = 0x0008; |
526 | pub const FT_FSTYPE_NO_SUBSETTING: FT_UShort = 0x0100; |
527 | pub const FT_FSTYPE_BITMAP_EMBEDDING_ONLY: FT_UShort = 0x0200; |
528 | |
529 | pub const FT_OUTLINE_NONE: c_int = 0x0; |
530 | pub const FT_OUTLINE_OWNER: c_int = 0x1; |
531 | pub const FT_OUTLINE_EVEN_ODD_FILL: c_int = 0x2; |
532 | pub const FT_OUTLINE_REVERSE_FILL: c_int = 0x4; |
533 | pub const FT_OUTLINE_IGNORE_DROPOUTS: c_int = 0x8; |
534 | pub const FT_OUTLINE_SMART_DROPOUTS: c_int = 0x10; |
535 | pub const FT_OUTLINE_INCLUDE_STUBS: c_int = 0x20; |
536 | pub const FT_OUTLINE_HIGH_PRECISION: c_int = 0x100; |
537 | pub const FT_OUTLINE_SINGLE_PASS: c_int = 0x200; |
538 | |
539 | pub const FT_VAR_AXIS_FLAG_HIDDEN: FT_UInt = 1; |
540 | |
541 | pub const FT_Err_Ok: FT_Error = 0; |
542 | pub const FT_Err_Cannot_Open_Resource: FT_Error = 1; |
543 | pub const FT_Err_Unknown_File_Format: FT_Error = 2; |
544 | pub const FT_Err_Invalid_File_Format: FT_Error = 3; |
545 | pub const FT_Err_Invalid_Version: FT_Error = 4; |
546 | pub const FT_Err_Lower_Module_Version: FT_Error = 5; |
547 | pub const FT_Err_Invalid_Argument: FT_Error = 6; |
548 | pub const FT_Err_Unimplemented_Feature: FT_Error = 7; |
549 | pub const FT_Err_Invalid_Table: FT_Error = 8; |
550 | pub const FT_Err_Invalid_Offset: FT_Error = 9; |
551 | pub const FT_Err_Array_Too_Large: FT_Error = 10; |
552 | pub const FT_Err_Missing_Module: FT_Error = 11; |
553 | pub const FT_Err_Missing_Property: FT_Error = 12; |
554 | pub const FT_Err_Invalid_Glyph_Index: FT_Error = 16; |
555 | pub const FT_Err_Invalid_Character_Code: FT_Error = 17; |
556 | pub const FT_Err_Invalid_Glyph_Format: FT_Error = 18; |
557 | pub const FT_Err_Cannot_Render_Glyph: FT_Error = 19; |
558 | pub const FT_Err_Invalid_Outline: FT_Error = 20; |
559 | pub const FT_Err_Invalid_Composite: FT_Error = 21; |
560 | pub const FT_Err_Too_Many_Hints: FT_Error = 22; |
561 | pub const FT_Err_Invalid_Pixel_Size: FT_Error = 23; |
562 | pub const FT_Err_Invalid_Handle: FT_Error = 32; |
563 | pub const FT_Err_Invalid_Library_Handle: FT_Error = 33; |
564 | pub const FT_Err_Invalid_Driver_Handle: FT_Error = 34; |
565 | pub const FT_Err_Invalid_Face_Handle: FT_Error = 35; |
566 | pub const FT_Err_Invalid_Size_Handle: FT_Error = 36; |
567 | pub const FT_Err_Invalid_Slot_Handle: FT_Error = 37; |
568 | pub const FT_Err_Invalid_CharMap_Handle: FT_Error = 38; |
569 | pub const FT_Err_Invalid_Cache_Handle: FT_Error = 39; |
570 | pub const FT_Err_Invalid_Stream_Handle: FT_Error = 40; |
571 | pub const FT_Err_Too_Many_Drivers: FT_Error = 48; |
572 | pub const FT_Err_Too_Many_Extensions: FT_Error = 49; |
573 | pub const FT_Err_Out_Of_Memory: FT_Error = 64; |
574 | pub const FT_Err_Unlisted_Object: FT_Error = 65; |
575 | pub const FT_Err_Cannot_Open_Stream: FT_Error = 81; |
576 | pub const FT_Err_Invalid_Stream_Seek: FT_Error = 82; |
577 | pub const FT_Err_Invalid_Stream_Skip: FT_Error = 83; |
578 | pub const FT_Err_Invalid_Stream_Read: FT_Error = 84; |
579 | pub const FT_Err_Invalid_Stream_Operation: FT_Error = 85; |
580 | pub const FT_Err_Invalid_Frame_Operation: FT_Error = 86; |
581 | pub const FT_Err_Nested_Frame_Access: FT_Error = 87; |
582 | pub const FT_Err_Invalid_Frame_Read: FT_Error = 88; |
583 | pub const FT_Err_Raster_Uninitialized: FT_Error = 96; |
584 | pub const FT_Err_Raster_Corrupted: FT_Error = 97; |
585 | pub const FT_Err_Raster_Overflow: FT_Error = 98; |
586 | pub const FT_Err_Raster_Negative_Height: FT_Error = 99; |
587 | pub const FT_Err_Too_Many_Caches: FT_Error = 112; |
588 | pub const FT_Err_Invalid_Opcode: FT_Error = 128; |
589 | pub const FT_Err_Too_Few_Arguments: FT_Error = 129; |
590 | pub const FT_Err_Stack_Overflow: FT_Error = 130; |
591 | pub const FT_Err_Code_Overflow: FT_Error = 131; |
592 | pub const FT_Err_Bad_Argument: FT_Error = 132; |
593 | pub const FT_Err_Divide_By_Zero: FT_Error = 133; |
594 | pub const FT_Err_Invalid_Reference: FT_Error = 134; |
595 | pub const FT_Err_Debug_OpCode: FT_Error = 135; |
596 | pub const FT_Err_ENDF_In_Exec_Stream: FT_Error = 136; |
597 | pub const FT_Err_Nested_DEFS: FT_Error = 137; |
598 | pub const FT_Err_Invalid_CodeRange: FT_Error = 138; |
599 | pub const FT_Err_Execution_Too_Long: FT_Error = 139; |
600 | pub const FT_Err_Too_Many_Function_Defs: FT_Error = 140; |
601 | pub const FT_Err_Too_Many_Instruction_Defs: FT_Error = 141; |
602 | pub const FT_Err_Table_Missing: FT_Error = 142; |
603 | pub const FT_Err_Horiz_Header_Missing: FT_Error = 143; |
604 | pub const FT_Err_Locations_Missing: FT_Error = 144; |
605 | pub const FT_Err_Name_Table_Missing: FT_Error = 145; |
606 | pub const FT_Err_CMap_Table_Missing: FT_Error = 146; |
607 | pub const FT_Err_Hmtx_Table_Missing: FT_Error = 147; |
608 | pub const FT_Err_Post_Table_Missing: FT_Error = 148; |
609 | pub const FT_Err_Invalid_Horiz_Metrics: FT_Error = 149; |
610 | pub const FT_Err_Invalid_CharMap_Format: FT_Error = 150; |
611 | pub const FT_Err_Invalid_PPem: FT_Error = 151; |
612 | pub const FT_Err_Invalid_Vert_Metrics: FT_Error = 152; |
613 | pub const FT_Err_Could_Not_Find_Context: FT_Error = 153; |
614 | pub const FT_Err_Invalid_Post_Table_Format: FT_Error = 154; |
615 | pub const FT_Err_Invalid_Post_Table: FT_Error = 155; |
616 | pub const FT_Err_Syntax_Error: FT_Error = 160; |
617 | pub const FT_Err_Stack_Underflow: FT_Error = 161; |
618 | pub const FT_Err_Ignore: FT_Error = 162; |
619 | pub const FT_Err_No_Unicode_Glyph_Name: FT_Error = 163; |
620 | pub const FT_Err_Missing_Startfont_Field: FT_Error = 176; |
621 | pub const FT_Err_Missing_Font_Field: FT_Error = 177; |
622 | pub const FT_Err_Missing_Size_Field: FT_Error = 178; |
623 | pub const FT_Err_Missing_Fontboundingbox_Field: FT_Error = 179; |
624 | pub const FT_Err_Missing_Chars_Field: FT_Error = 180; |
625 | pub const FT_Err_Missing_Startchar_Field: FT_Error = 181; |
626 | pub const FT_Err_Missing_Encoding_Field: FT_Error = 182; |
627 | pub const FT_Err_Missing_Bbx_Field: FT_Error = 183; |
628 | pub const FT_Err_Bbx_Too_Big: FT_Error = 184; |
629 | pub const FT_Err_Corrupted_Font_Header: FT_Error = 185; |
630 | pub const FT_Err_Corrupted_Font_Glyphs: FT_Error = 186; |
631 | pub const FT_Err_Max: FT_Error = 187; |
632 | |
633 | // Objects |
634 | pub type FT_Library = *mut FT_LibraryRec; |
635 | pub type FT_Face = *mut FT_FaceRec; |
636 | pub type FT_Size = *mut FT_SizeRec; |
637 | pub type FT_GlyphSlot = *mut FT_GlyphSlotRec; |
638 | pub type FT_CharMap = *mut FT_CharMapRec; |
639 | pub type FT_Module = *mut FT_ModuleRec; |
640 | pub type FT_Driver = *mut FT_DriverRec; |
641 | pub type FT_Renderer = *mut FT_RendererRec; |
642 | pub type FT_Size_Internal = *mut FT_Size_InternalRec; |
643 | pub type FT_SubGlyph = *mut FT_SubGlyphRec; |
644 | pub type FT_Slot_Internal = *mut FT_Slot_InternalRec; |
645 | pub type FT_Size_Request = *mut FT_Size_RequestRec; |
646 | pub type FT_Face_Internal = *mut FT_Face_InternalRec; |
647 | pub type FT_Stream = *mut FT_StreamRec; |
648 | pub type FT_Memory = *mut FT_MemoryRec; |
649 | pub type FT_ListNode = *mut FT_ListNodeRec; |
650 | pub type FT_Glyph = *mut FT_GlyphRec; |
651 | pub type FT_BitmapGlyph = *mut FT_BitmapGlyphRec; |
652 | pub type FT_OutlineGlyph = *mut FT_OutlineGlyphRec; |
653 | pub type FT_Stroker = *mut FT_StrokerRec; |
654 | pub type TT_OS2_Internal = *mut TT_OS2; |
655 | pub type TT_Postscript_Internal = *mut TT_Postscript; |
656 | |
657 | // Internal Types |
658 | pub type FT_LibraryRec = c_void; |
659 | pub type FT_ModuleRec = c_void; |
660 | pub type FT_DriverRec = c_void; |
661 | pub type FT_RendererRec = c_void; |
662 | pub type FT_Size_InternalRec = c_void; |
663 | pub type FT_SubGlyphRec = c_void; |
664 | pub type FT_Slot_InternalRec = c_void; |
665 | pub type FT_Face_InternalRec = c_void; |
666 | pub type FT_StrokerRec = c_void; |
667 | |
668 | #[repr (C)] |
669 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
670 | pub struct FT_CharMapRec { |
671 | pub face: FT_Face, |
672 | pub encoding: FT_Encoding, |
673 | pub platform_id: FT_UShort, |
674 | pub encoding_id: FT_UShort, |
675 | } |
676 | |
677 | #[repr (C)] |
678 | #[derive (Debug, Hash, PartialEq, Eq)] |
679 | #[allow (missing_copy_implementations)] |
680 | pub struct FT_FaceRec { |
681 | pub num_faces: FT_Long, |
682 | pub face_index: FT_Long, |
683 | |
684 | pub face_flags: FT_Long, |
685 | pub style_flags: FT_Long, |
686 | |
687 | pub num_glyphs: FT_Long, |
688 | |
689 | pub family_name: *mut FT_String, |
690 | pub style_name: *mut FT_String, |
691 | |
692 | pub num_fixed_sizes: FT_Int, |
693 | pub available_sizes: *mut FT_Bitmap_Size, |
694 | |
695 | pub num_charmaps: FT_Int, |
696 | pub charmaps: *mut FT_CharMap, |
697 | |
698 | pub generic: FT_Generic, |
699 | |
700 | pub bbox: FT_BBox, |
701 | |
702 | pub units_per_EM: FT_UShort, |
703 | pub ascender: FT_Short, |
704 | pub descender: FT_Short, |
705 | pub height: FT_Short, |
706 | |
707 | pub max_advance_width: FT_Short, |
708 | pub max_advance_height: FT_Short, |
709 | |
710 | pub underline_position: FT_Short, |
711 | pub underline_thickness: FT_Short, |
712 | |
713 | pub glyph: FT_GlyphSlot, |
714 | pub size: FT_Size, |
715 | pub charmap: FT_CharMap, |
716 | |
717 | /* @private begin */ |
718 | pub driver: FT_Driver, |
719 | pub memory: FT_Memory, |
720 | pub stream: FT_Stream, |
721 | |
722 | pub sizes_list: FT_ListRec, |
723 | |
724 | pub autohint: FT_Generic, |
725 | pub extensions: *mut c_void, |
726 | |
727 | pub internal: FT_Face_Internal, |
728 | /* @private end */ |
729 | } |
730 | |
731 | #[repr (C)] |
732 | #[derive (Debug, Hash, PartialEq, Eq)] |
733 | #[allow (missing_copy_implementations)] |
734 | pub struct FT_GlyphSlotRec { |
735 | pub library: FT_Library, |
736 | pub face: FT_Face, |
737 | pub next: FT_GlyphSlot, |
738 | pub reserved: FT_UInt, |
739 | pub generic: FT_Generic, |
740 | |
741 | pub metrics: FT_Glyph_Metrics, |
742 | pub linearHoriAdvance: FT_Fixed, |
743 | pub linearVertAdvance: FT_Fixed, |
744 | pub advance: FT_Vector, |
745 | |
746 | pub format: FT_Glyph_Format, |
747 | |
748 | pub bitmap: FT_Bitmap, |
749 | pub bitmap_left: FT_Int, |
750 | pub bitmap_top: FT_Int, |
751 | |
752 | pub outline: FT_Outline, |
753 | |
754 | pub num_subglyphs: FT_UInt, |
755 | pub subglyphs: FT_SubGlyph, |
756 | |
757 | pub control_data: *mut c_void, |
758 | pub control_len: c_long, |
759 | |
760 | pub lsb_delta: FT_Pos, |
761 | pub rsb_delta: FT_Pos, |
762 | |
763 | pub other: *mut c_void, |
764 | |
765 | pub internal: FT_Slot_Internal, |
766 | } |
767 | |
768 | #[repr (C)] |
769 | #[derive (Debug, Hash, PartialEq, Eq)] |
770 | pub struct FT_SizeRec { |
771 | pub face: FT_Face, |
772 | pub generic: FT_Generic, |
773 | pub metrics: FT_Size_Metrics, |
774 | pub internal: FT_Size_Internal, |
775 | } |
776 | |
777 | #[repr (C)] |
778 | #[derive (Debug, Hash, PartialEq, Eq)] |
779 | #[allow (missing_copy_implementations)] |
780 | pub struct FT_StreamRec { |
781 | pub base: *mut c_uchar, |
782 | pub size: c_ulong, |
783 | pub pos: c_ulong, |
784 | |
785 | pub descriptor: FT_StreamDesc, |
786 | pub pathname: FT_StreamDesc, |
787 | pub read: FT_Stream_IoFunc, |
788 | pub close: FT_Stream_CloseFunc, |
789 | |
790 | pub memory: FT_Memory, |
791 | pub cursor: *mut c_uchar, |
792 | pub limit: *mut c_uchar, |
793 | } |
794 | |
795 | #[repr (C)] |
796 | #[derive (Debug, Hash, PartialEq, Eq)] |
797 | #[allow (missing_copy_implementations)] |
798 | pub struct FT_MemoryRec { |
799 | pub user: *mut c_void, |
800 | pub alloc: FT_Alloc_Func, |
801 | pub free: FT_Free_Func, |
802 | pub realloc: FT_Realloc_Func, |
803 | } |
804 | |
805 | unsafe impl Sync for FT_MemoryRec {} |
806 | |
807 | #[repr (C)] |
808 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
809 | pub struct FT_ListRec { |
810 | pub head: FT_ListNode, |
811 | pub tail: FT_ListNode, |
812 | } |
813 | |
814 | #[repr (C)] |
815 | #[derive (Debug, Hash, PartialEq, Eq)] |
816 | #[allow (missing_copy_implementations)] |
817 | pub struct FT_ListNodeRec { |
818 | pub prev: FT_ListNode, |
819 | pub next: FT_ListNode, |
820 | pub data: *mut c_void, |
821 | } |
822 | |
823 | #[repr (C)] |
824 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
825 | pub struct FT_Size_RequestRec { |
826 | pub size_request_type: FT_Size_Request_Type, // type |
827 | pub width: FT_Long, |
828 | pub height: FT_Long, |
829 | pub horiResolution: FT_UInt, |
830 | pub vertResolution: FT_UInt, |
831 | } |
832 | |
833 | #[repr (C)] |
834 | #[derive (Debug, Hash, PartialEq, Eq)] |
835 | #[allow (missing_copy_implementations)] |
836 | pub struct FT_GlyphRec { |
837 | pub library: FT_Library, |
838 | pub clazz: *const c_void, // FT_Glyph_Class |
839 | pub format: FT_Glyph_Format, |
840 | pub advance: FT_Vector, |
841 | } |
842 | |
843 | #[repr (C)] |
844 | #[derive (Debug, Hash, PartialEq, Eq)] |
845 | #[allow (missing_copy_implementations)] |
846 | pub struct FT_BitmapGlyphRec { |
847 | pub root: FT_GlyphRec, |
848 | pub left: FT_Int, |
849 | pub top: FT_Int, |
850 | pub bitmap: FT_Bitmap, |
851 | } |
852 | |
853 | #[repr (C)] |
854 | #[derive (Debug, Hash, PartialEq, Eq)] |
855 | #[allow (missing_copy_implementations)] |
856 | pub struct FT_OutlineGlyphRec { |
857 | pub root: FT_GlyphRec, |
858 | pub outline: FT_Outline, |
859 | } |
860 | |
861 | #[repr (C)] |
862 | #[derive (Debug, Copy, Clone, Hash, PartialEq, Eq)] |
863 | pub struct FT_Outline_Funcs { |
864 | pub move_to: FT_Outline_MoveToFunc, |
865 | pub line_to: FT_Outline_LineToFunc, |
866 | pub conic_to: FT_Outline_ConicToFunc, |
867 | pub cubic_to: FT_Outline_CubicToFunc, |
868 | pub shift: c_int, |
869 | pub delta: FT_Pos, |
870 | } |
871 | |
872 | #[repr (C)] |
873 | #[derive (Debug, Hash, PartialEq, Eq)] |
874 | #[allow (missing_copy_implementations)] |
875 | pub struct FT_Raster_Params { |
876 | pub target: *const FT_Bitmap, |
877 | pub source: *const c_void, |
878 | pub flags: c_int, |
879 | pub gray_spans: FT_SpanFunc, |
880 | pub black_spans: FT_SpanFunc, |
881 | pub bit_test: FT_Raster_BitTest_Func, |
882 | pub bit_set: FT_Raster_BitSet_Func, |
883 | pub user: *mut c_void, |
884 | pub clip_box: FT_BBox, |
885 | } |
886 | |
887 | // Macro functions |
888 | #[inline (always)] |
889 | pub fn FT_HAS_HORIZONTAL(face: FT_Face) -> bool { |
890 | unsafe { (*face).face_flags & FT_FACE_FLAG_HORIZONTAL != 0 } |
891 | } |
892 | |
893 | #[inline (always)] |
894 | pub fn FT_HAS_VERTICAL(face: FT_Face) -> bool { |
895 | unsafe { (*face).face_flags & FT_FACE_FLAG_VERTICAL != 0 } |
896 | } |
897 | |
898 | #[inline (always)] |
899 | pub fn FT_HAS_KERNING(face: FT_Face) -> bool { |
900 | unsafe { (*face).face_flags & FT_FACE_FLAG_KERNING != 0 } |
901 | } |
902 | |
903 | #[inline (always)] |
904 | pub fn FT_IS_SCALABLE(face: FT_Face) -> bool { |
905 | unsafe { (*face).face_flags & FT_FACE_FLAG_SCALABLE != 0 } |
906 | } |
907 | |
908 | #[inline (always)] |
909 | pub fn FT_IS_SFNT(face: FT_Face) -> bool { |
910 | unsafe { (*face).face_flags & FT_FACE_FLAG_SFNT != 0 } |
911 | } |
912 | |
913 | #[inline (always)] |
914 | pub fn FT_IS_FIXED_WIDTH(face: FT_Face) -> bool { |
915 | unsafe { (*face).face_flags & FT_FACE_FLAG_FIXED_WIDTH != 0 } |
916 | } |
917 | |
918 | #[inline (always)] |
919 | pub fn FT_HAS_FIXED_SIZES(face: FT_Face) -> bool { |
920 | unsafe { (*face).face_flags & FT_FACE_FLAG_FIXED_SIZES != 0 } |
921 | } |
922 | |
923 | #[inline (always)] |
924 | pub fn FT_HAS_GLYPH_NAMES(face: FT_Face) -> bool { |
925 | unsafe { (*face).face_flags & FT_FACE_FLAG_GLYPH_NAMES != 0 } |
926 | } |
927 | |
928 | #[inline (always)] |
929 | pub fn FT_HAS_MULTIPLE_MASTERS(face: FT_Face) -> bool { |
930 | unsafe { (*face).face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS != 0 } |
931 | } |
932 | |
933 | #[inline (always)] |
934 | pub fn FT_IS_CID_KEYED(face: FT_Face) -> bool { |
935 | unsafe { (*face).face_flags & FT_FACE_FLAG_CID_KEYED != 0 } |
936 | } |
937 | |
938 | #[inline (always)] |
939 | pub fn FT_IS_TRICKY(face: FT_Face) -> bool { |
940 | unsafe { (*face).face_flags & FT_FACE_FLAG_TRICKY != 0 } |
941 | } |
942 | |
943 | #[inline (always)] |
944 | pub fn FT_HAS_COLOR(face: FT_Face) -> bool { |
945 | unsafe { (*face).face_flags & FT_FACE_FLAG_COLOR != 0 } |
946 | } |
947 | |
948 | extern "C" { |
949 | pub fn FT_Get_Sfnt_Table(face: FT_Face, tag: FT_Sfnt_Tag) -> *mut c_void; |
950 | } |
951 | |
952 | extern "C" { |
953 | pub fn FT_Init_FreeType(alibrary: *mut FT_Library) -> FT_Error; |
954 | pub fn FT_Done_FreeType(library: FT_Library) -> FT_Error; |
955 | pub fn FT_Set_Default_Properties(library: FT_Library); |
956 | pub fn FT_Property_Get( |
957 | library: FT_Library, |
958 | module_name: *const FT_String, |
959 | property_name: *const FT_String, |
960 | value: *mut c_void, |
961 | ) -> FT_Error; |
962 | pub fn FT_Property_Set( |
963 | library: FT_Library, |
964 | module_name: *const FT_String, |
965 | property_name: *const FT_String, |
966 | value: *const c_void, |
967 | ) -> FT_Error; |
968 | pub fn FT_New_Library(memory: FT_Memory, alibrary: *mut FT_Library) -> FT_Error; |
969 | pub fn FT_Done_Library(library: FT_Library) -> FT_Error; |
970 | pub fn FT_Reference_Library(library: FT_Library) -> FT_Error; |
971 | pub fn FT_Add_Default_Modules(library: FT_Library); |
972 | pub fn FT_New_Face( |
973 | library: FT_Library, |
974 | filepathname: *const c_char, |
975 | face_index: FT_Long, |
976 | aface: *mut FT_Face, |
977 | ) -> FT_Error; |
978 | pub fn FT_New_Memory_Face( |
979 | library: FT_Library, |
980 | file_base: *const FT_Byte, |
981 | file_size: FT_Long, |
982 | face_index: FT_Long, |
983 | aface: *mut FT_Face, |
984 | ) -> FT_Error; |
985 | pub fn FT_Open_Face( |
986 | library: FT_Library, |
987 | args: *const FT_Open_Args, |
988 | face_index: FT_Long, |
989 | aface: *mut FT_Face, |
990 | ) -> FT_Error; |
991 | pub fn FT_Attach_File(face: FT_Face, filepathname: *const c_char) -> FT_Error; |
992 | pub fn FT_Attach_Stream(face: FT_Face, parameters: *mut FT_Open_Args) -> FT_Error; |
993 | pub fn FT_Reference_Face(face: FT_Face) -> FT_Error; |
994 | pub fn FT_Done_Face(face: FT_Face) -> FT_Error; |
995 | pub fn FT_Select_Size(face: FT_Face, strike_index: FT_Int) -> FT_Error; |
996 | pub fn FT_Request_Size(face: FT_Face, req: FT_Size_Request) -> FT_Error; |
997 | pub fn FT_Set_Char_Size( |
998 | face: FT_Face, |
999 | char_width: FT_F26Dot6, |
1000 | char_height: FT_F26Dot6, |
1001 | horz_resolution: FT_UInt, |
1002 | vert_resolution: FT_UInt, |
1003 | ) -> FT_Error; |
1004 | pub fn FT_Set_Pixel_Sizes( |
1005 | face: FT_Face, |
1006 | pixel_width: FT_UInt, |
1007 | pixel_height: FT_UInt, |
1008 | ) -> FT_Error; |
1009 | pub fn FT_Library_SetLcdFilter(library: FT_Library, filter: FT_LcdFilter) -> FT_Error; |
1010 | pub fn FT_Load_Glyph(face: FT_Face, glyph_index: FT_UInt, load_flags: FT_Int32) -> FT_Error; |
1011 | pub fn FT_Load_Char(face: FT_Face, char_code: FT_ULong, load_flags: FT_Int32) -> FT_Error; |
1012 | pub fn FT_Set_Transform(face: FT_Face, matrix: *mut FT_Matrix, delta: *mut FT_Vector); |
1013 | pub fn FT_Render_Glyph(slot: FT_GlyphSlot, render_mode: FT_Render_Mode) -> FT_Error; |
1014 | pub fn FT_Get_Kerning( |
1015 | face: FT_Face, |
1016 | left_glyph: FT_UInt, |
1017 | right_glyph: FT_UInt, |
1018 | kern_mode: FT_UInt, |
1019 | akerning: *mut FT_Vector, |
1020 | ) -> FT_Error; |
1021 | pub fn FT_Get_Track_Kerning( |
1022 | face: FT_Face, |
1023 | point_size: FT_Fixed, |
1024 | degree: FT_Int, |
1025 | akerning: *mut FT_Fixed, |
1026 | ) -> FT_Error; |
1027 | pub fn FT_Get_Glyph_Name( |
1028 | face: FT_Face, |
1029 | glyph_index: FT_UInt, |
1030 | buffer: FT_Pointer, |
1031 | buffer_max: FT_UInt, |
1032 | ) -> FT_Error; |
1033 | pub fn FT_Get_Postscript_Name(face: FT_Face) -> *const c_char; |
1034 | pub fn FT_Select_Charmap(face: FT_Face, encoding: FT_Encoding) -> FT_Error; |
1035 | pub fn FT_Set_Charmap(face: FT_Face, charmap: FT_CharMap) -> FT_Error; |
1036 | pub fn FT_Get_Charmap_Index(charmap: FT_CharMap) -> FT_Int; |
1037 | pub fn FT_Get_Char_Index(face: FT_Face, charcode: FT_ULong) -> FT_UInt; |
1038 | pub fn FT_Get_First_Char(face: FT_Face, agindex: *mut FT_UInt) -> FT_ULong; |
1039 | pub fn FT_Get_Next_Char(face: FT_Face, char_code: FT_ULong, agindex: *mut FT_UInt) -> FT_ULong; |
1040 | pub fn FT_Get_Name_Index(face: FT_Face, glyph_name: *mut FT_String) -> FT_UInt; |
1041 | pub fn FT_Get_SubGlyph_Info( |
1042 | glyph: FT_GlyphSlot, |
1043 | sub_index: FT_UInt, |
1044 | p_index: *mut FT_Int, |
1045 | p_flags: *mut FT_UInt, |
1046 | p_arg1: *mut FT_Int, |
1047 | p_arg2: *mut FT_Int, |
1048 | p_transform: *mut FT_Matrix, |
1049 | ) -> FT_Error; |
1050 | pub fn FT_Get_FSType_Flags(face: FT_Face) -> FT_UShort; |
1051 | pub fn FT_Get_Glyph(slot: FT_GlyphSlot, aglyph: *mut FT_Glyph) -> FT_Error; |
1052 | pub fn FT_Glyph_Copy(source: FT_Glyph, target: *mut FT_Glyph) -> FT_Error; |
1053 | pub fn FT_Glyph_Transform( |
1054 | glyph: FT_Glyph, |
1055 | matrix: *mut FT_Matrix, |
1056 | delta: *mut FT_Vector, |
1057 | ) -> FT_Error; |
1058 | pub fn FT_Glyph_Get_CBox(glyph: FT_Glyph, bbox_mode: FT_UInt, acbox: *mut FT_BBox); |
1059 | pub fn FT_Glyph_To_Bitmap( |
1060 | the_glyph: *mut FT_Glyph, |
1061 | render_mode: FT_Render_Mode, |
1062 | origin: *mut FT_Vector, |
1063 | destroy: FT_Bool, |
1064 | ) -> FT_Error; |
1065 | pub fn FT_Done_Glyph(glyph: FT_Glyph); |
1066 | pub fn FT_Outline_GetInsideBorder(outline: *mut FT_Outline) -> FT_StrokerBorder; |
1067 | pub fn FT_Outline_GetOutsideBorder(outline: *mut FT_Outline) -> FT_StrokerBorder; |
1068 | pub fn FT_Glyph_Stroke( |
1069 | pglyph: *mut FT_Glyph, |
1070 | stroker: FT_Stroker, |
1071 | destroy: FT_Bool, |
1072 | ) -> FT_Error; |
1073 | pub fn FT_Glyph_StrokeBorder( |
1074 | pglyph: *mut FT_Glyph, |
1075 | stroker: FT_Stroker, |
1076 | inside: FT_Bool, |
1077 | outline: FT_Bool, |
1078 | ) -> FT_Error; |
1079 | pub fn FT_Stroker_New(library: FT_Library, stroker: *mut FT_Stroker) -> FT_Error; |
1080 | pub fn FT_Stroker_Set( |
1081 | stroker: FT_Stroker, |
1082 | radius: FT_Fixed, |
1083 | line_cap: FT_Stroker_LineCap, |
1084 | line_join: FT_Stroker_LineJoin, |
1085 | miter_limit: FT_Fixed, |
1086 | ); |
1087 | pub fn FT_Stroker_Rewind(stroker: FT_Stroker); |
1088 | pub fn FT_Stroker_ParseOutline( |
1089 | stroker: FT_Stroker, |
1090 | outline: *mut FT_Outline, |
1091 | opened: FT_Bool, |
1092 | ) -> FT_Error; |
1093 | pub fn FT_Stroker_Done(stroker: FT_Stroker); |
1094 | pub fn FT_Stroker_BeginSubPath( |
1095 | stroker: FT_Stroker, |
1096 | to: *mut FT_Vector, |
1097 | open: FT_Bool, |
1098 | ) -> FT_Error; |
1099 | pub fn FT_Stroker_EndSubPath(stroker: FT_Stroker) -> FT_Error; |
1100 | pub fn FT_Stroker_LineTo(stroker: FT_Stroker, to: *mut FT_Vector) -> FT_Error; |
1101 | pub fn FT_Stroker_ConicTo( |
1102 | stroker: FT_Stroker, |
1103 | control: *mut FT_Vector, |
1104 | to: *mut FT_Vector, |
1105 | ) -> FT_Error; |
1106 | pub fn FT_Stroker_CubicTo( |
1107 | stroker: FT_Stroker, |
1108 | control1: *mut FT_Vector, |
1109 | control2: *mut FT_Vector, |
1110 | to: *mut FT_Vector, |
1111 | ) -> FT_Error; |
1112 | pub fn FT_Stroker_GetBorderCounts( |
1113 | stroker: FT_Stroker, |
1114 | border: FT_StrokerBorder, |
1115 | anum_points: *mut FT_UInt, |
1116 | anum_contours: *mut FT_UInt, |
1117 | ) -> FT_Error; |
1118 | pub fn FT_Stroker_ExportBorder( |
1119 | stroker: FT_Stroker, |
1120 | border: FT_StrokerBorder, |
1121 | outline: *mut FT_Outline, |
1122 | ); |
1123 | pub fn FT_Stroker_GetCounts( |
1124 | stroker: FT_Stroker, |
1125 | anum_points: *mut FT_UInt, |
1126 | anum_contours: *mut FT_UInt, |
1127 | ) -> FT_Error; |
1128 | pub fn FT_Stroker_Export(stroker: FT_Stroker, outline: *mut FT_Outline); |
1129 | pub fn FT_MulDiv(a: FT_Long, b: FT_Long, c: FT_Long) -> FT_Long; |
1130 | pub fn FT_MulFix(a: FT_Long, b: FT_Long) -> FT_Long; |
1131 | pub fn FT_DivFix(a: FT_Long, b: FT_Long) -> FT_Long; |
1132 | pub fn FT_RoundFix(a: FT_Fixed) -> FT_Fixed; |
1133 | pub fn FT_CeilFix(a: FT_Fixed) -> FT_Fixed; |
1134 | pub fn FT_FloorFix(a: FT_Fixed) -> FT_Fixed; |
1135 | |
1136 | pub fn FT_Outline_New( |
1137 | library: FT_Library, |
1138 | num_points: FT_UInt, |
1139 | num_contours: FT_Int, |
1140 | anoutline: *mut FT_Outline, |
1141 | ) -> FT_Error; |
1142 | pub fn FT_Outline_Done(library: FT_Library, outline: *mut FT_Outline) -> FT_Error; |
1143 | pub fn FT_Outline_Copy(source: *const FT_Outline, target: *mut FT_Outline) -> FT_Error; |
1144 | pub fn FT_Outline_Translate(outline: *const FT_Outline, xOffset: FT_Pos, yOffset: FT_Pos); |
1145 | pub fn FT_Outline_Transform(outline: *const FT_Outline, matrix: *const FT_Matrix); |
1146 | pub fn FT_Outline_Embolden(outline: *mut FT_Outline, strength: FT_Pos) -> FT_Error; |
1147 | pub fn FT_Outline_EmboldenXY( |
1148 | outline: *mut FT_Outline, |
1149 | xstrength: FT_Pos, |
1150 | ystrength: FT_Pos, |
1151 | ) -> FT_Error; |
1152 | pub fn FT_Outline_Reverse(outline: *mut FT_Outline); |
1153 | pub fn FT_Outline_Check(outline: *mut FT_Outline) -> FT_Error; |
1154 | |
1155 | pub fn FT_Outline_Get_CBox(outline: *const FT_Outline, acbox: *mut FT_BBox); |
1156 | pub fn FT_Outline_Get_BBox(outline: *const FT_Outline, abbox: *mut FT_BBox) -> FT_Error; |
1157 | |
1158 | pub fn FT_Outline_Get_Bitmap( |
1159 | library: FT_Library, |
1160 | outline: *mut FT_Outline, |
1161 | abitmap: *const FT_Bitmap, |
1162 | ) -> FT_Error; |
1163 | pub fn FT_Outline_Render( |
1164 | library: FT_Library, |
1165 | outline: *mut FT_Outline, |
1166 | params: *mut FT_Raster_Params, |
1167 | ) -> FT_Error; |
1168 | pub fn FT_Outline_Decompose( |
1169 | outline: *mut FT_Outline, |
1170 | func_interface: *const FT_Outline_Funcs, |
1171 | user: *mut c_void, |
1172 | ) -> FT_Error; |
1173 | |
1174 | pub fn FT_Outline_Get_Orientation(outline: *mut FT_Outline) -> FT_Orientation; |
1175 | |
1176 | pub fn FT_GlyphSlot_Embolden(slot: FT_GlyphSlot); |
1177 | pub fn FT_GlyphSlot_Oblique(slot: FT_GlyphSlot); |
1178 | |
1179 | pub fn FT_Get_Multi_Master(face: FT_Face, amaster: *mut FT_Multi_Master) -> FT_Error; |
1180 | pub fn FT_Get_MM_Var(face: FT_Face, amaster: *mut *mut FT_MM_Var) -> FT_Error; |
1181 | pub fn FT_Done_MM_Var(library: FT_Library, amaster: *mut FT_MM_Var) -> FT_Error; |
1182 | pub fn FT_Set_MM_Design_Coordinates( |
1183 | face: FT_Face, |
1184 | num_coords: FT_UInt, |
1185 | coords: *const FT_Long, |
1186 | ) -> FT_Error; |
1187 | pub fn FT_Set_Var_Design_Coordinates( |
1188 | face: FT_Face, |
1189 | num_coords: FT_UInt, |
1190 | coords: *const FT_Fixed, |
1191 | ) -> FT_Error; |
1192 | pub fn FT_Get_Var_Design_Coordinates( |
1193 | face: FT_Face, |
1194 | num_coords: FT_UInt, |
1195 | coords: *mut FT_Fixed, |
1196 | ) -> FT_Error; |
1197 | pub fn FT_Set_MM_Blend_Coordinates( |
1198 | face: FT_Face, |
1199 | num_coords: FT_UInt, |
1200 | coords: *const FT_Fixed, |
1201 | ) -> FT_Error; |
1202 | pub fn FT_Get_MM_Blend_Coordinates( |
1203 | face: FT_Face, |
1204 | num_coords: FT_UInt, |
1205 | coords: *mut FT_Fixed, |
1206 | ) -> FT_Error; |
1207 | pub fn FT_Set_Var_Blend_Coordinates( |
1208 | face: FT_Face, |
1209 | num_coords: FT_UInt, |
1210 | coords: *const FT_Fixed, |
1211 | ) -> FT_Error; |
1212 | pub fn FT_Get_Var_Blend_Coordinates( |
1213 | face: FT_Face, |
1214 | num_coords: FT_UInt, |
1215 | coords: *mut FT_Fixed, |
1216 | ) -> FT_Error; |
1217 | pub fn FT_Set_MM_WeightVector( |
1218 | face: FT_Face, |
1219 | len: FT_UInt, |
1220 | weightvector: *const FT_Fixed, |
1221 | ) -> FT_Error; |
1222 | pub fn FT_Get_MM_WeightVector( |
1223 | face: FT_Face, |
1224 | len: *mut FT_UInt, |
1225 | weightvector: *mut FT_Fixed, |
1226 | ) -> FT_Error; |
1227 | pub fn FT_Get_Var_Axis_Flags( |
1228 | master: *const FT_MM_Var, |
1229 | axis_index: FT_UInt, |
1230 | flags: *mut FT_UInt, |
1231 | ) -> FT_Error; |
1232 | pub fn FT_Set_Named_Instance(face: FT_Face, instance_index: FT_UInt) -> FT_Error; |
1233 | |
1234 | pub fn FT_Get_Sfnt_Name_Count(face: FT_Face) -> FT_UInt; |
1235 | pub fn FT_Get_Sfnt_Name(face: FT_Face, idx: FT_UInt, aname: *mut FT_SfntName) -> FT_Error; |
1236 | pub fn FT_Get_Sfnt_LangTag( |
1237 | face: FT_Face, |
1238 | langID: FT_UInt, |
1239 | alangtag: *mut FT_SfntName, |
1240 | ) -> FT_Error; |
1241 | |
1242 | pub fn FT_Face_GetCharVariantIndex( |
1243 | face: FT_Face, |
1244 | charcode: FT_ULong, |
1245 | variant_selector: FT_ULong, |
1246 | ) -> FT_UInt; |
1247 | pub fn FT_Face_GetCharVariantIsDefault( |
1248 | face: FT_Face, |
1249 | charcode: FT_ULong, |
1250 | variant_selector: FT_ULong, |
1251 | ) -> FT_Int; |
1252 | pub fn FT_Face_GetVariantSelectors(face: FT_Face) -> *mut FT_UInt; |
1253 | pub fn FT_Face_GetVariantsOfChar(face: FT_Face, charcode: FT_ULong) -> *mut FT_UInt32; |
1254 | pub fn FT_Face_GetCharsOfVariant(face: FT_Face, variant_selector: FT_ULong) -> *mut FT_UInt32; |
1255 | } |
1256 | |