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