PageRenderTime 5ms CodeModel.GetById 121ms app.highlight 130ms RepoModel.GetById 167ms app.codeStats 1ms

/src/compiler/android-ndk/jni/freetype/include/freetype/freetype.h

http://ftk.googlecode.com/
C++ Header | 995 lines | 126 code | 88 blank | 781 comment | 0 complexity | 9f2d72f3be18516679a278611a5a10cf MD5 | raw file
  1/***************************************************************************/
  2/*                                                                         */
  3/*  freetype.h                                                             */
  4/*                                                                         */
  5/*    FreeType high-level API and common types (specification only).       */
  6/*                                                                         */
  7/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */
  8/*            2010 by                                                      */
  9/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 10/*                                                                         */
 11/*  This file is part of the FreeType project, and may only be used,       */
 12/*  modified, and distributed under the terms of the FreeType project      */
 13/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
 14/*  this file you indicate that you have read the license and              */
 15/*  understand and accept it fully.                                        */
 16/*                                                                         */
 17/***************************************************************************/
 18
 19
 20#ifndef FT_FREETYPE_H
 21#error "`ft2build.h' hasn't been included yet!"
 22#error "Please always use macros to include FreeType header files."
 23#error "Example:"
 24#error "  #include <ft2build.h>"
 25#error "  #include FT_FREETYPE_H"
 26#endif
 27
 28
 29#ifndef __FREETYPE_H__
 30#define __FREETYPE_H__
 31
 32
 33#include <ft2build.h>
 34#include FT_CONFIG_CONFIG_H
 35#include FT_ERRORS_H
 36#include FT_TYPES_H
 37
 38
 39FT_BEGIN_HEADER
 40
 41
 42
 43  /*************************************************************************/
 44  /*                                                                       */
 45  /* <Section>                                                             */
 46  /*    user_allocation                                                    */
 47  /*                                                                       */
 48  /* <Title>                                                               */
 49  /*    User allocation                                                    */
 50  /*                                                                       */
 51  /* <Abstract>                                                            */
 52  /*    How client applications should allocate FreeType data structures.  */
 53  /*                                                                       */
 54  /* <Description>                                                         */
 55  /*    FreeType assumes that structures allocated by the user and passed  */
 56  /*    as arguments are zeroed out except for the actual data.  In other  */
 57  /*    words, it is recommended to use `calloc' (or variants of it)       */
 58  /*    instead of `malloc' for allocation.                                */
 59  /*                                                                       */
 60  /*************************************************************************/
 61
 62
 63
 64  /*************************************************************************/
 65  /*************************************************************************/
 66  /*                                                                       */
 67  /*                        B A S I C   T Y P E S                          */
 68  /*                                                                       */
 69  /*************************************************************************/
 70  /*************************************************************************/
 71
 72
 73  /*************************************************************************/
 74  /*                                                                       */
 75  /* <Section>                                                             */
 76  /*    base_interface                                                     */
 77  /*                                                                       */
 78  /* <Title>                                                               */
 79  /*    Base Interface                                                     */
 80  /*                                                                       */
 81  /* <Abstract>                                                            */
 82  /*    The FreeType~2 base font interface.                                */
 83  /*                                                                       */
 84  /* <Description>                                                         */
 85  /*    This section describes the public high-level API of FreeType~2.    */
 86  /*                                                                       */
 87  /* <Order>                                                               */
 88  /*    FT_Library                                                         */
 89  /*    FT_Face                                                            */
 90  /*    FT_Size                                                            */
 91  /*    FT_GlyphSlot                                                       */
 92  /*    FT_CharMap                                                         */
 93  /*    FT_Encoding                                                        */
 94  /*                                                                       */
 95  /*    FT_FaceRec                                                         */
 96  /*                                                                       */
 97  /*    FT_FACE_FLAG_SCALABLE                                              */
 98  /*    FT_FACE_FLAG_FIXED_SIZES                                           */
 99  /*    FT_FACE_FLAG_FIXED_WIDTH                                           */
100  /*    FT_FACE_FLAG_HORIZONTAL                                            */
101  /*    FT_FACE_FLAG_VERTICAL                                              */
102  /*    FT_FACE_FLAG_SFNT                                                  */
103  /*    FT_FACE_FLAG_KERNING                                               */
104  /*    FT_FACE_FLAG_MULTIPLE_MASTERS                                      */
105  /*    FT_FACE_FLAG_GLYPH_NAMES                                           */
106  /*    FT_FACE_FLAG_EXTERNAL_STREAM                                       */
107  /*    FT_FACE_FLAG_FAST_GLYPHS                                           */
108  /*    FT_FACE_FLAG_HINTER                                                */
109  /*                                                                       */
110  /*    FT_STYLE_FLAG_BOLD                                                 */
111  /*    FT_STYLE_FLAG_ITALIC                                               */
112  /*                                                                       */
113  /*    FT_SizeRec                                                         */
114  /*    FT_Size_Metrics                                                    */
115  /*                                                                       */
116  /*    FT_GlyphSlotRec                                                    */
117  /*    FT_Glyph_Metrics                                                   */
118  /*    FT_SubGlyph                                                        */
119  /*                                                                       */
120  /*    FT_Bitmap_Size                                                     */
121  /*                                                                       */
122  /*    FT_Init_FreeType                                                   */
123  /*    FT_Done_FreeType                                                   */
124  /*                                                                       */
125  /*    FT_New_Face                                                        */
126  /*    FT_Done_Face                                                       */
127  /*    FT_New_Memory_Face                                                 */
128  /*    FT_Open_Face                                                       */
129  /*    FT_Open_Args                                                       */
130  /*    FT_Parameter                                                       */
131  /*    FT_Attach_File                                                     */
132  /*    FT_Attach_Stream                                                   */
133  /*                                                                       */
134  /*    FT_Set_Char_Size                                                   */
135  /*    FT_Set_Pixel_Sizes                                                 */
136  /*    FT_Request_Size                                                    */
137  /*    FT_Select_Size                                                     */
138  /*    FT_Size_Request_Type                                               */
139  /*    FT_Size_Request                                                    */
140  /*    FT_Set_Transform                                                   */
141  /*    FT_Load_Glyph                                                      */
142  /*    FT_Get_Char_Index                                                  */
143  /*    FT_Get_Name_Index                                                  */
144  /*    FT_Load_Char                                                       */
145  /*                                                                       */
146  /*    FT_OPEN_MEMORY                                                     */
147  /*    FT_OPEN_STREAM                                                     */
148  /*    FT_OPEN_PATHNAME                                                   */
149  /*    FT_OPEN_DRIVER                                                     */
150  /*    FT_OPEN_PARAMS                                                     */
151  /*                                                                       */
152  /*    FT_LOAD_DEFAULT                                                    */
153  /*    FT_LOAD_RENDER                                                     */
154  /*    FT_LOAD_MONOCHROME                                                 */
155  /*    FT_LOAD_LINEAR_DESIGN                                              */
156  /*    FT_LOAD_NO_SCALE                                                   */
157  /*    FT_LOAD_NO_HINTING                                                 */
158  /*    FT_LOAD_NO_BITMAP                                                  */
159  /*    FT_LOAD_CROP_BITMAP                                                */
160  /*                                                                       */
161  /*    FT_LOAD_VERTICAL_LAYOUT                                            */
162  /*    FT_LOAD_IGNORE_TRANSFORM                                           */
163  /*    FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH                                */
164  /*    FT_LOAD_FORCE_AUTOHINT                                             */
165  /*    FT_LOAD_NO_RECURSE                                                 */
166  /*    FT_LOAD_PEDANTIC                                                   */
167  /*                                                                       */
168  /*    FT_LOAD_TARGET_NORMAL                                              */
169  /*    FT_LOAD_TARGET_LIGHT                                               */
170  /*    FT_LOAD_TARGET_MONO                                                */
171  /*    FT_LOAD_TARGET_LCD                                                 */
172  /*    FT_LOAD_TARGET_LCD_V                                               */
173  /*                                                                       */
174  /*    FT_Render_Glyph                                                    */
175  /*    FT_Render_Mode                                                     */
176  /*    FT_Get_Kerning                                                     */
177  /*    FT_Kerning_Mode                                                    */
178  /*    FT_Get_Track_Kerning                                               */
179  /*    FT_Get_Glyph_Name                                                  */
180  /*    FT_Get_Postscript_Name                                             */
181  /*                                                                       */
182  /*    FT_CharMapRec                                                      */
183  /*    FT_Select_Charmap                                                  */
184  /*    FT_Set_Charmap                                                     */
185  /*    FT_Get_Charmap_Index                                               */
186  /*                                                                       */
187  /*    FT_FSTYPE_INSTALLABLE_EMBEDDING                                    */
188  /*    FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING                             */
189  /*    FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING                              */
190  /*    FT_FSTYPE_EDITABLE_EMBEDDING                                       */
191  /*    FT_FSTYPE_NO_SUBSETTING                                            */
192  /*    FT_FSTYPE_BITMAP_EMBEDDING_ONLY                                    */
193  /*                                                                       */
194  /*    FT_Get_FSType_Flags                                                */
195  /*                                                                       */
196  /*************************************************************************/
197
198
199  /*************************************************************************/
200  /*                                                                       */
201  /* <Struct>                                                              */
202  /*    FT_Glyph_Metrics                                                   */
203  /*                                                                       */
204  /* <Description>                                                         */
205  /*    A structure used to model the metrics of a single glyph.  The      */
206  /*    values are expressed in 26.6 fractional pixel format; if the flag  */
207  /*    @FT_LOAD_NO_SCALE has been used while loading the glyph, values    */
208  /*    are expressed in font units instead.                               */
209  /*                                                                       */
210  /* <Fields>                                                              */
211  /*    width ::                                                           */
212  /*      The glyph's width.                                               */
213  /*                                                                       */
214  /*    height ::                                                          */
215  /*      The glyph's height.                                              */
216  /*                                                                       */
217  /*    horiBearingX ::                                                    */
218  /*      Left side bearing for horizontal layout.                         */
219  /*                                                                       */
220  /*    horiBearingY ::                                                    */
221  /*      Top side bearing for horizontal layout.                          */
222  /*                                                                       */
223  /*    horiAdvance ::                                                     */
224  /*      Advance width for horizontal layout.                             */
225  /*                                                                       */
226  /*    vertBearingX ::                                                    */
227  /*      Left side bearing for vertical layout.                           */
228  /*                                                                       */
229  /*    vertBearingY ::                                                    */
230  /*      Top side bearing for vertical layout.                            */
231  /*                                                                       */
232  /*    vertAdvance ::                                                     */
233  /*      Advance height for vertical layout.                              */
234  /*                                                                       */
235  /* <Note>                                                                */
236  /*    If not disabled with @FT_LOAD_NO_HINTING, the values represent     */
237  /*    dimensions of the hinted glyph (in case hinting is applicable).    */
238  /*                                                                       */
239  typedef struct  FT_Glyph_Metrics_
240  {
241    FT_Pos  width;
242    FT_Pos  height;
243
244    FT_Pos  horiBearingX;
245    FT_Pos  horiBearingY;
246    FT_Pos  horiAdvance;
247
248    FT_Pos  vertBearingX;
249    FT_Pos  vertBearingY;
250    FT_Pos  vertAdvance;
251
252  } FT_Glyph_Metrics;
253
254
255  /*************************************************************************/
256  /*                                                                       */
257  /* <Struct>                                                              */
258  /*    FT_Bitmap_Size                                                     */
259  /*                                                                       */
260  /* <Description>                                                         */
261  /*    This structure models the metrics of a bitmap strike (i.e., a set  */
262  /*    of glyphs for a given point size and resolution) in a bitmap font. */
263  /*    It is used for the `available_sizes' field of @FT_Face.            */
264  /*                                                                       */
265  /* <Fields>                                                              */
266  /*    height :: The vertical distance, in pixels, between two            */
267  /*              consecutive baselines.  It is always positive.           */
268  /*                                                                       */
269  /*    width  :: The average width, in pixels, of all glyphs in the       */
270  /*              strike.                                                  */
271  /*                                                                       */
272  /*    size   :: The nominal size of the strike in 26.6 fractional        */
273  /*              points.  This field is not very useful.                  */
274  /*                                                                       */
275  /*    x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional   */
276  /*              pixels.                                                  */
277  /*                                                                       */
278  /*    y_ppem :: The vertical ppem (nominal height) in 26.6 fractional    */
279  /*              pixels.                                                  */
280  /*                                                                       */
281  /* <Note>                                                                */
282  /*    Windows FNT:                                                       */
283  /*      The nominal size given in a FNT font is not reliable.  Thus when */
284  /*      the driver finds it incorrect, it sets `size' to some calculated */
285  /*      values and sets `x_ppem' and `y_ppem' to the pixel width and     */
286  /*      height given in the font, respectively.                          */
287  /*                                                                       */
288  /*    TrueType embedded bitmaps:                                         */
289  /*      `size', `width', and `height' values are not contained in the    */
290  /*      bitmap strike itself.  They are computed from the global font    */
291  /*      parameters.                                                      */
292  /*                                                                       */
293  typedef struct  FT_Bitmap_Size_
294  {
295    FT_Short  height;
296    FT_Short  width;
297
298    FT_Pos    size;
299
300    FT_Pos    x_ppem;
301    FT_Pos    y_ppem;
302
303  } FT_Bitmap_Size;
304
305
306  /*************************************************************************/
307  /*************************************************************************/
308  /*                                                                       */
309  /*                     O B J E C T   C L A S S E S                       */
310  /*                                                                       */
311  /*************************************************************************/
312  /*************************************************************************/
313
314  /*************************************************************************/
315  /*                                                                       */
316  /* <Type>                                                                */
317  /*    FT_Library                                                         */
318  /*                                                                       */
319  /* <Description>                                                         */
320  /*    A handle to a FreeType library instance.  Each `library' is        */
321  /*    completely independent from the others; it is the `root' of a set  */
322  /*    of objects like fonts, faces, sizes, etc.                          */
323  /*                                                                       */
324  /*    It also embeds a memory manager (see @FT_Memory), as well as a     */
325  /*    scan-line converter object (see @FT_Raster).                       */
326  /*                                                                       */
327  /*    For multi-threading applications each thread should have its own   */
328  /*    FT_Library object.                                                 */
329  /*                                                                       */
330  /* <Note>                                                                */
331  /*    Library objects are normally created by @FT_Init_FreeType, and     */
332  /*    destroyed with @FT_Done_FreeType.                                  */
333  /*                                                                       */
334  typedef struct FT_LibraryRec_  *FT_Library;
335
336
337  /*************************************************************************/
338  /*                                                                       */
339  /* <Type>                                                                */
340  /*    FT_Module                                                          */
341  /*                                                                       */
342  /* <Description>                                                         */
343  /*    A handle to a given FreeType module object.  Each module can be a  */
344  /*    font driver, a renderer, or anything else that provides services   */
345  /*    to the formers.                                                    */
346  /*                                                                       */
347  typedef struct FT_ModuleRec_*  FT_Module;
348
349
350  /*************************************************************************/
351  /*                                                                       */
352  /* <Type>                                                                */
353  /*    FT_Driver                                                          */
354  /*                                                                       */
355  /* <Description>                                                         */
356  /*    A handle to a given FreeType font driver object.  Each font driver */
357  /*    is a special module capable of creating faces from font files.     */
358  /*                                                                       */
359  typedef struct FT_DriverRec_*  FT_Driver;
360
361
362  /*************************************************************************/
363  /*                                                                       */
364  /* <Type>                                                                */
365  /*    FT_Renderer                                                        */
366  /*                                                                       */
367  /* <Description>                                                         */
368  /*    A handle to a given FreeType renderer.  A renderer is a special    */
369  /*    module in charge of converting a glyph image to a bitmap, when     */
370  /*    necessary.  Each renderer supports a given glyph image format, and */
371  /*    one or more target surface depths.                                 */
372  /*                                                                       */
373  typedef struct FT_RendererRec_*  FT_Renderer;
374
375
376  /*************************************************************************/
377  /*                                                                       */
378  /* <Type>                                                                */
379  /*    FT_Face                                                            */
380  /*                                                                       */
381  /* <Description>                                                         */
382  /*    A handle to a given typographic face object.  A face object models */
383  /*    a given typeface, in a given style.                                */
384  /*                                                                       */
385  /* <Note>                                                                */
386  /*    Each face object also owns a single @FT_GlyphSlot object, as well  */
387  /*    as one or more @FT_Size objects.                                   */
388  /*                                                                       */
389  /*    Use @FT_New_Face or @FT_Open_Face to create a new face object from */
390  /*    a given filepathname or a custom input stream.                     */
391  /*                                                                       */
392  /*    Use @FT_Done_Face to destroy it (along with its slot and sizes).   */
393  /*                                                                       */
394  /* <Also>                                                                */
395  /*    See @FT_FaceRec for the publicly accessible fields of a given face */
396  /*    object.                                                            */
397  /*                                                                       */
398  typedef struct FT_FaceRec_*  FT_Face;
399
400
401  /*************************************************************************/
402  /*                                                                       */
403  /* <Type>                                                                */
404  /*    FT_Size                                                            */
405  /*                                                                       */
406  /* <Description>                                                         */
407  /*    A handle to an object used to model a face scaled to a given       */
408  /*    character size.                                                    */
409  /*                                                                       */
410  /* <Note>                                                                */
411  /*    Each @FT_Face has an _active_ @FT_Size object that is used by      */
412  /*    functions like @FT_Load_Glyph to determine the scaling             */
413  /*    transformation which is used to load and hint glyphs and metrics.  */
414  /*                                                                       */
415  /*    You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes,                */
416  /*    @FT_Request_Size or even @FT_Select_Size to change the content     */
417  /*    (i.e., the scaling values) of the active @FT_Size.                 */
418  /*                                                                       */
419  /*    You can use @FT_New_Size to create additional size objects for a   */
420  /*    given @FT_Face, but they won't be used by other functions until    */
421  /*    you activate it through @FT_Activate_Size.  Only one size can be   */
422  /*    activated at any given time per face.                              */
423  /*                                                                       */
424  /* <Also>                                                                */
425  /*    See @FT_SizeRec for the publicly accessible fields of a given size */
426  /*    object.                                                            */
427  /*                                                                       */
428  typedef struct FT_SizeRec_*  FT_Size;
429
430
431  /*************************************************************************/
432  /*                                                                       */
433  /* <Type>                                                                */
434  /*    FT_GlyphSlot                                                       */
435  /*                                                                       */
436  /* <Description>                                                         */
437  /*    A handle to a given `glyph slot'.  A slot is a container where it  */
438  /*    is possible to load any of the glyphs contained in its parent      */
439  /*    face.                                                              */
440  /*                                                                       */
441  /*    In other words, each time you call @FT_Load_Glyph or               */
442  /*    @FT_Load_Char, the slot's content is erased by the new glyph data, */
443  /*    i.e., the glyph's metrics, its image (bitmap or outline), and      */
444  /*    other control information.                                         */
445  /*                                                                       */
446  /* <Also>                                                                */
447  /*    See @FT_GlyphSlotRec for the publicly accessible glyph fields.     */
448  /*                                                                       */
449  typedef struct FT_GlyphSlotRec_*  FT_GlyphSlot;
450
451
452  /*************************************************************************/
453  /*                                                                       */
454  /* <Type>                                                                */
455  /*    FT_CharMap                                                         */
456  /*                                                                       */
457  /* <Description>                                                         */
458  /*    A handle to a given character map.  A charmap is used to translate */
459  /*    character codes in a given encoding into glyph indexes for its     */
460  /*    parent's face.  Some font formats may provide several charmaps per */
461  /*    font.                                                              */
462  /*                                                                       */
463  /*    Each face object owns zero or more charmaps, but only one of them  */
464  /*    can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char.   */
465  /*                                                                       */
466  /*    The list of available charmaps in a face is available through the  */
467  /*    `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec.   */
468  /*                                                                       */
469  /*    The currently active charmap is available as `face->charmap'.      */
470  /*    You should call @FT_Set_Charmap to change it.                      */
471  /*                                                                       */
472  /* <Note>                                                                */
473  /*    When a new face is created (either through @FT_New_Face or         */
474  /*    @FT_Open_Face), the library looks for a Unicode charmap within     */
475  /*    the list and automatically activates it.                           */
476  /*                                                                       */
477  /* <Also>                                                                */
478  /*    See @FT_CharMapRec for the publicly accessible fields of a given   */
479  /*    character map.                                                     */
480  /*                                                                       */
481  typedef struct FT_CharMapRec_*  FT_CharMap;
482
483
484  /*************************************************************************/
485  /*                                                                       */
486  /* <Macro>                                                               */
487  /*    FT_ENC_TAG                                                         */
488  /*                                                                       */
489  /* <Description>                                                         */
490  /*    This macro converts four-letter tags into an unsigned long.  It is */
491  /*    used to define `encoding' identifiers (see @FT_Encoding).          */
492  /*                                                                       */
493  /* <Note>                                                                */
494  /*    Since many 16-bit compilers don't like 32-bit enumerations, you    */
495  /*    should redefine this macro in case of problems to something like   */
496  /*    this:                                                              */
497  /*                                                                       */
498  /*    {                                                                  */
499  /*      #define FT_ENC_TAG( value, a, b, c, d )  value                   */
500  /*    }                                                                  */
501  /*                                                                       */
502  /*    to get a simple enumeration without assigning special numbers.     */
503  /*                                                                       */
504
505#ifndef FT_ENC_TAG
506#define FT_ENC_TAG( value, a, b, c, d )         \
507          value = ( ( (FT_UInt32)(a) << 24 ) |  \
508                    ( (FT_UInt32)(b) << 16 ) |  \
509                    ( (FT_UInt32)(c) <<  8 ) |  \
510                      (FT_UInt32)(d)         )
511
512#endif /* FT_ENC_TAG */
513
514
515  /*************************************************************************/
516  /*                                                                       */
517  /* <Enum>                                                                */
518  /*    FT_Encoding                                                        */
519  /*                                                                       */
520  /* <Description>                                                         */
521  /*    An enumeration used to specify character sets supported by         */
522  /*    charmaps.  Used in the @FT_Select_Charmap API function.            */
523  /*                                                                       */
524  /* <Note>                                                                */
525  /*    Despite the name, this enumeration lists specific character        */
526  /*    repertories (i.e., charsets), and not text encoding methods (e.g., */
527  /*    UTF-8, UTF-16, etc.).                                              */
528  /*                                                                       */
529  /*    Other encodings might be defined in the future.                    */
530  /*                                                                       */
531  /* <Values>                                                              */
532  /*    FT_ENCODING_NONE ::                                                */
533  /*      The encoding value~0 is reserved.                                */
534  /*                                                                       */
535  /*    FT_ENCODING_UNICODE ::                                             */
536  /*      Corresponds to the Unicode character set.  This value covers     */
537  /*      all versions of the Unicode repertoire, including ASCII and      */
538  /*      Latin-1.  Most fonts include a Unicode charmap, but not all      */
539  /*      of them.                                                         */
540  /*                                                                       */
541  /*      For example, if you want to access Unicode value U+1F028 (and    */
542  /*      the font contains it), use value 0x1F028 as the input value for  */
543  /*      @FT_Get_Char_Index.                                              */
544  /*                                                                       */
545  /*    FT_ENCODING_MS_SYMBOL ::                                           */
546  /*      Corresponds to the Microsoft Symbol encoding, used to encode     */
547  /*      mathematical symbols in the 32..255 character code range.  For   */
548  /*      more information, see `http://www.ceviz.net/symbol.htm'.         */
549  /*                                                                       */
550  /*    FT_ENCODING_SJIS ::                                                */
551  /*      Corresponds to Japanese SJIS encoding.  More info at             */
552  /*      at `http://langsupport.japanreference.com/encoding.shtml'.       */
553  /*      See note on multi-byte encodings below.                          */
554  /*                                                                       */
555  /*    FT_ENCODING_GB2312 ::                                              */
556  /*      Corresponds to an encoding system for Simplified Chinese as used */
557  /*      used in mainland China.                                          */
558  /*                                                                       */
559  /*    FT_ENCODING_BIG5 ::                                                */
560  /*      Corresponds to an encoding system for Traditional Chinese as     */
561  /*      used in Taiwan and Hong Kong.                                    */
562  /*                                                                       */
563  /*    FT_ENCODING_WANSUNG ::                                             */
564  /*      Corresponds to the Korean encoding system known as Wansung.      */
565  /*      For more information see                                         */
566  /*      `http://www.microsoft.com/typography/unicode/949.txt'.           */
567  /*                                                                       */
568  /*    FT_ENCODING_JOHAB ::                                               */
569  /*      The Korean standard character set (KS~C 5601-1992), which        */
570  /*      corresponds to MS Windows code page 1361.  This character set    */
571  /*      includes all possible Hangeul character combinations.            */
572  /*                                                                       */
573  /*    FT_ENCODING_ADOBE_LATIN_1 ::                                       */
574  /*      Corresponds to a Latin-1 encoding as defined in a Type~1         */
575  /*      PostScript font.  It is limited to 256 character codes.          */
576  /*                                                                       */
577  /*    FT_ENCODING_ADOBE_STANDARD ::                                      */
578  /*      Corresponds to the Adobe Standard encoding, as found in Type~1,  */
579  /*      CFF, and OpenType/CFF fonts.  It is limited to 256 character     */
580  /*      codes.                                                           */
581  /*                                                                       */
582  /*    FT_ENCODING_ADOBE_EXPERT ::                                        */
583  /*      Corresponds to the Adobe Expert encoding, as found in Type~1,    */
584  /*      CFF, and OpenType/CFF fonts.  It is limited to 256 character     */
585  /*      codes.                                                           */
586  /*                                                                       */
587  /*    FT_ENCODING_ADOBE_CUSTOM ::                                        */
588  /*      Corresponds to a custom encoding, as found in Type~1, CFF, and   */
589  /*      OpenType/CFF fonts.  It is limited to 256 character codes.       */
590  /*                                                                       */
591  /*    FT_ENCODING_APPLE_ROMAN ::                                         */
592  /*      Corresponds to the 8-bit Apple roman encoding.  Many TrueType    */
593  /*      and OpenType fonts contain a charmap for this encoding, since    */
594  /*      older versions of Mac OS are able to use it.                     */
595  /*                                                                       */
596  /*    FT_ENCODING_OLD_LATIN_2 ::                                         */
597  /*      This value is deprecated and was never used nor reported by      */
598  /*      FreeType.  Don't use or test for it.                             */
599  /*                                                                       */
600  /*    FT_ENCODING_MS_SJIS ::                                             */
601  /*      Same as FT_ENCODING_SJIS.  Deprecated.                           */
602  /*                                                                       */
603  /*    FT_ENCODING_MS_GB2312 ::                                           */
604  /*      Same as FT_ENCODING_GB2312.  Deprecated.                         */
605  /*                                                                       */
606  /*    FT_ENCODING_MS_BIG5 ::                                             */
607  /*      Same as FT_ENCODING_BIG5.  Deprecated.                           */
608  /*                                                                       */
609  /*    FT_ENCODING_MS_WANSUNG ::                                          */
610  /*      Same as FT_ENCODING_WANSUNG.  Deprecated.                        */
611  /*                                                                       */
612  /*    FT_ENCODING_MS_JOHAB ::                                            */
613  /*      Same as FT_ENCODING_JOHAB.  Deprecated.                          */
614  /*                                                                       */
615  /* <Note>                                                                */
616  /*    By default, FreeType automatically synthesizes a Unicode charmap   */
617  /*    for PostScript fonts, using their glyph names dictionaries.        */
618  /*    However, it also reports the encodings defined explicitly in the   */
619  /*    font file, for the cases when they are needed, with the Adobe      */
620  /*    values as well.                                                    */
621  /*                                                                       */
622  /*    FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap  */
623  /*    is neither Unicode nor ISO-8859-1 (otherwise it is set to          */
624  /*    FT_ENCODING_UNICODE).  Use @FT_Get_BDF_Charset_ID to find out      */
625  /*    which encoding is really present.  If, for example, the            */
626  /*    `cs_registry' field is `KOI8' and the `cs_encoding' field is `R',  */
627  /*    the font is encoded in KOI8-R.                                     */
628  /*                                                                       */
629  /*    FT_ENCODING_NONE is always set (with a single exception) by the    */
630  /*    winfonts driver.  Use @FT_Get_WinFNT_Header and examine the        */
631  /*    `charset' field of the @FT_WinFNT_HeaderRec structure to find out  */
632  /*    which encoding is really present.  For example,                    */
633  /*    @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for       */
634  /*    Russian).                                                          */
635  /*                                                                       */
636  /*    FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
637  /*    and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to  */
638  /*    FT_ENCODING_APPLE_ROMAN).                                          */
639  /*                                                                       */
640  /*    If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function       */
641  /*    @FT_Get_CMap_Language_ID  to query the Mac language ID which may   */
642  /*    be needed to be able to distinguish Apple encoding variants.  See  */
643  /*                                                                       */
644  /*      http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT  */
645  /*                                                                       */
646  /*    to get an idea how to do that.  Basically, if the language ID      */
647  /*    is~0, don't use it, otherwise subtract 1 from the language ID.     */
648  /*    Then examine `encoding_id'.  If, for example, `encoding_id' is     */
649  /*    @TT_MAC_ID_ROMAN and the language ID (minus~1) is                  */
650  /*    `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman.        */
651  /*    @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi       */
652  /*    variant the Arabic encoding.                                       */
653  /*                                                                       */
654  typedef enum  FT_Encoding_
655  {
656    FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
657
658    FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
659    FT_ENC_TAG( FT_ENCODING_UNICODE,   'u', 'n', 'i', 'c' ),
660
661    FT_ENC_TAG( FT_ENCODING_SJIS,    's', 'j', 'i', 's' ),
662    FT_ENC_TAG( FT_ENCODING_GB2312,  'g', 'b', ' ', ' ' ),
663    FT_ENC_TAG( FT_ENCODING_BIG5,    'b', 'i', 'g', '5' ),
664    FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
665    FT_ENC_TAG( FT_ENCODING_JOHAB,   'j', 'o', 'h', 'a' ),
666
667    /* for backwards compatibility */
668    FT_ENCODING_MS_SJIS    = FT_ENCODING_SJIS,
669    FT_ENCODING_MS_GB2312  = FT_ENCODING_GB2312,
670    FT_ENCODING_MS_BIG5    = FT_ENCODING_BIG5,
671    FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
672    FT_ENCODING_MS_JOHAB   = FT_ENCODING_JOHAB,
673
674    FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
675    FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT,   'A', 'D', 'B', 'E' ),
676    FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM,   'A', 'D', 'B', 'C' ),
677    FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1,  'l', 'a', 't', '1' ),
678
679    FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
680
681    FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
682
683  } FT_Encoding;
684
685
686  /*************************************************************************/
687  /*                                                                       */
688  /* <Enum>                                                                */
689  /*    ft_encoding_xxx                                                    */
690  /*                                                                       */
691  /* <Description>                                                         */
692  /*    These constants are deprecated; use the corresponding @FT_Encoding */
693  /*    values instead.                                                    */
694  /*                                                                       */
695#define ft_encoding_none            FT_ENCODING_NONE
696#define ft_encoding_unicode         FT_ENCODING_UNICODE
697#define ft_encoding_symbol          FT_ENCODING_MS_SYMBOL
698#define ft_encoding_latin_1         FT_ENCODING_ADOBE_LATIN_1
699#define ft_encoding_latin_2         FT_ENCODING_OLD_LATIN_2
700#define ft_encoding_sjis            FT_ENCODING_SJIS
701#define ft_encoding_gb2312          FT_ENCODING_GB2312
702#define ft_encoding_big5            FT_ENCODING_BIG5
703#define ft_encoding_wansung         FT_ENCODING_WANSUNG
704#define ft_encoding_johab           FT_ENCODING_JOHAB
705
706#define ft_encoding_adobe_standard  FT_ENCODING_ADOBE_STANDARD
707#define ft_encoding_adobe_expert    FT_ENCODING_ADOBE_EXPERT
708#define ft_encoding_adobe_custom    FT_ENCODING_ADOBE_CUSTOM
709#define ft_encoding_apple_roman     FT_ENCODING_APPLE_ROMAN
710
711
712  /*************************************************************************/
713  /*                                                                       */
714  /* <Struct>                                                              */
715  /*    FT_CharMapRec                                                      */
716  /*                                                                       */
717  /* <Description>                                                         */
718  /*    The base charmap structure.                                        */
719  /*                                                                       */
720  /* <Fields>                                                              */
721  /*    face        :: A handle to the parent face object.                 */
722  /*                                                                       */
723  /*    encoding    :: An @FT_Encoding tag identifying the charmap.  Use   */
724  /*                   this with @FT_Select_Charmap.                       */
725  /*                                                                       */
726  /*    platform_id :: An ID number describing the platform for the        */
727  /*                   following encoding ID.  This comes directly from    */
728  /*                   the TrueType specification and should be emulated   */
729  /*                   for other formats.                                  */
730  /*                                                                       */
731  /*    encoding_id :: A platform specific encoding number.  This also     */
732  /*                   comes from the TrueType specification and should be */
733  /*                   emulated similarly.                                 */
734  /*                                                                       */
735  typedef struct  FT_CharMapRec_
736  {
737    FT_Face      face;
738    FT_Encoding  encoding;
739    FT_UShort    platform_id;
740    FT_UShort    encoding_id;
741
742  } FT_CharMapRec;
743
744
745  /*************************************************************************/
746  /*************************************************************************/
747  /*                                                                       */
748  /*                 B A S E   O B J E C T   C L A S S E S                 */
749  /*                                                                       */
750  /*************************************************************************/
751  /*************************************************************************/
752
753
754  /*************************************************************************/
755  /*                                                                       */
756  /* <Type>                                                                */
757  /*    FT_Face_Internal                                                   */
758  /*                                                                       */
759  /* <Description>                                                         */
760  /*    An opaque handle to an `FT_Face_InternalRec' structure, used to    */
761  /*    model private data of a given @FT_Face object.                     */
762  /*                                                                       */
763  /*    This structure might change between releases of FreeType~2 and is  */
764  /*    not generally available to client applications.                    */
765  /*                                                                       */
766  typedef struct FT_Face_InternalRec_*  FT_Face_Internal;
767
768
769  /*************************************************************************/
770  /*                                                                       */
771  /* <Struct>                                                              */
772  /*    FT_FaceRec                                                         */
773  /*                                                                       */
774  /* <Description>                                                         */
775  /*    FreeType root face class structure.  A face object models a        */
776  /*    typeface in a font file.                                           */
777  /*                                                                       */
778  /* <Fields>                                                              */
779  /*    num_faces           :: The number of faces in the font file.  Some */
780  /*                           font formats can have multiple faces in     */
781  /*                           a font file.                                */
782  /*                                                                       */
783  /*    face_index          :: The index of the face in the font file.  It */
784  /*                           is set to~0 if there is only one face in    */
785  /*                           the font file.                              */
786  /*                                                                       */
787  /*    face_flags          :: A set of bit flags that give important      */
788  /*                           information about the face; see             */
789  /*                           @FT_FACE_FLAG_XXX for the details.          */
790  /*                                                                       */
791  /*    style_flags         :: A set of bit flags indicating the style of  */
792  /*                           the face; see @FT_STYLE_FLAG_XXX for the    */
793  /*                           details.                                    */
794  /*                                                                       */
795  /*    num_glyphs          :: The number of glyphs in the face.  If the   */
796  /*                           face is scalable and has sbits (see         */
797  /*                           `num_fixed_sizes'), it is set to the number */
798  /*                           of outline glyphs.                          */
799  /*                                                                       */
800  /*                           For CID-keyed fonts, this value gives the   */
801  /*                           highest CID used in the font.               */
802  /*                                                                       */
803  /*    family_name         :: The face's family name.  This is an ASCII   */
804  /*                           string, usually in English, which describes */
805  /*                           the typeface's family (like `Times New      */
806  /*                           Roman', `Bodoni', `Garamond', etc).  This   */
807  /*                           is a least common denominator used to list  */
808  /*                           fonts.  Some formats (TrueType & OpenType)  */
809  /*                           provide localized and Unicode versions of   */
810  /*                           this string.  Applications should use the   */
811  /*                           format specific interface to access them.   */
812  /*                           Can be NULL (e.g., in fonts embedded in a   */
813  /*                           PDF file).                                  */
814  /*                                                                       */
815  /*    style_name          :: The face's style name.  This is an ASCII    */
816  /*                           string, usually in English, which describes */
817  /*                           the typeface's style (like `Italic',        */
818  /*                           `Bold', `Condensed', etc).  Not all font    */
819  /*                           formats provide a style name, so this field */
820  /*                           is optional, and can be set to NULL.  As    */
821  /*                           for `family_name', some formats provide     */
822  /*                           localized and Unicode versions of this      */
823  /*                           string.  Applications should use the format */
824  /*                           specific interface to access them.          */
825  /*                                                                       */
826  /*    num_fixed_sizes     :: The number of bitmap strikes in the face.   */
827  /*                           Even if the face is scalable, there might   */
828  /*                           still be bitmap strikes, which are called   */
829  /*                           `sbits' in that case.                       */
830  /*                                                                       */
831  /*    available_sizes     :: An array of @FT_Bitmap_Size for all bitmap  */
832  /*                           strikes in the face.  It is set to NULL if  */
833  /*                           there is no bitmap strike.                  */
834  /*                                                                       */
835  /*    num_charmaps        :: The number of charmaps in the face.         */
836  /*                                                                       */
837  /*    charmaps            :: An array of the charmaps of the face.       */
838  /*                                                                       */
839  /*    generic             :: A field reserved for client uses.  See the  */
840  /*                           @FT_Generic type description.               */
841  /*                                                                       */
842  /*    bbox                :: The font bounding box.  Coordinates are     */
843  /*                           expressed in font units (see                */
844  /*                           `units_per_EM').  The box is large enough   */
845  /*                           to contain any glyph from the font.  Thus,  */
846  /*                           `bbox.yMax' can be seen as the `maximal     */
847  /*                           ascender', and `bbox.yMin' as the `minimal  */
848  /*                           descender'.  Only relevant for scalable     */
849  /*                           formats.                                    */
850  /*                                                                       */
851  /*                           Note that the bounding box might be off by  */
852  /*                           (at least) one pixel for hinted fonts.  See */
853  /*                           @FT_Size_Metrics for further discussion.    */
854  /*                                                                       */
855  /*    units_per_EM        :: The number of font units per EM square for  */
856  /*                           this face.  This is typically 2048 for      */
857  /*                           TrueType fonts, and 1000 for Type~1 fonts.  */
858  /*                           Only relevant for scalable formats.         */
859  /*                                                                       */
860  /*    ascender            :: The typographic ascender of the face,       */
861  /*                           expressed in font units.  For font formats  */
862  /*                           not having this information, it is set to   */
863  /*                           `bbox.yMax'.  Only relevant for scalable    */
864  /*                           formats.                                    */
865  /*                                                                       */
866  /*    descender           :: The typographic descender of the face,      */
867  /*                           expressed in font units.  For font formats  */
868  /*                           not having this information, it is set to   */
869  /*                           `bbox.yMin'.  Note that this field is       */
870  /*                           usually negative.  Only relevant for        */
871  /*                           scalable formats.                           */
872  /*                                                                       */
873  /*    height              :: The height is the vertical distance         */
874  /*                           between two consecutive baselines,          */
875  /*                           expressed in font units.  It is always      */
876  /*                           positive.  Only relevant for scalable       */
877  /*                           formats.                                    */
878  /*                                                                       */
879  /*    max_advance_width   :: The maximal advance width, in font units,   */
880  /*                           for all glyphs in this face.  This can be   */
881  /*                           used to make word wrapping computations     */
882  /*                           faster.  Only relevant for scalable         */
883  /*                           formats.                                    */
884  /*                                                                       */
885  /*    max_advance_height  :: The maximal advance height, in font units,  */
886  /*                           for all glyphs in this face.  This is only  */
887  /*                           relevant for vertical layouts, and is set   */
888  /*                           to `height' for fonts that do not provide   */
889  /*                           vertical metrics.  Only relevant for        */
890  /*                           scalable formats.                           */
891  /*                                                                       */
892  /*    underline_position  :: The position, in font units, of the         */
893  /*                           underline line for this face.  It is the    */
894  /*                           center of the underlining stem.  Only       */
895  /*                           relevant for scalable formats.              */
896  /*                                                                       */
897  /*    underline_thickness :: The thickness, in font units, of the        */
898  /*                           underline for this face.  Only relevant for */
899  /*                           scalable formats.                           */
900  /*                                                                       */
901  /*    glyph               :: The face's associated glyph slot(s).        */
902  /*                                                                       */
903  /*    size                :: The current active size for this face.      */
904  /*                                                                       */
905  /*    charmap             :: The current active charmap for this face.   */
906  /*                                                                       */
907  /* <Note>                                                                */
908  /*    Fields may be changed after a call to @FT_Attach_File or           */
909  /*    @FT_Attach_Stream.                                                 */
910  /*                                                                       */
911  typedef struct  FT_FaceRec_
912  {
913    FT_Long           num_faces;
914    FT_Long           face_index;
915
916    FT_Long           face_flags;
917    FT_Long           style_flags;
918
919    FT_Long           num_glyphs;
920
921    FT_String*        family_name;
922    FT_String*        style_name;
923
924    FT_Int            num_fixed_sizes;
925    FT_Bitmap_Size*   available_sizes;
926
927    FT_Int            num_charmaps;
928    FT_CharMap*       charmaps;
929
930    FT_Generic        generic;
931
932    /*# The following member variables (down to `underline_thickness') */
933    /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size    */
934    /*# for bitmap fonts.                                              */
935    FT_BBox           bbox;
936
937    FT_UShort         units_per_EM;
938    FT_Short          ascender;
939    FT_Short          descender;
940    FT_Short          height;
941
942    FT_Short          max_advance_width;
943    FT_Short          max_advance_height;
944
945    FT_Short          underline_position;
946    FT_Short          underline_thickness;
947
948    FT_GlyphSlot      glyph;
949    FT_Size           size;
950    FT_CharMap        charmap;
951
952    /*@private begin */
953
954    FT_Driver         driver;
955    FT_Memory         memory;
956    FT_Stream         stream;
957
958    FT_ListRec        sizes_list;
959
960    FT_Generic        autohint;
961    void*             extensions;
962
963    FT_Face_Internal  internal;
964
965    /*@private end */
966
967  } FT_FaceRec;
968
969
970  /*************************************************************************/
971  /*                                                                       */
972  /* <Enum>                                                                */
973  /*    FT_FACE_FLAG_XXX                                                   */
974  /*                                                                       */
975  /* <Description>                                                         */
976  /*    A list of bit flags used in the `face_flags' field of the          */
977  /*    @FT_FaceRec structure.  They inform client applications of         */
978  /*    properties of the corresponding face.                              */
979  /*                                                                       */
980  /* <Values>                                                              */
981  /*    FT_FACE_FLAG_SCALABLE ::                                           */
982  /*      Indicates that the face contains outline glyphs.  This doesn't   */
983  /*      prevent bitmap strikes, i.e., a face can have both this and      */
984  /*      and @FT_FACE_FLAG_FIXED_SIZES set.                               */
985  /*                                                                       */
986  /*    FT_FACE_FLAG_FIXED_SIZES ::                                        */
987  /*      Indicates that the face contains bitmap strikes.  See also the   */
988  /*      `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec.   */
989  /*                                                                       */
990  /*    FT_FACE_FLAG_FIXED_WIDTH ::                                        */
991  /*      Indicates that the face contains fixed-width characters (like    */
992  /*      Courier, Lucido, MonoType, etc.).                                */
993  /*                                                                       */
994  /*    FT_FACE_FLAG_SFNT ::                                               */
995  /*      Indicates that the face uses th