1 /***************************************************************************/
2 /*                                                                         */
3 /*  freetype.h                                                             */
4 /*                                                                         */
5 /*    FreeType high-level API and common types (specification only).       */
6 /*                                                                         */
7 /*  Copyright 1996-2017 by                                                 */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
9 /*                                                                         */
10 /*  This file is part of the FreeType project, and may only be used,       */
11 /*  modified, and distributed under the terms of the FreeType project      */
12 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
13 /*  this file you indicate that you have read the license and              */
14 /*  understand and accept it fully.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17 
18 
19 #ifndef FREETYPE_H_
20 #define FREETYPE_H_
21 
22 
23 #ifndef FT_FREETYPE_H
24 #error "`ft2build.h' hasn't been included yet!"
25 #error "Please always use macros to include FreeType header files."
26 #error "Example:"
27 #error "  #include <ft2build.h>"
28 #error "  #include FT_FREETYPE_H"
29 #endif
30 
31 
32 #include <ft2build.h>
33 #include FT_CONFIG_CONFIG_H
34 #include FT_TYPES_H
35 #include FT_ERRORS_H
36 
37 
38 FT_BEGIN_HEADER
39 
40 
41 
42   /*************************************************************************/
43   /*                                                                       */
44   /* <Section>                                                             */
45   /*    header_inclusion                                                   */
46   /*                                                                       */
47   /* <Title>                                                               */
48   /*    FreeType's header inclusion scheme                                 */
49   /*                                                                       */
50   /* <Abstract>                                                            */
51   /*    How client applications should include FreeType header files.      */
52   /*                                                                       */
53   /* <Description>                                                         */
54   /*    To be as flexible as possible (and for historical reasons),        */
55   /*    FreeType uses a very special inclusion scheme to load header       */
56   /*    files, for example                                                 */
57   /*                                                                       */
58   /*    {                                                                  */
59   /*      #include <ft2build.h>                                            */
60   /*                                                                       */
61   /*      #include FT_FREETYPE_H                                           */
62   /*      #include FT_OUTLINE_H                                            */
63   /*    }                                                                  */
64   /*                                                                       */
65   /*    A compiler and its preprocessor only needs an include path to find */
66   /*    the file `ft2build.h'; the exact locations and names of the other  */
67   /*    FreeType header files are hidden by preprocessor macro names,      */
68   /*    loaded by `ft2build.h'.  The API documentation always gives the    */
69   /*    header macro name needed for a particular function.                */
70   /*                                                                       */
71   /*************************************************************************/
72 
73 
74   /*************************************************************************/
75   /*                                                                       */
76   /* <Section>                                                             */
77   /*    user_allocation                                                    */
78   /*                                                                       */
79   /* <Title>                                                               */
80   /*    User allocation                                                    */
81   /*                                                                       */
82   /* <Abstract>                                                            */
83   /*    How client applications should allocate FreeType data structures.  */
84   /*                                                                       */
85   /* <Description>                                                         */
86   /*    FreeType assumes that structures allocated by the user and passed  */
87   /*    as arguments are zeroed out except for the actual data.  In other  */
88   /*    words, it is recommended to use `calloc' (or variants of it)       */
89   /*    instead of `malloc' for allocation.                                */
90   /*                                                                       */
91   /*************************************************************************/
92 
93 
94 
95   /*************************************************************************/
96   /*************************************************************************/
97   /*                                                                       */
98   /*                        B A S I C   T Y P E S                          */
99   /*                                                                       */
100   /*************************************************************************/
101   /*************************************************************************/
102 
103 
104   /*************************************************************************/
105   /*                                                                       */
106   /* <Section>                                                             */
107   /*    base_interface                                                     */
108   /*                                                                       */
109   /* <Title>                                                               */
110   /*    Base Interface                                                     */
111   /*                                                                       */
112   /* <Abstract>                                                            */
113   /*    The FreeType~2 base font interface.                                */
114   /*                                                                       */
115   /* <Description>                                                         */
116   /*    This section describes the most important public high-level API    */
117   /*    functions of FreeType~2.                                           */
118   /*                                                                       */
119   /* <Order>                                                               */
120   /*    FT_Library                                                         */
121   /*    FT_Face                                                            */
122   /*    FT_Size                                                            */
123   /*    FT_GlyphSlot                                                       */
124   /*    FT_CharMap                                                         */
125   /*    FT_Encoding                                                        */
126   /*    FT_ENC_TAG                                                         */
127   /*                                                                       */
128   /*    FT_FaceRec                                                         */
129   /*                                                                       */
130   /*    FT_FACE_FLAG_SCALABLE                                              */
131   /*    FT_FACE_FLAG_FIXED_SIZES                                           */
132   /*    FT_FACE_FLAG_FIXED_WIDTH                                           */
133   /*    FT_FACE_FLAG_HORIZONTAL                                            */
134   /*    FT_FACE_FLAG_VERTICAL                                              */
135   /*    FT_FACE_FLAG_COLOR                                                 */
136   /*    FT_FACE_FLAG_SFNT                                                  */
137   /*    FT_FACE_FLAG_CID_KEYED                                             */
138   /*    FT_FACE_FLAG_TRICKY                                                */
139   /*    FT_FACE_FLAG_KERNING                                               */
140   /*    FT_FACE_FLAG_MULTIPLE_MASTERS                                      */
141   /*    FT_FACE_FLAG_GLYPH_NAMES                                           */
142   /*    FT_FACE_FLAG_EXTERNAL_STREAM                                       */
143   /*    FT_FACE_FLAG_HINTER                                                */
144   /*                                                                       */
145   /*    FT_HAS_HORIZONTAL                                                  */
146   /*    FT_HAS_VERTICAL                                                    */
147   /*    FT_HAS_KERNING                                                     */
148   /*    FT_HAS_FIXED_SIZES                                                 */
149   /*    FT_HAS_GLYPH_NAMES                                                 */
150   /*    FT_HAS_MULTIPLE_MASTERS                                            */
151   /*    FT_HAS_COLOR                                                       */
152   /*                                                                       */
153   /*    FT_IS_SFNT                                                         */
154   /*    FT_IS_SCALABLE                                                     */
155   /*    FT_IS_FIXED_WIDTH                                                  */
156   /*    FT_IS_CID_KEYED                                                    */
157   /*    FT_IS_TRICKY                                                       */
158   /*                                                                       */
159   /*    FT_STYLE_FLAG_BOLD                                                 */
160   /*    FT_STYLE_FLAG_ITALIC                                               */
161   /*                                                                       */
162   /*    FT_SizeRec                                                         */
163   /*    FT_Size_Metrics                                                    */
164   /*                                                                       */
165   /*    FT_GlyphSlotRec                                                    */
166   /*    FT_Glyph_Metrics                                                   */
167   /*    FT_SubGlyph                                                        */
168   /*                                                                       */
169   /*    FT_Bitmap_Size                                                     */
170   /*                                                                       */
171   /*    FT_Init_FreeType                                                   */
172   /*    FT_Done_FreeType                                                   */
173   /*                                                                       */
174   /*    FT_New_Face                                                        */
175   /*    FT_Done_Face                                                       */
176   /*    FT_Reference_Face                                                  */
177   /*    FT_New_Memory_Face                                                 */
178   /*    FT_Open_Face                                                       */
179   /*    FT_Open_Args                                                       */
180   /*    FT_Parameter                                                       */
181   /*    FT_Attach_File                                                     */
182   /*    FT_Attach_Stream                                                   */
183   /*                                                                       */
184   /*    FT_Set_Char_Size                                                   */
185   /*    FT_Set_Pixel_Sizes                                                 */
186   /*    FT_Request_Size                                                    */
187   /*    FT_Select_Size                                                     */
188   /*    FT_Size_Request_Type                                               */
189   /*    FT_Size_RequestRec                                                 */
190   /*    FT_Size_Request                                                    */
191   /*    FT_Set_Transform                                                   */
192   /*    FT_Load_Glyph                                                      */
193   /*    FT_Get_Char_Index                                                  */
194   /*    FT_Get_First_Char                                                  */
195   /*    FT_Get_Next_Char                                                   */
196   /*    FT_Get_Name_Index                                                  */
197   /*    FT_Load_Char                                                       */
198   /*                                                                       */
199   /*    FT_OPEN_MEMORY                                                     */
200   /*    FT_OPEN_STREAM                                                     */
201   /*    FT_OPEN_PATHNAME                                                   */
202   /*    FT_OPEN_DRIVER                                                     */
203   /*    FT_OPEN_PARAMS                                                     */
204   /*                                                                       */
205   /*    FT_LOAD_DEFAULT                                                    */
206   /*    FT_LOAD_RENDER                                                     */
207   /*    FT_LOAD_MONOCHROME                                                 */
208   /*    FT_LOAD_LINEAR_DESIGN                                              */
209   /*    FT_LOAD_NO_SCALE                                                   */
210   /*    FT_LOAD_NO_HINTING                                                 */
211   /*    FT_LOAD_NO_BITMAP                                                  */
212   /*    FT_LOAD_NO_AUTOHINT                                                */
213   /*    FT_LOAD_COLOR                                                      */
214   /*                                                                       */
215   /*    FT_LOAD_VERTICAL_LAYOUT                                            */
216   /*    FT_LOAD_IGNORE_TRANSFORM                                           */
217   /*    FT_LOAD_FORCE_AUTOHINT                                             */
218   /*    FT_LOAD_NO_RECURSE                                                 */
219   /*    FT_LOAD_PEDANTIC                                                   */
220   /*                                                                       */
221   /*    FT_LOAD_TARGET_NORMAL                                              */
222   /*    FT_LOAD_TARGET_LIGHT                                               */
223   /*    FT_LOAD_TARGET_MONO                                                */
224   /*    FT_LOAD_TARGET_LCD                                                 */
225   /*    FT_LOAD_TARGET_LCD_V                                               */
226   /*                                                                       */
227   /*    FT_LOAD_TARGET_MODE                                                */
228   /*                                                                       */
229   /*    FT_Render_Glyph                                                    */
230   /*    FT_Render_Mode                                                     */
231   /*    FT_Get_Kerning                                                     */
232   /*    FT_Kerning_Mode                                                    */
233   /*    FT_Get_Track_Kerning                                               */
234   /*    FT_Get_Glyph_Name                                                  */
235   /*    FT_Get_Postscript_Name                                             */
236   /*                                                                       */
237   /*    FT_CharMapRec                                                      */
238   /*    FT_Select_Charmap                                                  */
239   /*    FT_Set_Charmap                                                     */
240   /*    FT_Get_Charmap_Index                                               */
241   /*                                                                       */
242   /*    FT_Get_FSType_Flags                                                */
243   /*    FT_Get_SubGlyph_Info                                               */
244   /*                                                                       */
245   /*    FT_Face_Internal                                                   */
246   /*    FT_Size_Internal                                                   */
247   /*    FT_Slot_Internal                                                   */
248   /*                                                                       */
249   /*    FT_FACE_FLAG_XXX                                                   */
250   /*    FT_STYLE_FLAG_XXX                                                  */
251   /*    FT_OPEN_XXX                                                        */
252   /*    FT_LOAD_XXX                                                        */
253   /*    FT_LOAD_TARGET_XXX                                                 */
254   /*    FT_SUBGLYPH_FLAG_XXX                                               */
255   /*    FT_FSTYPE_XXX                                                      */
256   /*                                                                       */
257   /*    FT_HAS_FAST_GLYPHS                                                 */
258   /*                                                                       */
259   /*************************************************************************/
260 
261 
262   /*************************************************************************/
263   /*                                                                       */
264   /* <Struct>                                                              */
265   /*    FT_Glyph_Metrics                                                   */
266   /*                                                                       */
267   /* <Description>                                                         */
268   /*    A structure to model the metrics of a single glyph.  The values    */
269   /*    are expressed in 26.6 fractional pixel format; if the flag         */
270   /*    @FT_LOAD_NO_SCALE has been used while loading the glyph, values    */
271   /*    are expressed in font units instead.                               */
272   /*                                                                       */
273   /* <Fields>                                                              */
274   /*    width ::                                                           */
275   /*      The glyph's width.                                               */
276   /*                                                                       */
277   /*    height ::                                                          */
278   /*      The glyph's height.                                              */
279   /*                                                                       */
280   /*    horiBearingX ::                                                    */
281   /*      Left side bearing for horizontal layout.                         */
282   /*                                                                       */
283   /*    horiBearingY ::                                                    */
284   /*      Top side bearing for horizontal layout.                          */
285   /*                                                                       */
286   /*    horiAdvance ::                                                     */
287   /*      Advance width for horizontal layout.                             */
288   /*                                                                       */
289   /*    vertBearingX ::                                                    */
290   /*      Left side bearing for vertical layout.                           */
291   /*                                                                       */
292   /*    vertBearingY ::                                                    */
293   /*      Top side bearing for vertical layout.  Larger positive values    */
294   /*      mean further below the vertical glyph origin.                    */
295   /*                                                                       */
296   /*    vertAdvance ::                                                     */
297   /*      Advance height for vertical layout.  Positive values mean the    */
298   /*      glyph has a positive advance downward.                           */
299   /*                                                                       */
300   /* <Note>                                                                */
301   /*    If not disabled with @FT_LOAD_NO_HINTING, the values represent     */
302   /*    dimensions of the hinted glyph (in case hinting is applicable).    */
303   /*                                                                       */
304   /*    Stroking a glyph with an outside border does not increase          */
305   /*    `horiAdvance' or `vertAdvance'; you have to manually adjust these  */
306   /*    values to account for the added width and height.                  */
307   /*                                                                       */
308   /*    FreeType doesn't use the `VORG' table data for CFF fonts because   */
309   /*    it doesn't have an interface to quickly retrieve the glyph height. */
310   /*    The y~coordinate of the vertical origin can be simply computed as  */
311   /*    `vertBearingY + height' after loading a glyph.                     */
312   /*                                                                       */
313   typedef struct  FT_Glyph_Metrics_
314   {
315     FT_Pos  width;
316     FT_Pos  height;
317 
318     FT_Pos  horiBearingX;
319     FT_Pos  horiBearingY;
320     FT_Pos  horiAdvance;
321 
322     FT_Pos  vertBearingX;
323     FT_Pos  vertBearingY;
324     FT_Pos  vertAdvance;
325 
326   } FT_Glyph_Metrics;
327 
328 
329   /*************************************************************************/
330   /*                                                                       */
331   /* <Struct>                                                              */
332   /*    FT_Bitmap_Size                                                     */
333   /*                                                                       */
334   /* <Description>                                                         */
335   /*    This structure models the metrics of a bitmap strike (i.e., a set  */
336   /*    of glyphs for a given point size and resolution) in a bitmap font. */
337   /*    It is used for the `available_sizes' field of @FT_Face.            */
338   /*                                                                       */
339   /* <Fields>                                                              */
340   /*    height :: The vertical distance, in pixels, between two            */
341   /*              consecutive baselines.  It is always positive.           */
342   /*                                                                       */
343   /*    width  :: The average width, in pixels, of all glyphs in the       */
344   /*              strike.                                                  */
345   /*                                                                       */
346   /*    size   :: The nominal size of the strike in 26.6 fractional        */
347   /*              points.  This field is not very useful.                  */
348   /*                                                                       */
349   /*    x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional   */
350   /*              pixels.                                                  */
351   /*                                                                       */
352   /*    y_ppem :: The vertical ppem (nominal height) in 26.6 fractional    */
353   /*              pixels.                                                  */
354   /*                                                                       */
355   /* <Note>                                                                */
356   /*    Windows FNT:                                                       */
357   /*      The nominal size given in a FNT font is not reliable.  If the    */
358   /*      driver finds it incorrect, it sets `size' to some calculated     */
359   /*      values, and `x_ppem' and `y_ppem' to the pixel width and height  */
360   /*      given in the font, respectively.                                 */
361   /*                                                                       */
362   /*    TrueType embedded bitmaps:                                         */
363   /*      `size', `width', and `height' values are not contained in the    */
364   /*      bitmap strike itself.  They are computed from the global font    */
365   /*      parameters.                                                      */
366   /*                                                                       */
367   typedef struct  FT_Bitmap_Size_
368   {
369     FT_Short  height;
370     FT_Short  width;
371 
372     FT_Pos    size;
373 
374     FT_Pos    x_ppem;
375     FT_Pos    y_ppem;
376 
377   } FT_Bitmap_Size;
378 
379 
380   /*************************************************************************/
381   /*************************************************************************/
382   /*                                                                       */
383   /*                     O B J E C T   C L A S S E S                       */
384   /*                                                                       */
385   /*************************************************************************/
386   /*************************************************************************/
387 
388   /*************************************************************************/
389   /*                                                                       */
390   /* <Type>                                                                */
391   /*    FT_Library                                                         */
392   /*                                                                       */
393   /* <Description>                                                         */
394   /*    A handle to a FreeType library instance.  Each `library' is        */
395   /*    completely independent from the others; it is the `root' of a set  */
396   /*    of objects like fonts, faces, sizes, etc.                          */
397   /*                                                                       */
398   /*    It also embeds a memory manager (see @FT_Memory), as well as a     */
399   /*    scan-line converter object (see @FT_Raster).                       */
400   /*                                                                       */
401   /*    In multi-threaded applications it is easiest to use one            */
402   /*    `FT_Library' object per thread.  In case this is too cumbersome,   */
403   /*    a single `FT_Library' object across threads is possible also       */
404   /*    (since FreeType version 2.5.6), as long as a mutex lock is used    */
405   /*    around @FT_New_Face and @FT_Done_Face.                             */
406   /*                                                                       */
407   /* <Note>                                                                */
408   /*    Library objects are normally created by @FT_Init_FreeType, and     */
409   /*    destroyed with @FT_Done_FreeType.  If you need reference-counting  */
410   /*    (cf. @FT_Reference_Library), use @FT_New_Library and               */
411   /*    @FT_Done_Library.                                                  */
412   /*                                                                       */
413   typedef struct FT_LibraryRec_  *FT_Library;
414 
415 
416   /*************************************************************************/
417   /*                                                                       */
418   /* <Section>                                                             */
419   /*    module_management                                                  */
420   /*                                                                       */
421   /*************************************************************************/
422 
423   /*************************************************************************/
424   /*                                                                       */
425   /* <Type>                                                                */
426   /*    FT_Module                                                          */
427   /*                                                                       */
428   /* <Description>                                                         */
429   /*    A handle to a given FreeType module object.  A module can be a     */
430   /*    font driver, a renderer, or anything else that provides services   */
431   /*    to the former.                                                     */
432   /*                                                                       */
433   typedef struct FT_ModuleRec_*  FT_Module;
434 
435 
436   /*************************************************************************/
437   /*                                                                       */
438   /* <Type>                                                                */
439   /*    FT_Driver                                                          */
440   /*                                                                       */
441   /* <Description>                                                         */
442   /*    A handle to a given FreeType font driver object.  A font driver    */
443   /*    is a module capable of creating faces from font files.             */
444   /*                                                                       */
445   typedef struct FT_DriverRec_*  FT_Driver;
446 
447 
448   /*************************************************************************/
449   /*                                                                       */
450   /* <Type>                                                                */
451   /*    FT_Renderer                                                        */
452   /*                                                                       */
453   /* <Description>                                                         */
454   /*    A handle to a given FreeType renderer.  A renderer is a module in  */
455   /*    charge of converting a glyph's outline image to a bitmap.  It      */
456   /*    supports a single glyph image format, and one or more target       */
457   /*    surface depths.                                                    */
458   /*                                                                       */
459   typedef struct FT_RendererRec_*  FT_Renderer;
460 
461 
462   /*************************************************************************/
463   /*                                                                       */
464   /* <Section>                                                             */
465   /*    base_interface                                                     */
466   /*                                                                       */
467   /*************************************************************************/
468 
469   /*************************************************************************/
470   /*                                                                       */
471   /* <Type>                                                                */
472   /*    FT_Face                                                            */
473   /*                                                                       */
474   /* <Description>                                                         */
475   /*    A handle to a typographic face object.  A face object models a     */
476   /*    given typeface, in a given style.                                  */
477   /*                                                                       */
478   /* <Note>                                                                */
479   /*    A face object also owns a single @FT_GlyphSlot object, as well     */
480   /*    as one or more @FT_Size objects.                                   */
481   /*                                                                       */
482   /*    Use @FT_New_Face or @FT_Open_Face to create a new face object from */
483   /*    a given filepath or a custom input stream.                         */
484   /*                                                                       */
485   /*    Use @FT_Done_Face to destroy it (along with its slot and sizes).   */
486   /*                                                                       */
487   /*    An `FT_Face' object can only be safely used from one thread at a   */
488   /*    time.  Similarly, creation and destruction of `FT_Face' with the   */
489   /*    same @FT_Library object can only be done from one thread at a      */
490   /*    time.  On the other hand, functions like @FT_Load_Glyph and its    */
491   /*    siblings are thread-safe and do not need the lock to be held as    */
492   /*    long as the same `FT_Face' object is not used from multiple        */
493   /*    threads at the same time.                                          */
494   /*                                                                       */
495   /* <Also>                                                                */
496   /*    See @FT_FaceRec for the publicly accessible fields of a given face */
497   /*    object.                                                            */
498   /*                                                                       */
499   typedef struct FT_FaceRec_*  FT_Face;
500 
501 
502   /*************************************************************************/
503   /*                                                                       */
504   /* <Type>                                                                */
505   /*    FT_Size                                                            */
506   /*                                                                       */
507   /* <Description>                                                         */
508   /*    A handle to an object that models a face scaled to a given         */
509   /*    character size.                                                    */
510   /*                                                                       */
511   /* <Note>                                                                */
512   /*    An @FT_Face has one _active_ @FT_Size object that is used by       */
513   /*    functions like @FT_Load_Glyph to determine the scaling             */
514   /*    transformation that in turn is used to load and hint glyphs and    */
515   /*    metrics.                                                           */
516   /*                                                                       */
517   /*    You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes,                */
518   /*    @FT_Request_Size or even @FT_Select_Size to change the content     */
519   /*    (i.e., the scaling values) of the active @FT_Size.                 */
520   /*                                                                       */
521   /*    You can use @FT_New_Size to create additional size objects for a   */
522   /*    given @FT_Face, but they won't be used by other functions until    */
523   /*    you activate it through @FT_Activate_Size.  Only one size can be   */
524   /*    activated at any given time per face.                              */
525   /*                                                                       */
526   /* <Also>                                                                */
527   /*    See @FT_SizeRec for the publicly accessible fields of a given size */
528   /*    object.                                                            */
529   /*                                                                       */
530   typedef struct FT_SizeRec_*  FT_Size;
531 
532 
533   /*************************************************************************/
534   /*                                                                       */
535   /* <Type>                                                                */
536   /*    FT_GlyphSlot                                                       */
537   /*                                                                       */
538   /* <Description>                                                         */
539   /*    A handle to a given `glyph slot'.  A slot is a container that can  */
540   /*    hold any of the glyphs contained in its parent face.               */
541   /*                                                                       */
542   /*    In other words, each time you call @FT_Load_Glyph or               */
543   /*    @FT_Load_Char, the slot's content is erased by the new glyph data, */
544   /*    i.e., the glyph's metrics, its image (bitmap or outline), and      */
545   /*    other control information.                                         */
546   /*                                                                       */
547   /* <Also>                                                                */
548   /*    See @FT_GlyphSlotRec for the publicly accessible glyph fields.     */
549   /*                                                                       */
550   typedef struct FT_GlyphSlotRec_*  FT_GlyphSlot;
551 
552 
553   /*************************************************************************/
554   /*                                                                       */
555   /* <Type>                                                                */
556   /*    FT_CharMap                                                         */
557   /*                                                                       */
558   /* <Description>                                                         */
559   /*    A handle to a character map (usually abbreviated to `charmap').  A */
560   /*    charmap is used to translate character codes in a given encoding   */
561   /*    into glyph indexes for its parent's face.  Some font formats may   */
562   /*    provide several charmaps per font.                                 */
563   /*                                                                       */
564   /*    Each face object owns zero or more charmaps, but only one of them  */
565   /*    can be `active', providing the data used by @FT_Get_Char_Index or  */
566   /*    @FT_Load_Char.                                                     */
567   /*                                                                       */
568   /*    The list of available charmaps in a face is available through the  */
569   /*    `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec.   */
570   /*                                                                       */
571   /*    The currently active charmap is available as `face->charmap'.      */
572   /*    You should call @FT_Set_Charmap to change it.                      */
573   /*                                                                       */
574   /* <Note>                                                                */
575   /*    When a new face is created (either through @FT_New_Face or         */
576   /*    @FT_Open_Face), the library looks for a Unicode charmap within     */
577   /*    the list and automatically activates it.                           */
578   /*                                                                       */
579   /* <Also>                                                                */
580   /*    See @FT_CharMapRec for the publicly accessible fields of a given   */
581   /*    character map.                                                     */
582   /*                                                                       */
583   typedef struct FT_CharMapRec_*  FT_CharMap;
584 
585 
586   /*************************************************************************/
587   /*                                                                       */
588   /* <Macro>                                                               */
589   /*    FT_ENC_TAG                                                         */
590   /*                                                                       */
591   /* <Description>                                                         */
592   /*    This macro converts four-letter tags into an unsigned long.  It is */
593   /*    used to define `encoding' identifiers (see @FT_Encoding).          */
594   /*                                                                       */
595   /* <Note>                                                                */
596   /*    Since many 16-bit compilers don't like 32-bit enumerations, you    */
597   /*    should redefine this macro in case of problems to something like   */
598   /*    this:                                                              */
599   /*                                                                       */
600   /*    {                                                                  */
601   /*      #define FT_ENC_TAG( value, a, b, c, d )  value                   */
602   /*    }                                                                  */
603   /*                                                                       */
604   /*    to get a simple enumeration without assigning special numbers.     */
605   /*                                                                       */
606 
607 #ifndef FT_ENC_TAG
608 #define FT_ENC_TAG( value, a, b, c, d )         \
609           value = ( ( (FT_UInt32)(a) << 24 ) |  \
610                     ( (FT_UInt32)(b) << 16 ) |  \
611                     ( (FT_UInt32)(c) <<  8 ) |  \
612                       (FT_UInt32)(d)         )
613 
614 #endif /* FT_ENC_TAG */
615 
616 
617   /*************************************************************************/
618   /*                                                                       */
619   /* <Enum>                                                                */
620   /*    FT_Encoding                                                        */
621   /*                                                                       */
622   /* <Description>                                                         */
623   /*    An enumeration to specify character sets supported by charmaps.    */
624   /*    Used in the @FT_Select_Charmap API function.                       */
625   /*                                                                       */
626   /* <Note>                                                                */
627   /*    Despite the name, this enumeration lists specific character        */
628   /*    repertories (i.e., charsets), and not text encoding methods (e.g., */
629   /*    UTF-8, UTF-16, etc.).                                              */
630   /*                                                                       */
631   /*    Other encodings might be defined in the future.                    */
632   /*                                                                       */
633   /* <Values>                                                              */
634   /*    FT_ENCODING_NONE ::                                                */
635   /*      The encoding value~0 is reserved.                                */
636   /*                                                                       */
637   /*    FT_ENCODING_UNICODE ::                                             */
638   /*      The Unicode character set.  This value covers all versions of    */
639   /*      the Unicode repertoire, including ASCII and Latin-1.  Most fonts */
640   /*      include a Unicode charmap, but not all of them.                  */
641   /*                                                                       */
642   /*      For example, if you want to access Unicode value U+1F028 (and    */
643   /*      the font contains it), use value 0x1F028 as the input value for  */
644   /*      @FT_Get_Char_Index.                                              */
645   /*                                                                       */
646   /*    FT_ENCODING_MS_SYMBOL ::                                           */
647   /*      Microsoft Symbol encoding, used to encode mathematical symbols   */
648   /*      and wingdings.  For more information, see                        */
649   /*      `http://www.microsoft.com/typography/otspec/recom.htm',          */
650   /*      `http://www.kostis.net/charsets/symbol.htm', and                 */
651   /*      `http://www.kostis.net/charsets/wingding.htm'.                   */
652   /*                                                                       */
653   /*      This encoding uses character codes from the PUA (Private Unicode */
654   /*      Area) in the range U+F020-U+F0FF.                                */
655   /*                                                                       */
656   /*    FT_ENCODING_SJIS ::                                                */
657   /*      Shift JIS encoding for Japanese.  More info at                   */
658   /*      `http://en.wikipedia.org/wiki/Shift_JIS'.  See note on           */
659   /*      multi-byte encodings below.                                      */
660   /*                                                                       */
661   /*    FT_ENCODING_PRC ::                                                 */
662   /*      Corresponds to encoding systems mainly for Simplified Chinese as */
663   /*      used in People's Republic of China (PRC).  The encoding layout   */
664   /*      is based on GB~2312 and its supersets GBK and GB~18030.          */
665   /*                                                                       */
666   /*    FT_ENCODING_BIG5 ::                                                */
667   /*      Corresponds to an encoding system for Traditional Chinese as     */
668   /*      used in Taiwan and Hong Kong.                                    */
669   /*                                                                       */
670   /*    FT_ENCODING_WANSUNG ::                                             */
671   /*      Corresponds to the Korean encoding system known as Extended      */
672   /*      Wansung (MS Windows code page 949).                              */
673   /*      For more information see                                         */
674   /*      `http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */
675   /*                                                                       */
676   /*    FT_ENCODING_JOHAB ::                                               */
677   /*      The Korean standard character set (KS~C 5601-1992), which        */
678   /*      corresponds to MS Windows code page 1361.  This character set    */
679   /*      includes all possible Hangeul character combinations.            */
680   /*                                                                       */
681   /*    FT_ENCODING_ADOBE_LATIN_1 ::                                       */
682   /*      Corresponds to a Latin-1 encoding as defined in a Type~1         */
683   /*      PostScript font.  It is limited to 256 character codes.          */
684   /*                                                                       */
685   /*    FT_ENCODING_ADOBE_STANDARD ::                                      */
686   /*      Adobe Standard encoding, as found in Type~1, CFF, and            */
687   /*      OpenType/CFF fonts.  It is limited to 256 character codes.       */
688   /*                                                                       */
689   /*    FT_ENCODING_ADOBE_EXPERT ::                                        */
690   /*      Adobe Expert encoding, as found in Type~1, CFF, and OpenType/CFF */
691   /*      fonts.  It is limited to 256 character codes.                    */
692   /*                                                                       */
693   /*    FT_ENCODING_ADOBE_CUSTOM ::                                        */
694   /*      Corresponds to a custom encoding, as found in Type~1, CFF, and   */
695   /*      OpenType/CFF fonts.  It is limited to 256 character codes.       */
696   /*                                                                       */
697   /*    FT_ENCODING_APPLE_ROMAN ::                                         */
698   /*      Apple roman encoding.  Many TrueType and OpenType fonts contain  */
699   /*      a charmap for this 8-bit encoding, since older versions of Mac   */
700   /*      OS are able to use it.                                           */
701   /*                                                                       */
702   /*    FT_ENCODING_OLD_LATIN_2 ::                                         */
703   /*      This value is deprecated and was neither used nor reported by    */
704   /*      FreeType.  Don't use or test for it.                             */
705   /*                                                                       */
706   /*    FT_ENCODING_MS_SJIS ::                                             */
707   /*      Same as FT_ENCODING_SJIS.  Deprecated.                           */
708   /*                                                                       */
709   /*    FT_ENCODING_MS_GB2312 ::                                           */
710   /*      Same as FT_ENCODING_PRC.  Deprecated.                            */
711   /*                                                                       */
712   /*    FT_ENCODING_MS_BIG5 ::                                             */
713   /*      Same as FT_ENCODING_BIG5.  Deprecated.                           */
714   /*                                                                       */
715   /*    FT_ENCODING_MS_WANSUNG ::                                          */
716   /*      Same as FT_ENCODING_WANSUNG.  Deprecated.                        */
717   /*                                                                       */
718   /*    FT_ENCODING_MS_JOHAB ::                                            */
719   /*      Same as FT_ENCODING_JOHAB.  Deprecated.                          */
720   /*                                                                       */
721   /* <Note>                                                                */
722   /*    By default, FreeType automatically synthesizes a Unicode charmap   */
723   /*    for PostScript fonts, using their glyph name dictionaries.         */
724   /*    However, it also reports the encodings defined explicitly in the   */
725   /*    font file, for the cases when they are needed, with the Adobe      */
726   /*    values as well.                                                    */
727   /*                                                                       */
728   /*    FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap  */
729   /*    is neither Unicode nor ISO-8859-1 (otherwise it is set to          */
730   /*    FT_ENCODING_UNICODE).  Use @FT_Get_BDF_Charset_ID to find out      */
731   /*    which encoding is really present.  If, for example, the            */
732   /*    `cs_registry' field is `KOI8' and the `cs_encoding' field is `R',  */
733   /*    the font is encoded in KOI8-R.                                     */
734   /*                                                                       */
735   /*    FT_ENCODING_NONE is always set (with a single exception) by the    */
736   /*    winfonts driver.  Use @FT_Get_WinFNT_Header and examine the        */
737   /*    `charset' field of the @FT_WinFNT_HeaderRec structure to find out  */
738   /*    which encoding is really present.  For example,                    */
739   /*    @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for       */
740   /*    Russian).                                                          */
741   /*                                                                       */
742   /*    FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
743   /*    and `encoding_id' is not `TT_MAC_ID_ROMAN' (otherwise it is set to */
744   /*    FT_ENCODING_APPLE_ROMAN).                                          */
745   /*                                                                       */
746   /*    If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function       */
747   /*    @FT_Get_CMap_Language_ID to query the Mac language ID that may     */
748   /*    be needed to be able to distinguish Apple encoding variants.  See  */
749   /*                                                                       */
750   /*      http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt  */
751   /*                                                                       */
752   /*    to get an idea how to do that.  Basically, if the language ID      */
753   /*    is~0, don't use it, otherwise subtract 1 from the language ID.     */
754   /*    Then examine `encoding_id'.  If, for example, `encoding_id' is     */
755   /*    `TT_MAC_ID_ROMAN' and the language ID (minus~1) is                 */
756   /*    `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman.        */
757   /*    `TT_MAC_ID_ARABIC' with `TT_MAC_LANGID_FARSI' means the Farsi      */
758   /*    variant the Arabic encoding.                                       */
759   /*                                                                       */
760   typedef enum  FT_Encoding_
761   {
762     FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
763 
764     FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
765     FT_ENC_TAG( FT_ENCODING_UNICODE,   'u', 'n', 'i', 'c' ),
766 
767     FT_ENC_TAG( FT_ENCODING_SJIS,    's', 'j', 'i', 's' ),
768     FT_ENC_TAG( FT_ENCODING_PRC,     'g', 'b', ' ', ' ' ),
769     FT_ENC_TAG( FT_ENCODING_BIG5,    'b', 'i', 'g', '5' ),
770     FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
771     FT_ENC_TAG( FT_ENCODING_JOHAB,   'j', 'o', 'h', 'a' ),
772 
773     /* for backwards compatibility */
774     FT_ENCODING_GB2312     = FT_ENCODING_PRC,
775     FT_ENCODING_MS_SJIS    = FT_ENCODING_SJIS,
776     FT_ENCODING_MS_GB2312  = FT_ENCODING_PRC,
777     FT_ENCODING_MS_BIG5    = FT_ENCODING_BIG5,
778     FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
779     FT_ENCODING_MS_JOHAB   = FT_ENCODING_JOHAB,
780 
781     FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
782     FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT,   'A', 'D', 'B', 'E' ),
783     FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM,   'A', 'D', 'B', 'C' ),
784     FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1,  'l', 'a', 't', '1' ),
785 
786     FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
787 
788     FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
789 
790   } FT_Encoding;
791 
792 
793   /* these constants are deprecated; use the corresponding `FT_Encoding' */
794   /* values instead                                                      */
795 #define ft_encoding_none            FT_ENCODING_NONE
796 #define ft_encoding_unicode         FT_ENCODING_UNICODE
797 #define ft_encoding_symbol          FT_ENCODING_MS_SYMBOL
798 #define ft_encoding_latin_1         FT_ENCODING_ADOBE_LATIN_1
799 #define ft_encoding_latin_2         FT_ENCODING_OLD_LATIN_2
800 #define ft_encoding_sjis            FT_ENCODING_SJIS
801 #define ft_encoding_gb2312          FT_ENCODING_PRC
802 #define ft_encoding_big5            FT_ENCODING_BIG5
803 #define ft_encoding_wansung         FT_ENCODING_WANSUNG
804 #define ft_encoding_johab           FT_ENCODING_JOHAB
805 
806 #define ft_encoding_adobe_standard  FT_ENCODING_ADOBE_STANDARD
807 #define ft_encoding_adobe_expert    FT_ENCODING_ADOBE_EXPERT
808 #define ft_encoding_adobe_custom    FT_ENCODING_ADOBE_CUSTOM
809 #define ft_encoding_apple_roman     FT_ENCODING_APPLE_ROMAN
810 
811 
812   /*************************************************************************/
813   /*                                                                       */
814   /* <Struct>                                                              */
815   /*    FT_CharMapRec                                                      */
816   /*                                                                       */
817   /* <Description>                                                         */
818   /*    The base charmap structure.                                        */
819   /*                                                                       */
820   /* <Fields>                                                              */
821   /*    face        :: A handle to the parent face object.                 */
822   /*                                                                       */
823   /*    encoding    :: An @FT_Encoding tag identifying the charmap.  Use   */
824   /*                   this with @FT_Select_Charmap.                       */
825   /*                                                                       */
826   /*    platform_id :: An ID number describing the platform for the        */
827   /*                   following encoding ID.  This comes directly from    */
828   /*                   the TrueType specification gets emulated            */
829   /*                   for other formats.                                  */
830   /*                                                                       */
831   /*    encoding_id :: A platform specific encoding number.  This also     */
832   /*                   comes from the TrueType specification and gets      */
833   /*                   emulated similarly.                                 */
834   /*                                                                       */
835   typedef struct  FT_CharMapRec_
836   {
837     FT_Face      face;
838     FT_Encoding  encoding;
839     FT_UShort    platform_id;
840     FT_UShort    encoding_id;
841 
842   } FT_CharMapRec;
843 
844 
845   /*************************************************************************/
846   /*************************************************************************/
847   /*                                                                       */
848   /*                 B A S E   O B J E C T   C L A S S E S                 */
849   /*                                                                       */
850   /*************************************************************************/
851   /*************************************************************************/
852 
853 
854   /*************************************************************************/
855   /*                                                                       */
856   /* <Type>                                                                */
857   /*    FT_Face_Internal                                                   */
858   /*                                                                       */
859   /* <Description>                                                         */
860   /*    An opaque handle to an `FT_Face_InternalRec' structure that models */
861   /*    the private data of a given @FT_Face object.                       */
862   /*                                                                       */
863   /*    This structure might change between releases of FreeType~2 and is  */
864   /*    not generally available to client applications.                    */
865   /*                                                                       */
866   typedef struct FT_Face_InternalRec_*  FT_Face_Internal;
867 
868 
869   /*************************************************************************/
870   /*                                                                       */
871   /* <Struct>                                                              */
872   /*    FT_FaceRec                                                         */
873   /*                                                                       */
874   /* <Description>                                                         */
875   /*    FreeType root face class structure.  A face object models a        */
876   /*    typeface in a font file.                                           */
877   /*                                                                       */
878   /* <Fields>                                                              */
879   /*    num_faces           :: The number of faces in the font file.  Some */
880   /*                           font formats can have multiple faces in     */
881   /*                           a single font file.                         */
882   /*                                                                       */
883   /*    face_index          :: This field holds two different values.      */
884   /*                           Bits 0-15 are the index of the face in the  */
885   /*                           font file (starting with value~0).  They    */
886   /*                           are set to~0 if there is only one face in   */
887   /*                           the font file.                              */
888   /*                                                                       */
889   /*                           Bits 16-30 are relevant to GX and OpenType  */
890   /*                           variation fonts only, holding the named     */
891   /*                           instance index for the current face index   */
892   /*                           (starting with value~1; value~0 indicates   */
893   /*                           font access without variation data).  For   */
894   /*                           non-variation fonts, bits 16-30 are         */
895   /*                           ignored.  If we have the third named        */
896   /*                           instance of face~4, say, `face_index' is    */
897   /*                           set to 0x00030004.                          */
898   /*                                                                       */
899   /*                           Bit 31 is always zero (this is,             */
900   /*                           `face_index' is always a positive value).   */
901   /*                                                                       */
902   /*    face_flags          :: A set of bit flags that give important      */
903   /*                           information about the face; see             */
904   /*                           @FT_FACE_FLAG_XXX for the details.          */
905   /*                                                                       */
906   /*    style_flags         :: The lower 16~bits contain a set of bit      */
907   /*                           flags indicating the style of the face; see */
908   /*                           @FT_STYLE_FLAG_XXX for the details.  Bits   */
909   /*                           16-30 hold the number of named instances    */
910   /*                           available for the current face if we have a */
911   /*                           GX or OpenType variation (sub)font.  Bit 31 */
912   /*                           is always zero (this is, `style_flags' is   */
913   /*                           always a positive value).                   */
914   /*                                                                       */
915   /*    num_glyphs          :: The number of glyphs in the face.  If the   */
916   /*                           face is scalable and has sbits (see         */
917   /*                           `num_fixed_sizes'), it is set to the number */
918   /*                           of outline glyphs.                          */
919   /*                                                                       */
920   /*                           For CID-keyed fonts (not in an SFNT         */
921   /*                           wrapper) this value gives the highest CID   */
922   /*                           used in the font.                           */
923   /*                                                                       */
924   /*    family_name         :: The face's family name.  This is an ASCII   */
925   /*                           string, usually in English, that describes  */
926   /*                           the typeface's family (like `Times New      */
927   /*                           Roman', `Bodoni', `Garamond', etc).  This   */
928   /*                           is a least common denominator used to list  */
929   /*                           fonts.  Some formats (TrueType & OpenType)  */
930   /*                           provide localized and Unicode versions of   */
931   /*                           this string.  Applications should use the   */
932   /*                           format specific interface to access them.   */
933   /*                           Can be NULL (e.g., in fonts embedded in a   */
934   /*                           PDF file).                                  */
935   /*                                                                       */
936   /*                           In case the font doesn't provide a specific */
937   /*                           family name entry, FreeType tries to        */
938   /*                           synthesize one, deriving it from other name */
939   /*                           entries.                                    */
940   /*                                                                       */
941   /*    style_name          :: The face's style name.  This is an ASCII    */
942   /*                           string, usually in English, that describes  */
943   /*                           the typeface's style (like `Italic',        */
944   /*                           `Bold', `Condensed', etc).  Not all font    */
945   /*                           formats provide a style name, so this field */
946   /*                           is optional, and can be set to NULL.  As    */
947   /*                           for `family_name', some formats provide     */
948   /*                           localized and Unicode versions of this      */
949   /*                           string.  Applications should use the format */
950   /*                           specific interface to access them.          */
951   /*                                                                       */
952   /*    num_fixed_sizes     :: The number of bitmap strikes in the face.   */
953   /*                           Even if the face is scalable, there might   */
954   /*                           still be bitmap strikes, which are called   */
955   /*                           `sbits' in that case.                       */
956   /*                                                                       */
957   /*    available_sizes     :: An array of @FT_Bitmap_Size for all bitmap  */
958   /*                           strikes in the face.  It is set to NULL if  */
959   /*                           there is no bitmap strike.                  */
960   /*                                                                       */
961   /*                           Note that FreeType tries to sanitize the    */
962   /*                           strike data since they are sometimes sloppy */
963   /*                           or incorrect, but this can easily fail.     */
964   /*                                                                       */
965   /*    num_charmaps        :: The number of charmaps in the face.         */
966   /*                                                                       */
967   /*    charmaps            :: An array of the charmaps of the face.       */
968   /*                                                                       */
969   /*    generic             :: A field reserved for client uses.  See the  */
970   /*                           @FT_Generic type description.               */
971   /*                                                                       */
972   /*    bbox                :: The font bounding box.  Coordinates are     */
973   /*                           expressed in font units (see                */
974   /*                           `units_per_EM').  The box is large enough   */
975   /*                           to contain any glyph from the font.  Thus,  */
976   /*                           `bbox.yMax' can be seen as the `maximum     */
977   /*                           ascender', and `bbox.yMin' as the `minimum  */
978   /*                           descender'.  Only relevant for scalable     */
979   /*                           formats.                                    */
980   /*                                                                       */
981   /*                           Note that the bounding box might be off by  */
982   /*                           (at least) one pixel for hinted fonts.  See */
983   /*                           @FT_Size_Metrics for further discussion.    */
984   /*                                                                       */
985   /*    units_per_EM        :: The number of font units per EM square for  */
986   /*                           this face.  This is typically 2048 for      */
987   /*                           TrueType fonts, and 1000 for Type~1 fonts.  */
988   /*                           Only relevant for scalable formats.         */
989   /*                                                                       */
990   /*    ascender            :: The typographic ascender of the face,       */
991   /*                           expressed in font units.  For font formats  */
992   /*                           not having this information, it is set to   */
993   /*                           `bbox.yMax'.  Only relevant for scalable    */
994   /*                           formats.                                    */
995   /*                                                                       */
996   /*    descender           :: The typographic descender of the face,      */
997   /*                           expressed in font units.  For font formats  */
998   /*                           not having this information, it is set to   */
999   /*                           `bbox.yMin'.  Note that this field is       */
1000   /*                           negative for values below the baseline.     */
1001   /*                           Only relevant for scalable formats.         */
1002   /*                                                                       */
1003   /*    height              :: This value is the vertical distance         */
1004   /*                           between two consecutive baselines,          */
1005   /*                           expressed in font units.  It is always      */
1006   /*                           positive.  Only relevant for scalable       */
1007   /*                           formats.                                    */
1008   /*                                                                       */
1009   /*                           If you want the global glyph height, use    */
1010   /*                           `ascender - descender'.                     */
1011   /*                                                                       */
1012   /*    max_advance_width   :: The maximum advance width, in font units,   */
1013   /*                           for all glyphs in this face.  This can be   */
1014   /*                           used to make word wrapping computations     */
1015   /*                           faster.  Only relevant for scalable         */
1016   /*                           formats.                                    */
1017   /*                                                                       */
1018   /*    max_advance_height  :: The maximum advance height, in font units,  */
1019   /*                           for all glyphs in this face.  This is only  */
1020   /*                           relevant for vertical layouts, and is set   */
1021   /*                           to `height' for fonts that do not provide   */
1022   /*                           vertical metrics.  Only relevant for        */
1023   /*                           scalable formats.                           */
1024   /*                                                                       */
1025   /*    underline_position  :: The position, in font units, of the         */
1026   /*                           underline line for this face.  It is the    */
1027   /*                           center of the underlining stem.  Only       */
1028   /*                           relevant for scalable formats.              */
1029   /*                                                                       */
1030   /*    underline_thickness :: The thickness, in font units, of the        */
1031   /*                           underline for this face.  Only relevant for */
1032   /*                           scalable formats.                           */
1033   /*                                                                       */
1034   /*    glyph               :: The face's associated glyph slot(s).        */
1035   /*                                                                       */
1036   /*    size                :: The current active size for this face.      */
1037   /*                                                                       */
1038   /*    charmap             :: The current active charmap for this face.   */
1039   /*                                                                       */
1040   /* <Note>                                                                */
1041   /*    Fields may be changed after a call to @FT_Attach_File or           */
1042   /*    @FT_Attach_Stream.                                                 */
1043   /*                                                                       */
1044   /*    For an OpenType variation font, the values of the following fields */
1045   /*    can change after a call to @FT_Set_Var_Design_Coordinates (and     */
1046   /*    friends) if the font contains an `MVAR' table: `ascender',         */
1047   /*    `descender', `height', `underline_position', and                   */
1048   /*    `underline_thickness'.                                             */
1049   /*                                                                       */
1050   typedef struct  FT_FaceRec_
1051   {
1052     FT_Long           num_faces;
1053     FT_Long           face_index;
1054 
1055     FT_Long           face_flags;
1056     FT_Long           style_flags;
1057 
1058     FT_Long           num_glyphs;
1059 
1060     FT_String*        family_name;
1061     FT_String*        style_name;
1062 
1063     FT_Int            num_fixed_sizes;
1064     FT_Bitmap_Size*   available_sizes;
1065 
1066     FT_Int            num_charmaps;
1067     FT_CharMap*       charmaps;
1068 
1069     FT_Generic        generic;
1070 
1071     /*# The following member variables (down to `underline_thickness') */
1072     /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size    */
1073     /*# for bitmap fonts.                                              */
1074     FT_BBox           bbox;
1075 
1076     FT_UShort         units_per_EM;
1077     FT_Short          ascender;
1078     FT_Short          descender;
1079     FT_Short          height;
1080 
1081     FT_Short          max_advance_width;
1082     FT_Short          max_advance_height;
1083 
1084     FT_Short          underline_position;
1085     FT_Short          underline_thickness;
1086 
1087     FT_GlyphSlot      glyph;
1088     FT_Size           size;
1089     FT_CharMap        charmap;
1090 
1091     /*@private begin */
1092 
1093     FT_Driver         driver;
1094     FT_Memory         memory;
1095     FT_Stream         stream;
1096 
1097     FT_ListRec        sizes_list;
1098 
1099     FT_Generic        autohint;   /* face-specific auto-hinter data */
1100     void*             extensions; /* unused                         */
1101 
1102     FT_Face_Internal  internal;
1103 
1104     /*@private end */
1105 
1106   } FT_FaceRec;
1107 
1108 
1109   /*************************************************************************/
1110   /*                                                                       */
1111   /* <Enum>                                                                */
1112   /*    FT_FACE_FLAG_XXX                                                   */
1113   /*                                                                       */
1114   /* <Description>                                                         */
1115   /*    A list of bit flags used in the `face_flags' field of the          */
1116   /*    @FT_FaceRec structure.  They inform client applications of         */
1117   /*    properties of the corresponding face.                              */
1118   /*                                                                       */
1119   /* <Values>                                                              */
1120   /*    FT_FACE_FLAG_SCALABLE ::                                           */
1121   /*      The face contains outline glyphs.  Note that a face can contain  */
1122   /*      bitmap strikes also, i.e., a face can have both this flag and    */
1123   /*      @FT_FACE_FLAG_FIXED_SIZES set.                                   */
1124   /*                                                                       */
1125   /*    FT_FACE_FLAG_FIXED_SIZES ::                                        */
1126   /*      The face contains bitmap strikes.  See also the                  */
1127   /*      `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec.   */
1128   /*                                                                       */
1129   /*    FT_FACE_FLAG_FIXED_WIDTH ::                                        */
1130   /*      The face contains fixed-width characters (like Courier, Lucida,  */
1131   /*      MonoType, etc.).                                                 */
1132   /*                                                                       */
1133   /*    FT_FACE_FLAG_SFNT ::                                               */
1134   /*      The face uses the SFNT storage scheme.  For now, this means      */
1135   /*      TrueType and OpenType.                                           */
1136   /*                                                                       */
1137   /*    FT_FACE_FLAG_HORIZONTAL ::                                         */
1138   /*      The face contains horizontal glyph metrics.  This should be set  */
1139   /*      for all common formats.                                          */
1140   /*                                                                       */
1141   /*    FT_FACE_FLAG_VERTICAL ::                                           */
1142   /*      The face contains vertical glyph metrics.  This is only          */
1143   /*      available in some formats, not all of them.                      */
1144   /*                                                                       */
1145   /*    FT_FACE_FLAG_KERNING ::                                            */
1146   /*      The face contains kerning information.  If set, the kerning      */
1147   /*      distance can be retrieved using the function @FT_Get_Kerning.    */
1148   /*      Otherwise the function always return the vector (0,0).  Note     */
1149   /*      that FreeType doesn't handle kerning data from the SFNT `GPOS'   */
1150   /*      table (as present in many OpenType fonts).                       */
1151   /*                                                                       */
1152   /*    FT_FACE_FLAG_FAST_GLYPHS ::                                        */
1153   /*      THIS FLAG IS DEPRECATED.  DO NOT USE OR TEST IT.                 */
1154   /*                                                                       */
1155   /*    FT_FACE_FLAG_MULTIPLE_MASTERS ::                                   */
1156   /*      The face contains multiple masters and is capable of             */
1157   /*      interpolating between them.  Supported formats are Adobe MM,     */
1158   /*      TrueType GX, and OpenType variation fonts.                       */
1159   /*                                                                       */
1160   /*      See the multiple-masters specific API for details.               */
1161   /*                                                                       */
1162   /*    FT_FACE_FLAG_GLYPH_NAMES ::                                        */
1163   /*      The face contains glyph names, which can be retrieved using      */
1164   /*      @FT_Get_Glyph_Name.  Note that some TrueType fonts contain       */
1165   /*      broken glyph name tables.  Use the function                      */
1166   /*      @FT_Has_PS_Glyph_Names when needed.                              */
1167   /*                                                                       */
1168   /*    FT_FACE_FLAG_EXTERNAL_STREAM ::                                    */
1169   /*      Used internally by FreeType to indicate that a face's stream was */
1170   /*      provided by the client application and should not be destroyed   */
1171   /*      when @FT_Done_Face is called.  Don't read or test this flag.     */
1172   /*                                                                       */
1173   /*    FT_FACE_FLAG_HINTER ::                                             */
1174   /*      The font driver has a hinting machine of its own.  For example,  */
1175   /*      with TrueType fonts, it makes sense to use data from the SFNT    */
1176   /*      `gasp' table only if the native TrueType hinting engine (with    */
1177   /*      the bytecode interpreter) is available and active.               */
1178   /*                                                                       */
1179   /*    FT_FACE_FLAG_CID_KEYED ::                                          */
1180   /*      The face is CID-keyed.  In that case, the face is not accessed   */
1181   /*      by glyph indices but by CID values.  For subsetted CID-keyed     */
1182   /*      fonts this has the consequence that not all index values are a   */
1183   /*      valid argument to @FT_Load_Glyph.  Only the CID values for which */
1184   /*      corresponding glyphs in the subsetted font exist make            */
1185   /*      `FT_Load_Glyph' return successfully; in all other cases you get  */
1186   /*      an `FT_Err_Invalid_Argument' error.                              */
1187   /*                                                                       */
1188   /*      Note that CID-keyed fonts that are in an SFNT wrapper (this is,  */
1189   /*      all OpenType/CFF fonts) don't have this flag set since the       */
1190   /*      glyphs are accessed in the normal way (using contiguous          */
1191   /*      indices); the `CID-ness' isn't visible to the application.       */
1192   /*                                                                       */
1193   /*    FT_FACE_FLAG_TRICKY ::                                             */
1194   /*      The face is `tricky', this is, it always needs the font format's */
1195   /*      native hinting engine to get a reasonable result.  A typical     */
1196   /*      example is the old Chinese font `mingli.ttf' (but not            */
1197   /*      `mingliu.ttc') that uses TrueType bytecode instructions to move  */
1198   /*      and scale all of its subglyphs.                                  */
1199   /*                                                                       */
1200   /*      It is not possible to auto-hint such fonts using                 */
1201   /*      @FT_LOAD_FORCE_AUTOHINT; it will also ignore                     */
1202   /*      @FT_LOAD_NO_HINTING.  You have to set both @FT_LOAD_NO_HINTING   */
1203   /*      and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
1204   /*      probably never want this except for demonstration purposes.      */
1205   /*                                                                       */
1206   /*      Currently, there are about a dozen TrueType fonts in the list of */
1207   /*      tricky fonts; they are hard-coded in file `ttobjs.c'.            */
1208   /*                                                                       */
1209   /*    FT_FACE_FLAG_COLOR ::                                              */
1210   /*      The face has color glyph tables.  To access color glyphs use     */
1211   /*      @FT_LOAD_COLOR.                                                  */
1212   /*                                                                       */
1213 #define FT_FACE_FLAG_SCALABLE          ( 1L <<  0 )
1214 #define FT_FACE_FLAG_FIXED_SIZES       ( 1L <<  1 )
1215 #define FT_FACE_FLAG_FIXED_WIDTH       ( 1L <<  2 )
1216 #define FT_FACE_FLAG_SFNT              ( 1L <<  3 )
1217 #define FT_FACE_FLAG_HORIZONTAL        ( 1L <<  4 )
1218 #define FT_FACE_FLAG_VERTICAL          ( 1L <<  5 )
1219 #define FT_FACE_FLAG_KERNING           ( 1L <<  6 )
1220 #define FT_FACE_FLAG_FAST_GLYPHS       ( 1L <<  7 )
1221 #define FT_FACE_FLAG_MULTIPLE_MASTERS  ( 1L <<  8 )
1222 #define FT_FACE_FLAG_GLYPH_NAMES       ( 1L <<  9 )
1223 #define FT_FACE_FLAG_EXTERNAL_STREAM   ( 1L << 10 )
1224 #define FT_FACE_FLAG_HINTER            ( 1L << 11 )
1225 #define FT_FACE_FLAG_CID_KEYED         ( 1L << 12 )
1226 #define FT_FACE_FLAG_TRICKY            ( 1L << 13 )
1227 #define FT_FACE_FLAG_COLOR             ( 1L << 14 )
1228 
1229 
1230   /*************************************************************************
1231    *
1232    * @macro:
1233    *   FT_HAS_HORIZONTAL( face )
1234    *
1235    * @description:
1236    *   A macro that returns true whenever a face object contains
1237    *   horizontal metrics (this is true for all font formats though).
1238    *
1239    * @also:
1240    *   @FT_HAS_VERTICAL can be used to check for vertical metrics.
1241    *
1242    */
1243 #define FT_HAS_HORIZONTAL( face ) \
1244           ( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL )
1245 
1246 
1247   /*************************************************************************
1248    *
1249    * @macro:
1250    *   FT_HAS_VERTICAL( face )
1251    *
1252    * @description:
1253    *   A macro that returns true whenever a face object contains real
1254    *   vertical metrics (and not only synthesized ones).
1255    *
1256    */
1257 #define FT_HAS_VERTICAL( face ) \
1258           ( (face)->face_flags & FT_FACE_FLAG_VERTICAL )
1259 
1260 
1261   /*************************************************************************
1262    *
1263    * @macro:
1264    *   FT_HAS_KERNING( face )
1265    *
1266    * @description:
1267    *   A macro that returns true whenever a face object contains kerning
1268    *   data that can be accessed with @FT_Get_Kerning.
1269    *
1270    */
1271 #define FT_HAS_KERNING( face ) \
1272           ( (face)->face_flags & FT_FACE_FLAG_KERNING )
1273 
1274 
1275   /*************************************************************************
1276    *
1277    * @macro:
1278    *   FT_IS_SCALABLE( face )
1279    *
1280    * @description:
1281    *   A macro that returns true whenever a face object contains a scalable
1282    *   font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
1283    *   and PFR font formats).
1284    *
1285    */
1286 #define FT_IS_SCALABLE( face ) \
1287           ( (face)->face_flags & FT_FACE_FLAG_SCALABLE )
1288 
1289 
1290   /*************************************************************************
1291    *
1292    * @macro:
1293    *   FT_IS_SFNT( face )
1294    *
1295    * @description:
1296    *   A macro that returns true whenever a face object contains a font
1297    *   whose format is based on the SFNT storage scheme.  This usually
1298    *   means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
1299    *   bitmap fonts.
1300    *
1301    *   If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
1302    *   @FT_TRUETYPE_TABLES_H are available.
1303    *
1304    */
1305 #define FT_IS_SFNT( face ) \
1306           ( (face)->face_flags & FT_FACE_FLAG_SFNT )
1307 
1308 
1309   /*************************************************************************
1310    *
1311    * @macro:
1312    *   FT_IS_FIXED_WIDTH( face )
1313    *
1314    * @description:
1315    *   A macro that returns true whenever a face object contains a font face
1316    *   that contains fixed-width (or `monospace', `fixed-pitch', etc.)
1317    *   glyphs.
1318    *
1319    */
1320 #define FT_IS_FIXED_WIDTH( face ) \
1321           ( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
1322 
1323 
1324   /*************************************************************************
1325    *
1326    * @macro:
1327    *   FT_HAS_FIXED_SIZES( face )
1328    *
1329    * @description:
1330    *   A macro that returns true whenever a face object contains some
1331    *   embedded bitmaps.  See the `available_sizes' field of the
1332    *   @FT_FaceRec structure.
1333    *
1334    */
1335 #define FT_HAS_FIXED_SIZES( face ) \
1336           ( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES )
1337 
1338 
1339   /*************************************************************************
1340    *
1341    * @macro:
1342    *   FT_HAS_FAST_GLYPHS( face )
1343    *
1344    * @description:
1345    *   Deprecated.
1346    *
1347    */
1348 #define FT_HAS_FAST_GLYPHS( face )  0
1349 
1350 
1351   /*************************************************************************
1352    *
1353    * @macro:
1354    *   FT_HAS_GLYPH_NAMES( face )
1355    *
1356    * @description:
1357    *   A macro that returns true whenever a face object contains some glyph
1358    *   names that can be accessed through @FT_Get_Glyph_Name.
1359    *
1360    */
1361 #define FT_HAS_GLYPH_NAMES( face ) \
1362           ( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
1363 
1364 
1365   /*************************************************************************
1366    *
1367    * @macro:
1368    *   FT_HAS_MULTIPLE_MASTERS( face )
1369    *
1370    * @description:
1371    *   A macro that returns true whenever a face object contains some
1372    *   multiple masters.  The functions provided by @FT_MULTIPLE_MASTERS_H
1373    *   are then available to choose the exact design you want.
1374    *
1375    */
1376 #define FT_HAS_MULTIPLE_MASTERS( face ) \
1377           ( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
1378 
1379 
1380   /*************************************************************************
1381    *
1382    * @macro:
1383    *   FT_IS_NAMED_INSTANCE( face )
1384    *
1385    * @description:
1386    *   A macro that returns true whenever a face object is a named instance
1387    *   of a GX or OpenType variation font.
1388    *
1389    */
1390 #define FT_IS_NAMED_INSTANCE( face ) \
1391           ( (face)->face_index & 0x7FFF0000L )
1392 
1393 
1394   /*************************************************************************
1395    *
1396    * @macro:
1397    *   FT_IS_CID_KEYED( face )
1398    *
1399    * @description:
1400    *   A macro that returns true whenever a face object contains a CID-keyed
1401    *   font.  See the discussion of @FT_FACE_FLAG_CID_KEYED for more
1402    *   details.
1403    *
1404    *   If this macro is true, all functions defined in @FT_CID_H are
1405    *   available.
1406    *
1407    */
1408 #define FT_IS_CID_KEYED( face ) \
1409           ( (face)->face_flags & FT_FACE_FLAG_CID_KEYED )
1410 
1411 
1412   /*************************************************************************
1413    *
1414    * @macro:
1415    *   FT_IS_TRICKY( face )
1416    *
1417    * @description:
1418    *   A macro that returns true whenever a face represents a `tricky' font.
1419    *   See the discussion of @FT_FACE_FLAG_TRICKY for more details.
1420    *
1421    */
1422 #define FT_IS_TRICKY( face ) \
1423           ( (face)->face_flags & FT_FACE_FLAG_TRICKY )
1424 
1425 
1426   /*************************************************************************
1427    *
1428    * @macro:
1429    *   FT_HAS_COLOR( face )
1430    *
1431    * @description:
1432    *   A macro that returns true whenever a face object contains
1433    *   tables for color glyphs.
1434    *
1435    */
1436 #define FT_HAS_COLOR( face ) \
1437           ( (face)->face_flags & FT_FACE_FLAG_COLOR )
1438 
1439 
1440   /*************************************************************************/
1441   /*                                                                       */
1442   /* <Const>                                                               */
1443   /*    FT_STYLE_FLAG_XXX                                                  */
1444   /*                                                                       */
1445   /* <Description>                                                         */
1446   /*    A list of bit flags to indicate the style of a given face.  These  */
1447   /*    are used in the `style_flags' field of @FT_FaceRec.                */
1448   /*                                                                       */
1449   /* <Values>                                                              */
1450   /*    FT_STYLE_FLAG_ITALIC ::                                            */
1451   /*      The face style is italic or oblique.                             */
1452   /*                                                                       */
1453   /*    FT_STYLE_FLAG_BOLD ::                                              */
1454   /*      The face is bold.                                                */
1455   /*                                                                       */
1456   /* <Note>                                                                */
1457   /*    The style information as provided by FreeType is very basic.  More */
1458   /*    details are beyond the scope and should be done on a higher level  */
1459   /*    (for example, by analyzing various fields of the `OS/2' table in   */
1460   /*    SFNT based fonts).                                                 */
1461   /*                                                                       */
1462 #define FT_STYLE_FLAG_ITALIC  ( 1 << 0 )
1463 #define FT_STYLE_FLAG_BOLD    ( 1 << 1 )
1464 
1465 
1466   /*************************************************************************/
1467   /*                                                                       */
1468   /* <Type>                                                                */
1469   /*    FT_Size_Internal                                                   */
1470   /*                                                                       */
1471   /* <Description>                                                         */
1472   /*    An opaque handle to an `FT_Size_InternalRec' structure, used to    */
1473   /*    model private data of a given @FT_Size object.                     */
1474   /*                                                                       */
1475   typedef struct FT_Size_InternalRec_*  FT_Size_Internal;
1476 
1477 
1478   /*************************************************************************/
1479   /*                                                                       */
1480   /* <Struct>                                                              */
1481   /*    FT_Size_Metrics                                                    */
1482   /*                                                                       */
1483   /* <Description>                                                         */
1484   /*    The size metrics structure gives the metrics of a size object.     */
1485   /*                                                                       */
1486   /* <Fields>                                                              */
1487   /*    x_ppem       :: The width of the scaled EM square in pixels, hence */
1488   /*                    the term `ppem' (pixels per EM).  It is also       */
1489   /*                    referred to as `nominal width'.                    */
1490   /*                                                                       */
1491   /*    y_ppem       :: The height of the scaled EM square in pixels,      */
1492   /*                    hence the term `ppem' (pixels per EM).  It is also */
1493   /*                    referred to as `nominal height'.                   */
1494   /*                                                                       */
1495   /*    x_scale      :: A 16.16 fractional scaling value to convert        */
1496   /*                    horizontal metrics from font units to 26.6         */
1497   /*                    fractional pixels.  Only relevant for scalable     */
1498   /*                    font formats.                                      */
1499   /*                                                                       */
1500   /*    y_scale      :: A 16.16 fractional scaling value to convert        */
1501   /*                    vertical metrics from font units to 26.6           */
1502   /*                    fractional pixels.  Only relevant for scalable     */
1503   /*                    font formats.                                      */
1504   /*                                                                       */
1505   /*    ascender     :: The ascender in 26.6 fractional pixels.  See       */
1506   /*                    @FT_FaceRec for the details.                       */
1507   /*                                                                       */
1508   /*    descender    :: The descender in 26.6 fractional pixels.  See      */
1509   /*                    @FT_FaceRec for the details.                       */
1510   /*                                                                       */
1511   /*    height       :: The height in 26.6 fractional pixels.  See         */
1512   /*                    @FT_FaceRec for the details.                       */
1513   /*                                                                       */
1514   /*    max_advance  :: The maximum advance width in 26.6 fractional       */
1515   /*                    pixels.  See @FT_FaceRec for the details.          */
1516   /*                                                                       */
1517   /* <Note>                                                                */
1518   /*    The scaling values, if relevant, are determined first during a     */
1519   /*    size changing operation.  The remaining fields are then set by the */
1520   /*    driver.  For scalable formats, they are usually set to scaled      */
1521   /*    values of the corresponding fields in @FT_FaceRec.                 */
1522   /*                                                                       */
1523   /*    Note that due to glyph hinting, these values might not be exact    */
1524   /*    for certain fonts.  Thus they must be treated as unreliable        */
1525   /*    with an error margin of at least one pixel!                        */
1526   /*                                                                       */
1527   /*    Indeed, the only way to get the exact metrics is to render _all_   */
1528   /*    glyphs.  As this would be a definite performance hit, it is up to  */
1529   /*    client applications to perform such computations.                  */
1530   /*                                                                       */
1531   /*    The `FT_Size_Metrics' structure is valid for bitmap fonts also.    */
1532   /*                                                                       */
1533   typedef struct  FT_Size_Metrics_
1534   {
1535     FT_UShort  x_ppem;      /* horizontal pixels per EM               */
1536     FT_UShort  y_ppem;      /* vertical pixels per EM                 */
1537 
1538     FT_Fixed   x_scale;     /* scaling values used to convert font    */
1539     FT_Fixed   y_scale;     /* units to 26.6 fractional pixels        */
1540 
1541     FT_Pos     ascender;    /* ascender in 26.6 frac. pixels          */
1542     FT_Pos     descender;   /* descender in 26.6 frac. pixels         */
1543     FT_Pos     height;      /* text height in 26.6 frac. pixels       */
1544     FT_Pos     max_advance; /* max horizontal advance, in 26.6 pixels */
1545 
1546   } FT_Size_Metrics;
1547 
1548 
1549   /*************************************************************************/
1550   /*                                                                       */
1551   /* <Struct>                                                              */
1552   /*    FT_SizeRec                                                         */
1553   /*                                                                       */
1554   /* <Description>                                                         */
1555   /*    FreeType root size class structure.  A size object models a face   */
1556   /*    object at a given size.                                            */
1557   /*                                                                       */
1558   /* <Fields>                                                              */
1559   /*    face    :: Handle to the parent face object.                       */
1560   /*                                                                       */
1561   /*    generic :: A typeless pointer, unused by the FreeType library or   */
1562   /*               any of its drivers.  It can be used by client           */
1563   /*               applications to link their own data to each size        */
1564   /*               object.                                                 */
1565   /*                                                                       */
1566   /*    metrics :: Metrics for this size object.  This field is read-only. */
1567   /*                                                                       */
1568   typedef struct  FT_SizeRec_
1569   {
1570     FT_Face           face;      /* parent face object              */
1571     FT_Generic        generic;   /* generic pointer for client uses */
1572     FT_Size_Metrics   metrics;   /* size metrics                    */
1573     FT_Size_Internal  internal;
1574 
1575   } FT_SizeRec;
1576 
1577 
1578   /*************************************************************************/
1579   /*                                                                       */
1580   /* <Struct>                                                              */
1581   /*    FT_SubGlyph                                                        */
1582   /*                                                                       */
1583   /* <Description>                                                         */
1584   /*    The subglyph structure is an internal object used to describe      */
1585   /*    subglyphs (for example, in the case of composites).                */
1586   /*                                                                       */
1587   /* <Note>                                                                */
1588   /*    The subglyph implementation is not part of the high-level API,     */
1589   /*    hence the forward structure declaration.                           */
1590   /*                                                                       */
1591   /*    You can however retrieve subglyph information with                 */
1592   /*    @FT_Get_SubGlyph_Info.                                             */
1593   /*                                                                       */
1594   typedef struct FT_SubGlyphRec_*  FT_SubGlyph;
1595 
1596 
1597   /*************************************************************************/
1598   /*                                                                       */
1599   /* <Type>                                                                */
1600   /*    FT_Slot_Internal                                                   */
1601   /*                                                                       */
1602   /* <Description>                                                         */
1603   /*    An opaque handle to an `FT_Slot_InternalRec' structure, used to    */
1604   /*    model private data of a given @FT_GlyphSlot object.                */
1605   /*                                                                       */
1606   typedef struct FT_Slot_InternalRec_*  FT_Slot_Internal;
1607 
1608 
1609   /*************************************************************************/
1610   /*                                                                       */
1611   /* <Struct>                                                              */
1612   /*    FT_GlyphSlotRec                                                    */
1613   /*                                                                       */
1614   /* <Description>                                                         */
1615   /*    FreeType root glyph slot class structure.  A glyph slot is a       */
1616   /*    container where individual glyphs can be loaded, be they in        */
1617   /*    outline or bitmap format.                                          */
1618   /*                                                                       */
1619   /* <Fields>                                                              */
1620   /*    library           :: A handle to the FreeType library instance     */
1621   /*                         this slot belongs to.                         */
1622   /*                                                                       */
1623   /*    face              :: A handle to the parent face object.           */
1624   /*                                                                       */
1625   /*    next              :: In some cases (like some font tools), several */
1626   /*                         glyph slots per face object can be a good     */
1627   /*                         thing.  As this is rare, the glyph slots are  */
1628   /*                         listed through a direct, single-linked list   */
1629   /*                         using its `next' field.                       */
1630   /*                                                                       */
1631   /*    generic           :: A typeless pointer unused by the FreeType     */
1632   /*                         library or any of its drivers.  It can be     */
1633   /*                         used by client applications to link their own */
1634   /*                         data to each glyph slot object.               */
1635   /*                                                                       */
1636   /*    metrics           :: The metrics of the last loaded glyph in the   */
1637   /*                         slot.  The returned values depend on the last */
1638   /*                         load flags (see the @FT_Load_Glyph API        */
1639   /*                         function) and can be expressed either in 26.6 */
1640   /*                         fractional pixels or font units.              */
1641   /*                                                                       */
1642   /*                         Note that even when the glyph image is        */
1643   /*                         transformed, the metrics are not.             */
1644   /*                                                                       */
1645   /*    linearHoriAdvance :: The advance width of the unhinted glyph.      */
1646   /*                         Its value is expressed in 16.16 fractional    */
1647   /*                         pixels, unless @FT_LOAD_LINEAR_DESIGN is set  */
1648   /*                         when loading the glyph.  This field can be    */
1649   /*                         important to perform correct WYSIWYG layout.  */
1650   /*                         Only relevant for outline glyphs.             */
1651   /*                                                                       */
1652   /*    linearVertAdvance :: The advance height of the unhinted glyph.     */
1653   /*                         Its value is expressed in 16.16 fractional    */
1654   /*                         pixels, unless @FT_LOAD_LINEAR_DESIGN is set  */
1655   /*                         when loading the glyph.  This field can be    */
1656   /*                         important to perform correct WYSIWYG layout.  */
1657   /*                         Only relevant for outline glyphs.             */
1658   /*                                                                       */
1659   /*    advance           :: This shorthand is, depending on               */
1660   /*                         @FT_LOAD_IGNORE_TRANSFORM, the transformed    */
1661   /*                         (hinted) advance width for the glyph, in 26.6 */
1662   /*                         fractional pixel format.  As specified with   */
1663   /*                         @FT_LOAD_VERTICAL_LAYOUT, it uses either the  */
1664   /*                         `horiAdvance' or the `vertAdvance' value of   */
1665   /*                         `metrics' field.                              */
1666   /*                                                                       */
1667   /*    format            :: This field indicates the format of the image  */
1668   /*                         contained in the glyph slot.  Typically       */
1669   /*                         @FT_GLYPH_FORMAT_BITMAP,                      */
1670   /*                         @FT_GLYPH_FORMAT_OUTLINE, or                  */
1671   /*                         @FT_GLYPH_FORMAT_COMPOSITE, but other values  */
1672   /*                         are possible.                                 */
1673   /*                                                                       */
1674   /*    bitmap            :: This field is used as a bitmap descriptor     */
1675   /*                         when the slot format is                       */
1676   /*                         @FT_GLYPH_FORMAT_BITMAP.  Note that the       */
1677   /*                         address and content of the bitmap buffer can  */
1678   /*                         change between calls of @FT_Load_Glyph and a  */
1679   /*                         few other functions.                          */
1680   /*                                                                       */
1681   /*    bitmap_left       :: The bitmap's left bearing expressed in        */
1682   /*                         integer pixels.  Only valid if the format is  */
1683   /*                         @FT_GLYPH_FORMAT_BITMAP, this is, if the      */
1684   /*                         glyph slot contains a bitmap.                 */
1685   /*                                                                       */
1686   /*    bitmap_top        :: The bitmap's top bearing expressed in integer */
1687   /*                         pixels.  This is the distance from the        */
1688   /*                         baseline to the top-most glyph scanline,      */
1689   /*                         upwards y~coordinates being *positive*.       */
1690   /*                                                                       */
1691   /*    outline           :: The outline descriptor for the current glyph  */
1692   /*                         image if its format is                        */
1693   /*                         @FT_GLYPH_FORMAT_OUTLINE.  Once a glyph is    */
1694   /*                         loaded, `outline' can be transformed,         */
1695   /*                         distorted, emboldened, etc.  However, it must */
1696   /*                         not be freed.                                 */
1697   /*                                                                       */
1698   /*    num_subglyphs     :: The number of subglyphs in a composite glyph. */
1699   /*                         This field is only valid for the composite    */
1700   /*                         glyph format that should normally only be     */
1701   /*                         loaded with the @FT_LOAD_NO_RECURSE flag.     */
1702   /*                                                                       */
1703   /*    subglyphs         :: An array of subglyph descriptors for          */
1704   /*                         composite glyphs.  There are `num_subglyphs'  */
1705   /*                         elements in there.  Currently internal to     */
1706   /*                         FreeType.                                     */
1707   /*                                                                       */
1708   /*    control_data      :: Certain font drivers can also return the      */
1709   /*                         control data for a given glyph image (e.g.    */
1710   /*                         TrueType bytecode, Type~1 charstrings, etc.). */
1711   /*                         This field is a pointer to such data; it is   */
1712   /*                         currently internal to FreeType.               */
1713   /*                                                                       */
1714   /*    control_len       :: This is the length in bytes of the control    */
1715   /*                         data.  Currently internal to FreeType.        */
1716   /*                                                                       */
1717   /*    other             :: Reserved.                                     */
1718   /*                                                                       */
1719   /*    lsb_delta         :: The difference between hinted and unhinted    */
1720   /*                         left side bearing while auto-hinting is       */
1721   /*                         active.  Zero otherwise.                      */
1722   /*                                                                       */
1723   /*    rsb_delta         :: The difference between hinted and unhinted    */
1724   /*                         right side bearing while auto-hinting is      */
1725   /*                         active.  Zero otherwise.                      */
1726   /*                                                                       */
1727   /* <Note>                                                                */
1728   /*    If @FT_Load_Glyph is called with default flags (see                */
1729   /*    @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in   */
1730   /*    its native format (e.g., an outline glyph for TrueType and Type~1  */
1731   /*    formats).                                                          */
1732   /*                                                                       */
1733   /*    This image can later be converted into a bitmap by calling         */
1734   /*    @FT_Render_Glyph.  This function searches the current renderer for */
1735   /*    the native image's format, then invokes it.                        */
1736   /*                                                                       */
1737   /*    The renderer is in charge of transforming the native image through */
1738   /*    the slot's face transformation fields, then converting it into a   */
1739   /*    bitmap that is returned in `slot->bitmap'.                         */
1740   /*                                                                       */
1741   /*    Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
1742   /*    to specify the position of the bitmap relative to the current pen  */
1743   /*    position (e.g., coordinates (0,0) on the baseline).  Of course,    */
1744   /*    `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP.         */
1745   /*                                                                       */
1746   /*    Here is a small pseudo code fragment that shows how to use         */
1747   /*    `lsb_delta' and `rsb_delta':                                       */
1748   /*                                                                       */
1749   /*    {                                                                  */
1750   /*      FT_Pos  origin_x       = 0;                                      */
1751   /*      FT_Pos  prev_rsb_delta = 0;                                      */
1752   /*                                                                       */
1753   /*                                                                       */
1754   /*      for all glyphs do                                                */
1755   /*        <compute kern between current and previous glyph               */
1756   /*         and add it to `origin_x'>                                     */
1757   /*                                                                       */
1758   /*        <load glyph with `FT_Load_Glyph'>                              */
1759   /*                                                                       */
1760   /*        if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 )           */
1761   /*          origin_x -= 64;                                              */
1762   /*        else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 )      */
1763   /*          origin_x += 64;                                              */
1764   /*                                                                       */
1765   /*        prev_rsb_delta = face->glyph->rsb_delta;                       */
1766   /*                                                                       */
1767   /*        <save glyph image, or render glyph, or ...>                    */
1768   /*                                                                       */
1769   /*        origin_x += face->glyph->advance.x;                            */
1770   /*      endfor                                                           */
1771   /*    }                                                                  */
1772   /*                                                                       */
1773   /*    If you use strong auto-hinting, you *must* apply these delta       */
1774   /*    values!  Otherwise you will experience far too large inter-glyph   */
1775   /*    spacing at small rendering sizes in most cases.  Note that it      */
1776   /*    doesn't harm to use the above code for other hinting modes also,   */
1777   /*    since the delta values are zero then.                              */
1778   /*                                                                       */
1779   typedef struct  FT_GlyphSlotRec_
1780   {
1781     FT_Library        library;
1782     FT_Face           face;
1783     FT_GlyphSlot      next;
1784     FT_UInt           reserved;       /* retained for binary compatibility */
1785     FT_Generic        generic;
1786 
1787     FT_Glyph_Metrics  metrics;
1788     FT_Fixed          linearHoriAdvance;
1789     FT_Fixed          linearVertAdvance;
1790     FT_Vector         advance;
1791 
1792     FT_Glyph_Format   format;
1793 
1794     FT_Bitmap         bitmap;
1795     FT_Int            bitmap_left;
1796     FT_Int            bitmap_top;
1797 
1798     FT_Outline        outline;
1799 
1800     FT_UInt           num_subglyphs;
1801     FT_SubGlyph       subglyphs;
1802 
1803     void*             control_data;
1804     long              control_len;
1805 
1806     FT_Pos            lsb_delta;
1807     FT_Pos            rsb_delta;
1808 
1809     void*             other;
1810 
1811     FT_Slot_Internal  internal;
1812 
1813   } FT_GlyphSlotRec;
1814 
1815 
1816   /*************************************************************************/
1817   /*************************************************************************/
1818   /*                                                                       */
1819   /*                         F U N C T I O N S                             */
1820   /*                                                                       */
1821   /*************************************************************************/
1822   /*************************************************************************/
1823 
1824 
1825   /*************************************************************************/
1826   /*                                                                       */
1827   /* <Function>                                                            */
1828   /*    FT_Init_FreeType                                                   */
1829   /*                                                                       */
1830   /* <Description>                                                         */
1831   /*    Initialize a new FreeType library object.  The set of modules      */
1832   /*    that are registered by this function is determined at build time.  */
1833   /*                                                                       */
1834   /* <Output>                                                              */
1835   /*    alibrary :: A handle to a new library object.                      */
1836   /*                                                                       */
1837   /* <Return>                                                              */
1838   /*    FreeType error code.  0~means success.                             */
1839   /*                                                                       */
1840   /* <Note>                                                                */
1841   /*    In case you want to provide your own memory allocating routines,   */
1842   /*    use @FT_New_Library instead, followed by a call to                 */
1843   /*    @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module)   */
1844   /*    and @FT_Set_Default_Properties.                                    */
1845   /*                                                                       */
1846   /*    See the documentation of @FT_Library and @FT_Face for              */
1847   /*    multi-threading issues.                                            */
1848   /*                                                                       */
1849   /*    If you need reference-counting (cf. @FT_Reference_Library), use    */
1850   /*    @FT_New_Library and @FT_Done_Library.                              */
1851   /*                                                                       */
1852   /*    If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is   */
1853   /*    set, this function reads the `FREETYPE_PROPERTIES' environment     */
1854   /*    variable to control driver properties.  See sections @auto_hinter, */
1855   /*    @cff_driver, @pcf_driver, and @tt_driver for more.                 */
1856   /*                                                                       */
1857   FT_EXPORT( FT_Error )
1858   FT_Init_FreeType( FT_Library  *alibrary );
1859 
1860 
1861   /*************************************************************************/
1862   /*                                                                       */
1863   /* <Function>                                                            */
1864   /*    FT_Done_FreeType                                                   */
1865   /*                                                                       */
1866   /* <Description>                                                         */
1867   /*    Destroy a given FreeType library object and all of its children,   */
1868   /*    including resources, drivers, faces, sizes, etc.                   */
1869   /*                                                                       */
1870   /* <Input>                                                               */
1871   /*    library :: A handle to the target library object.                  */
1872   /*                                                                       */
1873   /* <Return>                                                              */
1874   /*    FreeType error code.  0~means success.                             */
1875   /*                                                                       */
1876   FT_EXPORT( FT_Error )
1877   FT_Done_FreeType( FT_Library  library );
1878 
1879 
1880   /*************************************************************************/
1881   /*                                                                       */
1882   /* <Enum>                                                                */
1883   /*    FT_OPEN_XXX                                                        */
1884   /*                                                                       */
1885   /* <Description>                                                         */
1886   /*    A list of bit field constants used within the `flags' field of the */
1887   /*    @FT_Open_Args structure.                                           */
1888   /*                                                                       */
1889   /* <Values>                                                              */
1890   /*    FT_OPEN_MEMORY   :: This is a memory-based stream.                 */
1891   /*                                                                       */
1892   /*    FT_OPEN_STREAM   :: Copy the stream from the `stream' field.       */
1893   /*                                                                       */
1894   /*    FT_OPEN_PATHNAME :: Create a new input stream from a C~path        */
1895   /*                        name.                                          */
1896   /*                                                                       */
1897   /*    FT_OPEN_DRIVER   :: Use the `driver' field.                        */
1898   /*                                                                       */
1899   /*    FT_OPEN_PARAMS   :: Use the `num_params' and `params' fields.      */
1900   /*                                                                       */
1901   /* <Note>                                                                */
1902   /*    The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME'     */
1903   /*    flags are mutually exclusive.                                      */
1904   /*                                                                       */
1905 #define FT_OPEN_MEMORY    0x1
1906 #define FT_OPEN_STREAM    0x2
1907 #define FT_OPEN_PATHNAME  0x4
1908 #define FT_OPEN_DRIVER    0x8
1909 #define FT_OPEN_PARAMS    0x10
1910 
1911 
1912   /* these constants are deprecated; use the corresponding `FT_OPEN_XXX' */
1913   /* values instead                                                      */
1914 #define ft_open_memory    FT_OPEN_MEMORY
1915 #define ft_open_stream    FT_OPEN_STREAM
1916 #define ft_open_pathname  FT_OPEN_PATHNAME
1917 #define ft_open_driver    FT_OPEN_DRIVER
1918 #define ft_open_params    FT_OPEN_PARAMS
1919 
1920 
1921   /*************************************************************************/
1922   /*                                                                       */
1923   /* <Struct>                                                              */
1924   /*    FT_Parameter                                                       */
1925   /*                                                                       */
1926   /* <Description>                                                         */
1927   /*    A simple structure to pass more or less generic parameters to      */
1928   /*    @FT_Open_Face.                                                     */
1929   /*                                                                       */
1930   /* <Fields>                                                              */
1931   /*    tag  :: A four-byte identification tag.                            */
1932   /*                                                                       */
1933   /*    data :: A pointer to the parameter data.                           */
1934   /*                                                                       */
1935   /* <Note>                                                                */
1936   /*    The ID and function of parameters are driver-specific.  See the    */
1937   /*    various FT_PARAM_TAG_XXX flags for more information.               */
1938   /*                                                                       */
1939   typedef struct  FT_Parameter_
1940   {
1941     FT_ULong    tag;
1942     FT_Pointer  data;
1943 
1944   } FT_Parameter;
1945 
1946 
1947   /*************************************************************************/
1948   /*                                                                       */
1949   /* <Struct>                                                              */
1950   /*    FT_Open_Args                                                       */
1951   /*                                                                       */
1952   /* <Description>                                                         */
1953   /*    A structure to indicate how to open a new font file or stream.  A  */
1954   /*    pointer to such a structure can be used as a parameter for the     */
1955   /*    functions @FT_Open_Face and @FT_Attach_Stream.                     */
1956   /*                                                                       */
1957   /* <Fields>                                                              */
1958   /*    flags       :: A set of bit flags indicating how to use the        */
1959   /*                   structure.                                          */
1960   /*                                                                       */
1961   /*    memory_base :: The first byte of the file in memory.               */
1962   /*                                                                       */
1963   /*    memory_size :: The size in bytes of the file in memory.            */
1964   /*                                                                       */
1965   /*    pathname    :: A pointer to an 8-bit file pathname.                */
1966   /*                                                                       */
1967   /*    stream      :: A handle to a source stream object.                 */
1968   /*                                                                       */
1969   /*    driver      :: This field is exclusively used by @FT_Open_Face;    */
1970   /*                   it simply specifies the font driver to use for      */
1971   /*                   opening the face.  If set to NULL, FreeType tries   */
1972   /*                   to load the face with each one of the drivers in    */
1973   /*                   its list.                                           */
1974   /*                                                                       */
1975   /*    num_params  :: The number of extra parameters.                     */
1976   /*                                                                       */
1977   /*    params      :: Extra parameters passed to the font driver when     */
1978   /*                   opening a new face.                                 */
1979   /*                                                                       */
1980   /* <Note>                                                                */
1981   /*    The stream type is determined by the contents of `flags' that      */
1982   /*    are tested in the following order by @FT_Open_Face:                */
1983   /*                                                                       */
1984   /*    If the @FT_OPEN_MEMORY bit is set, assume that this is a           */
1985   /*    memory file of `memory_size' bytes, located at `memory_address'.   */
1986   /*    The data are not copied, and the client is responsible for         */
1987   /*    releasing and destroying them _after_ the corresponding call to    */
1988   /*    @FT_Done_Face.                                                     */
1989   /*                                                                       */
1990   /*    Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a        */
1991   /*    custom input stream `stream' is used.                              */
1992   /*                                                                       */
1993   /*    Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this   */
1994   /*    is a normal file and use `pathname' to open it.                    */
1995   /*                                                                       */
1996   /*    If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to     */
1997   /*    open the file with the driver whose handler is in `driver'.        */
1998   /*                                                                       */
1999   /*    If the @FT_OPEN_PARAMS bit is set, the parameters given by         */
2000   /*    `num_params' and `params' is used.  They are ignored otherwise.    */
2001   /*                                                                       */
2002   /*    Ideally, both the `pathname' and `params' fields should be tagged  */
2003   /*    as `const'; this is missing for API backwards compatibility.  In   */
2004   /*    other words, applications should treat them as read-only.          */
2005   /*                                                                       */
2006   typedef struct  FT_Open_Args_
2007   {
2008     FT_UInt         flags;
2009     const FT_Byte*  memory_base;
2010     FT_Long         memory_size;
2011     FT_String*      pathname;
2012     FT_Stream       stream;
2013     FT_Module       driver;
2014     FT_Int          num_params;
2015     FT_Parameter*   params;
2016 
2017   } FT_Open_Args;
2018 
2019 
2020   /*************************************************************************/
2021   /*                                                                       */
2022   /* <Function>                                                            */
2023   /*    FT_New_Face                                                        */
2024   /*                                                                       */
2025   /* <Description>                                                         */
2026   /*    Call @FT_Open_Face to open a font by its pathname.                 */
2027   /*                                                                       */
2028   /* <InOut>                                                               */
2029   /*    library    :: A handle to the library resource.                    */
2030   /*                                                                       */
2031   /* <Input>                                                               */
2032   /*    pathname   :: A path to the font file.                             */
2033   /*                                                                       */
2034   /*    face_index :: See @FT_Open_Face for a detailed description of this */
2035   /*                  parameter.                                           */
2036   /*                                                                       */
2037   /* <Output>                                                              */
2038   /*    aface      :: A handle to a new face object.  If `face_index' is   */
2039   /*                  greater than or equal to zero, it must be non-NULL.  */
2040   /*                                                                       */
2041   /* <Return>                                                              */
2042   /*    FreeType error code.  0~means success.                             */
2043   /*                                                                       */
2044   /* <Note>                                                                */
2045   /*    Use @FT_Done_Face to destroy the created @FT_Face object (along    */
2046   /*    with its slot and sizes).                                          */
2047   /*                                                                       */
2048   FT_EXPORT( FT_Error )
2049   FT_New_Face( FT_Library   library,
2050                const char*  filepathname,
2051                FT_Long      face_index,
2052                FT_Face     *aface );
2053 
2054 
2055   /*************************************************************************/
2056   /*                                                                       */
2057   /* <Function>                                                            */
2058   /*    FT_New_Memory_Face                                                 */
2059   /*                                                                       */
2060   /* <Description>                                                         */
2061   /*    Call @FT_Open_Face to open a font that has been loaded into        */
2062   /*    memory.                                                            */
2063   /*                                                                       */
2064   /* <InOut>                                                               */
2065   /*    library    :: A handle to the library resource.                    */
2066   /*                                                                       */
2067   /* <Input>                                                               */
2068   /*    file_base  :: A pointer to the beginning of the font data.         */
2069   /*                                                                       */
2070   /*    file_size  :: The size of the memory chunk used by the font data.  */
2071   /*                                                                       */
2072   /*    face_index :: See @FT_Open_Face for a detailed description of this */
2073   /*                  parameter.                                           */
2074   /*                                                                       */
2075   /* <Output>                                                              */
2076   /*    aface      :: A handle to a new face object.  If `face_index' is   */
2077   /*                  greater than or equal to zero, it must be non-NULL.  */
2078   /*                                                                       */
2079   /* <Return>                                                              */
2080   /*    FreeType error code.  0~means success.                             */
2081   /*                                                                       */
2082   /* <Note>                                                                */
2083   /*    You must not deallocate the memory before calling @FT_Done_Face.   */
2084   /*                                                                       */
2085   FT_EXPORT( FT_Error )
2086   FT_New_Memory_Face( FT_Library      library,
2087                       const FT_Byte*  file_base,
2088                       FT_Long         file_size,
2089                       FT_Long         face_index,
2090                       FT_Face        *aface );
2091 
2092 
2093   /*************************************************************************/
2094   /*                                                                       */
2095   /* <Function>                                                            */
2096   /*    FT_Open_Face                                                       */
2097   /*                                                                       */
2098   /* <Description>                                                         */
2099   /*    Create a face object from a given resource described by            */
2100   /*    @FT_Open_Args.                                                     */
2101   /*                                                                       */
2102   /* <InOut>                                                               */
2103   /*    library    :: A handle to the library resource.                    */
2104   /*                                                                       */
2105   /* <Input>                                                               */
2106   /*    args       :: A pointer to an `FT_Open_Args' structure that must   */
2107   /*                  be filled by the caller.                             */
2108   /*                                                                       */
2109   /*    face_index :: This field holds two different values.  Bits 0-15    */
2110   /*                  are the index of the face in the font file (starting */
2111   /*                  with value~0).  Set it to~0 if there is only one     */
2112   /*                  face in the font file.                               */
2113   /*                                                                       */
2114   /*                  Bits 16-30 are relevant to GX and OpenType variation */
2115   /*                  fonts only, specifying the named instance index for  */
2116   /*                  the current face index (starting with value~1;       */
2117   /*                  value~0 makes FreeType ignore named instances).  For */
2118   /*                  non-variation fonts, bits 16-30 are ignored.         */
2119   /*                  Assuming that you want to access the third named     */
2120   /*                  instance in face~4, `face_index' should be set to    */
2121   /*                  0x00030004.  If you want to access face~4 without    */
2122   /*                  variation handling, simply set `face_index' to       */
2123   /*                  value~4.                                             */
2124   /*                                                                       */
2125   /*                  `FT_Open_Face' and its siblings can be used to       */
2126   /*                  quickly check whether the font format of a given     */
2127   /*                  font resource is supported by FreeType.  In general, */
2128   /*                  if the `face_index' argument is negative, the        */
2129   /*                  function's return value is~0 if the font format is   */
2130   /*                  recognized, or non-zero otherwise.  The function     */
2131   /*                  allocates a more or less empty face handle in        */
2132   /*                  `*aface' (if `aface' isn't NULL); the only two       */
2133   /*                  useful fields in this special case are               */
2134   /*                  `face->num_faces' and `face->style_flags'.  For any  */
2135   /*                  negative value of `face_index', `face->num_faces'    */
2136   /*                  gives the number of faces within the font file.  For */
2137   /*                  the negative value `-(N+1)' (with `N' a non-negative */
2138   /*                  16-bit value), bits 16-30 in `face->style_flags'     */
2139   /*                  give the number of named instances in face `N' if we */
2140   /*                  have a variation font (or zero otherwise).  After    */
2141   /*                  examination, the returned @FT_Face structure should  */
2142   /*                  be deallocated with a call to @FT_Done_Face.         */
2143   /*                                                                       */
2144   /* <Output>                                                              */
2145   /*    aface      :: A handle to a new face object.  If `face_index' is   */
2146   /*                  greater than or equal to zero, it must be non-NULL.  */
2147   /*                                                                       */
2148   /* <Return>                                                              */
2149   /*    FreeType error code.  0~means success.                             */
2150   /*                                                                       */
2151   /* <Note>                                                                */
2152   /*    Unlike FreeType 1.x, this function automatically creates a glyph   */
2153   /*    slot for the face object that can be accessed directly through     */
2154   /*    `face->glyph'.                                                     */
2155   /*                                                                       */
2156   /*    Each new face object created with this function also owns a        */
2157   /*    default @FT_Size object, accessible as `face->size'.               */
2158   /*                                                                       */
2159   /*    One @FT_Library instance can have multiple face objects, this is,  */
2160   /*    @FT_Open_Face and its siblings can be called multiple times using  */
2161   /*    the same `library' argument.                                       */
2162   /*                                                                       */
2163   /*    See the discussion of reference counters in the description of     */
2164   /*    @FT_Reference_Face.                                                */
2165   /*                                                                       */
2166   /*    To loop over all faces, use code similar to the following snippet  */
2167   /*    (omitting the error handling).                                     */
2168   /*                                                                       */
2169   /*    {                                                                  */
2170   /*      ...                                                              */
2171   /*      FT_Face  face;                                                   */
2172   /*      FT_Long  i, num_faces;                                           */
2173   /*                                                                       */
2174   /*                                                                       */
2175   /*      error = FT_Open_Face( library, args, -1, &face );                */
2176   /*      if ( error ) { ... }                                             */
2177   /*                                                                       */
2178   /*      num_faces = face->num_faces;                                     */
2179   /*      FT_Done_Face( face );                                            */
2180   /*                                                                       */
2181   /*      for ( i = 0; i < num_faces; i++ )                                */
2182   /*      {                                                                */
2183   /*        ...                                                            */
2184   /*        error = FT_Open_Face( library, args, i, &face );               */
2185   /*        ...                                                            */
2186   /*        FT_Done_Face( face );                                          */
2187   /*        ...                                                            */
2188   /*      }                                                                */
2189   /*    }                                                                  */
2190   /*                                                                       */
2191   /*    To loop over all valid values for `face_index', use something      */
2192   /*    similar to the following snippet, again without error handling.    */
2193   /*    The code accesses all faces immediately (thus only a single call   */
2194   /*    of `FT_Open_Face' within the do-loop), with and without named      */
2195   /*    instances.                                                         */
2196   /*                                                                       */
2197   /*    {                                                                  */
2198   /*      ...                                                              */
2199   /*      FT_Face  face;                                                   */
2200   /*                                                                       */
2201   /*      FT_Long  num_faces     = 0;                                      */
2202   /*      FT_Long  num_instances = 0;                                      */
2203   /*                                                                       */
2204   /*      FT_Long  face_idx     = 0;                                       */
2205   /*      FT_Long  instance_idx = 0;                                       */
2206   /*                                                                       */
2207   /*                                                                       */
2208   /*      do                                                               */
2209   /*      {                                                                */
2210   /*        FT_Long  id = ( instance_idx << 16 ) + face_idx;               */
2211   /*                                                                       */
2212   /*                                                                       */
2213   /*        error = FT_Open_Face( library, args, id, &face );              */
2214   /*        if ( error ) { ... }                                           */
2215   /*                                                                       */
2216   /*        num_faces     = face->num_faces;                               */
2217   /*        num_instances = face->style_flags >> 16;                       */
2218   /*                                                                       */
2219   /*        ...                                                            */
2220   /*                                                                       */
2221   /*        FT_Done_Face( face );                                          */
2222   /*                                                                       */
2223   /*        if ( instance_idx < num_instances )                            */
2224   /*          instance_idx++;                                              */
2225   /*        else                                                           */
2226   /*        {                                                              */
2227   /*          face_idx++;                                                  */
2228   /*          instance_idx = 0;                                            */
2229   /*        }                                                              */
2230   /*                                                                       */
2231   /*      } while ( face_idx < num_faces )                                 */
2232   /*    }                                                                  */
2233   /*                                                                       */
2234   FT_EXPORT( FT_Error )
2235   FT_Open_Face( FT_Library           library,
2236                 const FT_Open_Args*  args,
2237                 FT_Long              face_index,
2238                 FT_Face             *aface );
2239 
2240 
2241   /*************************************************************************/
2242   /*                                                                       */
2243   /* <Function>                                                            */
2244   /*    FT_Attach_File                                                     */
2245   /*                                                                       */
2246   /* <Description>                                                         */
2247   /*    Call @FT_Attach_Stream to attach a file.                           */
2248   /*                                                                       */
2249   /* <InOut>                                                               */
2250   /*    face         :: The target face object.                            */
2251   /*                                                                       */
2252   /* <Input>                                                               */
2253   /*    filepathname :: The pathname.                                      */
2254   /*                                                                       */
2255   /* <Return>                                                              */
2256   /*    FreeType error code.  0~means success.                             */
2257   /*                                                                       */
2258   FT_EXPORT( FT_Error )
2259   FT_Attach_File( FT_Face      face,
2260                   const char*  filepathname );
2261 
2262 
2263   /*************************************************************************/
2264   /*                                                                       */
2265   /* <Function>                                                            */
2266   /*    FT_Attach_Stream                                                   */
2267   /*                                                                       */
2268   /* <Description>                                                         */
2269   /*    `Attach' data to a face object.  Normally, this is used to read    */
2270   /*    additional information for the face object.  For example, you can  */
2271   /*    attach an AFM file that comes with a Type~1 font to get the        */
2272   /*    kerning values and other metrics.                                  */
2273   /*                                                                       */
2274   /* <InOut>                                                               */
2275   /*    face       :: The target face object.                              */
2276   /*                                                                       */
2277   /* <Input>                                                               */
2278   /*    parameters :: A pointer to @FT_Open_Args that must be filled by    */
2279   /*                  the caller.                                          */
2280   /*                                                                       */
2281   /* <Return>                                                              */
2282   /*    FreeType error code.  0~means success.                             */
2283   /*                                                                       */
2284   /* <Note>                                                                */
2285   /*    The meaning of the `attach' (i.e., what really happens when the    */
2286   /*    new file is read) is not fixed by FreeType itself.  It really      */
2287   /*    depends on the font format (and thus the font driver).             */
2288   /*                                                                       */
2289   /*    Client applications are expected to know what they are doing       */
2290   /*    when invoking this function.  Most drivers simply do not implement */
2291   /*    file or stream attachments.                                        */
2292   /*                                                                       */
2293   FT_EXPORT( FT_Error )
2294   FT_Attach_Stream( FT_Face        face,
2295                     FT_Open_Args*  parameters );
2296 
2297 
2298   /*************************************************************************/
2299   /*                                                                       */
2300   /* <Function>                                                            */
2301   /*    FT_Reference_Face                                                  */
2302   /*                                                                       */
2303   /* <Description>                                                         */
2304   /*    A counter gets initialized to~1 at the time an @FT_Face structure  */
2305   /*    is created.  This function increments the counter.  @FT_Done_Face  */
2306   /*    then only destroys a face if the counter is~1, otherwise it simply */
2307   /*    decrements the counter.                                            */
2308   /*                                                                       */
2309   /*    This function helps in managing life-cycles of structures that     */
2310   /*    reference @FT_Face objects.                                        */
2311   /*                                                                       */
2312   /* <Input>                                                               */
2313   /*    face :: A handle to a target face object.                          */
2314   /*                                                                       */
2315   /* <Return>                                                              */
2316   /*    FreeType error code.  0~means success.                             */
2317   /*                                                                       */
2318   /* <Since>                                                               */
2319   /*    2.4.2                                                              */
2320   /*                                                                       */
2321   FT_EXPORT( FT_Error )
2322   FT_Reference_Face( FT_Face  face );
2323 
2324 
2325   /*************************************************************************/
2326   /*                                                                       */
2327   /* <Function>                                                            */
2328   /*    FT_Done_Face                                                       */
2329   /*                                                                       */
2330   /* <Description>                                                         */
2331   /*    Discard a given face object, as well as all of its child slots and */
2332   /*    sizes.                                                             */
2333   /*                                                                       */
2334   /* <Input>                                                               */
2335   /*    face :: A handle to a target face object.                          */
2336   /*                                                                       */
2337   /* <Return>                                                              */
2338   /*    FreeType error code.  0~means success.                             */
2339   /*                                                                       */
2340   /* <Note>                                                                */
2341   /*    See the discussion of reference counters in the description of     */
2342   /*    @FT_Reference_Face.                                                */
2343   /*                                                                       */
2344   FT_EXPORT( FT_Error )
2345   FT_Done_Face( FT_Face  face );
2346 
2347 
2348   /*************************************************************************/
2349   /*                                                                       */
2350   /* <Function>                                                            */
2351   /*    FT_Select_Size                                                     */
2352   /*                                                                       */
2353   /* <Description>                                                         */
2354   /*    Select a bitmap strike.  To be more precise, this function sets    */
2355   /*    the scaling factors of the active @FT_Size object in a face so     */
2356   /*    that bitmaps from this particular strike are taken by              */
2357   /*    @FT_Load_Glyph and friends.                                        */
2358   /*                                                                       */
2359   /* <InOut>                                                               */
2360   /*    face         :: A handle to a target face object.                  */
2361   /*                                                                       */
2362   /* <Input>                                                               */
2363   /*    strike_index :: The index of the bitmap strike in the              */
2364   /*                    `available_sizes' field of @FT_FaceRec structure.  */
2365   /*                                                                       */
2366   /* <Return>                                                              */
2367   /*    FreeType error code.  0~means success.                             */
2368   /*                                                                       */
2369   /* <Note>                                                                */
2370   /*    For bitmaps embedded in outline fonts it is common that only a     */
2371   /*    subset of the available glyphs at a given ppem value is available. */
2372   /*    FreeType silently uses outlines if there is no bitmap for a given  */
2373   /*    glyph index.                                                       */
2374   /*                                                                       */
2375   /*    For GX and OpenType variation fonts, a bitmap strike makes sense   */
2376   /*    only if the default instance is active (this is, no glyph          */
2377   /*    variation takes place); otherwise, FreeType simply ignores bitmap  */
2378   /*    strikes.  The same is true for all named instances that are        */
2379   /*    different from the default instance.                               */
2380   /*                                                                       */
2381   /*    Don't use this function if you are using the FreeType cache API.   */
2382   /*                                                                       */
2383   FT_EXPORT( FT_Error )
2384   FT_Select_Size( FT_Face  face,
2385                   FT_Int   strike_index );
2386 
2387 
2388   /*************************************************************************/
2389   /*                                                                       */
2390   /* <Enum>                                                                */
2391   /*    FT_Size_Request_Type                                               */
2392   /*                                                                       */
2393   /* <Description>                                                         */
2394   /*    An enumeration type that lists the supported size request types,   */
2395   /*    i.e., what input size (in font units) maps to the requested output */
2396   /*    size (in pixels, as computed from the arguments of                 */
2397   /*    @FT_Size_Request).                                                 */
2398   /*                                                                       */
2399   /* <Values>                                                              */
2400   /*    FT_SIZE_REQUEST_TYPE_NOMINAL ::                                    */
2401   /*      The nominal size.  The `units_per_EM' field of @FT_FaceRec is    */
2402   /*      used to determine both scaling values.                           */
2403   /*                                                                       */
2404   /*      This is the standard scaling found in most applications.  In     */
2405   /*      particular, use this size request type for TrueType fonts if     */
2406   /*      they provide optical scaling or something similar.  Note,        */
2407   /*      however, that `units_per_EM' is a rather abstract value which    */
2408   /*      bears no relation to the actual size of the glyphs in a font.    */
2409   /*                                                                       */
2410   /*    FT_SIZE_REQUEST_TYPE_REAL_DIM ::                                   */
2411   /*      The real dimension.  The sum of the `ascender' and (minus of)    */
2412   /*      the `descender' fields of @FT_FaceRec is used to determine both  */
2413   /*      scaling values.                                                  */
2414   /*                                                                       */
2415   /*    FT_SIZE_REQUEST_TYPE_BBOX ::                                       */
2416   /*      The font bounding box.  The width and height of the `bbox' field */
2417   /*      of @FT_FaceRec are used to determine the horizontal and vertical */
2418   /*      scaling value, respectively.                                     */
2419   /*                                                                       */
2420   /*    FT_SIZE_REQUEST_TYPE_CELL ::                                       */
2421   /*      The `max_advance_width' field of @FT_FaceRec is used to          */
2422   /*      determine the horizontal scaling value; the vertical scaling     */
2423   /*      value is determined the same way as                              */
2424   /*      @FT_SIZE_REQUEST_TYPE_REAL_DIM does.  Finally, both scaling      */
2425   /*      values are set to the smaller one.  This type is useful if you   */
2426   /*      want to specify the font size for, say, a window of a given      */
2427   /*      dimension and 80x24 cells.                                       */
2428   /*                                                                       */
2429   /*    FT_SIZE_REQUEST_TYPE_SCALES ::                                     */
2430   /*      Specify the scaling values directly.                             */
2431   /*                                                                       */
2432   /* <Note>                                                                */
2433   /*    The above descriptions only apply to scalable formats.  For bitmap */
2434   /*    formats, the behaviour is up to the driver.                        */
2435   /*                                                                       */
2436   /*    See the note section of @FT_Size_Metrics if you wonder how size    */
2437   /*    requesting relates to scaling values.                              */
2438   /*                                                                       */
2439   typedef enum  FT_Size_Request_Type_
2440   {
2441     FT_SIZE_REQUEST_TYPE_NOMINAL,
2442     FT_SIZE_REQUEST_TYPE_REAL_DIM,
2443     FT_SIZE_REQUEST_TYPE_BBOX,
2444     FT_SIZE_REQUEST_TYPE_CELL,
2445     FT_SIZE_REQUEST_TYPE_SCALES,
2446 
2447     FT_SIZE_REQUEST_TYPE_MAX
2448 
2449   } FT_Size_Request_Type;
2450 
2451 
2452   /*************************************************************************/
2453   /*                                                                       */
2454   /* <Struct>                                                              */
2455   /*    FT_Size_RequestRec                                                 */
2456   /*                                                                       */
2457   /* <Description>                                                         */
2458   /*    A structure to model a size request.                               */
2459   /*                                                                       */
2460   /* <Fields>                                                              */
2461   /*    type           :: See @FT_Size_Request_Type.                       */
2462   /*                                                                       */
2463   /*    width          :: The desired width, given as a 26.6 fractional    */
2464   /*                      point value (with 72pt = 1in).                   */
2465   /*                                                                       */
2466   /*    height         :: The desired height, given as a 26.6 fractional   */
2467   /*                      point value (with 72pt = 1in).                   */
2468   /*                                                                       */
2469   /*    horiResolution :: The horizontal resolution (dpi, i.e., pixels per */
2470   /*                      inch).  If set to zero, `width' is treated as a  */
2471   /*                      26.6 fractional *pixel* value, which gets        */
2472   /*                      internally rounded to an integer.                */
2473   /*                                                                       */
2474   /*    vertResolution :: The vertical resolution (dpi, i.e., pixels per   */
2475   /*                      inch).  If set to zero, `height' is treated as a */
2476   /*                      26.6 fractional *pixel* value, which gets        */
2477   /*                      internally rounded to an integer.                */
2478   /*                                                                       */
2479   /* <Note>                                                                */
2480   /*    If `width' is zero, the horizontal scaling value is set equal      */
2481   /*    to the vertical scaling value, and vice versa.                     */
2482   /*                                                                       */
2483   /*    If `type' is FT_SIZE_REQUEST_TYPE_SCALES, `width' and `height' are */
2484   /*    interpreted directly as 16.16 fractional scaling values, without   */
2485   /*    any further modification, and both `horiResolution' and            */
2486   /*    `vertResolution' are ignored.                                      */
2487   /*                                                                       */
2488   typedef struct  FT_Size_RequestRec_
2489   {
2490     FT_Size_Request_Type  type;
2491     FT_Long               width;
2492     FT_Long               height;
2493     FT_UInt               horiResolution;
2494     FT_UInt               vertResolution;
2495 
2496   } FT_Size_RequestRec;
2497 
2498 
2499   /*************************************************************************/
2500   /*                                                                       */
2501   /* <Struct>                                                              */
2502   /*    FT_Size_Request                                                    */
2503   /*                                                                       */
2504   /* <Description>                                                         */
2505   /*    A handle to a size request structure.                              */
2506   /*                                                                       */
2507   typedef struct FT_Size_RequestRec_  *FT_Size_Request;
2508 
2509 
2510   /*************************************************************************/
2511   /*                                                                       */
2512   /* <Function>                                                            */
2513   /*    FT_Request_Size                                                    */
2514   /*                                                                       */
2515   /* <Description>                                                         */
2516   /*    Resize the scale of the active @FT_Size object in a face.          */
2517   /*                                                                       */
2518   /* <InOut>                                                               */
2519   /*    face :: A handle to a target face object.                          */
2520   /*                                                                       */
2521   /* <Input>                                                               */
2522   /*    req  :: A pointer to a @FT_Size_RequestRec.                        */
2523   /*                                                                       */
2524   /* <Return>                                                              */
2525   /*    FreeType error code.  0~means success.                             */
2526   /*                                                                       */
2527   /* <Note>                                                                */
2528   /*    Although drivers may select the bitmap strike matching the         */
2529   /*    request, you should not rely on this if you intend to select a     */
2530   /*    particular bitmap strike.  Use @FT_Select_Size instead in that     */
2531   /*    case.                                                              */
2532   /*                                                                       */
2533   /*    The relation between the requested size and the resulting glyph    */
2534   /*    size is dependent entirely on how the size is defined in the       */
2535   /*    source face.  The font designer chooses the final size of each     */
2536   /*    glyph relative to this size.  For more information refer to        */
2537   /*    `https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'.    */
2538   /*                                                                       */
2539   /*    Don't use this function if you are using the FreeType cache API.   */
2540   /*                                                                       */
2541   FT_EXPORT( FT_Error )
2542   FT_Request_Size( FT_Face          face,
2543                    FT_Size_Request  req );
2544 
2545 
2546   /*************************************************************************/
2547   /*                                                                       */
2548   /* <Function>                                                            */
2549   /*    FT_Set_Char_Size                                                   */
2550   /*                                                                       */
2551   /* <Description>                                                         */
2552   /*    Call @FT_Request_Size to request the nominal size (in points).     */
2553   /*                                                                       */
2554   /* <InOut>                                                               */
2555   /*    face            :: A handle to a target face object.               */
2556   /*                                                                       */
2557   /* <Input>                                                               */
2558   /*    char_width      :: The nominal width, in 26.6 fractional points.   */
2559   /*                                                                       */
2560   /*    char_height     :: The nominal height, in 26.6 fractional points.  */
2561   /*                                                                       */
2562   /*    horz_resolution :: The horizontal resolution in dpi.               */
2563   /*                                                                       */
2564   /*    vert_resolution :: The vertical resolution in dpi.                 */
2565   /*                                                                       */
2566   /* <Return>                                                              */
2567   /*    FreeType error code.  0~means success.                             */
2568   /*                                                                       */
2569   /* <Note>                                                                */
2570   /*    While this function allows fractional points as input values, the  */
2571   /*    resulting ppem value for the given resolution is always rounded to */
2572   /*    the nearest integer.                                               */
2573   /*                                                                       */
2574   /*    If either the character width or height is zero, it is set equal   */
2575   /*    to the other value.                                                */
2576   /*                                                                       */
2577   /*    If either the horizontal or vertical resolution is zero, it is set */
2578   /*    equal to the other value.                                          */
2579   /*                                                                       */
2580   /*    A character width or height smaller than 1pt is set to 1pt; if     */
2581   /*    both resolution values are zero, they are set to 72dpi.            */
2582   /*                                                                       */
2583   /*    Don't use this function if you are using the FreeType cache API.   */
2584   /*                                                                       */
2585   FT_EXPORT( FT_Error )
2586   FT_Set_Char_Size( FT_Face     face,
2587                     FT_F26Dot6  char_width,
2588                     FT_F26Dot6  char_height,
2589                     FT_UInt     horz_resolution,
2590                     FT_UInt     vert_resolution );
2591 
2592 
2593   /*************************************************************************/
2594   /*                                                                       */
2595   /* <Function>                                                            */
2596   /*    FT_Set_Pixel_Sizes                                                 */
2597   /*                                                                       */
2598   /* <Description>                                                         */
2599   /*    Call @FT_Request_Size to request the nominal size (in pixels).     */
2600   /*                                                                       */
2601   /* <InOut>                                                               */
2602   /*    face         :: A handle to the target face object.                */
2603   /*                                                                       */
2604   /* <Input>                                                               */
2605   /*    pixel_width  :: The nominal width, in pixels.                      */
2606   /*                                                                       */
2607   /*    pixel_height :: The nominal height, in pixels.                     */
2608   /*                                                                       */
2609   /* <Return>                                                              */
2610   /*    FreeType error code.  0~means success.                             */
2611   /*                                                                       */
2612   /* <Note>                                                                */
2613   /*    You should not rely on the resulting glyphs matching or being      */
2614   /*    constrained to this pixel size.  Refer to @FT_Request_Size to      */
2615   /*    understand how requested sizes relate to actual sizes.             */
2616   /*                                                                       */
2617   /*    Don't use this function if you are using the FreeType cache API.   */
2618   /*                                                                       */
2619   FT_EXPORT( FT_Error )
2620   FT_Set_Pixel_Sizes( FT_Face  face,
2621                       FT_UInt  pixel_width,
2622                       FT_UInt  pixel_height );
2623 
2624 
2625   /*************************************************************************/
2626   /*                                                                       */
2627   /* <Function>                                                            */
2628   /*    FT_Load_Glyph                                                      */
2629   /*                                                                       */
2630   /* <Description>                                                         */
2631   /*    Load a glyph into the glyph slot of a face object.                 */
2632   /*                                                                       */
2633   /* <InOut>                                                               */
2634   /*    face        :: A handle to the target face object where the glyph  */
2635   /*                   is loaded.                                          */
2636   /*                                                                       */
2637   /* <Input>                                                               */
2638   /*    glyph_index :: The index of the glyph in the font file.  For       */
2639   /*                   CID-keyed fonts (either in PS or in CFF format)     */
2640   /*                   this argument specifies the CID value.              */
2641   /*                                                                       */
2642   /*    load_flags  :: A flag indicating what to load for this glyph.  The */
2643   /*                   @FT_LOAD_XXX constants can be used to control the   */
2644   /*                   glyph loading process (e.g., whether the outline    */
2645   /*                   should be scaled, whether to load bitmaps or not,   */
2646   /*                   whether to hint the outline, etc).                  */
2647   /*                                                                       */
2648   /* <Return>                                                              */
2649   /*    FreeType error code.  0~means success.                             */
2650   /*                                                                       */
2651   /* <Note>                                                                */
2652   /*    The loaded glyph may be transformed.  See @FT_Set_Transform for    */
2653   /*    the details.                                                       */
2654   /*                                                                       */
2655   /*    For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is        */
2656   /*    returned for invalid CID values (this is, for CID values that      */
2657   /*    don't have a corresponding glyph in the font).  See the discussion */
2658   /*    of the @FT_FACE_FLAG_CID_KEYED flag for more details.              */
2659   /*                                                                       */
2660   /*    If you receive `FT_Err_Glyph_Too_Big', try getting the glyph       */
2661   /*    outline at EM size, then scale it manually and fill it as a        */
2662   /*    graphics operation.                                                */
2663   /*                                                                       */
2664   FT_EXPORT( FT_Error )
2665   FT_Load_Glyph( FT_Face   face,
2666                  FT_UInt   glyph_index,
2667                  FT_Int32  load_flags );
2668 
2669 
2670   /*************************************************************************/
2671   /*                                                                       */
2672   /* <Function>                                                            */
2673   /*    FT_Load_Char                                                       */
2674   /*                                                                       */
2675   /* <Description>                                                         */
2676   /*    Load a glyph into the glyph slot of a face object, accessed by its */
2677   /*    character code.                                                    */
2678   /*                                                                       */
2679   /* <InOut>                                                               */
2680   /*    face        :: A handle to a target face object where the glyph    */
2681   /*                   is loaded.                                          */
2682   /*                                                                       */
2683   /* <Input>                                                               */
2684   /*    char_code   :: The glyph's character code, according to the        */
2685   /*                   current charmap used in the face.                   */
2686   /*                                                                       */
2687   /*    load_flags  :: A flag indicating what to load for this glyph.  The */
2688   /*                   @FT_LOAD_XXX constants can be used to control the   */
2689   /*                   glyph loading process (e.g., whether the outline    */
2690   /*                   should be scaled, whether to load bitmaps or not,   */
2691   /*                   whether to hint the outline, etc).                  */
2692   /*                                                                       */
2693   /* <Return>                                                              */
2694   /*    FreeType error code.  0~means success.                             */
2695   /*                                                                       */
2696   /* <Note>                                                                */
2697   /*    This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph.  */
2698   /*                                                                       */
2699   /*    Many fonts contain glyphs that can't be loaded by this function    */
2700   /*    since its glyph indices are not listed in any of the font's        */
2701   /*    charmaps.                                                          */
2702   /*                                                                       */
2703   FT_EXPORT( FT_Error )
2704   FT_Load_Char( FT_Face   face,
2705                 FT_ULong  char_code,
2706                 FT_Int32  load_flags );
2707 
2708 
2709   /*************************************************************************
2710    *
2711    * @enum:
2712    *   FT_LOAD_XXX
2713    *
2714    * @description:
2715    *   A list of bit field constants for @FT_Load_Glyph to indicate what
2716    *   kind of operations to perform during glyph loading.
2717    *
2718    * @values:
2719    *   FT_LOAD_DEFAULT ::
2720    *     Corresponding to~0, this value is used as the default glyph load
2721    *     operation.  In this case, the following happens:
2722    *
2723    *     1. FreeType looks for a bitmap for the glyph corresponding to the
2724    *        face's current size.  If one is found, the function returns.
2725    *        The bitmap data can be accessed from the glyph slot (see note
2726    *        below).
2727    *
2728    *     2. If no embedded bitmap is searched for or found, FreeType looks
2729    *        for a scalable outline.  If one is found, it is loaded from
2730    *        the font file, scaled to device pixels, then `hinted' to the
2731    *        pixel grid in order to optimize it.  The outline data can be
2732    *        accessed from the glyph slot (see note below).
2733    *
2734    *     Note that by default the glyph loader doesn't render outlines into
2735    *     bitmaps.  The following flags are used to modify this default
2736    *     behaviour to more specific and useful cases.
2737    *
2738    *   FT_LOAD_NO_SCALE ::
2739    *     Don't scale the loaded outline glyph but keep it in font units.
2740    *
2741    *     This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
2742    *     unsets @FT_LOAD_RENDER.
2743    *
2744    *     If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using
2745    *     FT_LOAD_NO_SCALE usually yields meaningless outlines because the
2746    *     subglyphs must be scaled and positioned with hinting instructions.
2747    *     This can be solved by loading the font without FT_LOAD_NO_SCALE and
2748    *     setting the character size to `font->units_per_EM'.
2749    *
2750    *   FT_LOAD_NO_HINTING ::
2751    *     Disable hinting.  This generally generates `blurrier' bitmap glyphs
2752    *     when the glyph are rendered in any of the anti-aliased modes.  See
2753    *     also the note below.
2754    *
2755    *     This flag is implied by @FT_LOAD_NO_SCALE.
2756    *
2757    *   FT_LOAD_RENDER ::
2758    *     Call @FT_Render_Glyph after the glyph is loaded.  By default, the
2759    *     glyph is rendered in @FT_RENDER_MODE_NORMAL mode.  This can be
2760    *     overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
2761    *
2762    *     This flag is unset by @FT_LOAD_NO_SCALE.
2763    *
2764    *   FT_LOAD_NO_BITMAP ::
2765    *     Ignore bitmap strikes when loading.  Bitmap-only fonts ignore this
2766    *     flag.
2767    *
2768    *     @FT_LOAD_NO_SCALE always sets this flag.
2769    *
2770    *   FT_LOAD_VERTICAL_LAYOUT ::
2771    *     Load the glyph for vertical text layout.  In particular, the
2772    *     `advance' value in the @FT_GlyphSlotRec structure is set to the
2773    *     `vertAdvance' value of the `metrics' field.
2774    *
2775    *     In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use
2776    *     this flag currently.  Reason is that in this case vertical metrics
2777    *     get synthesized, and those values are not always consistent across
2778    *     various font formats.
2779    *
2780    *   FT_LOAD_FORCE_AUTOHINT ::
2781    *     Prefer the auto-hinter over the font's native hinter.  See also
2782    *     the note below.
2783    *
2784    *   FT_LOAD_PEDANTIC ::
2785    *     Make the font driver perform pedantic verifications during glyph
2786    *     loading.  This is mostly used to detect broken glyphs in fonts.
2787    *     By default, FreeType tries to handle broken fonts also.
2788    *
2789    *     In particular, errors from the TrueType bytecode engine are not
2790    *     passed to the application if this flag is not set; this might
2791    *     result in partially hinted or distorted glyphs in case a glyph's
2792    *     bytecode is buggy.
2793    *
2794    *   FT_LOAD_NO_RECURSE ::
2795    *     Don't load composite glyphs recursively.  Instead, the font
2796    *     driver should set the `num_subglyph' and `subglyphs' values of
2797    *     the glyph slot accordingly, and set `glyph->format' to
2798    *     @FT_GLYPH_FORMAT_COMPOSITE.  The description of subglyphs can
2799    *     then be accessed with @FT_Get_SubGlyph_Info.
2800    *
2801    *     This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
2802    *
2803    *   FT_LOAD_IGNORE_TRANSFORM ::
2804    *     Ignore the transform matrix set by @FT_Set_Transform.
2805    *
2806    *   FT_LOAD_MONOCHROME ::
2807    *     This flag is used with @FT_LOAD_RENDER to indicate that you want to
2808    *     render an outline glyph to a 1-bit monochrome bitmap glyph, with
2809    *     8~pixels packed into each byte of the bitmap data.
2810    *
2811    *     Note that this has no effect on the hinting algorithm used.  You
2812    *     should rather use @FT_LOAD_TARGET_MONO so that the
2813    *     monochrome-optimized hinting algorithm is used.
2814    *
2815    *   FT_LOAD_LINEAR_DESIGN ::
2816    *     Keep  `linearHoriAdvance' and `linearVertAdvance' fields of
2817    *     @FT_GlyphSlotRec in font units.  See @FT_GlyphSlotRec for
2818    *     details.
2819    *
2820    *   FT_LOAD_NO_AUTOHINT ::
2821    *     Disable the auto-hinter.  See also the note below.
2822    *
2823    *   FT_LOAD_COLOR ::
2824    *     Load embedded color bitmap images.  The resulting color bitmaps,
2825    *     if available, will have the @FT_PIXEL_MODE_BGRA format.  If the
2826    *     flag is not set and color bitmaps are found, they are converted
2827    *     to 256-level gray bitmaps transparently, using the
2828    *     @FT_PIXEL_MODE_GRAY format.
2829    *
2830    *   FT_LOAD_COMPUTE_METRICS ::
2831    *     Compute glyph metrics from the glyph data, without the use of
2832    *     bundled metrics tables (for example, the `hdmx' table in TrueType
2833    *     fonts).  This flag is mainly used by font validating or font
2834    *     editing applications, which need to ignore, verify, or edit those
2835    *     tables.
2836    *
2837    *     Currently, this flag is only implemented for TrueType fonts.
2838    *
2839    *   FT_LOAD_BITMAP_METRICS_ONLY ::
2840    *     Request loading of the metrics and bitmap image information of a
2841    *     (possibly embedded) bitmap glyph without allocating or copying
2842    *     the bitmap image data itself.  No effect if the target glyph is
2843    *     not a bitmap image.
2844    *
2845    *     This flag unsets @FT_LOAD_RENDER.
2846    *
2847    *   FT_LOAD_CROP_BITMAP ::
2848    *     Ignored.  Deprecated.
2849    *
2850    *   FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
2851    *     Ignored.  Deprecated.
2852    *
2853    * @note:
2854    *   By default, hinting is enabled and the font's native hinter (see
2855    *   @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter.  You can
2856    *   disable hinting by setting @FT_LOAD_NO_HINTING or change the
2857    *   precedence by setting @FT_LOAD_FORCE_AUTOHINT.  You can also set
2858    *   @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
2859    *   used at all.
2860    *
2861    *   See the description of @FT_FACE_FLAG_TRICKY for a special exception
2862    *   (affecting only a handful of Asian fonts).
2863    *
2864    *   Besides deciding which hinter to use, you can also decide which
2865    *   hinting algorithm to use.  See @FT_LOAD_TARGET_XXX for details.
2866    *
2867    *   Note that the auto-hinter needs a valid Unicode cmap (either a native
2868    *   one or synthesized by FreeType) for producing correct results.  If a
2869    *   font provides an incorrect mapping (for example, assigning the
2870    *   character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a
2871    *   mathematical integral sign), the auto-hinter might produce useless
2872    *   results.
2873    *
2874    */
2875 #define FT_LOAD_DEFAULT                      0x0
2876 #define FT_LOAD_NO_SCALE                     ( 1L << 0 )
2877 #define FT_LOAD_NO_HINTING                   ( 1L << 1 )
2878 #define FT_LOAD_RENDER                       ( 1L << 2 )
2879 #define FT_LOAD_NO_BITMAP                    ( 1L << 3 )
2880 #define FT_LOAD_VERTICAL_LAYOUT              ( 1L << 4 )
2881 #define FT_LOAD_FORCE_AUTOHINT               ( 1L << 5 )
2882 #define FT_LOAD_CROP_BITMAP                  ( 1L << 6 )
2883 #define FT_LOAD_PEDANTIC                     ( 1L << 7 )
2884 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH  ( 1L << 9 )
2885 #define FT_LOAD_NO_RECURSE                   ( 1L << 10 )
2886 #define FT_LOAD_IGNORE_TRANSFORM             ( 1L << 11 )
2887 #define FT_LOAD_MONOCHROME                   ( 1L << 12 )
2888 #define FT_LOAD_LINEAR_DESIGN                ( 1L << 13 )
2889 #define FT_LOAD_NO_AUTOHINT                  ( 1L << 15 )
2890   /* Bits 16-19 are used by `FT_LOAD_TARGET_' */
2891 #define FT_LOAD_COLOR                        ( 1L << 20 )
2892 #define FT_LOAD_COMPUTE_METRICS              ( 1L << 21 )
2893 #define FT_LOAD_BITMAP_METRICS_ONLY          ( 1L << 22 )
2894 
2895   /* */
2896 
2897   /* used internally only by certain font drivers */
2898 #define FT_LOAD_ADVANCE_ONLY                 ( 1L << 8 )
2899 #define FT_LOAD_SBITS_ONLY                   ( 1L << 14 )
2900 
2901 
2902   /**************************************************************************
2903    *
2904    * @enum:
2905    *   FT_LOAD_TARGET_XXX
2906    *
2907    * @description:
2908    *   A list of values to select a specific hinting algorithm for the
2909    *   hinter.  You should OR one of these values to your `load_flags'
2910    *   when calling @FT_Load_Glyph.
2911    *
2912    *   Note that a font's native hinters may ignore the hinting algorithm
2913    *   you have specified (e.g., the TrueType bytecode interpreter).  You
2914    *   can set @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is
2915    *   used.
2916    *
2917    * @values:
2918    *   FT_LOAD_TARGET_NORMAL ::
2919    *     The default hinting algorithm, optimized for standard gray-level
2920    *     rendering.  For monochrome output, use @FT_LOAD_TARGET_MONO
2921    *     instead.
2922    *
2923    *   FT_LOAD_TARGET_LIGHT ::
2924    *     A lighter hinting algorithm for gray-level modes.  Many generated
2925    *     glyphs are fuzzier but better resemble their original shape.  This
2926    *     is achieved by snapping glyphs to the pixel grid only vertically
2927    *     (Y-axis), as is done by Microsoft's ClearType and Adobe's
2928    *     proprietary font renderer.  This preserves inter-glyph spacing in
2929    *     horizontal text.  The snapping is done either by the native font
2930    *     driver, if the driver itself and the font support it, or by the
2931    *     auto-hinter.
2932    *
2933    *   FT_LOAD_TARGET_MONO ::
2934    *     Strong hinting algorithm that should only be used for monochrome
2935    *     output.  The result is probably unpleasant if the glyph is rendered
2936    *     in non-monochrome modes.
2937    *
2938    *   FT_LOAD_TARGET_LCD ::
2939    *     A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally
2940    *     decimated LCD displays.
2941    *
2942    *   FT_LOAD_TARGET_LCD_V ::
2943    *     A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
2944    *     decimated LCD displays.
2945    *
2946    * @note:
2947    *   You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
2948    *   `load_flags'.  They can't be ORed.
2949    *
2950    *   If @FT_LOAD_RENDER is also set, the glyph is rendered in the
2951    *   corresponding mode (i.e., the mode that matches the used algorithm
2952    *   best).  An exception is FT_LOAD_TARGET_MONO since it implies
2953    *   @FT_LOAD_MONOCHROME.
2954    *
2955    *   You can use a hinting algorithm that doesn't correspond to the same
2956    *   rendering mode.  As an example, it is possible to use the `light'
2957    *   hinting algorithm and have the results rendered in horizontal LCD
2958    *   pixel mode, with code like
2959    *
2960    *     {
2961    *       FT_Load_Glyph( face, glyph_index,
2962    *                      load_flags | FT_LOAD_TARGET_LIGHT );
2963    *
2964    *       FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
2965    *     }
2966    *
2967    */
2968 #define FT_LOAD_TARGET_( x )   ( (FT_Int32)( (x) & 15 ) << 16 )
2969 
2970 #define FT_LOAD_TARGET_NORMAL  FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
2971 #define FT_LOAD_TARGET_LIGHT   FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT  )
2972 #define FT_LOAD_TARGET_MONO    FT_LOAD_TARGET_( FT_RENDER_MODE_MONO   )
2973 #define FT_LOAD_TARGET_LCD     FT_LOAD_TARGET_( FT_RENDER_MODE_LCD    )
2974 #define FT_LOAD_TARGET_LCD_V   FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V  )
2975 
2976 
2977   /**************************************************************************
2978    *
2979    * @macro:
2980    *   FT_LOAD_TARGET_MODE
2981    *
2982    * @description:
2983    *   Return the @FT_Render_Mode corresponding to a given
2984    *   @FT_LOAD_TARGET_XXX value.
2985    *
2986    */
2987 #define FT_LOAD_TARGET_MODE( x )  ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
2988 
2989 
2990   /*************************************************************************/
2991   /*                                                                       */
2992   /* <Function>                                                            */
2993   /*    FT_Set_Transform                                                   */
2994   /*                                                                       */
2995   /* <Description>                                                         */
2996   /*    Set the transformation that is applied to glyph images when they   */
2997   /*    are loaded into a glyph slot through @FT_Load_Glyph.               */
2998   /*                                                                       */
2999   /* <InOut>                                                               */
3000   /*    face   :: A handle to the source face object.                      */
3001   /*                                                                       */
3002   /* <Input>                                                               */
3003   /*    matrix :: A pointer to the transformation's 2x2 matrix.  Use NULL  */
3004   /*              for the identity matrix.                                 */
3005   /*    delta  :: A pointer to the translation vector.  Use NULL for the   */
3006   /*              null vector.                                             */
3007   /*                                                                       */
3008   /* <Note>                                                                */
3009   /*    The transformation is only applied to scalable image formats after */
3010   /*    the glyph has been loaded.  It means that hinting is unaltered by  */
3011   /*    the transformation and is performed on the character size given in */
3012   /*    the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes.         */
3013   /*                                                                       */
3014   /*    Note that this also transforms the `face.glyph.advance' field, but */
3015   /*    *not* the values in `face.glyph.metrics'.                          */
3016   /*                                                                       */
3017   FT_EXPORT( void )
3018   FT_Set_Transform( FT_Face     face,
3019                     FT_Matrix*  matrix,
3020                     FT_Vector*  delta );
3021 
3022 
3023   /*************************************************************************/
3024   /*                                                                       */
3025   /* <Enum>                                                                */
3026   /*    FT_Render_Mode                                                     */
3027   /*                                                                       */
3028   /* <Description>                                                         */
3029   /*    Render modes supported by FreeType~2.  Each mode corresponds to a  */
3030   /*    specific type of scanline conversion performed on the outline.     */
3031   /*                                                                       */
3032   /*    For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode'     */
3033   /*    field in the @FT_GlyphSlotRec structure gives the format of the    */
3034   /*    returned bitmap.                                                   */
3035   /*                                                                       */
3036   /*    All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity,   */
3037   /*    indicating pixel coverage.  Use linear alpha blending and gamma    */
3038   /*    correction to correctly render non-monochrome glyph bitmaps onto a */
3039   /*    surface; see @FT_Render_Glyph.                                     */
3040   /*                                                                       */
3041   /* <Values>                                                              */
3042   /*    FT_RENDER_MODE_NORMAL ::                                           */
3043   /*      Default render mode; it corresponds to 8-bit anti-aliased        */
3044   /*      bitmaps.                                                         */
3045   /*                                                                       */
3046   /*    FT_RENDER_MODE_LIGHT ::                                            */
3047   /*      This is equivalent to @FT_RENDER_MODE_NORMAL.  It is only        */
3048   /*      defined as a separate value because render modes are also used   */
3049   /*      indirectly to define hinting algorithm selectors.  See           */
3050   /*      @FT_LOAD_TARGET_XXX for details.                                 */
3051   /*                                                                       */
3052   /*    FT_RENDER_MODE_MONO ::                                             */
3053   /*      This mode corresponds to 1-bit bitmaps (with 2~levels of         */
3054   /*      opacity).                                                        */
3055   /*                                                                       */
3056   /*    FT_RENDER_MODE_LCD ::                                              */
3057   /*      This mode corresponds to horizontal RGB and BGR sub-pixel        */
3058   /*      displays like LCD screens.  It produces 8-bit bitmaps that are   */
3059   /*      3~times the width of the original glyph outline in pixels, and   */
3060   /*      which use the @FT_PIXEL_MODE_LCD mode.                           */
3061   /*                                                                       */
3062   /*    FT_RENDER_MODE_LCD_V ::                                            */
3063   /*      This mode corresponds to vertical RGB and BGR sub-pixel displays */
3064   /*      (like PDA screens, rotated LCD displays, etc.).  It produces     */
3065   /*      8-bit bitmaps that are 3~times the height of the original        */
3066   /*      glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode.   */
3067   /*                                                                       */
3068   /* <Note>                                                                */
3069   /*    The LCD-optimized glyph bitmaps produced by `FT_Render_Glyph' can  */
3070   /*    be filtered to reduce color-fringes by using                       */
3071   /*    @FT_Library_SetLcdFilter (not active in the default builds).  It   */
3072   /*    is up to the caller to either call `FT_Library_SetLcdFilter' (if   */
3073   /*    available) or do the filtering itself.                             */
3074   /*                                                                       */
3075   /*    The selected render mode only affects vector glyphs of a font.     */
3076   /*    Embedded bitmaps often have a different pixel mode like            */
3077   /*    @FT_PIXEL_MODE_MONO.  You can use @FT_Bitmap_Convert to transform  */
3078   /*    them into 8-bit pixmaps.                                           */
3079   /*                                                                       */
3080   typedef enum  FT_Render_Mode_
3081   {
3082     FT_RENDER_MODE_NORMAL = 0,
3083     FT_RENDER_MODE_LIGHT,
3084     FT_RENDER_MODE_MONO,
3085     FT_RENDER_MODE_LCD,
3086     FT_RENDER_MODE_LCD_V,
3087 
3088     FT_RENDER_MODE_MAX
3089 
3090   } FT_Render_Mode;
3091 
3092 
3093   /* these constants are deprecated; use the corresponding */
3094   /* `FT_Render_Mode' values instead                       */
3095 #define ft_render_mode_normal  FT_RENDER_MODE_NORMAL
3096 #define ft_render_mode_mono    FT_RENDER_MODE_MONO
3097 
3098 
3099   /*************************************************************************/
3100   /*                                                                       */
3101   /* <Function>                                                            */
3102   /*    FT_Render_Glyph                                                    */
3103   /*                                                                       */
3104   /* <Description>                                                         */
3105   /*    Convert a given glyph image to a bitmap.  It does so by inspecting */
3106   /*    the glyph image format, finding the relevant renderer, and         */
3107   /*    invoking it.                                                       */
3108   /*                                                                       */
3109   /* <InOut>                                                               */
3110   /*    slot        :: A handle to the glyph slot containing the image to  */
3111   /*                   convert.                                            */
3112   /*                                                                       */
3113   /* <Input>                                                               */
3114   /*    render_mode :: The render mode used to render the glyph image into */
3115   /*                   a bitmap.  See @FT_Render_Mode for a list of        */
3116   /*                   possible values.                                    */
3117   /*                                                                       */
3118   /* <Return>                                                              */
3119   /*    FreeType error code.  0~means success.                             */
3120   /*                                                                       */
3121   /* <Note>                                                                */
3122   /*    To get meaningful results, font scaling values must be set with    */
3123   /*    functions like @FT_Set_Char_Size before calling `FT_Render_Glyph'. */
3124   /*                                                                       */
3125   /*    When FreeType outputs a bitmap of a glyph, it really outputs an    */
3126   /*    alpha coverage map.  If a pixel is completely covered by a         */
3127   /*    filled-in outline, the bitmap contains 0xFF at that pixel, meaning */
3128   /*    that 0xFF/0xFF fraction of that pixel is covered, meaning the      */
3129   /*    pixel is 100% black (or 0% bright).  If a pixel is only 50%        */
3130   /*    covered (value 0x80), the pixel is made 50% black (50% bright or a */
3131   /*    middle shade of grey).  0% covered means 0% black (100% bright or  */
3132   /*    white).                                                            */
3133   /*                                                                       */
3134   /*    On high-DPI screens like on smartphones and tablets, the pixels    */
3135   /*    are so small that their chance of being completely covered and     */
3136   /*    therefore completely black are fairly good.  On the low-DPI        */
3137   /*    screens, however, the situation is different.  The pixels are too  */
3138   /*    large for most of the details of a glyph and shades of gray are    */
3139   /*    the norm rather than the exception.                                */
3140   /*                                                                       */
3141   /*    This is relevant because all our screens have a second problem:    */
3142   /*    they are not linear.  1~+~1 is not~2.  Twice the value does not    */
3143   /*    result in twice the brightness.  When a pixel is only 50% covered, */
3144   /*    the coverage map says 50% black, and this translates to a pixel    */
3145   /*    value of 128 when you use 8~bits per channel (0-255).  However,    */
3146   /*    this does not translate to 50% brightness for that pixel on our    */
3147   /*    sRGB and gamma~2.2 screens.  Due to their non-linearity, they      */
3148   /*    dwell longer in the darks and only a pixel value of about 186      */
3149   /*    results in 50% brightness – 128 ends up too dark on both bright    */
3150   /*    and dark backgrounds.  The net result is that dark text looks      */
3151   /*    burnt-out, pixely and blotchy on bright background, bright text    */
3152   /*    too frail on dark backgrounds, and colored text on colored         */
3153   /*    background (for example, red on green) seems to have dark halos or */
3154   /*    `dirt' around it.  The situation is especially ugly for diagonal   */
3155   /*    stems like in `w' glyph shapes where the quality of FreeType's     */
3156   /*    anti-aliasing depends on the correct display of grays.  On         */
3157   /*    high-DPI screens where smaller, fully black pixels reign supreme,  */
3158   /*    this doesn't matter, but on our low-DPI screens with all the gray  */
3159   /*    shades, it does.  0% and 100% brightness are the same things in    */
3160   /*    linear and non-linear space, just all the shades in-between        */
3161   /*    aren't.                                                            */
3162   /*                                                                       */
3163   /*    The blending function for placing text over a background is        */
3164   /*                                                                       */
3165   /*    {                                                                  */
3166   /*      dst = alpha * src + (1 - alpha) * dst    ,                       */
3167   /*    }                                                                  */
3168   /*                                                                       */
3169   /*    which is known as the OVER operator.                               */
3170   /*                                                                       */
3171   /*    To correctly composite an antialiased pixel of a glyph onto a      */
3172   /*    surface,                                                           */
3173   /*                                                                       */
3174   /*    1. take the foreground and background colors (e.g., in sRGB space) */
3175   /*       and apply gamma to get them in a linear space,                  */
3176   /*                                                                       */
3177   /*    2. use OVER to blend the two linear colors using the glyph pixel   */
3178   /*       as the alpha value (remember, the glyph bitmap is an alpha      */
3179   /*       coverage bitmap), and                                           */
3180   /*                                                                       */
3181   /*    3. apply inverse gamma to the blended pixel and write it back to   */
3182   /*       the image.                                                      */
3183   /*                                                                       */
3184   /*    Internal testing at Adobe found that a target inverse gamma of~1.8 */
3185   /*    for step~3 gives good results across a wide range of displays with */
3186   /*    an sRGB gamma curve or a similar one.                              */
3187   /*                                                                       */
3188   /*    This process can cost performance.  There is an approximation that */
3189   /*    does not need to know about the background color; see              */
3190   /*    https://bel.fi/alankila/lcd/ and                                   */
3191   /*    https://bel.fi/alankila/lcd/alpcor.html for details.               */
3192   /*                                                                       */
3193   /*    *ATTENTION*: Linear blending is even more important when dealing   */
3194   /*    with subpixel-rendered glyphs to prevent color-fringing!  A        */
3195   /*    subpixel-rendered glyph must first be filtered with a filter that  */
3196   /*    gives equal weight to the three color primaries and does not       */
3197   /*    exceed a sum of 0x100, see section @lcd_filtering.  Then the       */
3198   /*    only difference to gray linear blending is that subpixel-rendered  */
3199   /*    linear blending is done 3~times per pixel: red foreground subpixel */
3200   /*    to red background subpixel and so on for green and blue.           */
3201   /*                                                                       */
3202   FT_EXPORT( FT_Error )
3203   FT_Render_Glyph( FT_GlyphSlot    slot,
3204                    FT_Render_Mode  render_mode );
3205 
3206 
3207   /*************************************************************************/
3208   /*                                                                       */
3209   /* <Enum>                                                                */
3210   /*    FT_Kerning_Mode                                                    */
3211   /*                                                                       */
3212   /* <Description>                                                         */
3213   /*    An enumeration to specify the format of kerning values returned by */
3214   /*    @FT_Get_Kerning.                                                   */
3215   /*                                                                       */
3216   /* <Values>                                                              */
3217   /*    FT_KERNING_DEFAULT  :: Return grid-fitted kerning distances in     */
3218   /*                           26.6 fractional pixels.                     */
3219   /*                                                                       */
3220   /*    FT_KERNING_UNFITTED :: Return un-grid-fitted kerning distances in  */
3221   /*                           26.6 fractional pixels.                     */
3222   /*                                                                       */
3223   /*    FT_KERNING_UNSCALED :: Return the kerning vector in original font  */
3224   /*                           units.                                      */
3225   /*                                                                       */
3226   /* <Note>                                                                */
3227   /*    FT_KERNING_DEFAULT returns full pixel values; it also makes        */
3228   /*    FreeType heuristically scale down kerning distances at small ppem  */
3229   /*    values so that they don't become too big.                          */
3230   /*                                                                       */
3231   /*    Both FT_KERNING_DEFAULT and FT_KERNING_UNFITTED use the current    */
3232   /*    horizontal scaling factor (as set e.g. with @FT_Set_Char_Size) to  */
3233   /*    convert font units to pixels.                                      */
3234   /*                                                                       */
3235   typedef enum  FT_Kerning_Mode_
3236   {
3237     FT_KERNING_DEFAULT = 0,
3238     FT_KERNING_UNFITTED,
3239     FT_KERNING_UNSCALED
3240 
3241   } FT_Kerning_Mode;
3242 
3243 
3244   /* these constants are deprecated; use the corresponding */
3245   /* `FT_Kerning_Mode' values instead                      */
3246 #define ft_kerning_default   FT_KERNING_DEFAULT
3247 #define ft_kerning_unfitted  FT_KERNING_UNFITTED
3248 #define ft_kerning_unscaled  FT_KERNING_UNSCALED
3249 
3250 
3251   /*************************************************************************/
3252   /*                                                                       */
3253   /* <Function>                                                            */
3254   /*    FT_Get_Kerning                                                     */
3255   /*                                                                       */
3256   /* <Description>                                                         */
3257   /*    Return the kerning vector between two glyphs of the same face.     */
3258   /*                                                                       */
3259   /* <Input>                                                               */
3260   /*    face        :: A handle to a source face object.                   */
3261   /*                                                                       */
3262   /*    left_glyph  :: The index of the left glyph in the kern pair.       */
3263   /*                                                                       */
3264   /*    right_glyph :: The index of the right glyph in the kern pair.      */
3265   /*                                                                       */
3266   /*    kern_mode   :: See @FT_Kerning_Mode for more information.          */
3267   /*                   Determines the scale and dimension of the returned  */
3268   /*                   kerning vector.                                     */
3269   /*                                                                       */
3270   /* <Output>                                                              */
3271   /*    akerning    :: The kerning vector.  This is either in font units,  */
3272   /*                   fractional pixels (26.6 format), or pixels for      */
3273   /*                   scalable formats, and in pixels for fixed-sizes     */
3274   /*                   formats.                                            */
3275   /*                                                                       */
3276   /* <Return>                                                              */
3277   /*    FreeType error code.  0~means success.                             */
3278   /*                                                                       */
3279   /* <Note>                                                                */
3280   /*    Only horizontal layouts (left-to-right & right-to-left) are        */
3281   /*    supported by this method.  Other layouts, or more sophisticated    */
3282   /*    kernings, are out of the scope of this API function -- they can be */
3283   /*    implemented through format-specific interfaces.                    */
3284   /*                                                                       */
3285   /*    Kerning for OpenType fonts implemented in a `GPOS' table is not    */
3286   /*    supported; use @FT_HAS_KERNING to find out whether a font has data */
3287   /*    that can be extracted with `FT_Get_Kerning'.                       */
3288   /*                                                                       */
3289   FT_EXPORT( FT_Error )
3290   FT_Get_Kerning( FT_Face     face,
3291                   FT_UInt     left_glyph,
3292                   FT_UInt     right_glyph,
3293                   FT_UInt     kern_mode,
3294                   FT_Vector  *akerning );
3295 
3296 
3297   /*************************************************************************/
3298   /*                                                                       */
3299   /* <Function>                                                            */
3300   /*    FT_Get_Track_Kerning                                               */
3301   /*                                                                       */
3302   /* <Description>                                                         */
3303   /*    Return the track kerning for a given face object at a given size.  */
3304   /*                                                                       */
3305   /* <Input>                                                               */
3306   /*    face       :: A handle to a source face object.                    */
3307   /*                                                                       */
3308   /*    point_size :: The point size in 16.16 fractional points.           */
3309   /*                                                                       */
3310   /*    degree     :: The degree of tightness.  Increasingly negative      */
3311   /*                  values represent tighter track kerning, while        */
3312   /*                  increasingly positive values represent looser track  */
3313   /*                  kerning.  Value zero means no track kerning.         */
3314   /*                                                                       */
3315   /* <Output>                                                              */
3316   /*    akerning   :: The kerning in 16.16 fractional points, to be        */
3317   /*                  uniformly applied between all glyphs.                */
3318   /*                                                                       */
3319   /* <Return>                                                              */
3320   /*    FreeType error code.  0~means success.                             */
3321   /*                                                                       */
3322   /* <Note>                                                                */
3323   /*    Currently, only the Type~1 font driver supports track kerning,     */
3324   /*    using data from AFM files (if attached with @FT_Attach_File or     */
3325   /*    @FT_Attach_Stream).                                                */
3326   /*                                                                       */
3327   /*    Only very few AFM files come with track kerning data; please refer */
3328   /*    to Adobe's AFM specification for more details.                     */
3329   /*                                                                       */
3330   FT_EXPORT( FT_Error )
3331   FT_Get_Track_Kerning( FT_Face    face,
3332                         FT_Fixed   point_size,
3333                         FT_Int     degree,
3334                         FT_Fixed*  akerning );
3335 
3336 
3337   /*************************************************************************/
3338   /*                                                                       */
3339   /* <Function>                                                            */
3340   /*    FT_Get_Glyph_Name                                                  */
3341   /*                                                                       */
3342   /* <Description>                                                         */
3343   /*    Retrieve the ASCII name of a given glyph in a face.  This only     */
3344   /*    works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1.   */
3345   /*                                                                       */
3346   /* <Input>                                                               */
3347   /*    face        :: A handle to a source face object.                   */
3348   /*                                                                       */
3349   /*    glyph_index :: The glyph index.                                    */
3350   /*                                                                       */
3351   /*    buffer_max  :: The maximum number of bytes available in the        */
3352   /*                   buffer.                                             */
3353   /*                                                                       */
3354   /* <Output>                                                              */
3355   /*    buffer      :: A pointer to a target buffer where the name is      */
3356   /*                   copied to.                                          */
3357   /*                                                                       */
3358   /* <Return>                                                              */
3359   /*    FreeType error code.  0~means success.                             */
3360   /*                                                                       */
3361   /* <Note>                                                                */
3362   /*    An error is returned if the face doesn't provide glyph names or if */
3363   /*    the glyph index is invalid.  In all cases of failure, the first    */
3364   /*    byte of `buffer' is set to~0 to indicate an empty name.            */
3365   /*                                                                       */
3366   /*    The glyph name is truncated to fit within the buffer if it is too  */
3367   /*    long.  The returned string is always zero-terminated.              */
3368   /*                                                                       */
3369   /*    Be aware that FreeType reorders glyph indices internally so that   */
3370   /*    glyph index~0 always corresponds to the `missing glyph' (called    */
3371   /*    `.notdef').                                                        */
3372   /*                                                                       */
3373   /*    This function always returns an error if the config macro          */
3374   /*    `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is not defined in `ftoption.h'.  */
3375   /*                                                                       */
3376   FT_EXPORT( FT_Error )
3377   FT_Get_Glyph_Name( FT_Face     face,
3378                      FT_UInt     glyph_index,
3379                      FT_Pointer  buffer,
3380                      FT_UInt     buffer_max );
3381 
3382 
3383   /*************************************************************************/
3384   /*                                                                       */
3385   /* <Function>                                                            */
3386   /*    FT_Get_Postscript_Name                                             */
3387   /*                                                                       */
3388   /* <Description>                                                         */
3389   /*    Retrieve the ASCII PostScript name of a given face, if available.  */
3390   /*    This only works with PostScript, TrueType, and OpenType fonts.     */
3391   /*                                                                       */
3392   /* <Input>                                                               */
3393   /*    face :: A handle to the source face object.                        */
3394   /*                                                                       */
3395   /* <Return>                                                              */
3396   /*    A pointer to the face's PostScript name.  NULL if unavailable.     */
3397   /*                                                                       */
3398   /* <Note>                                                                */
3399   /*    The returned pointer is owned by the face and is destroyed with    */
3400   /*    it.                                                                */
3401   /*                                                                       */
3402   FT_EXPORT( const char* )
3403   FT_Get_Postscript_Name( FT_Face  face );
3404 
3405 
3406   /*************************************************************************/
3407   /*                                                                       */
3408   /* <Function>                                                            */
3409   /*    FT_Select_Charmap                                                  */
3410   /*                                                                       */
3411   /* <Description>                                                         */
3412   /*    Select a given charmap by its encoding tag (as listed in           */
3413   /*    `freetype.h').                                                     */
3414   /*                                                                       */
3415   /* <InOut>                                                               */
3416   /*    face     :: A handle to the source face object.                    */
3417   /*                                                                       */
3418   /* <Input>                                                               */
3419   /*    encoding :: A handle to the selected encoding.                     */
3420   /*                                                                       */
3421   /* <Return>                                                              */
3422   /*    FreeType error code.  0~means success.                             */
3423   /*                                                                       */
3424   /* <Note>                                                                */
3425   /*    This function returns an error if no charmap in the face           */
3426   /*    corresponds to the encoding queried here.                          */
3427   /*                                                                       */
3428   /*    Because many fonts contain more than a single cmap for Unicode     */
3429   /*    encoding, this function has some special code to select the one    */
3430   /*    that covers Unicode best (`best' in the sense that a UCS-4 cmap is */
3431   /*    preferred to a UCS-2 cmap).  It is thus preferable to              */
3432   /*    @FT_Set_Charmap in this case.                                      */
3433   /*                                                                       */
3434   FT_EXPORT( FT_Error )
3435   FT_Select_Charmap( FT_Face      face,
3436                      FT_Encoding  encoding );
3437 
3438 
3439   /*************************************************************************/
3440   /*                                                                       */
3441   /* <Function>                                                            */
3442   /*    FT_Set_Charmap                                                     */
3443   /*                                                                       */
3444   /* <Description>                                                         */
3445   /*    Select a given charmap for character code to glyph index mapping.  */
3446   /*                                                                       */
3447   /* <InOut>                                                               */
3448   /*    face    :: A handle to the source face object.                     */
3449   /*                                                                       */
3450   /* <Input>                                                               */
3451   /*    charmap :: A handle to the selected charmap.                       */
3452   /*                                                                       */
3453   /* <Return>                                                              */
3454   /*    FreeType error code.  0~means success.                             */
3455   /*                                                                       */
3456   /* <Note>                                                                */
3457   /*    This function returns an error if the charmap is not part of       */
3458   /*    the face (i.e., if it is not listed in the `face->charmaps'        */
3459   /*    table).                                                            */
3460   /*                                                                       */
3461   /*    It also fails if an OpenType type~14 charmap is selected (which    */
3462   /*    doesn't map character codes to glyph indices at all).              */
3463   /*                                                                       */
3464   FT_EXPORT( FT_Error )
3465   FT_Set_Charmap( FT_Face     face,
3466                   FT_CharMap  charmap );
3467 
3468 
3469   /*************************************************************************
3470    *
3471    * @function:
3472    *   FT_Get_Charmap_Index
3473    *
3474    * @description:
3475    *   Retrieve index of a given charmap.
3476    *
3477    * @input:
3478    *   charmap ::
3479    *     A handle to a charmap.
3480    *
3481    * @return:
3482    *   The index into the array of character maps within the face to which
3483    *   `charmap' belongs.  If an error occurs, -1 is returned.
3484    *
3485    */
3486   FT_EXPORT( FT_Int )
3487   FT_Get_Charmap_Index( FT_CharMap  charmap );
3488 
3489 
3490   /*************************************************************************/
3491   /*                                                                       */
3492   /* <Function>                                                            */
3493   /*    FT_Get_Char_Index                                                  */
3494   /*                                                                       */
3495   /* <Description>                                                         */
3496   /*    Return the glyph index of a given character code.  This function   */
3497   /*    uses the currently selected charmap to do the mapping.             */
3498   /*                                                                       */
3499   /* <Input>                                                               */
3500   /*    face     :: A handle to the source face object.                    */
3501   /*                                                                       */
3502   /*    charcode :: The character code.                                    */
3503   /*                                                                       */
3504   /* <Return>                                                              */
3505   /*    The glyph index.  0~means `undefined character code'.              */
3506   /*                                                                       */
3507   /* <Note>                                                                */
3508   /*    If you use FreeType to manipulate the contents of font files       */
3509   /*    directly, be aware that the glyph index returned by this function  */
3510   /*    doesn't always correspond to the internal indices used within the  */
3511   /*    file.  This is done to ensure that value~0 always corresponds to   */
3512   /*    the `missing glyph'.  If the first glyph is not named `.notdef',   */
3513   /*    then for Type~1 and Type~42 fonts, `.notdef' will be moved into    */
3514   /*    the glyph ID~0 position, and whatever was there will be moved to   */
3515   /*    the position `.notdef' had.  For Type~1 fonts, if there is no      */
3516   /*    `.notdef' glyph at all, then one will be created at index~0 and    */
3517   /*    whatever was there will be moved to the last index -- Type~42      */
3518   /*    fonts are considered invalid under this condition.                 */
3519   /*                                                                       */
3520   FT_EXPORT( FT_UInt )
3521   FT_Get_Char_Index( FT_Face   face,
3522                      FT_ULong  charcode );
3523 
3524 
3525   /*************************************************************************/
3526   /*                                                                       */
3527   /* <Function>                                                            */
3528   /*    FT_Get_First_Char                                                  */
3529   /*                                                                       */
3530   /* <Description>                                                         */
3531   /*    Return the first character code in the current charmap of a given  */
3532   /*    face, together with its corresponding glyph index.                 */
3533   /*                                                                       */
3534   /* <Input>                                                               */
3535   /*    face    :: A handle to the source face object.                     */
3536   /*                                                                       */
3537   /* <Output>                                                              */
3538   /*    agindex :: Glyph index of first character code.  0~if charmap is   */
3539   /*               empty.                                                  */
3540   /*                                                                       */
3541   /* <Return>                                                              */
3542   /*    The charmap's first character code.                                */
3543   /*                                                                       */
3544   /* <Note>                                                                */
3545   /*    You should use this function together with @FT_Get_Next_Char to    */
3546   /*    parse all character codes available in a given charmap.  The code  */
3547   /*    should look like this:                                             */
3548   /*                                                                       */
3549   /*    {                                                                  */
3550   /*      FT_ULong  charcode;                                              */
3551   /*      FT_UInt   gindex;                                                */
3552   /*                                                                       */
3553   /*                                                                       */
3554   /*      charcode = FT_Get_First_Char( face, &gindex );                   */
3555   /*      while ( gindex != 0 )                                            */
3556   /*      {                                                                */
3557   /*        ... do something with (charcode,gindex) pair ...               */
3558   /*                                                                       */
3559   /*        charcode = FT_Get_Next_Char( face, charcode, &gindex );        */
3560   /*      }                                                                */
3561   /*    }                                                                  */
3562   /*                                                                       */
3563   /*    Be aware that character codes can have values up to 0xFFFFFFFF;    */
3564   /*    this might happen for non-Unicode or malformed cmaps.  However,    */
3565   /*    even with regular Unicode encoding, so-called `last resort fonts'  */
3566   /*    (using SFNT cmap format 13, see function @FT_Get_CMap_Format)      */
3567   /*    normally have entries for all Unicode characters up to 0x1FFFFF,   */
3568   /*    which can cause *a lot* of iterations.                             */
3569   /*                                                                       */
3570   /*    Note that `*agindex' is set to~0 if the charmap is empty.  The     */
3571   /*    result itself can be~0 in two cases: if the charmap is empty or    */
3572   /*    if the value~0 is the first valid character code.                  */
3573   /*                                                                       */
3574   FT_EXPORT( FT_ULong )
3575   FT_Get_First_Char( FT_Face   face,
3576                      FT_UInt  *agindex );
3577 
3578 
3579   /*************************************************************************/
3580   /*                                                                       */
3581   /* <Function>                                                            */
3582   /*    FT_Get_Next_Char                                                   */
3583   /*                                                                       */
3584   /* <Description>                                                         */
3585   /*    Return the next character code in the current charmap of a given   */
3586   /*    face following the value `char_code', as well as the corresponding */
3587   /*    glyph index.                                                       */
3588   /*                                                                       */
3589   /* <Input>                                                               */
3590   /*    face      :: A handle to the source face object.                   */
3591   /*                                                                       */
3592   /*    char_code :: The starting character code.                          */
3593   /*                                                                       */
3594   /* <Output>                                                              */
3595   /*    agindex   :: Glyph index of next character code.  0~if charmap     */
3596   /*                 is empty.                                             */
3597   /*                                                                       */
3598   /* <Return>                                                              */
3599   /*    The charmap's next character code.                                 */
3600   /*                                                                       */
3601   /* <Note>                                                                */
3602   /*    You should use this function with @FT_Get_First_Char to walk       */
3603   /*    over all character codes available in a given charmap.  See the    */
3604   /*    note for that function for a simple code example.                  */
3605   /*                                                                       */
3606   /*    Note that `*agindex' is set to~0 when there are no more codes in   */
3607   /*    the charmap.                                                       */
3608   /*                                                                       */
3609   FT_EXPORT( FT_ULong )
3610   FT_Get_Next_Char( FT_Face    face,
3611                     FT_ULong   char_code,
3612                     FT_UInt   *agindex );
3613 
3614 
3615   /*************************************************************************/
3616   /*                                                                       */
3617   /* <Function>                                                            */
3618   /*    FT_Get_Name_Index                                                  */
3619   /*                                                                       */
3620   /* <Description>                                                         */
3621   /*    Return the glyph index of a given glyph name.                      */
3622   /*                                                                       */
3623   /* <Input>                                                               */
3624   /*    face       :: A handle to the source face object.                  */
3625   /*                                                                       */
3626   /*    glyph_name :: The glyph name.                                      */
3627   /*                                                                       */
3628   /* <Return>                                                              */
3629   /*    The glyph index.  0~means `undefined character code'.              */
3630   /*                                                                       */
3631   FT_EXPORT( FT_UInt )
3632   FT_Get_Name_Index( FT_Face     face,
3633                      FT_String*  glyph_name );
3634 
3635 
3636   /*************************************************************************
3637    *
3638    * @macro:
3639    *   FT_SUBGLYPH_FLAG_XXX
3640    *
3641    * @description:
3642    *   A list of constants describing subglyphs.  Please refer to the
3643    *   `glyf' table description in the OpenType specification for the
3644    *   meaning of the various flags (which get synthesized for
3645    *   non-OpenType subglyphs).
3646    *
3647    * @values:
3648    *   FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
3649    *   FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
3650    *   FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
3651    *   FT_SUBGLYPH_FLAG_SCALE ::
3652    *   FT_SUBGLYPH_FLAG_XY_SCALE ::
3653    *   FT_SUBGLYPH_FLAG_2X2 ::
3654    *   FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
3655    *
3656    */
3657 #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1
3658 #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES      2
3659 #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID        4
3660 #define FT_SUBGLYPH_FLAG_SCALE                   8
3661 #define FT_SUBGLYPH_FLAG_XY_SCALE             0x40
3662 #define FT_SUBGLYPH_FLAG_2X2                  0x80
3663 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS      0x200
3664 
3665 
3666   /*************************************************************************
3667    *
3668    * @func:
3669    *   FT_Get_SubGlyph_Info
3670    *
3671    * @description:
3672    *   Retrieve a description of a given subglyph.  Only use it if
3673    *   `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
3674    *   returned otherwise.
3675    *
3676    * @input:
3677    *   glyph ::
3678    *     The source glyph slot.
3679    *
3680    *   sub_index ::
3681    *     The index of the subglyph.  Must be less than
3682    *     `glyph->num_subglyphs'.
3683    *
3684    * @output:
3685    *   p_index ::
3686    *     The glyph index of the subglyph.
3687    *
3688    *   p_flags ::
3689    *     The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
3690    *
3691    *   p_arg1 ::
3692    *     The subglyph's first argument (if any).
3693    *
3694    *   p_arg2 ::
3695    *     The subglyph's second argument (if any).
3696    *
3697    *   p_transform ::
3698    *     The subglyph transformation (if any).
3699    *
3700    * @return:
3701    *   FreeType error code.  0~means success.
3702    *
3703    * @note:
3704    *   The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
3705    *   interpreted depending on the flags returned in `*p_flags'.  See the
3706    *   OpenType specification for details.
3707    *
3708    */
3709   FT_EXPORT( FT_Error )
3710   FT_Get_SubGlyph_Info( FT_GlyphSlot  glyph,
3711                         FT_UInt       sub_index,
3712                         FT_Int       *p_index,
3713                         FT_UInt      *p_flags,
3714                         FT_Int       *p_arg1,
3715                         FT_Int       *p_arg2,
3716                         FT_Matrix    *p_transform );
3717 
3718 
3719   /*************************************************************************/
3720   /*                                                                       */
3721   /* <Enum>                                                                */
3722   /*    FT_FSTYPE_XXX                                                      */
3723   /*                                                                       */
3724   /* <Description>                                                         */
3725   /*    A list of bit flags used in the `fsType' field of the OS/2 table   */
3726   /*    in a TrueType or OpenType font and the `FSType' entry in a         */
3727   /*    PostScript font.  These bit flags are returned by                  */
3728   /*    @FT_Get_FSType_Flags; they inform client applications of embedding */
3729   /*    and subsetting restrictions associated with a font.                */
3730   /*                                                                       */
3731   /*    See                                                                */
3732   /*    http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */
3733   /*    for more details.                                                  */
3734   /*                                                                       */
3735   /* <Values>                                                              */
3736   /*    FT_FSTYPE_INSTALLABLE_EMBEDDING ::                                 */
3737   /*      Fonts with no fsType bit set may be embedded and permanently     */
3738   /*      installed on the remote system by an application.                */
3739   /*                                                                       */
3740   /*    FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING ::                          */
3741   /*      Fonts that have only this bit set must not be modified, embedded */
3742   /*      or exchanged in any manner without first obtaining permission of */
3743   /*      the font software copyright owner.                               */
3744   /*                                                                       */
3745   /*    FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING ::                           */
3746   /*      The font may be embedded and temporarily loaded on the remote    */
3747   /*      system.  Documents containing Preview & Print fonts must be      */
3748   /*      opened `read-only'; no edits can be applied to the document.     */
3749   /*                                                                       */
3750   /*    FT_FSTYPE_EDITABLE_EMBEDDING ::                                    */
3751   /*      The font may be embedded but must only be installed temporarily  */
3752   /*      on other systems.  In contrast to Preview & Print fonts,         */
3753   /*      documents containing editable fonts may be opened for reading,   */
3754   /*      editing is permitted, and changes may be saved.                  */
3755   /*                                                                       */
3756   /*    FT_FSTYPE_NO_SUBSETTING ::                                         */
3757   /*      The font may not be subsetted prior to embedding.                */
3758   /*                                                                       */
3759   /*    FT_FSTYPE_BITMAP_EMBEDDING_ONLY ::                                 */
3760   /*      Only bitmaps contained in the font may be embedded; no outline   */
3761   /*      data may be embedded.  If there are no bitmaps available in the  */
3762   /*      font, then the font is unembeddable.                             */
3763   /*                                                                       */
3764   /* <Note>                                                                */
3765   /*    The flags are ORed together, thus more than a single value can be  */
3766   /*    returned.                                                          */
3767   /*                                                                       */
3768   /*    While the `fsType' flags can indicate that a font may be embedded, */
3769   /*    a license with the font vendor may be separately required to use   */
3770   /*    the font in this way.                                              */
3771   /*                                                                       */
3772 #define FT_FSTYPE_INSTALLABLE_EMBEDDING         0x0000
3773 #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING  0x0002
3774 #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING   0x0004
3775 #define FT_FSTYPE_EDITABLE_EMBEDDING            0x0008
3776 #define FT_FSTYPE_NO_SUBSETTING                 0x0100
3777 #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY         0x0200
3778 
3779 
3780   /*************************************************************************/
3781   /*                                                                       */
3782   /* <Function>                                                            */
3783   /*    FT_Get_FSType_Flags                                                */
3784   /*                                                                       */
3785   /* <Description>                                                         */
3786   /*    Return the `fsType' flags for a font.                              */
3787   /*                                                                       */
3788   /* <Input>                                                               */
3789   /*    face :: A handle to the source face object.                        */
3790   /*                                                                       */
3791   /* <Return>                                                              */
3792   /*    The `fsType' flags, see @FT_FSTYPE_XXX.                            */
3793   /*                                                                       */
3794   /* <Note>                                                                */
3795   /*    Use this function rather than directly reading the `fs_type' field */
3796   /*    in the @PS_FontInfoRec structure, which is only guaranteed to      */
3797   /*    return the correct results for Type~1 fonts.                       */
3798   /*                                                                       */
3799   /* <Since>                                                               */
3800   /*    2.3.8                                                              */
3801   /*                                                                       */
3802   FT_EXPORT( FT_UShort )
3803   FT_Get_FSType_Flags( FT_Face  face );
3804 
3805 
3806   /*************************************************************************/
3807   /*                                                                       */
3808   /* <Section>                                                             */
3809   /*    glyph_variants                                                     */
3810   /*                                                                       */
3811   /* <Title>                                                               */
3812   /*    Unicode Variation Sequences                                        */
3813   /*                                                                       */
3814   /* <Abstract>                                                            */
3815   /*    The FreeType~2 interface to Unicode Variation Sequences (UVS),     */
3816   /*    using the SFNT cmap format~14.                                     */
3817   /*                                                                       */
3818   /* <Description>                                                         */
3819   /*    Many characters, especially for CJK scripts, have variant forms.   */
3820   /*    They are a sort of grey area somewhere between being totally       */
3821   /*    irrelevant and semantically distinct; for this reason, the Unicode */
3822   /*    consortium decided to introduce Variation Sequences (VS),          */
3823   /*    consisting of a Unicode base character and a variation selector    */
3824   /*    instead of further extending the already huge number of            */
3825   /*    characters.                                                        */
3826   /*                                                                       */
3827   /*    Unicode maintains two different sets, namely `Standardized         */
3828   /*    Variation Sequences' and registered `Ideographic Variation         */
3829   /*    Sequences' (IVS), collected in the `Ideographic Variation          */
3830   /*    Database' (IVD).                                                   */
3831   /*                                                                       */
3832   /*      http://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */
3833   /*      http://unicode.org/reports/tr37/                                 */
3834   /*      http://unicode.org/ivd/                                          */
3835   /*                                                                       */
3836   /*    To date (January 2017), the character with the most ideographic    */
3837   /*    variations is U+9089, having 32 such IVS.                          */
3838   /*                                                                       */
3839   /*    Three Mongolian Variation Selectors have the values U+180B-U+180D; */
3840   /*    256 generic Variation Selectors are encoded in the ranges          */
3841   /*    U+FE00-U+FE0F and U+E0100-U+E01EF.  IVS currently use Variation    */
3842   /*    Selectors from the range U+E0100-U+E01EF only.                     */
3843   /*                                                                       */
3844   /*    A VS consists of the base character value followed by a single     */
3845   /*    Variation Selector.  For example, to get the first variation of    */
3846   /*    U+9089, you have to write the character sequence `U+9089 U+E0100'. */
3847   /*                                                                       */
3848   /*    Adobe and MS decided to support both standardized and ideographic  */
3849   /*    VS with a new cmap subtable (format~14).  It is an odd subtable    */
3850   /*    because it is not a mapping of input code points to glyphs, but    */
3851   /*    contains lists of all variations supported by the font.            */
3852   /*                                                                       */
3853   /*    A variation may be either `default' or `non-default' for a given   */
3854   /*    font.  A default variation is the one you will get for that code   */
3855   /*    point if you look it up in the standard Unicode cmap.  A           */
3856   /*    non-default variation is a different glyph.                        */
3857   /*                                                                       */
3858   /*************************************************************************/
3859 
3860 
3861   /*************************************************************************/
3862   /*                                                                       */
3863   /* <Function>                                                            */
3864   /*    FT_Face_GetCharVariantIndex                                        */
3865   /*                                                                       */
3866   /* <Description>                                                         */
3867   /*    Return the glyph index of a given character code as modified by    */
3868   /*    the variation selector.                                            */
3869   /*                                                                       */
3870   /* <Input>                                                               */
3871   /*    face ::                                                            */
3872   /*      A handle to the source face object.                              */
3873   /*                                                                       */
3874   /*    charcode ::                                                        */
3875   /*      The character code point in Unicode.                             */
3876   /*                                                                       */
3877   /*    variantSelector ::                                                 */
3878   /*      The Unicode code point of the variation selector.                */
3879   /*                                                                       */
3880   /* <Return>                                                              */
3881   /*    The glyph index.  0~means either `undefined character code', or    */
3882   /*    `undefined selector code', or `no variation selector cmap          */
3883   /*    subtable', or `current CharMap is not Unicode'.                    */
3884   /*                                                                       */
3885   /* <Note>                                                                */
3886   /*    If you use FreeType to manipulate the contents of font files       */
3887   /*    directly, be aware that the glyph index returned by this function  */
3888   /*    doesn't always correspond to the internal indices used within      */
3889   /*    the file.  This is done to ensure that value~0 always corresponds  */
3890   /*    to the `missing glyph'.                                            */
3891   /*                                                                       */
3892   /*    This function is only meaningful if                                */
3893   /*      a) the font has a variation selector cmap sub table,             */
3894   /*    and                                                                */
3895   /*      b) the current charmap has a Unicode encoding.                   */
3896   /*                                                                       */
3897   /* <Since>                                                               */
3898   /*    2.3.6                                                              */
3899   /*                                                                       */
3900   FT_EXPORT( FT_UInt )
3901   FT_Face_GetCharVariantIndex( FT_Face   face,
3902                                FT_ULong  charcode,
3903                                FT_ULong  variantSelector );
3904 
3905 
3906   /*************************************************************************/
3907   /*                                                                       */
3908   /* <Function>                                                            */
3909   /*    FT_Face_GetCharVariantIsDefault                                    */
3910   /*                                                                       */
3911   /* <Description>                                                         */
3912   /*    Check whether this variation of this Unicode character is the one  */
3913   /*    to be found in the `cmap'.                                         */
3914   /*                                                                       */
3915   /* <Input>                                                               */
3916   /*    face ::                                                            */
3917   /*      A handle to the source face object.                              */
3918   /*                                                                       */
3919   /*    charcode ::                                                        */
3920   /*      The character codepoint in Unicode.                              */
3921   /*                                                                       */
3922   /*    variantSelector ::                                                 */
3923   /*      The Unicode codepoint of the variation selector.                 */
3924   /*                                                                       */
3925   /* <Return>                                                              */
3926   /*    1~if found in the standard (Unicode) cmap, 0~if found in the       */
3927   /*    variation selector cmap, or -1 if it is not a variation.           */
3928   /*                                                                       */
3929   /* <Note>                                                                */
3930   /*    This function is only meaningful if the font has a variation       */
3931   /*    selector cmap subtable.                                            */
3932   /*                                                                       */
3933   /* <Since>                                                               */
3934   /*    2.3.6                                                              */
3935   /*                                                                       */
3936   FT_EXPORT( FT_Int )
3937   FT_Face_GetCharVariantIsDefault( FT_Face   face,
3938                                    FT_ULong  charcode,
3939                                    FT_ULong  variantSelector );
3940 
3941 
3942   /*************************************************************************/
3943   /*                                                                       */
3944   /* <Function>                                                            */
3945   /*    FT_Face_GetVariantSelectors                                        */
3946   /*                                                                       */
3947   /* <Description>                                                         */
3948   /*    Return a zero-terminated list of Unicode variation selectors found */
3949   /*    in the font.                                                       */
3950   /*                                                                       */
3951   /* <Input>                                                               */
3952   /*    face ::                                                            */
3953   /*      A handle to the source face object.                              */
3954   /*                                                                       */
3955   /* <Return>                                                              */
3956   /*    A pointer to an array of selector code points, or NULL if there is */
3957   /*    no valid variation selector cmap subtable.                         */
3958   /*                                                                       */
3959   /* <Note>                                                                */
3960   /*    The last item in the array is~0; the array is owned by the         */
3961   /*    @FT_Face object but can be overwritten or released on the next     */
3962   /*    call to a FreeType function.                                       */
3963   /*                                                                       */
3964   /* <Since>                                                               */
3965   /*    2.3.6                                                              */
3966   /*                                                                       */
3967   FT_EXPORT( FT_UInt32* )
3968   FT_Face_GetVariantSelectors( FT_Face  face );
3969 
3970 
3971   /*************************************************************************/
3972   /*                                                                       */
3973   /* <Function>                                                            */
3974   /*    FT_Face_GetVariantsOfChar                                          */
3975   /*                                                                       */
3976   /* <Description>                                                         */
3977   /*    Return a zero-terminated list of Unicode variation selectors found */
3978   /*    for the specified character code.                                  */
3979   /*                                                                       */
3980   /* <Input>                                                               */
3981   /*    face ::                                                            */
3982   /*      A handle to the source face object.                              */
3983   /*                                                                       */
3984   /*    charcode ::                                                        */
3985   /*      The character codepoint in Unicode.                              */
3986   /*                                                                       */
3987   /* <Return>                                                              */
3988   /*    A pointer to an array of variation selector code points that are   */
3989   /*    active for the given character, or NULL if the corresponding list  */
3990   /*    is empty.                                                          */
3991   /*                                                                       */
3992   /* <Note>                                                                */
3993   /*    The last item in the array is~0; the array is owned by the         */
3994   /*    @FT_Face object but can be overwritten or released on the next     */
3995   /*    call to a FreeType function.                                       */
3996   /*                                                                       */
3997   /* <Since>                                                               */
3998   /*    2.3.6                                                              */
3999   /*                                                                       */
4000   FT_EXPORT( FT_UInt32* )
4001   FT_Face_GetVariantsOfChar( FT_Face   face,
4002                              FT_ULong  charcode );
4003 
4004 
4005   /*************************************************************************/
4006   /*                                                                       */
4007   /* <Function>                                                            */
4008   /*    FT_Face_GetCharsOfVariant                                          */
4009   /*                                                                       */
4010   /* <Description>                                                         */
4011   /*    Return a zero-terminated list of Unicode character codes found for */
4012   /*    the specified variation selector.                                  */
4013   /*                                                                       */
4014   /* <Input>                                                               */
4015   /*    face ::                                                            */
4016   /*      A handle to the source face object.                              */
4017   /*                                                                       */
4018   /*    variantSelector ::                                                 */
4019   /*      The variation selector code point in Unicode.                    */
4020   /*                                                                       */
4021   /* <Return>                                                              */
4022   /*    A list of all the code points that are specified by this selector  */
4023   /*    (both default and non-default codes are returned) or NULL if there */
4024   /*    is no valid cmap or the variation selector is invalid.             */
4025   /*                                                                       */
4026   /* <Note>                                                                */
4027   /*    The last item in the array is~0; the array is owned by the         */
4028   /*    @FT_Face object but can be overwritten or released on the next     */
4029   /*    call to a FreeType function.                                       */
4030   /*                                                                       */
4031   /* <Since>                                                               */
4032   /*    2.3.6                                                              */
4033   /*                                                                       */
4034   FT_EXPORT( FT_UInt32* )
4035   FT_Face_GetCharsOfVariant( FT_Face   face,
4036                              FT_ULong  variantSelector );
4037 
4038 
4039   /*************************************************************************/
4040   /*                                                                       */
4041   /* <Section>                                                             */
4042   /*    computations                                                       */
4043   /*                                                                       */
4044   /* <Title>                                                               */
4045   /*    Computations                                                       */
4046   /*                                                                       */
4047   /* <Abstract>                                                            */
4048   /*    Crunching fixed numbers and vectors.                               */
4049   /*                                                                       */
4050   /* <Description>                                                         */
4051   /*    This section contains various functions used to perform            */
4052   /*    computations on 16.16 fixed-float numbers or 2d vectors.           */
4053   /*                                                                       */
4054   /* <Order>                                                               */
4055   /*    FT_MulDiv                                                          */
4056   /*    FT_MulFix                                                          */
4057   /*    FT_DivFix                                                          */
4058   /*    FT_RoundFix                                                        */
4059   /*    FT_CeilFix                                                         */
4060   /*    FT_FloorFix                                                        */
4061   /*    FT_Vector_Transform                                                */
4062   /*    FT_Matrix_Multiply                                                 */
4063   /*    FT_Matrix_Invert                                                   */
4064   /*                                                                       */
4065   /*************************************************************************/
4066 
4067 
4068   /*************************************************************************/
4069   /*                                                                       */
4070   /* <Function>                                                            */
4071   /*    FT_MulDiv                                                          */
4072   /*                                                                       */
4073   /* <Description>                                                         */
4074   /*    Compute `(a*b)/c' with maximum accuracy, using a 64-bit            */
4075   /*    intermediate integer whenever necessary.                           */
4076   /*                                                                       */
4077   /*    This function isn't necessarily as fast as some processor specific */
4078   /*    operations, but is at least completely portable.                   */
4079   /*                                                                       */
4080   /* <Input>                                                               */
4081   /*    a :: The first multiplier.                                         */
4082   /*                                                                       */
4083   /*    b :: The second multiplier.                                        */
4084   /*                                                                       */
4085   /*    c :: The divisor.                                                  */
4086   /*                                                                       */
4087   /* <Return>                                                              */
4088   /*    The result of `(a*b)/c'.  This function never traps when trying to */
4089   /*    divide by zero; it simply returns `MaxInt' or `MinInt' depending   */
4090   /*    on the signs of `a' and `b'.                                       */
4091   /*                                                                       */
4092   FT_EXPORT( FT_Long )
4093   FT_MulDiv( FT_Long  a,
4094              FT_Long  b,
4095              FT_Long  c );
4096 
4097 
4098   /*************************************************************************/
4099   /*                                                                       */
4100   /* <Function>                                                            */
4101   /*    FT_MulFix                                                          */
4102   /*                                                                       */
4103   /* <Description>                                                         */
4104   /*    Compute `(a*b)/0x10000' with maximum accuracy.  Its main use is to */
4105   /*    multiply a given value by a 16.16 fixed-point factor.              */
4106   /*                                                                       */
4107   /* <Input>                                                               */
4108   /*    a :: The first multiplier.                                         */
4109   /*                                                                       */
4110   /*    b :: The second multiplier.  Use a 16.16 factor here whenever      */
4111   /*         possible (see note below).                                    */
4112   /*                                                                       */
4113   /* <Return>                                                              */
4114   /*    The result of `(a*b)/0x10000'.                                     */
4115   /*                                                                       */
4116   /* <Note>                                                                */
4117   /*    This function has been optimized for the case where the absolute   */
4118   /*    value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
4119   /*    As this happens mainly when scaling from notional units to         */
4120   /*    fractional pixels in FreeType, it resulted in noticeable speed     */
4121   /*    improvements between versions 2.x and 1.x.                         */
4122   /*                                                                       */
4123   /*    As a conclusion, always try to place a 16.16 factor as the         */
4124   /*    _second_ argument of this function; this can make a great          */
4125   /*    difference.                                                        */
4126   /*                                                                       */
4127   FT_EXPORT( FT_Long )
4128   FT_MulFix( FT_Long  a,
4129              FT_Long  b );
4130 
4131 
4132   /*************************************************************************/
4133   /*                                                                       */
4134   /* <Function>                                                            */
4135   /*    FT_DivFix                                                          */
4136   /*                                                                       */
4137   /* <Description>                                                         */
4138   /*    Compute `(a*0x10000)/b' with maximum accuracy.  Its main use is to */
4139   /*    divide a given value by a 16.16 fixed-point factor.                */
4140   /*                                                                       */
4141   /* <Input>                                                               */
4142   /*    a :: The numerator.                                                */
4143   /*                                                                       */
4144   /*    b :: The denominator.  Use a 16.16 factor here.                    */
4145   /*                                                                       */
4146   /* <Return>                                                              */
4147   /*    The result of `(a*0x10000)/b'.                                     */
4148   /*                                                                       */
4149   FT_EXPORT( FT_Long )
4150   FT_DivFix( FT_Long  a,
4151              FT_Long  b );
4152 
4153 
4154   /*************************************************************************/
4155   /*                                                                       */
4156   /* <Function>                                                            */
4157   /*    FT_RoundFix                                                        */
4158   /*                                                                       */
4159   /* <Description>                                                         */
4160   /*    Round a 16.16 fixed number.                                        */
4161   /*                                                                       */
4162   /* <Input>                                                               */
4163   /*    a :: The number to be rounded.                                     */
4164   /*                                                                       */
4165   /* <Return>                                                              */
4166   /*    `a' rounded to the nearest 16.16 fixed integer, halfway cases away */
4167   /*    from zero.                                                         */
4168   /*                                                                       */
4169   FT_EXPORT( FT_Fixed )
4170   FT_RoundFix( FT_Fixed  a );
4171 
4172 
4173   /*************************************************************************/
4174   /*                                                                       */
4175   /* <Function>                                                            */
4176   /*    FT_CeilFix                                                         */
4177   /*                                                                       */
4178   /* <Description>                                                         */
4179   /*    Compute the smallest following integer of a 16.16 fixed number.    */
4180   /*                                                                       */
4181   /* <Input>                                                               */
4182   /*    a :: The number for which the ceiling function is to be computed.  */
4183   /*                                                                       */
4184   /* <Return>                                                              */
4185   /*    `a' rounded towards plus infinity.                                 */
4186   /*                                                                       */
4187   FT_EXPORT( FT_Fixed )
4188   FT_CeilFix( FT_Fixed  a );
4189 
4190 
4191   /*************************************************************************/
4192   /*                                                                       */
4193   /* <Function>                                                            */
4194   /*    FT_FloorFix                                                        */
4195   /*                                                                       */
4196   /* <Description>                                                         */
4197   /*    Compute the largest previous integer of a 16.16 fixed number.      */
4198   /*                                                                       */
4199   /* <Input>                                                               */
4200   /*    a :: The number for which the floor function is to be computed.    */
4201   /*                                                                       */
4202   /* <Return>                                                              */
4203   /*    `a' rounded towards minus infinity.                                */
4204   /*                                                                       */
4205   FT_EXPORT( FT_Fixed )
4206   FT_FloorFix( FT_Fixed  a );
4207 
4208 
4209   /*************************************************************************/
4210   /*                                                                       */
4211   /* <Function>                                                            */
4212   /*    FT_Vector_Transform                                                */
4213   /*                                                                       */
4214   /* <Description>                                                         */
4215   /*    Transform a single vector through a 2x2 matrix.                    */
4216   /*                                                                       */
4217   /* <InOut>                                                               */
4218   /*    vector :: The target vector to transform.                          */
4219   /*                                                                       */
4220   /* <Input>                                                               */
4221   /*    matrix :: A pointer to the source 2x2 matrix.                      */
4222   /*                                                                       */
4223   /* <Note>                                                                */
4224   /*    The result is undefined if either `vector' or `matrix' is invalid. */
4225   /*                                                                       */
4226   FT_EXPORT( void )
4227   FT_Vector_Transform( FT_Vector*        vec,
4228                        const FT_Matrix*  matrix );
4229 
4230 
4231   /*************************************************************************/
4232   /*                                                                       */
4233   /* <Section>                                                             */
4234   /*    version                                                            */
4235   /*                                                                       */
4236   /* <Title>                                                               */
4237   /*    FreeType Version                                                   */
4238   /*                                                                       */
4239   /* <Abstract>                                                            */
4240   /*    Functions and macros related to FreeType versions.                 */
4241   /*                                                                       */
4242   /* <Description>                                                         */
4243   /*    Note that those functions and macros are of limited use because    */
4244   /*    even a new release of FreeType with only documentation changes     */
4245   /*    increases the version number.                                      */
4246   /*                                                                       */
4247   /* <Order>                                                               */
4248   /*    FT_Library_Version                                                 */
4249   /*                                                                       */
4250   /*    FREETYPE_MAJOR                                                     */
4251   /*    FREETYPE_MINOR                                                     */
4252   /*    FREETYPE_PATCH                                                     */
4253   /*                                                                       */
4254   /*    FT_Face_CheckTrueTypePatents                                       */
4255   /*    FT_Face_SetUnpatentedHinting                                       */
4256   /*                                                                       */
4257   /*    FREETYPE_XXX                                                       */
4258   /*                                                                       */
4259   /*************************************************************************/
4260 
4261 
4262   /*************************************************************************
4263    *
4264    * @enum:
4265    *   FREETYPE_XXX
4266    *
4267    * @description:
4268    *   These three macros identify the FreeType source code version.
4269    *   Use @FT_Library_Version to access them at runtime.
4270    *
4271    * @values:
4272    *   FREETYPE_MAJOR :: The major version number.
4273    *   FREETYPE_MINOR :: The minor version number.
4274    *   FREETYPE_PATCH :: The patch level.
4275    *
4276    * @note:
4277    *   The version number of FreeType if built as a dynamic link library
4278    *   with the `libtool' package is _not_ controlled by these three
4279    *   macros.
4280    *
4281    */
4282 #define FREETYPE_MAJOR  2
4283 #define FREETYPE_MINOR  7
4284 #define FREETYPE_PATCH  1
4285 
4286 
4287   /*************************************************************************/
4288   /*                                                                       */
4289   /* <Function>                                                            */
4290   /*    FT_Library_Version                                                 */
4291   /*                                                                       */
4292   /* <Description>                                                         */
4293   /*    Return the version of the FreeType library being used.  This is    */
4294   /*    useful when dynamically linking to the library, since one cannot   */
4295   /*    use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and               */
4296   /*    @FREETYPE_PATCH.                                                   */
4297   /*                                                                       */
4298   /* <Input>                                                               */
4299   /*    library :: A source library handle.                                */
4300   /*                                                                       */
4301   /* <Output>                                                              */
4302   /*    amajor  :: The major version number.                               */
4303   /*                                                                       */
4304   /*    aminor  :: The minor version number.                               */
4305   /*                                                                       */
4306   /*    apatch  :: The patch version number.                               */
4307   /*                                                                       */
4308   /* <Note>                                                                */
4309   /*    The reason why this function takes a `library' argument is because */
4310   /*    certain programs implement library initialization in a custom way  */
4311   /*    that doesn't use @FT_Init_FreeType.                                */
4312   /*                                                                       */
4313   /*    In such cases, the library version might not be available before   */
4314   /*    the library object has been created.                               */
4315   /*                                                                       */
4316   FT_EXPORT( void )
4317   FT_Library_Version( FT_Library   library,
4318                       FT_Int      *amajor,
4319                       FT_Int      *aminor,
4320                       FT_Int      *apatch );
4321 
4322 
4323   /*************************************************************************/
4324   /*                                                                       */
4325   /* <Function>                                                            */
4326   /*    FT_Face_CheckTrueTypePatents                                       */
4327   /*                                                                       */
4328   /* <Description>                                                         */
4329   /*    Deprecated, does nothing.                                          */
4330   /*                                                                       */
4331   /* <Input>                                                               */
4332   /*    face :: A face handle.                                             */
4333   /*                                                                       */
4334   /* <Return>                                                              */
4335   /*    Always returns false.                                              */
4336   /*                                                                       */
4337   /* <Note>                                                                */
4338   /*    Since May 2010, TrueType hinting is no longer patented.            */
4339   /*                                                                       */
4340   /* <Since>                                                               */
4341   /*    2.3.5                                                              */
4342   /*                                                                       */
4343   FT_EXPORT( FT_Bool )
4344   FT_Face_CheckTrueTypePatents( FT_Face  face );
4345 
4346 
4347   /*************************************************************************/
4348   /*                                                                       */
4349   /* <Function>                                                            */
4350   /*    FT_Face_SetUnpatentedHinting                                       */
4351   /*                                                                       */
4352   /* <Description>                                                         */
4353   /*    Deprecated, does nothing.                                          */
4354   /*                                                                       */
4355   /* <Input>                                                               */
4356   /*    face  :: A face handle.                                            */
4357   /*                                                                       */
4358   /*    value :: New boolean setting.                                      */
4359   /*                                                                       */
4360   /* <Return>                                                              */
4361   /*    Always returns false.                                              */
4362   /*                                                                       */
4363   /* <Note>                                                                */
4364   /*    Since May 2010, TrueType hinting is no longer patented.            */
4365   /*                                                                       */
4366   /* <Since>                                                               */
4367   /*    2.3.5                                                              */
4368   /*                                                                       */
4369   FT_EXPORT( FT_Bool )
4370   FT_Face_SetUnpatentedHinting( FT_Face  face,
4371                                 FT_Bool  value );
4372 
4373   /* */
4374 
4375 
4376 FT_END_HEADER
4377 
4378 #endif /* FREETYPE_H_ */
4379 
4380 
4381 /* END */
4382