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