This commit was manufactured by cvs2svn to create branch 'captive'.
[reactos.git] / subsys / win32k / freetype / include / freetype / freetype.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  freetype.h                                                             */
4 /*                                                                         */
5 /*    FreeType high-level API and common types (specification only).       */
6 /*                                                                         */
7 /*  Copyright 1996-2000 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   /*************************************************************************/
24   /*                                                                       */
25   /* The `raster' component duplicates some of the declarations in         */
26   /* freetype.h for stand-alone use if _FREETYPE_ isn't defined.           */
27   /*                                                                       */
28 #define _FREETYPE_
29
30
31   /*************************************************************************/
32   /*                                                                       */
33   /* The FREETYPE_MAJOR and FREETYPE_MINOR macros are used to version the  */
34   /* new FreeType design, which is able to host several kinds of font      */
35   /* drivers.  It starts at 2.0.                                           */
36   /*                                                                       */
37 #define FREETYPE_MAJOR 2
38 #define FREETYPE_MINOR 0
39
40
41 #include <freetype/config/ftconfig.h>   /* read configuration information */
42 #include <freetype/fterrors.h>
43 #include <freetype/fttypes.h>
44
45
46 #ifdef __cplusplus
47   extern "C" {
48 #endif
49
50
51   /*************************************************************************/
52   /*************************************************************************/
53   /*                                                                       */
54   /*                        B A S I C   T Y P E S                          */
55   /*                                                                       */
56   /*************************************************************************/
57   /*************************************************************************/
58
59
60   /*************************************************************************/
61   /*                                                                       */
62   /* <Struct>                                                              */
63   /*    FT_Glyph_Metrics                                                   */
64   /*                                                                       */
65   /* <Description>                                                         */
66   /*    A structure used to model the metrics of a single glyph.  Note     */
67   /*    that values are expressed in 26.6 fractional pixel format or in    */
68   /*    font units, depending on context.                                  */
69   /*                                                                       */
70   /* <Fields>                                                              */
71   /*    width        :: The glyph's width.                                 */
72   /*                                                                       */
73   /*    height       :: The glyph's height.                                */
74   /*                                                                       */
75   /*    horiBearingX :: Horizontal left side bearing.                      */
76   /*                                                                       */
77   /*    horiBearingY :: Horizontal top side bearing.                       */
78   /*                                                                       */
79   /*    horiAdvance  :: Horizontal advance width.                          */
80   /*                                                                       */
81   /*    vertBearingX :: Vertical left side bearing.                        */
82   /*                                                                       */
83   /*    vertBearingY :: Vertical top side bearing.                         */
84   /*                                                                       */
85   /*    vertAdvance  :: Vertical advance height.                           */
86   /*                                                                       */
87   typedef struct  FT_Glyph_Metrics_
88   {
89     FT_Pos  width;         /* glyph width  */
90     FT_Pos  height;        /* glyph height */
91
92     FT_Pos  horiBearingX;  /* left side bearing in horizontal layouts */
93     FT_Pos  horiBearingY;  /* top side bearing in horizontal layouts  */
94     FT_Pos  horiAdvance;   /* advance width for horizontal layout     */
95
96     FT_Pos  vertBearingX;  /* left side bearing in vertical layouts */
97     FT_Pos  vertBearingY;  /* top side bearing in vertical layouts  */
98     FT_Pos  vertAdvance;   /* advance height for vertical layout    */
99
100   } FT_Glyph_Metrics;
101
102
103   /*************************************************************************/
104   /*                                                                       */
105   /* <FuncType>                                                            */
106   /*    FT_Generic_Finalizer                                               */
107   /*                                                                       */
108   /* <Description>                                                         */
109   /*    Describes a function used to destroy the `client' data of any      */
110   /*    FreeType object.  See the description of the FT_Generic type for   */
111   /*    details of usage.                                                  */
112   /*                                                                       */
113   /* <Input>                                                               */
114   /*    The address of the FreeType object which is under finalization.    */
115   /*    Its client data is accessed through its `generic' field.           */
116   /*                                                                       */
117   typedef void  (*FT_Generic_Finalizer)(void*  object);
118
119
120   /*************************************************************************/
121   /*                                                                       */
122   /* <Struct>                                                              */
123   /*    FT_Generic                                                         */
124   /*                                                                       */
125   /* <Description>                                                         */
126   /*    Client applications often need to associate their own data to a    */
127   /*    variety of FreeType core objects.  For example, a text layout API  */
128   /*    might want to associate a glyph cache to a given size object.      */
129   /*                                                                       */
130   /*    Most FreeType object contains a `generic' field, of type           */
131   /*    FT_Generic, which usage is left to client applications and font    */
132   /*    servers.                                                           */
133   /*                                                                       */
134   /*    It can be used to store a pointer to client-specific data, as well */
135   /*    as the address of a `finalizer' function, which will be called by  */
136   /*    FreeType when the object is destroyed (for example, the previous   */
137   /*    client example would put the address of the glyph cache destructor */
138   /*    in the `finalizer' field).                                         */
139   /*                                                                       */
140   /* <Fields>                                                              */
141   /*    data      :: A typeless pointer to any client-specified data. This */
142   /*                 field is completely ignored by the FreeType library.  */
143   /*                                                                       */
144   /*    finalizer :: A pointer to a `generic finalizer' function, which    */
145   /*                 will be called when the object is destroyed.  If this */
146   /*                 field is set to NULL, no code will be called.         */
147   /*                                                                       */
148   typedef struct  FT_Generic_
149   {
150     void*                 data;
151     FT_Generic_Finalizer  finalizer;
152
153   } FT_Generic;
154
155
156   /*************************************************************************/
157   /*                                                                       */
158   /* <Struct>                                                              */
159   /*    FT_Bitmap_Size                                                     */
160   /*                                                                       */
161   /* <Description>                                                         */
162   /*    An extremely simple structure used to model the size of a bitmap   */
163   /*    strike (i.e., a bitmap instance of the font for a given            */
164   /*    resolution) in a fixed-size font face.  This is used for the       */
165   /*    `available_sizes' field of the FT_Face_Properties structure.       */
166   /*                                                                       */
167   /* <Fields>                                                              */
168   /*    height :: The character height in pixels.                          */
169   /*                                                                       */
170   /*    width  :: The character width in pixels.                           */
171   /*                                                                       */
172   typedef struct  FT_Bitmap_Size_
173   {
174     FT_Short  height;
175     FT_Short  width;
176
177   } FT_Bitmap_Size;
178
179
180   /*************************************************************************/
181   /*************************************************************************/
182   /*                                                                       */
183   /*                     O B J E C T   C L A S S E S                       */
184   /*                                                                       */
185   /*************************************************************************/
186   /*************************************************************************/
187
188   /*************************************************************************/
189   /*                                                                       */
190   /* <Type>                                                                */
191   /*    FT_Library                                                         */
192   /*                                                                       */
193   /* <Description>                                                         */
194   /*    A handle to a FreeType library instance.  Each `library' is        */
195   /*    completely independent from the others; it is the `root' of a set  */
196   /*    of objects like fonts, faces, sizes, etc.                          */
197   /*                                                                       */
198   /*    It also embeds a system object (see FT_System), as well as a       */
199   /*    scan-line converter object (see FT_Raster).                        */
200   /*                                                                       */
201   /* <Note>                                                                */
202   /*    Library objects are created through FT_Init_FreeType().            */
203   /*                                                                       */
204   typedef struct FT_LibraryRec_  *FT_Library;
205
206
207   /*************************************************************************/
208   /*                                                                       */
209   /* <Type>                                                                */
210   /*    FT_Module                                                          */
211   /*                                                                       */
212   /* <Description>                                                         */
213   /*    A handle to a given FreeType module object.  Each module can be a  */
214   /*    font driver, a renderer, or anything else that provides services   */
215   /*    to the formers.                                                    */
216   /*                                                                       */
217   typedef struct FT_ModuleRec_*  FT_Module;
218
219
220   /*************************************************************************/
221   /*                                                                       */
222   /* <Type>                                                                */
223   /*    FT_Driver                                                          */
224   /*                                                                       */
225   /* <Description>                                                         */
226   /*    A handle to a given FreeType font driver object.  Each font driver */
227   /*    is able to create faces, sizes, glyph slots, and charmaps from the */
228   /*    resources whose format it supports.                                */
229   /*                                                                       */
230   /*    A driver can support either bitmap, graymap, or scalable font      */
231   /*    formats.                                                           */
232   /*                                                                       */
233   typedef struct FT_DriverRec_*  FT_Driver;
234
235
236   /*************************************************************************/
237   /*                                                                       */
238   /* <Type>                                                                */
239   /*    FT_Renderer                                                        */
240   /*                                                                       */
241   /* <Description>                                                         */
242   /*    A handle to a given FreeType renderer.  A renderer is in charge of */
243   /*    converting a glyph image to a bitmap, when necessary.  Each        */
244   /*    supports a given glyph image format, and one or more target        */
245   /*    surface depths.                                                    */
246   /*                                                                       */
247   typedef struct FT_RendererRec_*  FT_Renderer;
248
249
250   /*************************************************************************/
251   /*                                                                       */
252   /* <Type>                                                                */
253   /*    FT_Face                                                            */
254   /*                                                                       */
255   /* <Description>                                                         */
256   /*    A handle to a given driver face object.  A face object contains    */
257   /*    all the instance and glyph independent data of a font file         */
258   /*    typeface.                                                          */
259   /*                                                                       */
260   /*    A face object is created from a resource object through the        */
261   /*    new_face() method of a given driver.                               */
262   /*                                                                       */
263   typedef struct FT_FaceRec_*  FT_Face;
264
265
266   /*************************************************************************/
267   /*                                                                       */
268   /* <Type>                                                                */
269   /*    FT_Size                                                            */
270   /*                                                                       */
271   /* <Description>                                                         */
272   /*    A handle to a given driver size object.  Such an object models the */
273   /*    _resolution_ AND _size_ dependent state of a given driver face     */
274   /*    size.                                                              */
275   /*                                                                       */
276   /*    A size object is always created from a given face object.  It is   */
277   /*    discarded automatically by its parent face.                        */
278   /*                                                                       */
279   typedef struct FT_SizeRec_*  FT_Size;
280
281
282   /*************************************************************************/
283   /*                                                                       */
284   /* <Type>                                                                */
285   /*    FT_GlyphSlot                                                       */
286   /*                                                                       */
287   /* <Description>                                                         */
288   /*    A handle to a given `glyph slot'.  A slot is a container where it  */
289   /*    is possible to load any of the glyphs contained within its parent  */
290   /*    face.                                                              */
291   /*                                                                       */
292   /*    A glyph slot is created from a given face object.  It is discarded */
293   /*    automatically by its parent face.                                  */
294   /*                                                                       */
295   typedef struct FT_GlyphSlotRec_*  FT_GlyphSlot;
296
297
298   /*************************************************************************/
299   /*                                                                       */
300   /* <Type>                                                                */
301   /*    FT_CharMap                                                         */
302   /*                                                                       */
303   /* <Description>                                                         */
304   /*    A handle to a given character map.  A charmap is used to translate */
305   /*    character codes in a given encoding into glyph indexes for its     */
306   /*    parent's face.  Some font formats may provide several charmaps per */
307   /*    font.                                                              */
308   /*                                                                       */
309   /*    A charmap is created from a given face object.  It is discarded    */
310   /*    automatically by its parent face.                                  */
311   /*                                                                       */
312   typedef struct FT_CharMapRec_*  FT_CharMap;
313
314
315   /*************************************************************************/
316   /*                                                                       */
317   /* <Enum>                                                                */
318   /*    FT_Encoding                                                        */
319   /*                                                                       */
320   /* <Description>                                                         */
321   /*    An enumeration used to specify encodings supported by charmaps.    */
322   /*    Used in the FT_Select_CharMap() API function.                      */
323   /*                                                                       */
324   /* <Note>                                                                */
325   /*    Because of 32-bit charcodes defined in Unicode (i.e., surrogates), */
326   /*    all character codes must be expressed as FT_Longs.                 */
327   /*                                                                       */
328   typedef enum  FT_Encoding_
329   {
330     ft_encoding_none    = 0,
331     ft_encoding_symbol  = FT_MAKE_TAG( 's', 'y', 'm', 'b' ),
332     ft_encoding_unicode = FT_MAKE_TAG( 'u', 'n', 'i', 'c' ),
333     ft_encoding_latin_2 = FT_MAKE_TAG( 'l', 'a', 't', '2' ),
334     ft_encoding_sjis    = FT_MAKE_TAG( 's', 'j', 'i', 's' ),
335     ft_encoding_gb2312  = FT_MAKE_TAG( 'g', 'b', ' ', ' ' ),
336     ft_encoding_big5    = FT_MAKE_TAG( 'b', 'i', 'g', '5' ),
337     ft_encoding_wansung = FT_MAKE_TAG( 'w', 'a', 'n', 's' ),
338     ft_encoding_johab   = FT_MAKE_TAG( 'j', 'o', 'h', 'a' ),
339
340     ft_encoding_adobe_standard = FT_MAKE_TAG( 'A', 'D', 'O', 'B' ),
341     ft_encoding_adobe_expert   = FT_MAKE_TAG( 'A', 'D', 'B', 'E' ),
342     ft_encoding_adobe_custom   = FT_MAKE_TAG( 'A', 'D', 'B', 'C' ),
343
344     ft_encoding_apple_roman    = FT_MAKE_TAG( 'a', 'r', 'm', 'n' )
345
346     /* other encodings might be defined in the future */
347
348   } FT_Encoding;
349
350
351   /*************************************************************************/
352   /*                                                                       */
353   /* <Struct>                                                              */
354   /*    FT_CharMapRec                                                      */
355   /*                                                                       */
356   /* <Description>                                                         */
357   /*    The base charmap class.                                            */
358   /*                                                                       */
359   /* <Fields>                                                              */
360   /*    face        :: A handle to the parent face object.                 */
361   /*                                                                       */
362   /*    flags       :: A set of bit flags used to describe the charmap.    */
363   /*                   Each bit indicates that a given encoding is         */
364   /*                   supported.                                          */
365   /*                                                                       */
366   /*    platform_id :: An ID number describing the platform for the        */
367   /*                   following encoding ID.  This comes directly from    */
368   /*                   the TrueType specification and should be emulated   */
369   /*                   for other formats.                                  */
370   /*                                                                       */
371   /*    encoding_id :: A platform specific encoding number.  This also     */
372   /*                   comes from the TrueType specification and should be */
373   /*                   emulated similarly.                                 */
374   /*                                                                       */
375   /* <Note>                                                                */
376   /*    We STRONGLY recommmend emulating a Unicode charmap for drivers     */
377   /*    that do not support TrueType or OpenType.                          */
378   /*                                                                       */
379   typedef struct  FT_CharMapRec_
380   {
381     FT_Face      face;
382     FT_Encoding  encoding;
383     FT_UShort    platform_id;
384     FT_UShort    encoding_id;
385
386   } FT_CharMapRec;
387
388
389   /*************************************************************************/
390   /*************************************************************************/
391   /*                                                                       */
392   /*                 B A S E   O B J E C T   C L A S S E S                 */
393   /*                                                                       */
394   /*************************************************************************/
395   /*************************************************************************/
396
397   /*************************************************************************/
398   /*                                                                       */
399   /*                       FreeType base face class                        */
400   /*                                                                       */
401   /* <Struct>                                                              */
402   /*    FT_FaceRec                                                         */
403   /*                                                                       */
404   /* <Description>                                                         */
405   /*    FreeType root face class structure.  A face object models the      */
406   /*    resolution and point-size independent data found in a font file.   */
407   /*                                                                       */
408   /* <Fields>                                                              */
409   /*    num_faces           :: In the case where the face is located in a  */
410   /*                           collection (i.e., a resource which embeds   */
411   /*                           several faces), this is the total number of */
412   /*                           faces found in the resource.  1 by default. */
413   /*                                                                       */
414   /*    face_index          :: The index of the face in its resource.      */
415   /*                           Usually, this is 0 for all normal font      */
416   /*                           formats.  It can be more in the case of     */
417   /*                           collections (which embed several fonts in a */
418   /*                           single resource/file).                      */
419   /*                                                                       */
420   /*    face_flags          :: A set of bit flags that give important      */
421   /*                           information about the face; see the         */
422   /*                           FT_FACE_FLAG_XXX macros for details.        */
423   /*                                                                       */
424   /*    style_flags         :: A set of bit flags indicating the style of  */
425   /*                           the face (i.e., italic, bold, underline,    */
426   /*                           etc).                                       */
427   /*                                                                       */
428   /*    num_glyphs          :: The total number of glyphs in the face.     */
429   /*                                                                       */
430   /*    family_name         :: The face's family name.  This is an ASCII   */
431   /*                           string, usually in English, which describes */
432   /*                           the typeface's family (like `Times New      */
433   /*                           Roman', `Bodoni', `Garamond', etc).  This   */
434   /*                           is a least common denominator used to list  */
435   /*                           fonts.  Some formats (TrueType & OpenType)  */
436   /*                           provide localized and Unicode versions of   */
437   /*                           this string.  Applications should use the   */
438   /*                           format specific interface to access them.   */
439   /*                                                                       */
440   /*    style_name          :: The face's style name.  This is an ASCII    */
441   /*                           string, usually in English, which describes */
442   /*                           the typeface's style (like `Italic',        */
443   /*                           `Bold', `Condensed', etc).  Not all font    */
444   /*                           formats provide a style name, so this field */
445   /*                           is optional, and can be set to NULL.  As    */
446   /*                           for `family_name', some formats provide     */
447   /*                           localized/Unicode versions of this string.  */
448   /*                           Applications should use the format specific */
449   /*                           interface to access them.                   */
450   /*                                                                       */
451   /*    num_fixed_sizes     :: The number of fixed sizes available in this */
452   /*                           face.  This should be set to 0 for scalable */
453   /*                           fonts, unless its resource includes a       */
454   /*                           complete set of glyphs (called a `strike')  */
455   /*                           for the specified size.                     */
456   /*                                                                       */
457   /*    available_sizes     :: An array of sizes specifying the available  */
458   /*                           bitmap/graymap sizes that are contained in  */
459   /*                           in the font resource.  Should be set to     */
460   /*                           NULL if the field `num_fixed_sizes' is set  */
461   /*                           to 0.                                       */
462   /*                                                                       */
463   /*    num_charmaps        :: The total number of character maps in the   */
464   /*                           face.                                       */
465   /*                                                                       */
466   /*    charmaps            :: A table of pointers to the face's charmaps  */
467   /*                           Used to scan the list of available charmaps */
468   /*                           this table might change after a call to     */
469   /*                           FT_Attach_File/Stream (e.g. when it used    */
470   /*                           to hook and additional encoding/CMap to     */
471   /*                           the face object).                           */
472   /*                                                                       */
473   /*    generic             :: A field reserved for client uses.  See the  */
474   /*                           FT_Generic type description.                */
475   /*                                                                       */
476   /*    bbox                :: The font bounding box.  Coordinates are     */
477   /*                           expressed in font units (see units_per_EM). */
478   /*                           The box is large enough to contain any      */
479   /*                           glyph from the font.  Thus, bbox.yMax can   */
480   /*                           be seen as the `maximal ascender',          */
481   /*                           bbox.yMin as the `minimal descender', and   */
482   /*                           the maximal glyph width is given by         */
483   /*                           `bbox.xMax-bbox.xMin' (not to be confused   */
484   /*                           with the maximal _advance_width_).  Only    */
485   /*                           relevant for scalable formats.              */
486   /*                                                                       */
487   /*    units_per_EM        :: The number of font units per EM square for  */
488   /*                           this face.  This is typically 2048 for      */
489   /*                           TrueType fonts, 1000 for Type1 fonts, and   */
490   /*                           should be set to the (unrealistic) value 1  */
491   /*                           for fixed-sizes fonts.  Only relevant for   */
492   /*                           scalable formats.                           */
493   /*                                                                       */
494   /*    ascender            :: The face's ascender is the vertical         */
495   /*                           distance from the baseline to the topmost   */
496   /*                           point of any glyph in the face.  This       */
497   /*                           field's value is positive, expressed in     */
498   /*                           font units.  Some font designs use a value  */
499   /*                           different from `bbox.yMax'.  Only relevant  */
500   /*                           for scalable formats.                       */
501   /*                                                                       */
502   /*    descender           :: The face's descender is the vertical        */
503   /*                           distance from the baseline to the           */
504   /*                           bottommost point of any glyph in the face.  */
505   /*                           This field's value is positive, expressed   */
506   /*                           in font units.  Some font designs use a     */
507   /*                           value different from `-bbox.yMin'.  Only    */
508   /*                           relevant for scalable formats.              */
509   /*                                                                       */
510   /*    height              :: The face's height is the vertical distance  */
511   /*                           from one baseline to the next when writing  */
512   /*                           several lines of text.  Its value is always */
513   /*                           positive, expressed in font units.  The     */
514   /*                           value can be computed as                    */
515   /*                           `ascender+descender+line_gap' where the     */
516   /*                           value of `line_gap' is also called          */
517   /*                           `external leading'.  Only relevant for      */
518   /*                           scalable formats.                           */
519   /*                                                                       */
520   /*    max_advance_width   :: The maximal advance width, in font units,   */
521   /*                           for all glyphs in this face.  This can be   */
522   /*                           used to make word wrapping computations     */
523   /*                           faster.  Only relevant for scalable         */
524   /*                           formats.                                    */
525   /*                                                                       */
526   /*    max_advance_height  :: The maximal advance height, in font units,  */
527   /*                           for all glyphs in this face.  This is only  */
528   /*                           relevant for vertical layouts, and should   */
529   /*                           be set to the `height' for fonts that do    */
530   /*                           not provide vertical metrics.  Only         */
531   /*                           relevant for scalable formats.              */
532   /*                                                                       */
533   /*    underline_position  :: The position, in font units, of the         */
534   /*                           underline line for this face.  It's the     */
535   /*                           center of the underlining stem.  Only       */
536   /*                           relevant for scalable formats.              */
537   /*                                                                       */
538   /*    underline_thickness :: The thickness, in font units, of the        */
539   /*                           underline for this face.  Only relevant for */
540   /*                           scalable formats.                           */
541   /*                                                                       */
542   /*    driver              :: A handle to the face's parent driver        */
543   /*                           object.                                     */
544   /*                                                                       */
545   /*    memory              :: A handle to the face's parent memory        */
546   /*                           object.  Used for the allocation of         */
547   /*                           subsequent objects.                         */
548   /*                                                                       */
549   /*    stream              :: A handle to the face's stream.              */
550   /*                                                                       */
551   /*    glyph               :: The face's associated glyph slot(s).  This  */
552   /*                           object is created automatically with a new  */
553   /*                           face object.  However, certain kinds of     */
554   /*                           applications (mainly tools like converters) */
555   /*                           can need more than one slot to ease their   */
556   /*                           task.                                       */
557   /*                                                                       */
558   /*    sizes_list          :: The list of child sizes for this face.      */
559   /*                                                                       */
560   /*    max_points          :: The maximal number of points used to store  */
561   /*                           the vectorial outline of any glyph in this  */
562   /*                           face.  If this value cannot be known in     */
563   /*                           advance, or if the face isn't scalable,     */
564   /*                           this should be set to 0.  Only relevant for */
565   /*                           scalable formats.                           */
566   /*                                                                       */
567   /*    max_contours        :: The maximal number of contours used to      */
568   /*                           store the vectorial outline of any glyph in */
569   /*                           this face.  If this value cannot be known   */
570   /*                           in advance, or if the face isn't scalable,  */
571   /*                           this should be set to 0.  Only relevant for */
572   /*                           scalable formats.                           */
573   /*                                                                       */
574   /*    transform_matrix    :: A 2x2 matrix of 16.16 coefficients used     */
575   /*                           to transform glyph outlines after they are  */
576   /*                           loaded from the font.  Only used by the     */
577   /*                           convenience functions.                      */
578   /*                                                                       */
579   /*    transform_delta     :: A translation vector used to transform      */
580   /*                           glyph outlines after they are loaded from   */
581   /*                           the font.  Only used by the convenience     */
582   /*                           functions.                                  */
583   /*                                                                       */
584   /*    transform_flags     :: Some flags used to classify the transform.  */
585   /*                           Only used by the convenience functions.     */
586   /*                                                                       */
587   typedef struct  FT_FaceRec_
588   {
589     FT_Long          num_faces;
590     FT_Long          face_index;
591
592     FT_Long          face_flags;
593     FT_Long          style_flags;
594
595     FT_Long          num_glyphs;
596
597     FT_String*       family_name;
598     FT_String*       style_name;
599
600     FT_Int           num_fixed_sizes;
601     FT_Bitmap_Size*  available_sizes;
602
603     /* the face's table of available charmaps */
604     FT_Int           num_charmaps;
605     FT_CharMap*      charmaps;
606
607     FT_Generic       generic;
608
609     /* the following are only relevant for scalable outlines */
610     FT_BBox          bbox;
611
612     FT_UShort        units_per_EM;
613     FT_Short         ascender;
614     FT_Short         descender;
615     FT_Short         height;
616
617     FT_Short         max_advance_width;
618     FT_Short         max_advance_height;
619
620     FT_Short         underline_position;
621     FT_Short         underline_thickness;
622
623     FT_GlyphSlot     glyph;
624     FT_Size          size;
625
626     /************************************************************/
627     /* The following fields should be considered private and    */
628     /* rarely, if ever, used directly by client applications.   */
629
630     FT_Driver        driver;
631     FT_Memory        memory;
632     FT_Stream        stream;
633
634     FT_CharMap       charmap;
635     FT_ListRec       sizes_list;
636
637     FT_Generic       autohint;
638     void*            extensions;
639
640     FT_UShort        max_points;
641     FT_Short         max_contours;
642
643     FT_Matrix        transform_matrix;
644     FT_Vector        transform_delta;
645     FT_Int           transform_flags;
646
647   } FT_FaceRec;
648
649
650   /*************************************************************************/
651   /*                                                                       */
652   /* <Constant>                                                            */
653   /*    FT_FACE_FLAG_SCALABLE                                              */
654   /*                                                                       */
655   /* <Description>                                                         */
656   /*    A bit-field constant, used to indicate that a given face provides  */
657   /*    vectorial outlines (i.e., TrueType or Type1).  This doesn't        */
658   /*    prevent embedding of bitmap strikes though, i.e., a given face can */
659   /*    have both this bit set, and a `num_fixed_sizes' property > 0.      */
660   /*                                                                       */
661 #define FT_FACE_FLAG_SCALABLE  1
662
663
664   /*************************************************************************/
665   /*                                                                       */
666   /* <Constant>                                                            */
667   /*    FT_FACE_FLAG_FIXED_SIZES                                           */
668   /*                                                                       */
669   /* <Description>                                                         */
670   /*    A bit-field constant, used to indicate that a given face contains  */
671   /*    `fixed sizes', i.e., bitmap strikes for some given pixel sizes.    */
672   /*    See the `num_fixed_sizes' and `available_sizes' face properties    */
673   /*    for more information.                                              */
674   /*                                                                       */
675 #define FT_FACE_FLAG_FIXED_SIZES  2
676
677
678   /*************************************************************************/
679   /*                                                                       */
680   /* <Constant>                                                            */
681   /*    FT_FACE_FLAG_FIXED_WIDTH                                           */
682   /*                                                                       */
683   /* <Description>                                                         */
684   /*    A bit-field constant, used to indicate that a given face contains  */
685   /*    fixed-width characters (like Courier, Lucida, MonoType, etc.).     */
686   /*                                                                       */
687 #define FT_FACE_FLAG_FIXED_WIDTH  4
688
689
690   /*************************************************************************/
691   /*                                                                       */
692   /* <Constant>                                                            */
693   /*    FT_FACE_FLAG_SFNT                                                  */
694   /*                                                                       */
695   /* <Description>                                                         */
696   /*    A bit-field constant, used to indicate that a given face uses the  */
697   /*    `sfnt' storage fomat.  For now, this means TrueType or OpenType.   */
698   /*                                                                       */
699 #define FT_FACE_FLAG_SFNT  8
700
701
702   /*************************************************************************/
703   /*                                                                       */
704   /* <Constant>                                                            */
705   /*    FT_FACE_FLAG_HORIZONTAL                                            */
706   /*                                                                       */
707   /* <Description>                                                         */
708   /*    A bit-field constant, used to indicate that a given face contains  */
709   /*    horizontal glyph metrics.  This should be set for all common       */
710   /*    formats, but who knows.                                            */
711   /*                                                                       */
712 #define FT_FACE_FLAG_HORIZONTAL  0x10
713
714
715   /*************************************************************************/
716   /*                                                                       */
717   /* <Constant>                                                            */
718   /*    FT_FACE_FLAG_VERTICAL                                              */
719   /*                                                                       */
720   /* <Description>                                                         */
721   /*    A bit-field constant, used to indicate that a given face contains  */
722   /*    vertical glyph metrics.  If not set, the glyph loader will         */
723   /*    synthetize vertical metrics itself to help display vertical text   */
724   /*    correctly.                                                         */
725   /*                                                                       */
726 #define FT_FACE_FLAG_VERTICAL  0x20
727
728
729   /*************************************************************************/
730   /*                                                                       */
731   /* <Constant>                                                            */
732   /*    FT_FACE_FLAG_KERNING                                               */
733   /*                                                                       */
734   /* <Description>                                                         */
735   /*    A bit-field constant, used to indicate that a given face contains  */
736   /*    kerning information.  When set, this information can be retrieved  */
737   /*    through the function FT_Get_Kerning().  Note that when unset, this */
738   /*    function will always return the kerning vector (0,0).              */
739   /*                                                                       */
740 #define FT_FACE_FLAG_KERNING  0x40
741
742
743   /*************************************************************************/
744   /*                                                                       */
745   /* <Constant>                                                            */
746   /*    FT_FACE_FLAG_FAST_GLYPHS                                           */
747   /*                                                                       */
748   /* <Description>                                                         */
749   /*    A bit-field constant, used to indicate that the glyphs in a given  */
750   /*    font can be retrieved very quickly, and that a glyph cache is thus */
751   /*    not necessary for any of its child size objects.                   */
752   /*                                                                       */
753   /*    This flag should really be set for fixed-size formats like FNT,    */
754   /*    where each glyph bitmap is available directly in binary form       */
755   /*    without any kind of compression.                                   */
756   /*                                                                       */
757 #define FT_FACE_FLAG_FAST_GLYPHS  0x80
758
759
760   /*************************************************************************/
761   /*                                                                       */
762   /* <Constant>                                                            */
763   /*    FT_FACE_FLAG_MULTIPLE_MASTERS                                      */
764   /*                                                                       */
765   /* <Description>                                                         */
766   /*    A bit-field constant, used to indicate that the font contains      */
767   /*    multiple masters and is capable of interpolating between them.     */
768   /*                                                                       */
769 #define FT_FACE_FLAG_MULTIPLE_MASTERS  0x100
770
771
772   /*************************************************************************/
773   /*                                                                       */
774   /* <Constant>                                                            */
775   /*    FT_FACE_FLAG_GLYPH_NAMES                                           */
776   /*                                                                       */
777   /* <Description>                                                         */
778   /*    A bit-field constant, used to indicate that the font contains      */
779   /*    glyph names that can be retrieved through FT_Get_Glyph_Name().     */
780   /*                                                                       */
781 #define FT_FACE_FLAG_GLYPH_NAMES       0x200
782
783
784   /*************************************************************************/
785   /*                                                                       */
786   /* <Constant>                                                            */
787   /*    FT_FACE_FLAG_EXTERNAL_STREAM                                       */
788   /*                                                                       */
789   /* <Description>                                                         */
790   /*    This bit field is used internally by FreeType to indicate that     */
791   /*    a face's stream was provided by the client application and should  */
792   /*    not be destroyed by FT_Done_Face().                                */
793   /*                                                                       */
794 #define FT_FACE_FLAG_EXTERNAL_STREAM   0x4000
795
796
797 #define FT_HAS_HORIZONTAL( face ) \
798           ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
799 #define FT_HAS_VERTICAL( face ) \
800           ( face->face_flags & FT_FACE_FLAG_VERTICAL )
801 #define FT_HAS_KERNING( face ) \
802           ( face->face_flags & FT_FACE_FLAG_KERNING )
803 #define FT_IS_SCALABLE( face ) \
804           ( face->face_flags & FT_FACE_FLAG_SCALABLE )
805 #define FT_IS_SFNT( face ) \
806           ( face->face_flags & FT_FACE_FLAG_SFNT )
807 #define FT_IS_FIXED_WIDTH( face ) \
808           ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
809 #define FT_HAS_FIXED_SIZES( face ) \
810           ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
811 #define FT_HAS_FAST_GLYPHS( face ) \
812           ( face->face_flags & FT_FACE_FLAG_FAST_GLYPHS )
813 #define FT_HAS_GLYPH_NAMES( face ) \
814           ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
815
816 #define FT_HAS_MULTIPLE_MASTERS( face ) \
817           ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
818
819
820   /*************************************************************************/
821   /*                                                                       */
822   /* <Constant>                                                            */
823   /*    FT_STYLE_FLAG_ITALIC                                               */
824   /*                                                                       */
825   /* <Description>                                                         */
826   /*    A bit-field constant, used to indicate that a given face is        */
827   /*    italicized.                                                        */
828   /*                                                                       */
829 #define FT_STYLE_FLAG_ITALIC  1
830
831
832   /*************************************************************************/
833   /*                                                                       */
834   /* <Constant>                                                            */
835   /*    FT_STYLE_FLAG_BOLD                                                 */
836   /*                                                                       */
837   /* <Description>                                                         */
838   /*    A bit-field constant, used to indicate that a given face is        */
839   /*    emboldened.                                                        */
840   /*                                                                       */
841 #define FT_STYLE_FLAG_BOLD  2
842
843
844   /*************************************************************************/
845   /*                                                                       */
846   /*                    FreeType base size metrics                         */
847   /*                                                                       */
848   /* <Struct>                                                              */
849   /*    FT_Size_Metrics                                                    */
850   /*                                                                       */
851   /* <Description>                                                         */
852   /*    The size metrics structure returned scaled important distances for */
853   /*    a given size object.                                               */
854   /*                                                                       */
855   /* <Fields>                                                              */
856   /*    x_ppem       :: The character width, expressed in integer pixels.  */
857   /*                    This is the width of the EM square expressed in    */
858   /*                    pixels, hence the term `ppem' (pixels per EM).     */
859   /*                                                                       */
860   /*    y_ppem       :: The character height, expressed in integer pixels. */
861   /*                    This is the height of the EM square expressed in   */
862   /*                    pixels, hence the term `ppem' (pixels per EM).     */
863   /*                                                                       */
864   /*    x_scale      :: A simple 16.16 fixed point format coefficient used */
865   /*                    to scale horizontal distances expressed in font    */
866   /*                    units to fractional (26.6) pixel coordinates.      */
867   /*                                                                       */
868   /*    y_scale      :: A simple 16.16 fixed point format coefficient used */
869   /*                    to scale vertical distances expressed in font      */
870   /*                    units to fractional (26.6) pixel coordinates.      */
871   /*                                                                       */
872   /*    x_resolution :: The horizontal device resolution for this size     */
873   /*                    object, expressed in integer dots per inches       */
874   /*                    (dpi).  As a convention, fixed font formats set    */
875   /*                    this value to 72.                                  */
876   /*                                                                       */
877   /*    y_resolution :: The vertical device resolution for this size       */
878   /*                    object, expressed in integer dots per inches       */
879   /*                    (dpi).  As a convention, fixed font formats set    */
880   /*                    this value to 72.                                  */
881   /*                                                                       */
882   /*    ascender     :: The ascender, expressed in 26.6 fixed point        */
883   /*                    pixels.  Always positive.                          */
884   /*                                                                       */
885   /*    descender    :: The descender, expressed in 26.6 fixed point       */
886   /*                    pixels.  Always positive.                          */
887   /*                                                                       */
888   /*    height       :: The text height, expressed in 26.6 fixed point     */
889   /*                    pixels.  Always positive.                          */
890   /*                                                                       */
891   /*    max_advance  :: Maximum horizontal advance, expressed in 26.6      */
892   /*                    fixed point pixels.  Always positive.              */
893   /*                                                                       */
894   /* <Note>                                                                */
895   /*    The values of `ascender', `descender', and `height' are only the   */
896   /*    scaled versions of `face->ascender', `face->descender', and        */
897   /*    `face->height'.                                                    */
898   /*                                                                       */
899   /*    Unfortunately, due to glyph hinting, these values might not be     */
900   /*    exact for certain fonts, they thus must be treated as unreliable   */
901   /*    with an error margin of at least one pixel!                        */
902   /*                                                                       */
903   /*    Indeed, the only way to get the exact pixel ascender and descender */
904   /*    is to render _all_ glyphs.  As this would be a definite            */
905   /*    performance hit, it is up to client applications to perform such   */
906   /*    computations.                                                      */
907   /*                                                                       */
908   typedef struct  FT_Size_Metrics_
909   {
910     FT_UShort   x_ppem;        /* horizontal pixels per EM               */
911     FT_UShort   y_ppem;        /* vertical pixels per EM                 */
912
913     FT_Fixed    x_scale;       /* two scales used to convert font units  */
914     FT_Fixed    y_scale;       /* to 26.6 frac. pixel coordinates..      */
915
916     FT_Pos      ascender;      /* ascender in 26.6 frac. pixels          */
917     FT_Pos      descender;     /* descender in 26.6 frac. pixels         */
918     FT_Pos      height;        /* text height in 26.6 frac. pixels       */
919     FT_Pos      max_advance;   /* max horizontal advance, in 26.6 pixels */
920
921   } FT_Size_Metrics;
922
923
924   /*************************************************************************/
925   /*                                                                       */
926   /*                       FreeType base size class                        */
927   /*                                                                       */
928   /* <Struct>                                                              */
929   /*    FT_SizeRec                                                         */
930   /*                                                                       */
931   /* <Description>                                                         */
932   /*    FreeType root size class structure.  A size object models the      */
933   /*    resolution and pointsize dependent data of a given face.           */
934   /*                                                                       */
935   /* <Fields>                                                              */
936   /*    face    :: Handle to the parent face object.                       */
937   /*                                                                       */
938   /*    generic :: A typeless pointer, which is unused by the FreeType     */
939   /*               library or any of its drivers.  It can be used by       */
940   /*               client applications to link their own data to each size */
941   /*               object.                                                 */
942   /*                                                                       */
943   /*    metrics :: Metrics for this size object.  This field is read-only. */
944   /*                                                                       */
945   typedef struct  FT_SizeRec_
946   {
947     FT_Face          face;      /* parent face object              */
948     FT_Generic       generic;   /* generic pointer for client uses */
949     FT_Size_Metrics  metrics;   /* size metrics                    */
950
951   } FT_SizeRec;
952
953
954   /*************************************************************************/
955   /*                                                                       */
956   /* <Struct>                                                              */
957   /*    FT_SubGlyph                                                        */
958   /*                                                                       */
959   /* <Description>                                                         */
960   /*    The subglyph structure is an internal object used to describe      */
961   /*    subglyphs (for example, in the case of composites).                */
962   /*                                                                       */
963   /* <Note>                                                                */
964   /*    The subglyph implementation is not part of the high-level API,     */
965   /*    hence the forward structure declaration.                           */
966   /*                                                                       */
967   typedef struct FT_SubGlyph_  FT_SubGlyph;
968
969
970   /*************************************************************************/
971   /*                                                                       */
972   /* <Struct>                                                              */
973   /*    FT_GlyphLoader                                                     */
974   /*                                                                       */
975   /* <Description>                                                         */
976   /*    The glyph loader is an internal object used to load several glyphs */
977   /*    together (for example, in the case of composites).                 */
978   /*                                                                       */
979   /* <Note>                                                                */
980   /*    The glyph loader implementation is not part of the high-level API, */
981   /*    hence the forward structure declaration.                           */
982   /*                                                                       */
983   typedef struct FT_GlyphLoader_  FT_GlyphLoader;
984
985
986   /*************************************************************************/
987   /*                                                                       */
988   /*                  FreeType Glyph Slot base class                       */
989   /*                                                                       */
990   /* <Struct>                                                              */
991   /*    FT_GlyphSlotRec                                                    */
992   /*                                                                       */
993   /* <Description>                                                         */
994   /*    FreeType root glyph slot class structure.  A glyph slot is a       */
995   /*    container where individual glyphs can be loaded, be they           */
996   /*    vectorial or bitmap/graymaps.                                      */
997   /*                                                                       */
998   /* <Fields>                                                              */
999   /*    library           :: A handle to the FreeType library instance     */
1000   /*                         this slot belongs to.                         */
1001   /*                                                                       */
1002   /*    face              :: A handle to the parent face object.           */
1003   /*                                                                       */
1004   /*    next              :: In some cases (like some font tools), several */
1005   /*                         glyph slots per face object can be a good     */
1006   /*                         thing.  As this is rare, the glyph slots are  */
1007   /*                         listed through a direct, single-linked list   */
1008   /*                         using its `next' field.                       */
1009   /*                                                                       */
1010   /*    generic           :: A typeless pointer which is unused by the     */
1011   /*                         FreeType library or any of its drivers.  It   */
1012   /*                         can be used by client applications to link    */
1013   /*                         their own data to each size object.           */
1014   /*                                                                       */
1015   /*    metrics           :: The metrics of the last loaded glyph in the   */
1016   /*                         slot.  The returned values depend on the last */
1017   /*                         load flags (see the FT_Load_Glyph() API       */
1018   /*                         function) and can be expressed either in 26.6 */
1019   /*                         fractional pixels or font units.              */
1020   /*                                                                       */
1021   /*                         Note that even when the glyph image is        */
1022   /*                         transformed, the metrics are not.             */
1023   /*                                                                       */
1024   /*    linearHoriAdvance :: For scalable formats only, this field holds   */
1025   /*                         the linearly scaled horizontal advance width  */
1026   /*                         for the glyph (i.e. the scaled and unhinted   */
1027   /*                         value of the hori advance). This can be       */
1028   /*                         important to perform correct WYSIWYG layout   */
1029   /*                                                                       */
1030   /*                         Note that this value is expressed by default  */
1031   /*                         in 16.16 pixels. However, when the glyph is   */
1032   /*                         loaded with the FT_LOAD_UNSCALED_LINEAR flag, */
1033   /*                         this field contains simply the value of the   */
1034   /*                         advance in original font units.               */
1035   /*                                                                       */
1036   /*    linearVertAdvance :: For scalable formats only, this field holds   */
1037   /*                         the linearly scaled vertical advance height   */
1038   /*                         for the glyph.  See linearHoriAdvance for     */
1039   /*                         comments.                                     */
1040   /*                                                                       */
1041   /*    advance           :: This is the transformed advance width for the */
1042   /*                         glyph.                                        */
1043   /*                                                                       */
1044   /*    format            :: This field indicates the format of the image  */
1045   /*                         contained in the glyph slot.  Typically       */
1046   /*                         ft_glyph_format_bitmap,                       */
1047   /*                         ft_glyph_format_outline, and                  */
1048   /*                         ft_glyph_format_composite, but others are     */
1049   /*                         possible.                                     */
1050   /*                                                                       */
1051   /*    bitmap            :: This field is used as a bitmap descriptor     */
1052   /*                         when the slot format is                       */
1053   /*                         ft_glyph_format_bitmap.  Note that the        */
1054   /*                         address and content of the bitmap buffer can  */
1055   /*                         change between calls of FT_Load_Glyph() and a */
1056   /*                         few other functions.                          */
1057   /*                                                                       */
1058   /*    bitmap_left       :: This is the bitmap's left bearing expressed   */
1059   /*                         in integer pixels.  Of course, this is only   */
1060   /*                         valid if the format is                        */
1061   /*                         ft_glyph_format_bitmap.                       */
1062   /*                                                                       */
1063   /*    bitmap_top        :: This is the bitmap's top bearing expressed in */
1064   /*                         integer pixels.  Remember that this is the    */
1065   /*                         distance from the baseline to the top-most    */
1066   /*                         glyph scanline, upwards y-coordinates being   */
1067   /*                         *positive*.                                   */
1068   /*                                                                       */
1069   /*    outline           :: The outline descriptor for the current glyph  */
1070   /*                         image if its format is                        */
1071   /*                         ft_glyph_bitmap_outline.                      */
1072   /*                                                                       */
1073   /*    num_subglyphs     :: The number of subglyphs in a composite glyph. */
1074   /*                         This format is only valid for the composite   */
1075   /*                         glyph format, that should normally only be    */
1076   /*                         loaded with the FT_LOAD_NO_RECURSE flag.      */
1077   /*                                                                       */
1078   /*    subglyphs         :: An array of subglyph descriptors for          */
1079   /*                         composite glyphs.  There are `num_subglyphs'  */
1080   /*                         elements in there.                            */
1081   /*                                                                       */
1082   /*    control_data      :: Certain font drivers can also return the      */
1083   /*                         control data for a given glyph image (e.g.    */
1084   /*                         TrueType bytecode, Type 1 charstrings, etc.). */
1085   /*                         This field is a pointer to such data.         */
1086   /*                                                                       */
1087   /*    control_len       :: This is the length in bytes of the control    */
1088   /*                         data.                                         */
1089   /*                                                                       */
1090   /*    other             :: Really wicked formats can use this pointer to */
1091   /*                         present their own glyph image to client apps. */
1092   /*                         Note that the app will need to know about the */
1093   /*                         image format.                                 */
1094   /*                                                                       */
1095   /*    loader            :: This is a private object for the glyph slot.  */
1096   /*                         Do not touch this.                            */
1097   /*                                                                       */
1098   /* <Note>                                                                */
1099   /*    If FT_Load_Glyph() is called with default flags (FT_LOAD_DEFAULT), */
1100   /*    the glyph image is loaded in the glyph slot in its native format   */
1101   /*    (e.g. a vectorial outline for TrueType and Type 1 formats).        */
1102   /*                                                                       */
1103   /*    This image can later be converted into a bitmap by calling         */
1104   /*    FT_Render_Glyph().  This function finds the current renderer for   */
1105   /*    the native image's format then invokes it.                         */
1106   /*                                                                       */
1107   /*    The renderer is in charge of transforming the native image through */
1108   /*    the slot's face transformation fields, then convert it into a      */
1109   /*    bitmap that is returned in `slot->bitmap'.                         */
1110   /*                                                                       */
1111   /*    Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
1112   /*    to specify the position of the bitmap relative to the current pen  */
1113   /*    position (e.g. coordinates [0,0] on the baseline).  Of course,     */
1114   /*    `slot->format' is also changed to `ft_glyph_format_bitmap' .       */
1115   /*                                                                       */
1116   typedef struct  FT_GlyphSlotRec_
1117   {
1118     FT_Library        library;
1119     FT_Face           face;
1120     FT_GlyphSlot      next;
1121     FT_UInt           flags;
1122     FT_Generic        generic;
1123
1124     FT_Glyph_Metrics  metrics;
1125     FT_Fixed          linearHoriAdvance;
1126     FT_Fixed          linearVertAdvance;
1127     FT_Vector         advance;
1128
1129     FT_Glyph_Format   format;
1130
1131     FT_Bitmap         bitmap;
1132     FT_Int            bitmap_left;
1133     FT_Int            bitmap_top;
1134
1135     FT_Outline        outline;
1136
1137     FT_UInt           num_subglyphs;
1138     FT_SubGlyph*      subglyphs;
1139
1140     void*             control_data;
1141     long              control_len;
1142
1143     void*             other;
1144
1145     /* private fields */
1146     FT_GlyphLoader*   loader;
1147
1148   } FT_GlyphSlotRec;
1149
1150
1151   /*************************************************************************/
1152   /*************************************************************************/
1153   /*                                                                       */
1154   /*                         F U N C T I O N S                             */
1155   /*                                                                       */
1156   /*************************************************************************/
1157   /*************************************************************************/
1158
1159
1160   /*************************************************************************/
1161   /*                                                                       */
1162   /* <Function>                                                            */
1163   /*    FT_Init_FreeType                                                   */
1164   /*                                                                       */
1165   /* <Description>                                                         */
1166   /*    Initializes a new FreeType library object.  The set of drivers     */
1167   /*    that are registered by this function is determined at build time.  */
1168   /*                                                                       */
1169   /* <Output>                                                              */
1170   /*    library :: A handle to a new library object.                       */
1171   /*                                                                       */
1172   /* <Return>                                                              */
1173   /*    FreeType error code.  0 means success.                             */
1174   /*                                                                       */
1175   FT_EXPORT_DEF( FT_Error )  FT_Init_FreeType( FT_Library*  library );
1176
1177
1178   /*************************************************************************/
1179   /*                                                                       */
1180   /* <Function>                                                            */
1181   /*    FT_Done_FreeType                                                   */
1182   /*                                                                       */
1183   /* <Description>                                                         */
1184   /*    Destroys a given FreeType library object and all of its childs,    */
1185   /*    including resources, drivers, faces, sizes, etc.                   */
1186   /*                                                                       */
1187   /* <Input>                                                               */
1188   /*    library :: A handle to the target library object.                  */
1189   /*                                                                       */
1190   /* <Return>                                                              */
1191   /*    FreeType error code.  0 means success.                             */
1192   /*                                                                       */
1193   FT_EXPORT_DEF( FT_Error )  FT_Done_FreeType( FT_Library  library );
1194
1195
1196   /*************************************************************************/
1197   /*                                                                       */
1198   /* <Enum>                                                                */
1199   /*    FT_Open_Flags                                                      */
1200   /*                                                                       */
1201   /* <Description>                                                         */
1202   /*    An enumeration used to list the bit flags used within              */
1203   /*    FT_Open_Args().                                                    */
1204   /*                                                                       */
1205   /* <Fields>                                                              */
1206   /*    ft_open_memory   :: This is a memory-based stream.                 */
1207   /*                                                                       */
1208   /*    ft_open_stream   :: Copy the stream from the `stream' field.       */
1209   /*                                                                       */
1210   /*    ft_open_pathname :: Create a new input stream from a C pathname.   */
1211   /*                                                                       */
1212   /*    ft_open_driver   :: Use the `driver' field.                        */
1213   /*                                                                       */
1214   /*    ft_open_params   :: Use the `num_params' & `params' field.         */
1215   /*                                                                       */
1216   typedef enum
1217   {
1218     ft_open_memory   = 1,
1219     ft_open_stream   = 2,
1220     ft_open_pathname = 4,
1221     ft_open_driver   = 8,
1222     ft_open_params   = 16
1223
1224   } FT_Open_Flags;
1225
1226
1227   /*************************************************************************/
1228   /*                                                                       */
1229   /* <Struct>                                                              */
1230   /*    FT_Parameter                                                       */
1231   /*                                                                       */
1232   /* <Description>                                                         */
1233   /*    A simple structure used to pass more or less generic parameters    */
1234   /*    to FT_Open_Face().                                                 */
1235   /*                                                                       */
1236   /* <Fields>                                                              */
1237   /*    tag  :: A 4-byte identification tag.                               */
1238   /*                                                                       */
1239   /*    data :: A pointer to the parameter data.                           */
1240   /*                                                                       */
1241   /* <Note>                                                                */
1242   /*    The id and function of parameters are driver-specific.             */
1243   /*                                                                       */
1244   typedef struct  FT_Parameter_
1245   {
1246     FT_ULong    tag;
1247     FT_Pointer  data;
1248
1249   } FT_Parameter;
1250
1251
1252   /*************************************************************************/
1253   /*                                                                       */
1254   /* <Struct>                                                              */
1255   /*    FT_Open_Args                                                       */
1256   /*                                                                       */
1257   /* <Description>                                                         */
1258   /*    A structure used to indicate how to open a new font file/stream.   */
1259   /*    A pointer to such a structure can be used as a parameter for the   */
1260   /*    functions FT_Open_Face() & FT_Attach_Stream().                     */
1261   /*                                                                       */
1262   /* <Fields>                                                              */
1263   /*    flags       :: A set of bit flags indicating how to use the        */
1264   /*                   structure.                                          */
1265   /*                                                                       */
1266   /*    memory_base :: The first byte of the file in memory.               */
1267   /*                                                                       */
1268   /*    memory_size :: The size in bytes of the file in memory.            */
1269   /*                                                                       */
1270   /*    pathname    :: A pointer to an 8-bit file pathname.                */
1271   /*                                                                       */
1272   /*    stream      :: A handle to a source stream object.                 */
1273   /*                                                                       */
1274   /*    driver      :: This field is exclusively used by FT_Open_Face();   */
1275   /*                   it simply specifies the font driver to use to open  */
1276   /*                   the face.  If set to 0, FreeType will try to load   */
1277   /*                   the face with each one of the drivers in its list.  */
1278   /*                                                                       */
1279   /*    num_params  :: The number of extra parameters.                     */
1280   /*                                                                       */
1281   /*    params      :: Extra parameters passed to the font driver when     */
1282   /*                   opening a new face.                                 */
1283   /*                                                                       */
1284   /* <Note>                                                                */
1285   /*    `stream_type' determines which fields are used to create a new     */
1286   /*    input stream.                                                      */
1287   /*                                                                       */
1288   /*    If it is `ft_stream_memory', a new memory-based stream will be     */
1289   /*    created using the memory block specified by `memory_base' and      */
1290   /*    `memory_size'.                                                     */
1291   /*                                                                       */
1292   /*    If it is `ft_stream_pathname', a new stream will be created with   */
1293   /*    the `pathname' field, calling the system-specific FT_New_Stream()  */
1294   /*    function.                                                          */
1295   /*                                                                       */
1296   /*    If is is `ft_stream_copy', then the content of `stream' will be    */
1297   /*    copied to a new input stream object.  The object will be closed    */
1298   /*    and destroyed when the face is destroyed itself.  Note that this   */
1299   /*    means that you should not close the stream before the library      */
1300   /*    does!                                                              */
1301   /*                                                                       */
1302   typedef struct  FT_Open_Args_
1303   {
1304     FT_Open_Flags  flags;
1305     FT_Byte*       memory_base;
1306     FT_Long        memory_size;
1307     FT_String*     pathname;
1308     FT_Stream      stream;
1309     FT_Module      driver;
1310     FT_Int         num_params;
1311     FT_Parameter*  params;
1312
1313   } FT_Open_Args;
1314
1315
1316   /*************************************************************************/
1317   /*                                                                       */
1318   /* <Function>                                                            */
1319   /*    FT_New_Face                                                        */
1320   /*                                                                       */
1321   /* <Description>                                                         */
1322   /*    Creates a new face object from a given resource and typeface index */
1323   /*    using a pathname to the font file.                                 */
1324   /*                                                                       */
1325   /* <InOut>                                                               */
1326   /*    library    :: A handle to the library resource.                    */
1327   /*                                                                       */
1328   /* <Input>                                                               */
1329   /*    pathname   :: A path to the font file.                             */
1330   /*                                                                       */
1331   /*    face_index :: The index of the face within the resource.  The      */
1332   /*                  first face has index 0.                              */
1333   /* <Output>                                                              */
1334   /*    aface      :: A handle to a new face object.                       */
1335   /*                                                                       */
1336   /* <Return>                                                              */
1337   /*    FreeType error code.  0 means success.                             */
1338   /*                                                                       */
1339   /* <Note>                                                                */
1340   /*    Unlike FreeType 1.x, this function automatically creates a glyph   */
1341   /*    slot for the face object which can be accessed directly through    */
1342   /*    `face->glyph'.                                                     */
1343   /*                                                                       */
1344   /*    Note that additional slots can be added to each face with the      */
1345   /*    FT_New_GlyphSlot() API function.  Slots are linked in a single     */
1346   /*    list through their `next' field.                                   */
1347   /*                                                                       */
1348   /*    FT_New_Face() can be used to determine and/or check the font       */
1349   /*    format of a given font resource.  If the `face_index' field is     */
1350   /*    negative, the function will _not_ return any face handle in        */
1351   /*    `*face'.  Its return value should be 0 if the resource is          */
1352   /*    recognized, or non-zero if not.                                    */
1353   /*                                                                       */
1354   FT_EXPORT_DEF( FT_Error )  FT_New_Face( FT_Library   library,
1355                                           const char*  filepathname,
1356                                           FT_Long      face_index,
1357                                           FT_Face*     face );
1358
1359
1360   /*************************************************************************/
1361   /*                                                                       */
1362   /* <Function>                                                            */
1363   /*    FT_New_Memory_Face                                                 */
1364   /*                                                                       */
1365   /* <Description>                                                         */
1366   /*    Creates a new face object from a given resource and typeface index */
1367   /*    using a font file already loaded into memory.                      */
1368   /*                                                                       */
1369   /* <InOut>                                                               */
1370   /*    library    :: A handle to the library resource.                    */
1371   /*                                                                       */
1372   /* <Input>                                                               */
1373   /*    file_base  :: A pointer to the beginning of the font data.         */
1374   /*                                                                       */
1375   /*    file_size  :: The size of the memory chunk used by the font data.  */
1376   /*                                                                       */
1377   /*    face_index :: The index of the face within the resource.  The      */
1378   /*                  first face has index 0.                              */
1379   /* <Output>                                                              */
1380   /*    face       :: A handle to a new face object.                       */
1381   /*                                                                       */
1382   /* <Return>                                                              */
1383   /*    FreeType error code.  0 means success.                             */
1384   /*                                                                       */
1385   /* <Note>                                                                */
1386   /*    Unlike FreeType 1.x, this function automatically creates a glyph   */
1387   /*    slot for the face object which can be accessed directly through    */
1388   /*    `face->glyph'.                                                     */
1389   /*                                                                       */
1390   /*    Note that additional slots can be added to each face with the      */
1391   /*    FT_New_GlyphSlot() API function.  Slots are linked in a single     */
1392   /*    list through their `next' field.                                   */
1393   /*                                                                       */
1394   /*    FT_New_Memory_Face() can be used to determine and/or check the     */
1395   /*    font format of a given font resource.  If the `face_index' field   */
1396   /*    is negative, the function will _not_ return any face handle in     */
1397   /*    `*face'.  Its return value should be 0 if the resource is          */
1398   /*    recognized, or non-zero if not.                                    */
1399   /*                                                                       */
1400   FT_EXPORT_DEF( FT_Error )  FT_New_Memory_Face( FT_Library  library,
1401                                                  FT_Byte*    file_base,
1402                                                  FT_Long     file_size,
1403                                                  FT_Long     face_index,
1404                                                  FT_Face*    face );
1405
1406
1407   /*************************************************************************/
1408   /*                                                                       */
1409   /* <Function>                                                            */
1410   /*    FT_Open_Face                                                       */
1411   /*                                                                       */
1412   /* <Description>                                                         */
1413   /*    Opens a face object from a given resource and typeface index using */
1414   /*    an `FT_Open_Args' structure.  If the face object doesn't exist, it */
1415   /*    will be created.                                                   */
1416   /*                                                                       */
1417   /* <InOut>                                                               */
1418   /*    library    :: A handle to the library resource.                    */
1419   /*                                                                       */
1420   /* <Input>                                                               */
1421   /*    args       :: A pointer to an `FT_Open_Args' structure which must  */
1422   /*                  be filled by the caller.                             */
1423   /*                                                                       */
1424   /*    face_index :: The index of the face within the resource.  The      */
1425   /*                  first face has index 0.                              */
1426   /* <Output>                                                              */
1427   /*    aface      :: A handle to a new face object.                       */
1428   /*                                                                       */
1429   /* <Return>                                                              */
1430   /*    FreeType error code.  0 means success.                             */
1431   /*                                                                       */
1432   /* <Note>                                                                */
1433   /*    Unlike FreeType 1.x, this function automatically creates a glyph   */
1434   /*    slot for the face object which can be accessed directly through    */
1435   /*    `face->glyph'.                                                     */
1436   /*                                                                       */
1437   /*    Note that additional slots can be added to each face with the      */
1438   /*    FT_New_GlyphSlot() API function.  Slots are linked in a single     */
1439   /*    list through their `next' field.                                   */
1440   /*                                                                       */
1441   /*    FT_Open_Face() can be used to determine and/or check the font      */
1442   /*    format of a given font resource.  If the `face_index' field is     */
1443   /*    negative, the function will _not_ return any face handle in        */
1444   /*    `*face'.  Its return value should be 0 if the resource is          */
1445   /*    recognized, or non-zero if not.                                    */
1446   /*                                                                       */
1447   FT_EXPORT_DEF( FT_Error )  FT_Open_Face( FT_Library     library,
1448                                            FT_Open_Args*  args,
1449                                            FT_Long        face_index,
1450                                            FT_Face*       face );
1451
1452
1453   /*************************************************************************/
1454   /*                                                                       */
1455   /* <Function>                                                            */
1456   /*    FT_Attach_File                                                     */
1457   /*                                                                       */
1458   /* <Description>                                                         */
1459   /*    `Attaches' a given font file to an existing face.  This is usually */
1460   /*    to read additional information for a single face object.  For      */
1461   /*    example, it is used to read the AFM files that come with Type 1    */
1462   /*    fonts in order to add kerning data and other metrics.              */
1463   /*                                                                       */
1464   /* <InOut>                                                               */
1465   /*    face         :: The target face object.                            */
1466   /*                                                                       */
1467   /* <Input>                                                               */
1468   /*    filepathname :: An 8-bit pathname naming the `metrics' file.       */
1469   /*                                                                       */
1470   /* <Return>                                                              */
1471   /*    FreeType error code.  0 means success.                             */
1472   /*                                                                       */
1473   /* <Note>                                                                */
1474   /*    If your font file is in memory, or if you want to provide your     */
1475   /*    own input stream object, use FT_Attach_Stream().                   */
1476   /*                                                                       */
1477   /*    The meaning of the `attach' action (i.e., what really happens when */
1478   /*    the new file is read) is not fixed by FreeType itself.  It really  */
1479   /*    depends on the font format (and thus the font driver).             */
1480   /*                                                                       */
1481   /*    Client applications are expected to know what they are doing       */
1482   /*    when invoking this function.  Most drivers simply do not implement */
1483   /*    file attachments.                                                  */
1484   /*                                                                       */
1485   FT_EXPORT_DEF( FT_Error )  FT_Attach_File( FT_Face      face,
1486                                              const char*  filepathname );
1487
1488
1489   /*************************************************************************/
1490   /*                                                                       */
1491   /* <Function>                                                            */
1492   /*    FT_Attach_Stream                                                   */
1493   /*                                                                       */
1494   /* <Description>                                                         */
1495   /*    This function is similar to FT_Attach_File() with the exception    */
1496   /*    that it reads the attachment from an arbitrary stream.             */
1497   /*                                                                       */
1498   /* <Input>                                                               */
1499   /*    face       :: The target face object.                              */
1500   /*                                                                       */
1501   /*    parameters :: A pointer to an FT_Open_Args structure used to       */
1502   /*                  describe the input stream to FreeType.               */
1503   /* <Return>                                                              */
1504   /*    FreeType error code.  0 means success.                             */
1505   /*                                                                       */
1506   /* <Note>                                                                */
1507   /*    The meaning of the `attach' (i.e. what really happens when the     */
1508   /*    new file is read) is not fixed by FreeType itself.  It really      */
1509   /*    depends on the font format (and thus the font driver).             */
1510   /*                                                                       */
1511   /*    Client applications are expected to know what they are doing       */
1512   /*    when invoking this function.  Most drivers simply do not implement */
1513   /*    file attachments.                                                  */
1514   /*                                                                       */
1515   FT_EXPORT_DEF( FT_Error )  FT_Attach_Stream( FT_Face        face,
1516                                                FT_Open_Args*  parameters );
1517
1518
1519   /*************************************************************************/
1520   /*                                                                       */
1521   /* <Function>                                                            */
1522   /*    FT_Done_Face                                                       */
1523   /*                                                                       */
1524   /* <Description>                                                         */
1525   /*    Discards a given face object, as well as all of its child slots    */
1526   /*    and sizes.                                                         */
1527   /*                                                                       */
1528   /* <Input>                                                               */
1529   /*    face :: A handle to a target face object.                          */
1530   /*                                                                       */
1531   /* <Return>                                                              */
1532   /*    FreeType error code.  0 means success.                             */
1533   /*                                                                       */
1534   FT_EXPORT_DEF( FT_Error )  FT_Done_Face( FT_Face  face );
1535
1536
1537   /*************************************************************************/
1538   /*                                                                       */
1539   /* <Function>                                                            */
1540   /*    FT_Set_Char_Size                                                   */
1541   /*                                                                       */
1542   /* <Description>                                                         */
1543   /*    Sets the character dimensions of a given face object.  The         */
1544   /*    `char_width' and `char_height' values are used for the width and   */
1545   /*    height, respectively, expressed in 26.6 fractional points.         */
1546   /*                                                                       */
1547   /*    If the horizontal or vertical resolution values are zero, a        */
1548   /*    default value of 72dpi is used.  Similarly, if one of the          */
1549   /*    character dimensions is zero, its value is set equal to the other. */
1550   /*                                                                       */
1551   /* <InOut>                                                               */
1552   /*    size            :: A handle to a target size object.               */
1553   /*                                                                       */
1554   /* <Input>                                                               */
1555   /*    char_width      :: The character width, in 26.6 fractional points. */
1556   /*                                                                       */
1557   /*    char_height     :: The character height, in 26.6 fractional        */
1558   /*                       points.                                         */
1559   /*                                                                       */
1560   /*    horz_resolution :: The horizontal resolution.                      */
1561   /*                                                                       */
1562   /*    vert_resolution :: The vertical resolution.                        */
1563   /*                                                                       */
1564   /* <Return>                                                              */
1565   /*    FreeType error code.  0 means success.                             */
1566   /*                                                                       */
1567   /* <Note>                                                                */
1568   /*    When dealing with fixed-size faces (i.e., non-scalable formats),   */
1569   /*    use the function FT_Set_Pixel_Sizes().                             */
1570   /*                                                                       */
1571   FT_EXPORT_DEF( FT_Error )  FT_Set_Char_Size( FT_Face     face,
1572                                                FT_F26Dot6  char_width,
1573                                                FT_F26Dot6  char_height,
1574                                                FT_UInt     horz_resolution,
1575                                                FT_UInt     vert_resolution );
1576
1577
1578   /*************************************************************************/
1579   /*                                                                       */
1580   /* <Function>                                                            */
1581   /*    FT_Set_Pixel_Sizes                                                 */
1582   /*                                                                       */
1583   /* <Description>                                                         */
1584   /*    Sets the character dimensions of a given face object.  The width   */
1585   /*    and height are expressed in integer pixels.                        */
1586   /*                                                                       */
1587   /*    If one of the character dimensions is zero, its value is set equal */
1588   /*    to the other.                                                      */
1589   /*                                                                       */
1590   /* <InOut>                                                               */
1591   /*    face         :: A handle to the target face object.                */
1592   /*                                                                       */
1593   /* <Input>                                                               */
1594   /*    pixel_width  :: The character width, in integer pixels.            */
1595   /*                                                                       */
1596   /*    pixel_height :: The character height, in integer pixels.           */
1597   /*                                                                       */
1598   /* <Return>                                                              */
1599   /*    FreeType error code.  0 means success.                             */
1600   /*                                                                       */
1601   FT_EXPORT_DEF( FT_Error )  FT_Set_Pixel_Sizes( FT_Face  face,
1602                                                  FT_UInt  pixel_width,
1603                                                  FT_UInt  pixel_height );
1604
1605
1606   /*************************************************************************/
1607   /*                                                                       */
1608   /* <Function>                                                            */
1609   /*    FT_Load_Glyph                                                      */
1610   /*                                                                       */
1611   /* <Description>                                                         */
1612   /*    A function used to load a single glyph within a given glyph slot,  */
1613   /*    for a given size.                                                  */
1614   /*                                                                       */
1615   /* <Input>                                                               */
1616   /*    face        :: A handle to the target face object where the glyph  */
1617   /*                   will be loaded.                                     */
1618   /*                                                                       */
1619   /*    glyph_index :: The index of the glyph in the font file.            */
1620   /*                                                                       */
1621   /*    load_flags  :: A flag indicating what to load for this glyph.  The */
1622   /*                   FT_LOAD_XXX constants can be used to control the    */
1623   /*                   glyph loading process (e.g., whether the outline    */
1624   /*                   should be scaled, whether to load bitmaps or not,   */
1625   /*                   whether to hint the outline, etc).                  */
1626   /*                                                                       */
1627   /* <Return>                                                              */
1628   /*    FreeType error code.  0 means success.                             */
1629   /*                                                                       */
1630   /* <Note>                                                                */
1631   /*    If the glyph image is not a bitmap, and if the bit flag            */
1632   /*    FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image will be         */
1633   /*    transformed with the information passed to a previous call to      */
1634   /*    FT_Set_Transform.                                                  */
1635   /*                                                                       */
1636   /*    Note that this also transforms the `face.glyph.advance' field, but */
1637   /*    *not* the values in `face.glyph.metrics'.                          */
1638   /*                                                                       */
1639   FT_EXPORT_DEF( FT_Error )  FT_Load_Glyph( FT_Face  face,
1640                                             FT_UInt  glyph_index,
1641                                             FT_Int   load_flags );
1642
1643
1644   /*************************************************************************/
1645   /*                                                                       */
1646   /* <Function>                                                            */
1647   /*    FT_Load_Char                                                       */
1648   /*                                                                       */
1649   /* <Description>                                                         */
1650   /*    A function used to load a single glyph within a given glyph slot,  */
1651   /*    for a given size, according to its character code.                 */
1652   /*                                                                       */
1653   /* <Input>                                                               */
1654   /*    face        :: A handle to a target face object where the glyph    */
1655   /*                   will be loaded.                                     */
1656   /*                                                                       */
1657   /*    char_code   :: The glyph's character code, according to the        */
1658   /*                   current charmap used in the face.                   */
1659   /*                                                                       */
1660   /*    load_flags  :: A flag indicating what to load for this glyph.  The */
1661   /*                   FT_LOAD_XXX constants can be used to control the    */
1662   /*                   glyph loading process (e.g., whether the outline    */
1663   /*                   should be scaled, whether to load bitmaps or not,   */
1664   /*                   whether to hint the outline, etc).                  */
1665   /*                                                                       */
1666   /* <Return>                                                              */
1667   /*    FreeType error code.  0 means success.                             */
1668   /*                                                                       */
1669   /* <Note>                                                                */
1670   /*    If the face has no current charmap, or if the character code       */
1671   /*    is not defined in the charmap, this function will return an        */
1672   /*    error.                                                             */
1673   /*                                                                       */
1674   /*    If the glyph image is not a bitmap, and if the bit flag            */
1675   /*    FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image will be         */
1676   /*    transformed with the information passed to a previous call to      */
1677   /*    FT_Set_Transform().                                                */
1678   /*                                                                       */
1679   /*    Note that this also transforms the `face.glyph.advance' field, but */
1680   /*    *not* the values in `face.glyph.metrics'.                          */
1681   /*                                                                       */
1682   FT_EXPORT_DEF( FT_Error )  FT_Load_Char( FT_Face   face,
1683                                            FT_ULong  char_code,
1684                                            FT_Int    load_flags );
1685
1686
1687   /*************************************************************************/
1688   /*                                                                       */
1689   /* <Constant>                                                            */
1690   /*    FT_LOAD_NO_SCALE                                                   */
1691   /*                                                                       */
1692   /* <Description>                                                         */
1693   /*    A bit field constant, used with FT_Load_Glyph() to indicate that   */
1694   /*    the vector outline being loaded should not be scaled to 26.6       */
1695   /*    fractional pixels, but kept in notional units.                     */
1696   /*                                                                       */
1697 #define FT_LOAD_NO_SCALE  1
1698
1699
1700   /*************************************************************************/
1701   /*                                                                       */
1702   /* <Constant>                                                            */
1703   /*    FT_LOAD_NO_HINTING                                                 */
1704   /*                                                                       */
1705   /* <Description>                                                         */
1706   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1707   /*    the vector outline being loaded should not be fitted to the pixel  */
1708   /*    grid but simply scaled to 26.6 fractional pixels.                  */
1709   /*                                                                       */
1710   /*    This flag is ignored if FT_LOAD_NO_SCALE is set.                   */
1711   /*                                                                       */
1712 #define FT_LOAD_NO_HINTING  2
1713
1714
1715   /*************************************************************************/
1716   /*                                                                       */
1717   /* <Constant>                                                            */
1718   /*    FT_LOAD_RENDER                                                     */
1719   /*                                                                       */
1720   /* <Description>                                                         */
1721   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1722   /*    the function should load the glyph and immediately convert it into */
1723   /*    a bitmap, if necessary, by calling FT_Render_Glyph().              */
1724   /*                                                                       */
1725   /*    Note that by default, FT_Load_Glyph() loads the glyph image in its */
1726   /*    native format.                                                     */
1727   /*                                                                       */
1728 #define FT_LOAD_RENDER  4
1729
1730
1731   /*************************************************************************/
1732   /*                                                                       */
1733   /* <Constant>                                                            */
1734   /*    FT_LOAD_NO_BITMAP                                                  */
1735   /*                                                                       */
1736   /* <Description>                                                         */
1737   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1738   /*    the function should not load the bitmap or pixmap of a given       */
1739   /*    glyph.  This is useful when you do not want to load the embedded   */
1740   /*    bitmaps of scalable formats, as the native glyph image will be     */
1741   /*    loaded, and can then be rendered through FT_Render_Glyph().        */
1742   /*                                                                       */
1743 #define FT_LOAD_NO_BITMAP  8
1744
1745
1746   /*************************************************************************/
1747   /*                                                                       */
1748   /* <Constant>                                                            */
1749   /*    FT_LOAD_VERTICAL_LAYOUT                                            */
1750   /*                                                                       */
1751   /* <Description>                                                         */
1752   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1753   /*    the glyph image should be prepared for vertical layout.  This      */
1754   /*    basically means that `face.glyph.advance' will correspond to the   */
1755   /*    vertical advance height (instead of the default horizontal         */
1756   /*    advance width), and that the glyph image will translated to match  */
1757   /*    the vertical bearings positions.                                   */
1758   /*                                                                       */
1759 #define FT_LOAD_VERTICAL_LAYOUT  16
1760
1761
1762   /*************************************************************************/
1763   /*                                                                       */
1764   /* <Constant>                                                            */
1765   /*    FT_LOAD_FORCE_AUTOHINT                                             */
1766   /*                                                                       */
1767   /* <Description>                                                         */
1768   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1769   /*    the function should try to auto-hint the glyphs, even if a driver  */
1770   /*    specific hinter is available.                                      */
1771   /*                                                                       */
1772 #define FT_LOAD_FORCE_AUTOHINT  32
1773
1774
1775   /*************************************************************************/
1776   /*                                                                       */
1777   /* <Constant>                                                            */
1778   /*    FT_LOAD_CROP_BITMAP                                                */
1779   /*                                                                       */
1780   /* <Description>                                                         */
1781   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1782   /*    the font driver should try to crop the bitmap (i.e. remove all     */
1783   /*    space around its black bits) when loading it.  For now, this       */
1784   /*    really only works with embedded bitmaps in TrueType fonts.         */
1785   /*                                                                       */
1786 #define FT_LOAD_CROP_BITMAP  64
1787
1788
1789   /*************************************************************************/
1790   /*                                                                       */
1791   /* <Constant>                                                            */
1792   /*    FT_LOAD_PEDANTIC                                                   */
1793   /*                                                                       */
1794   /* <Description>                                                         */
1795   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1796   /*    the glyph loader should perform a pedantic bytecode                */
1797   /*    interpretation.  Many popular fonts come with broken glyph         */
1798   /*    programs.  When this flag is set, loading them will return an      */
1799   /*    error.  Otherwise, errors are ignored by the loader, sometimes     */
1800   /*    resulting in ugly glyphs.                                          */
1801   /*                                                                       */
1802 #define FT_LOAD_PEDANTIC  128
1803
1804
1805   /*************************************************************************/
1806   /*                                                                       */
1807   /* <Constant>                                                            */
1808   /*    FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH                                */
1809   /*                                                                       */
1810   /* <Description>                                                         */
1811   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1812   /*    the glyph loader should ignore the global advance width defined    */
1813   /*    in the font.  As far as we know, this is only used by the          */
1814   /*    X-TrueType font server, in order to deal correctly with the        */
1815   /*    incorrect metrics contained in DynaLab's TrueType CJK fonts.       */
1816   /*                                                                       */
1817 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH  512
1818
1819
1820   /*************************************************************************/
1821   /*                                                                       */
1822   /* <Constant>                                                            */
1823   /*    FT_LOAD_NO_RECURSE                                                 */
1824   /*                                                                       */
1825   /* <Description>                                                         */
1826   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1827   /*    the glyph loader should not load composite glyph recursively.      */
1828   /*    Rather, when a composite glyph is encountered, it should set       */
1829   /*    the values of `num_subglyphs' and `subglyphs', as well as set      */
1830   /*    `face->glyph.format' to ft_glyph_format_composite.                 */
1831   /*                                                                       */
1832   /*    This is for use by the auto-hinter and possibly other tools.       */
1833   /*    For nearly all applications, this flags should be left unset       */
1834   /*    when invoking FT_Load_Glyph().                                     */
1835   /*                                                                       */
1836   /*    Note that the flag forces the load of unscaled glyphs.             */
1837   /*                                                                       */
1838 #define FT_LOAD_NO_RECURSE  1024
1839
1840
1841   /*************************************************************************/
1842   /*                                                                       */
1843   /* <Constant>                                                            */
1844   /*    FT_LOAD_IGNORE_TRANSFORM                                           */
1845   /*                                                                       */
1846   /* <Description>                                                         */
1847   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1848   /*    the glyph loader should not try to transform the loaded glyph      */
1849   /*    image.                                                             */
1850   /*                                                                       */
1851 #define FT_LOAD_IGNORE_TRANSFORM 2048
1852
1853
1854   /*************************************************************************/
1855   /*                                                                       */
1856   /* <Constant>                                                            */
1857   /*    FT_LOAD_MONOCHROME                                                 */
1858   /*                                                                       */
1859   /* <Description>                                                         */
1860   /*    Only used with FT_LOAD_RENDER set, it indicates that the returned  */
1861   /*    glyph image should be 1-bit monochrome.  This really tells the     */
1862   /*    glyph loader to use `ft_render_mode_mono' when calling             */
1863   /*    FT_Render_Glyph().                                                 */
1864   /*                                                                       */
1865 #define FT_LOAD_MONOCHROME  4096
1866
1867
1868   /*************************************************************************/
1869   /*                                                                       */
1870   /* <Constant>                                                            */
1871   /*    FT_LOAD_LINEAR_DESIGN                                              */
1872   /*                                                                       */
1873   /* <Description>                                                         */
1874   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1875   /*    the function should return the linearly scaled metrics expressed   */
1876   /*    in original font units, instead of the default 16.16 pixel values. */
1877   /*                                                                       */
1878 #define FT_LOAD_LINEAR_DESIGN 8192
1879
1880
1881   /*************************************************************************/
1882   /*                                                                       */
1883   /* <Constant>                                                            */
1884   /*    FT_LOAD_DEFAULT                                                    */
1885   /*                                                                       */
1886   /* <Description>                                                         */
1887   /*    A bit-field constant, used with FT_Load_Glyph() to indicate that   */
1888   /*    the function should try to load the glyph normally, i.e.,          */
1889   /*    embedded bitmaps are favored over outlines, vectors are always     */
1890   /*    scaled and grid-fitted.                                            */
1891   /*                                                                       */
1892 #define FT_LOAD_DEFAULT  0
1893
1894
1895   /*************************************************************************/
1896   /*                                                                       */
1897   /* <Function>                                                            */
1898   /*    FT_Set_Transform                                                   */
1899   /*                                                                       */
1900   /* <Description>                                                         */
1901   /*    A function used to set the transformation that is applied to glyph */
1902   /*    images just before they are converted to bitmaps in a glyph slot   */
1903   /*    when FT_Render_Glyph() is called.                                  */
1904   /*                                                                       */
1905   /* <InOut>                                                               */
1906   /*    face   :: A handle to the source face object.                      */
1907   /*                                                                       */
1908   /* <Input>                                                               */
1909   /*    matrix :: A pointer to the transformation's 2x2 matrix.  Use 0 for */
1910   /*              the identity matrix.                                     */
1911   /*    delta  :: A pointer to the translation vector.  Use 0 for the null */
1912   /*              vector.                                                  */
1913   /*                                                                       */
1914   /* <Note>                                                                */
1915   /*    The transformation is only applied to scalable image formats after */
1916   /*    the glyph has been loaded.  It means that hinting is unaltered by  */
1917   /*    the transformation and is performed on the character size given in */
1918   /*    the last call to FT_Set_Char_Sizes() or FT_Set_Pixel_Sizes().      */
1919   /*                                                                       */
1920   FT_EXPORT_DEF( void )  FT_Set_Transform( FT_Face     face,
1921                                            FT_Matrix*  matrix,
1922                                            FT_Vector*  delta );
1923
1924
1925   /*************************************************************************/
1926   /*                                                                       */
1927   /* <Enum>                                                                */
1928   /*    FT_Render_Mode                                                     */
1929   /*                                                                       */
1930   /* <Description>                                                         */
1931   /*    An enumeration type that lists the render modes supported by the   */
1932   /*    FreeType 2 renderer(s).  A renderer is in charge of converting a   */
1933   /*    glyph image into a bitmap.                                         */
1934   /*                                                                       */
1935   /* <Fields>                                                              */
1936   /*    ft_render_mode_normal :: This is the default render mode; it       */
1937   /*                             corresponds to 8-bit anti-aliased         */
1938   /*                             bitmaps, using 256 levels of gray.        */
1939   /*                                                                       */
1940   /*    ft_render_mode_mono   :: This render mode is used to produce 1-bit */
1941   /*                             monochrome bitmaps.                       */
1942   /*                                                                       */
1943   /* <Note>                                                                */
1944   /*    There is no render mode to produce 8-bit `monochrome' bitmaps --   */
1945   /*    you have to make the conversion yourself if you need such things   */
1946   /*    (besides, FreeType is not a graphics library).                     */
1947   /*                                                                       */
1948   /*    More modes might appear later for specific display modes (e.g. TV, */
1949   /*    LCDs, etc.).  They will be supported through the simple addition   */
1950   /*    of a renderer module, with no changes to the rest of the engine.   */
1951   /*                                                                       */
1952   typedef enum  FT_Render_Mode_
1953   {
1954     ft_render_mode_normal = 0,
1955     ft_render_mode_mono   = 1
1956
1957   } FT_Render_Mode;
1958
1959
1960   /*************************************************************************/
1961   /*                                                                       */
1962   /* <Function>                                                            */
1963   /*    FT_Render_Glyph                                                    */
1964   /*                                                                       */
1965   /* <Description>                                                         */
1966   /*    Converts a given glyph image to a bitmap.  It does so by           */
1967   /*    inspecting the glyph image format, find the relevant renderer, and */
1968   /*    invoke it.                                                         */
1969   /*                                                                       */
1970   /* <Input>                                                               */
1971   /*    slot        :: A handle to the glyph slot containing the image to  */
1972   /*                   convert.                                            */
1973   /*                                                                       */
1974   /*    render_mode :: This is the render mode used to render the glyph    */
1975   /*                   image into a bitmap.  See FT_Render_Mode for a list */
1976   /*                   of possible values.                                 */
1977   /*                                                                       */
1978   /* <Return>                                                              */
1979   /*    FreeType error code.  0 means success.                             */
1980   /*                                                                       */
1981   FT_EXPORT_DEF( FT_Error )  FT_Render_Glyph( FT_GlyphSlot  slot,
1982                                               FT_UInt       render_mode );
1983
1984
1985   /*************************************************************************/
1986   /*                                                                       */
1987   /* <Enum>                                                                */
1988   /*    FT_Kerning_Mode                                                    */
1989   /*                                                                       */
1990   /* <Description>                                                         */
1991   /*    An enumeration used to specify which kerning values to return in   */
1992   /*    FT_Get_Kerning().                                                  */
1993   /*                                                                       */
1994   /* <Fields>                                                              */
1995   /*    ft_kerning_default  :: Return scaled and grid-fitted kerning       */
1996   /*                           distances (value is 0).                     */
1997   /*                                                                       */
1998   /*    ft_kerning_unfitted :: Return scaled but un-grid-fitted kerning    */
1999   /*                           distances.                                  */
2000   /*                                                                       */
2001   /*    ft_kerning_unscaled :: Return the kerning vector in original font  */
2002   /*                           units.                                      */
2003   /*                                                                       */
2004   typedef enum  FT_Kerning_Mode_
2005   {
2006     ft_kerning_default  = 0,
2007     ft_kerning_unfitted,
2008     ft_kerning_unscaled
2009
2010   } FT_Kerning_Mode;
2011
2012
2013   /*************************************************************************/
2014   /*                                                                       */
2015   /* <Function>                                                            */
2016   /*    FT_Get_Kerning                                                     */
2017   /*                                                                       */
2018   /* <Description>                                                         */
2019   /*    Returns the kerning vector between two glyphs of a same face.      */
2020   /*                                                                       */
2021   /* <Input>                                                               */
2022   /*    face        :: A handle to a source face object.                   */
2023   /*                                                                       */
2024   /*    left_glyph  :: The index of the left glyph in the kern pair.       */
2025   /*                                                                       */
2026   /*    right_glyph :: The index of the right glyph in the kern pair.      */
2027   /*                                                                       */
2028   /*    kern_mode   :: See FT_Kerning_Mode() for more information.         */
2029   /*                   Determines the scale/dimension of the returned      */
2030   /*                   kerning vector.                                     */
2031   /*                                                                       */
2032   /* <Output>                                                              */
2033   /*    kerning     :: The kerning vector.  This is in font units for      */
2034   /*                   scalable formats, and in pixels for fixed-sizes     */
2035   /*                   formats.                                            */
2036   /*                                                                       */
2037   /* <Return>                                                              */
2038   /*    FreeType error code.  0 means success.                             */
2039   /*                                                                       */
2040   /* <Note>                                                                */
2041   /*    Only horizontal layouts (left-to-right & right-to-left) are        */
2042   /*    supported by this method.  Other layouts, or more sophisticated    */
2043   /*    kernings, are out of the scope of this API function -- they can be */
2044   /*    implemented through format-specific interfaces.                    */
2045   /*                                                                       */
2046   FT_EXPORT_DEF( FT_Error )  FT_Get_Kerning( FT_Face     face,
2047                                              FT_UInt     left_glyph,
2048                                              FT_UInt     right_glyph,
2049                                              FT_UInt     kern_mode,
2050                                              FT_Vector*  kerning );
2051
2052
2053   /*************************************************************************/
2054   /*                                                                       */
2055   /* <Function>                                                            */
2056   /*    FT_Get_Glyph_Name                                                  */
2057   /*                                                                       */
2058   /* <Description>                                                         */
2059   /*    Retrieves the ASCII name of a given glyph in a face.  This only    */
2060   /*    works for those faces where FT_HAS_GLYPH_NAME(face) returns true.  */
2061   /*                                                                       */
2062   /* <Input>                                                               */
2063   /*    face        :: A handle to a source face object.                   */
2064   /*                                                                       */
2065   /*    glyph_index :: The glyph index.                                    */
2066   /*                                                                       */
2067   /*    buffer      :: A pointer to a target buffer where the name will be */
2068   /*                   copied to.                                          */
2069   /*                                                                       */
2070   /*    buffer_max  :: The maximal number of bytes available in the        */
2071   /*                   buffer.                                             */
2072   /*                                                                       */
2073   /* <Return>                                                              */
2074   /*    FreeType error code.  0 means success.                             */
2075   /*                                                                       */
2076   /* <Note>                                                                */
2077   /*    An error is returned if the face doesn't provide glyph names or if */
2078   /*    the glyph index is invalid.  In all cases of failure, the first    */
2079   /*    byte of `buffer' will be set to 0 to indicate an empty name.       */
2080   /*                                                                       */
2081   /*    The glyph name is truncated to fit within the buffer if it is too  */
2082   /*    long.  The returned string is always zero-terminated.              */
2083   /*                                                                       */
2084   /*    This function is not compiled within the library if the config     */
2085   /*    macro FT_CONFIG_OPTION_NO_GLYPH_NAMES is defined in                */
2086   /*    `include/freetype/config/ftoptions.h'                              */
2087   /*                                                                       */
2088   FT_EXPORT_DEF( FT_Error )  FT_Get_Glyph_Name( FT_Face     face,
2089                                                 FT_UInt     glyph_index,
2090                                                 FT_Pointer  buffer,
2091                                                 FT_UInt     buffer_max );
2092
2093
2094   /*************************************************************************/
2095   /*                                                                       */
2096   /* <Function>                                                            */
2097   /*    FT_Select_Charmap                                                  */
2098   /*                                                                       */
2099   /* <Description>                                                         */
2100   /*    Selects a given charmap by its encoding tag (as listed in          */
2101   /*    `freetype.h').                                                     */
2102   /*                                                                       */
2103   /* <Input>                                                               */
2104   /*    face     :: A handle to the source face object.                    */
2105   /*                                                                       */
2106   /*    encoding :: A handle to the selected charmap.                      */
2107   /*                                                                       */
2108   /* <Return>                                                              */
2109   /*    FreeType error code.  0 means success.                             */
2110   /*                                                                       */
2111   /* <Note>                                                                */
2112   /*    This function will return an error if no charmap in the face       */
2113   /*    corresponds to the encoding queried here.                          */
2114   /*                                                                       */
2115   FT_EXPORT_DEF( FT_Error )  FT_Select_Charmap( FT_Face      face,
2116                                                 FT_Encoding  encoding );
2117
2118
2119   /*************************************************************************/
2120   /*                                                                       */
2121   /* <Function>                                                            */
2122   /*    FT_Set_Charmap                                                     */
2123   /*                                                                       */
2124   /* <Description>                                                         */
2125   /*    Selects a given charmap for character code to glyph index          */
2126   /*    decoding.                                                          */
2127   /*                                                                       */
2128   /* <Input>                                                               */
2129   /*    face     :: A handle to the source face object.                    */
2130   /*    charmap  :: A handle to the selected charmap.                      */
2131   /*                                                                       */
2132   /* <Return>                                                              */
2133   /*    FreeType error code.  0 means success.                             */
2134   /*                                                                       */
2135   /* <Note>                                                                */
2136   /*    This function will return an error if the charmap is not part of   */
2137   /*    the face (i.e., if it is not listed in the face->charmaps[]        */
2138   /*    table).                                                            */
2139   /*                                                                       */
2140   FT_EXPORT_DEF( FT_Error )  FT_Set_Charmap( FT_Face     face,
2141                                              FT_CharMap  charmap );
2142
2143
2144   /*************************************************************************/
2145   /*                                                                       */
2146   /* <Function>                                                            */
2147   /*    FT_Get_Char_Index                                                  */
2148   /*                                                                       */
2149   /* <Description>                                                         */
2150   /*    Returns the glyph index of a given character code.  This function  */
2151   /*    uses a charmap object to do the translation.                       */
2152   /*                                                                       */
2153   /* <Input>                                                               */
2154   /*    face     :: A handle to the source face object.                    */
2155   /*                                                                       */
2156   /*    charcode :: The character code.                                    */
2157   /*                                                                       */
2158   /* <Return>                                                              */
2159   /*    The glyph index.  0 means `undefined character code'.              */
2160   /*                                                                       */
2161   FT_EXPORT_DEF( FT_UInt )  FT_Get_Char_Index( FT_Face   face,
2162                                                FT_ULong  charcode );
2163
2164
2165   /*************************************************************************/
2166   /*                                                                       */
2167   /* <Function>                                                            */
2168   /*    FT_MulDiv                                                          */
2169   /*                                                                       */
2170   /* <Description>                                                         */
2171   /*    A very simple function used to perform the computation `(a*b)/c'   */
2172   /*    with maximal accuracy (it uses a 64-bit intermediate integer       */
2173   /*    whenever necessary).                                               */
2174   /*                                                                       */
2175   /*    This function isn't necessarily as fast as some processor specific */
2176   /*    operations, but is at least completely portable.                   */
2177   /*                                                                       */
2178   /* <Input>                                                               */
2179   /*    a :: The first multiplier.                                         */
2180   /*    b :: The second multiplier.                                        */
2181   /*    c :: The divisor.                                                  */
2182   /*                                                                       */
2183   /* <Return>                                                              */
2184   /*    The result of `(a*b)/c'.  This function never traps when trying to */
2185   /*    divide by zero; it simply returns `MaxInt' or `MinInt' depending   */
2186   /*    on the signs of `a' and `b'.                                       */
2187   /*                                                                       */
2188   FT_EXPORT_DEF( FT_Long )  FT_MulDiv( FT_Long  a,
2189                                        FT_Long  b,
2190                                        FT_Long  c );
2191
2192
2193   /*************************************************************************/
2194   /*                                                                       */
2195   /* <Function>                                                            */
2196   /*    FT_MulFix                                                          */
2197   /*                                                                       */
2198   /* <Description>                                                         */
2199   /*    A very simple function used to perform the computation             */
2200   /*    `(a*b)/0x10000' with maximal accuracy.  Most of the time this is   */
2201   /*    used to multiply a given value by a 16.16 fixed float factor.      */
2202   /*                                                                       */
2203   /* <Input>                                                               */
2204   /*    a :: The first multiplier.                                         */
2205   /*    b :: The second multiplier.  Use a 16.16 factor here whenever      */
2206   /*         possible (see note below).                                    */
2207   /*                                                                       */
2208   /* <Return>                                                              */
2209   /*    The result of `(a*b)/0x10000'.                                     */
2210   /*                                                                       */
2211   /* <Note>                                                                */
2212   /*    This function has been optimized for the case where the absolute   */
2213   /*    value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
2214   /*    As this happens mainly when scaling from notional units to         */
2215   /*    fractional pixels in FreeType, it resulted in noticeable speed     */
2216   /*    improvements between versions 2.x and 1.x.                         */
2217   /*                                                                       */
2218   /*    As a conclusion, always try to place a 16.16 factor as the         */
2219   /*    _second_ argument of this function; this can make a great          */
2220   /*    difference.                                                        */
2221   /*                                                                       */
2222   FT_EXPORT_DEF( FT_Long )  FT_MulFix( FT_Long  a,
2223                                        FT_Long  b );
2224
2225
2226   /*************************************************************************/
2227   /*                                                                       */
2228   /* <Function>                                                            */
2229   /*    FT_DivFix                                                          */
2230   /*                                                                       */
2231   /* <Description>                                                         */
2232   /*    A very simple function used to perform the computation             */
2233   /*    `(a*0x10000)/b' with maximal accuracy.  Most of the time, this is  */
2234   /*    used to divide a given value by a 16.16 fixed float factor.        */
2235   /*                                                                       */
2236   /* <Input>                                                               */
2237   /*    a :: The first multiplier.                                         */
2238   /*    b :: The second multiplier.  Use a 16.16 factor here whenever      */
2239   /*         possible (see note below).                                    */
2240   /*                                                                       */
2241   /* <Return>                                                              */
2242   /*    The result of `(a*0x10000)/b'.                                     */
2243   /*                                                                       */
2244   /* <Note>                                                                */
2245   /*    The optimization for FT_DivFix() is simple: If (a << 16) fits in   */
2246   /*    32 bits, then the division is computed directly.  Otherwise, we    */
2247   /*    use a specialized version of the old FT_MulDiv64().                */
2248   /*                                                                       */
2249   FT_EXPORT_DEF( FT_Long )  FT_DivFix( FT_Long  a,
2250                                        FT_Long  b );
2251
2252
2253   /*************************************************************************/
2254   /*                                                                       */
2255   /* <Function>                                                            */
2256   /*    FT_Vector_Transform                                                */
2257   /*                                                                       */
2258   /* <Description>                                                         */
2259   /*    Transforms a single vector through a 2x2 matrix.                   */
2260   /*                                                                       */
2261   /* <InOut>                                                               */
2262   /*    vector :: The target vector to transform.                          */
2263   /*                                                                       */
2264   /* <Input>                                                               */
2265   /*    matrix :: A pointer to the source 2x2 matrix.                      */
2266   /*                                                                       */
2267   /* <MT-Note>                                                             */
2268   /*    Yes.                                                               */
2269   /*                                                                       */
2270   /* <Note>                                                                */
2271   /*    The result is undefined if either `vector' or `matrix' is invalid. */
2272   /*                                                                       */
2273   FT_EXPORT_DEF( void )  FT_Vector_Transform( FT_Vector*  vec,
2274                                               FT_Matrix*  matrix );
2275
2276
2277
2278 #ifdef __cplusplus
2279   }
2280 #endif
2281
2282
2283 #endif /* FREETYPE_H */
2284
2285
2286 /* END */