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