modules/freetype2/include/freetype.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial