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