Skip to main content

freetype_sys_nopng/
lib.rs

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