tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ftmm.h (27783B)


      1 /****************************************************************************
      2 *
      3 * ftmm.h
      4 *
      5 *   FreeType variation font interface (specification).
      6 *
      7 * Copyright (C) 1996-2025 by
      8 * David Turner, Robert Wilhelm, and Werner Lemberg.
      9 *
     10 * This file is part of the FreeType project, and may only be used,
     11 * modified, and distributed under the terms of the FreeType project
     12 * license, LICENSE.TXT.  By continuing to use, modify, or distribute
     13 * this file you indicate that you have read the license and
     14 * understand and accept it fully.
     15 *
     16 */
     17 
     18 
     19 #ifndef FTMM_H_
     20 #define FTMM_H_
     21 
     22 #include <freetype/freetype.h>
     23 
     24 #ifdef FREETYPE_H
     25 #error "freetype.h of FreeType 1 has been loaded!"
     26 #error "Please fix the directory search order for header files"
     27 #error "so that freetype.h of FreeType 2 is found first."
     28 #endif
     29 
     30 
     31 FT_BEGIN_HEADER
     32 
     33 
     34  /**************************************************************************
     35   *
     36   * @section:
     37   *   multiple_masters
     38   *
     39   * @title:
     40   *   OpenType Font Variations, TrueType GX, and Adobe MM Fonts
     41   *
     42   * @abstract:
     43   *   How to manage variable fonts with multiple design axes.
     44   *
     45   * @description:
     46   *   The following types and functions manage OpenType Font Variations,
     47   *   Adobe Multiple Master (MM) fonts, and Apple TrueType GX fonts.  These
     48   *   formats have in common that they allow the selection of specific
     49   *   design instances by setting design coordinates for one or more axes
     50   *   like font weight or width.
     51   *
     52   *   For historical reasons there are two interfaces.  The first, older one
     53   *   can be used with Adobe MM fonts only, and the second, newer one is a
     54   *   unified interface that handles all three font formats.  However, some
     55   *   differences remain and are documented accordingly; in particular,
     56   *   Adobe MM fonts don't have named instances (see below).
     57   *
     58   *   For Adobe MM fonts, macro @FT_IS_SFNT returns false.  For TrueType GX
     59   *   and OpenType Font Variations, it returns true.
     60   *
     61   *   We use mostly the terminology of the OpenType standard.  Here are some
     62   *   important technical terms.
     63   *
     64   *   * A 'named instance' is a tuple of design coordinates that has a
     65   *     string ID (i.e., an index into the font's 'name' table) associated
     66   *     with it.  The font can tell the user that, for example,
     67   *     [Weight=700,Width=110] is 'Bold'.  Another name for 'named instance'
     68   *     is 'named style'.
     69   *
     70   *       Adobe MM fonts don't have named instances.
     71   *
     72   *   * The 'default instance' of a variation font is that instance for
     73   *     which the nth axis coordinate is equal to the nth default axis
     74   *     coordinate (i.e., `axis[n].def` as specified in the @FT_MM_Var
     75   *     structure), with~n covering all axes.  In TrueType GX and OpenType
     76   *     Font Variations, the default instance is explicitly given.  In Adobe
     77   *     MM fonts, the `WeightVector` entry as found in the font file is
     78   *     taken as the default instance.
     79   *
     80   *       For TrueType GX and OpenType Font Variations, FreeType synthesizes
     81   *       a named instance for the default instance if the font does not
     82   *       contain such an entry.
     83   *
     84   *   * 'Design coordinates' are the axis values found in a variation font
     85   *      file.  Their meaning is specified by the font designer and the
     86   *      values are rather arbitrary.
     87   *
     88   *       For example, the 'weight' axis in design coordinates might vary
     89   *       between 100 (thin) and 900 (heavy) in font~A, while font~B
     90   *       contains values between 400 (normal) and 800 (extra bold).
     91   *
     92   *   * 'Normalized coordinates' are design coordinates mapped to a standard
     93   *     range; they are also called 'blend coordinates'.
     94   *
     95   *       For TrueType GX and OpenType Font Variations, the range is [-1;1],
     96   *       with the minimum mapped to value~-1, the default mapped to
     97   *       value~0, and the maximum mapped to value~1, and all other
     98   *       coordinates mapped to intervening points.  Please look up the
     99   *       [OpenType
    100   *       specification](https://learn.microsoft.com/en-us/typography/opentype/spec/otvaroverview)
    101   *       on how this mapping works in detail.
    102   *
    103   *       For Adobe MM fonts, this standard range is [0;1], with the minimum
    104   *       mapped to value~0 and the maximum mapped to value~1, and all other
    105   *       coordinates mapped to intervening points.  Please look up [Adobe
    106   *       TechNote
    107   *       #5015](https://adobe-type-tools.github.io/font-tech-notes/pdfs/5015.Type1_Supp.pdf)
    108   *       on how this mapping works in detail.
    109   *
    110   *       Assuming that the two fonts in the previous example are OpenType
    111   *       Font Variations, both font~A's [100;900] and font~B's [400;800]
    112   *       coordinate ranges get mapped to [-1;1].
    113   */
    114 
    115 
    116  /**************************************************************************
    117   *
    118   * @enum:
    119   *   T1_MAX_MM_XXX
    120   *
    121   * @description:
    122   *   Adobe MM font limits as defined in their specifications.
    123   *
    124   * @values:
    125   *   T1_MAX_MM_AXIS ::
    126   *     The maximum number of Adobe MM font axes.
    127   *
    128   *   T1_MAX_MM_DESIGNS ::
    129   *     The maximum number of Adobe MM font designs.
    130   *
    131   *   T1_MAX_MM_MAP_POINTS ::
    132   *     The maximum number of elements in a design map.
    133   *
    134   */
    135 #define T1_MAX_MM_AXIS         4
    136 #define T1_MAX_MM_DESIGNS     16
    137 #define T1_MAX_MM_MAP_POINTS  20
    138 
    139 
    140  /**************************************************************************
    141   *
    142   * @struct:
    143   *   FT_MM_Axis
    144   *
    145   * @description:
    146   *   A structure to model a given axis in design space for Adobe MM fonts.
    147   *
    148   *   This structure can't be used with TrueType GX or OpenType Font
    149   *   Variations.
    150   *
    151   * @fields:
    152   *   name ::
    153   *     The axis's name.
    154   *
    155   *   minimum ::
    156   *     The axis's minimum design coordinate.
    157   *
    158   *   maximum ::
    159   *     The axis's maximum design coordinate.
    160   */
    161  typedef struct  FT_MM_Axis_
    162  {
    163    FT_String*  name;
    164    FT_Long     minimum;
    165    FT_Long     maximum;
    166 
    167  } FT_MM_Axis;
    168 
    169 
    170  /**************************************************************************
    171   *
    172   * @struct:
    173   *   FT_Multi_Master
    174   *
    175   * @description:
    176   *   A structure to model the axes and space of an Adobe MM font.
    177   *
    178   *   This structure can't be used with TrueType GX or OpenType Font
    179   *   Variations.
    180   *
    181   * @fields:
    182   *   num_axis ::
    183   *     Number of axes.  Cannot exceed~4.
    184   *
    185   *   num_designs ::
    186   *     Number of designs; should be normally `2^num_axis` even though the
    187   *     Type~1 specification strangely allows for intermediate designs to be
    188   *     present.  This number cannot exceed~16.
    189   *
    190   *   axis ::
    191   *     A table of axis descriptors.
    192   */
    193  typedef struct  FT_Multi_Master_
    194  {
    195    FT_UInt     num_axis;
    196    FT_UInt     num_designs;
    197    FT_MM_Axis  axis[T1_MAX_MM_AXIS];
    198 
    199  } FT_Multi_Master;
    200 
    201 
    202  /**************************************************************************
    203   *
    204   * @struct:
    205   *   FT_Var_Axis
    206   *
    207   * @description:
    208   *   A structure to model a given axis in design space for Adobe MM fonts,
    209   *   TrueType GX, and OpenType Font Variations.
    210   *
    211   * @fields:
    212   *   name ::
    213   *     The axis's name.  Not always meaningful for TrueType GX or OpenType
    214   *     Font Variations.
    215   *
    216   *   minimum ::
    217   *     The axis's minimum design coordinate.
    218   *
    219   *   def ::
    220   *     The axis's default design coordinate.  FreeType computes meaningful
    221   *     default values for Adobe MM fonts.
    222   *
    223   *   maximum ::
    224   *     The axis's maximum design coordinate.
    225   *
    226   *   tag ::
    227   *     The axis's tag (the equivalent to 'name' for TrueType GX and
    228   *     OpenType Font Variations).  FreeType provides default values for
    229   *     Adobe MM fonts if possible.
    230   *
    231   *   strid ::
    232   *     The axis name entry in the font's 'name' table.  This is another
    233   *     (and often better) version of the 'name' field for TrueType GX or
    234   *     OpenType Font Variations.  Not meaningful for Adobe MM fonts.
    235   *
    236   * @note:
    237   *   The fields `minimum`, `def`, and `maximum` are 16.16 fractional values
    238   *   for TrueType GX and OpenType Font Variations.  For Adobe MM fonts, the
    239   *   values are whole numbers (i.e., the fractional part is zero).
    240   */
    241  typedef struct  FT_Var_Axis_
    242  {
    243    FT_String*  name;
    244 
    245    FT_Fixed    minimum;
    246    FT_Fixed    def;
    247    FT_Fixed    maximum;
    248 
    249    FT_ULong    tag;
    250    FT_UInt     strid;
    251 
    252  } FT_Var_Axis;
    253 
    254 
    255  /**************************************************************************
    256   *
    257   * @struct:
    258   *   FT_Var_Named_Style
    259   *
    260   * @description:
    261   *   A structure to model a named instance in a TrueType GX or OpenType
    262   *   Font Variations.
    263   *
    264   *   This structure can't be used for Adobe MM fonts.
    265   *
    266   * @fields:
    267   *   coords ::
    268   *     The design coordinates for this instance.  This is an array with one
    269   *     entry for each axis.
    270   *
    271   *   strid ::
    272   *     An index into the 'name' table identifying this instance.
    273   *
    274   *   psid ::
    275   *     An index into the 'name' table identifying a PostScript name for
    276   *     this instance.  Value 0xFFFF indicates a missing entry.
    277   */
    278  typedef struct  FT_Var_Named_Style_
    279  {
    280    FT_Fixed*  coords;
    281    FT_UInt    strid;
    282    FT_UInt    psid;   /* since 2.7.1 */
    283 
    284  } FT_Var_Named_Style;
    285 
    286 
    287  /**************************************************************************
    288   *
    289   * @struct:
    290   *   FT_MM_Var
    291   *
    292   * @description:
    293   *   A structure to model the axes and space of Adobe MM fonts, TrueType
    294   *   GX, or OpenType Font Variations.
    295   *
    296   *   Some fields are specific to one format and not to the others.
    297   *
    298   * @fields:
    299   *   num_axis ::
    300   *     The number of axes.  The maximum value is~4 for Adobe MM fonts; no
    301   *     limit in TrueType GX or OpenType Font Variations.
    302   *
    303   *   num_designs ::
    304   *     The number of designs; should be normally `2^num_axis` for Adobe MM
    305   *     fonts.  Not meaningful for TrueType GX or OpenType Font Variations
    306   *     (where every glyph could have a different number of designs).
    307   *
    308   *   num_namedstyles ::
    309   *     The number of named instances.  For Adobe MM fonts, this value is
    310   *     always zero.
    311   *
    312   *   axis ::
    313   *     An axis descriptor table.  TrueType GX and OpenType Font Variations
    314   *     contain slightly more data than Adobe MM fonts.  Memory management
    315   *     of this pointer is done internally by FreeType.
    316   *
    317   *   namedstyle ::
    318   *     An array of named instances.  Only meaningful for TrueType GX and
    319   *     OpenType Font Variations.  Memory management of this pointer is done
    320   *     internally by FreeType.
    321   */
    322  typedef struct  FT_MM_Var_
    323  {
    324    FT_UInt              num_axis;
    325    FT_UInt              num_designs;
    326    FT_UInt              num_namedstyles;
    327    FT_Var_Axis*         axis;
    328    FT_Var_Named_Style*  namedstyle;
    329 
    330  } FT_MM_Var;
    331 
    332 
    333  /**************************************************************************
    334   *
    335   * @function:
    336   *   FT_Get_Multi_Master
    337   *
    338   * @description:
    339   *   Retrieve a variation descriptor of a given Adobe MM font.
    340   *
    341   *   This function can't be used with TrueType GX or OpenType Font
    342   *   Variations.
    343   *
    344   * @input:
    345   *   face ::
    346   *     A handle to the source face.
    347   *
    348   * @output:
    349   *   amaster ::
    350   *     The Adobe MM font's variation descriptor.
    351   *
    352   * @return:
    353   *   FreeType error code.  0~means success.
    354   */
    355  FT_EXPORT( FT_Error )
    356  FT_Get_Multi_Master( FT_Face           face,
    357                       FT_Multi_Master  *amaster );
    358 
    359 
    360  /**************************************************************************
    361   *
    362   * @function:
    363   *   FT_Get_MM_Var
    364   *
    365   * @description:
    366   *   Retrieve a variation descriptor for a given font.
    367   *
    368   *   This function works with all supported variation formats.
    369   *
    370   * @input:
    371   *   face ::
    372   *     A handle to the source face.
    373   *
    374   * @output:
    375   *   amaster ::
    376   *     The variation descriptor.  Allocates a data structure, which the
    377   *     user must deallocate with a call to @FT_Done_MM_Var after use.
    378   *
    379   * @return:
    380   *   FreeType error code.  0~means success.
    381   */
    382  FT_EXPORT( FT_Error )
    383  FT_Get_MM_Var( FT_Face      face,
    384                 FT_MM_Var*  *amaster );
    385 
    386 
    387  /**************************************************************************
    388   *
    389   * @function:
    390   *   FT_Done_MM_Var
    391   *
    392   * @description:
    393   *   Free the memory allocated by @FT_Get_MM_Var.
    394   *
    395   * @input:
    396   *   library ::
    397   *     A handle of the face's parent library object that was used in the
    398   *     call to @FT_Get_MM_Var to create `amaster`.
    399   *
    400   * @return:
    401   *   FreeType error code.  0~means success.
    402   */
    403  FT_EXPORT( FT_Error )
    404  FT_Done_MM_Var( FT_Library   library,
    405                  FT_MM_Var   *amaster );
    406 
    407 
    408  /**************************************************************************
    409   *
    410   * @function:
    411   *   FT_Set_MM_Design_Coordinates
    412   *
    413   * @description:
    414   *   For Adobe MM fonts, choose an interpolated font design through design
    415   *   coordinates.
    416   *
    417   *   This function can't be used with TrueType GX or OpenType Font
    418   *   Variations.
    419   *
    420   * @inout:
    421   *   face ::
    422   *     A handle to the source face.
    423   *
    424   * @input:
    425   *   num_coords ::
    426   *     The number of available design coordinates.  If it is larger than
    427   *     the number of axes, ignore the excess values.  If it is smaller than
    428   *     the number of axes, use default values for the remaining axes.
    429   *
    430   *   coords ::
    431   *     An array of design coordinates.
    432   *
    433   * @return:
    434   *   FreeType error code.  0~means success.
    435   *
    436   * @note:
    437   *   [Since 2.8.1] To reset all axes to the default values, call the
    438   *   function with `num_coords` set to zero and `coords` set to `NULL`.
    439   *
    440   *   [Since 2.9] If `num_coords` is larger than zero, this function sets
    441   *   the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field
    442   *   (i.e., @FT_IS_VARIATION returns true).  If `num_coords` is zero, this
    443   *   bit flag gets unset.
    444   */
    445  FT_EXPORT( FT_Error )
    446  FT_Set_MM_Design_Coordinates( FT_Face   face,
    447                                FT_UInt   num_coords,
    448                                FT_Long*  coords );
    449 
    450 
    451  /**************************************************************************
    452   *
    453   * @function:
    454   *   FT_Set_Var_Design_Coordinates
    455   *
    456   * @description:
    457   *   Choose an interpolated font design through design coordinates.
    458   *
    459   *   This function works with all supported variation formats.
    460   *
    461   * @inout:
    462   *   face ::
    463   *     A handle to the source face.
    464   *
    465   * @input:
    466   *   num_coords ::
    467   *     The number of available design coordinates.  If it is larger than
    468   *     the number of axes, ignore the excess values.  If it is smaller than
    469   *     the number of axes, use default values for the remaining axes.
    470   *
    471   *   coords ::
    472   *     An array of design coordinates.
    473   *
    474   * @return:
    475   *   FreeType error code.  0~means success.
    476   *
    477   * @note:
    478   *   The design coordinates are 16.16 fractional values for TrueType GX and
    479   *   OpenType Font Variations.  For Adobe MM fonts, the values are supposed
    480   *   to be whole numbers (i.e., the fractional part is zero).
    481   *
    482   *   [Since 2.8.1] To reset all axes to the default values, call the
    483   *   function with `num_coords` set to zero and `coords` set to `NULL`.
    484   *   [Since 2.9] 'Default values' means the currently selected named
    485   *   instance (or the base font if no named instance is selected).
    486   *
    487   *   [Since 2.9] If `num_coords` is larger than zero, this function sets
    488   *   the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field
    489   *   (i.e., @FT_IS_VARIATION returns true).  If `num_coords` is zero, this
    490   *   bit flag gets unset.
    491   *
    492   *   [Since 2.14] This function also sets the @FT_FACE_FLAG_VARIATION bit
    493   *   in @FT_Face's `face_flags` field (i.e., @FT_IS_VARIATION returns
    494   *   true) if any of the provided coordinates is different from the face's
    495   *   default value for the corresponding axis, that is, the set up face is
    496   *   not at its default position.
    497   */
    498  FT_EXPORT( FT_Error )
    499  FT_Set_Var_Design_Coordinates( FT_Face    face,
    500                                 FT_UInt    num_coords,
    501                                 FT_Fixed*  coords );
    502 
    503 
    504  /**************************************************************************
    505   *
    506   * @function:
    507   *   FT_Get_Var_Design_Coordinates
    508   *
    509   * @description:
    510   *   Get the design coordinates of the currently selected interpolated
    511   *   font.
    512   *
    513   *   This function works with all supported variation formats.
    514   *
    515   * @input:
    516   *   face ::
    517   *     A handle to the source face.
    518   *
    519   *   num_coords ::
    520   *     The number of design coordinates to retrieve.  If it is larger than
    521   *     the number of axes, set the excess values to~0.
    522   *
    523   * @output:
    524   *   coords ::
    525   *     The design coordinates array, which must be allocated by the user.
    526   *
    527   * @return:
    528   *   FreeType error code.  0~means success.
    529   *
    530   * @note:
    531   *   The design coordinates are 16.16 fractional values for TrueType GX and
    532   *   OpenType Font Variations.  For Adobe MM fonts, the values are whole
    533   *   numbers (i.e., the fractional part is zero).
    534   *
    535   * @since:
    536   *   2.7.1
    537   */
    538  FT_EXPORT( FT_Error )
    539  FT_Get_Var_Design_Coordinates( FT_Face    face,
    540                                 FT_UInt    num_coords,
    541                                 FT_Fixed*  coords );
    542 
    543 
    544  /**************************************************************************
    545   *
    546   * @function:
    547   *   FT_Set_MM_Blend_Coordinates
    548   *
    549   * @description:
    550   *   Choose an interpolated font design through normalized coordinates.
    551   *
    552   *   This function works with all supported variation formats.
    553   *
    554   * @inout:
    555   *   face ::
    556   *     A handle to the source face.
    557   *
    558   * @input:
    559   *   num_coords ::
    560   *     The number of available design coordinates.  If it is larger than
    561   *     the number of axes, ignore the excess values.  If it is smaller than
    562   *     the number of axes, use default values for the remaining axes.
    563   *
    564   *   coords ::
    565   *     The normalized coordinates array.  Each element is a 16.16
    566   *     fractional value and must be between 0 and 1.0 for Adobe MM fonts,
    567   *     and between -1.0 and 1.0 for TrueType GX and OpenType Font
    568   *     Variations.
    569   *
    570   * @return:
    571   *   FreeType error code.  0~means success.
    572   *
    573   * @note:
    574   *   [Since 2.8.1] To reset all axes to the default values, call the
    575   *   function with `num_coords` set to zero and `coords` set to `NULL`.
    576   *   [Since 2.9] 'Default values' means the currently selected named
    577   *   instance (or the base font if no named instance is selected).
    578   *
    579   *   [Since 2.9] If `num_coords` is larger than zero, this function sets
    580   *   the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field
    581   *   (i.e., @FT_IS_VARIATION returns true).  If `num_coords` is zero, this
    582   *   bit flag gets unset.
    583   *
    584   *   [Since 2.14] This function also sets the @FT_FACE_FLAG_VARIATION bit
    585   *   in @FT_Face's `face_flags` field (i.e., @FT_IS_VARIATION returns
    586   *   true) if any of the provided coordinates is different from the face's
    587   *   default value for the corresponding axis, that is, the set up face is
    588   *   not at its default position.
    589   */
    590  FT_EXPORT( FT_Error )
    591  FT_Set_MM_Blend_Coordinates( FT_Face    face,
    592                               FT_UInt    num_coords,
    593                               FT_Fixed*  coords );
    594 
    595 
    596  /**************************************************************************
    597   *
    598   * @function:
    599   *   FT_Get_MM_Blend_Coordinates
    600   *
    601   * @description:
    602   *   Get the normalized coordinates of the currently selected interpolated
    603   *   font.
    604   *
    605   *   This function works with all supported variation formats.
    606   *
    607   * @input:
    608   *   face ::
    609   *     A handle to the source face.
    610   *
    611   *   num_coords ::
    612   *     The number of normalized coordinates to retrieve.  If it is larger
    613   *     than the number of axes, set the excess values to~0.5 for Adobe MM
    614   *     fonts, and to~0 for TrueType GX and OpenType Font Variations.
    615   *
    616   * @output:
    617   *   coords ::
    618   *     The normalized coordinates array (as 16.16 fractional values), which
    619   *     must be allocated by the user.
    620   *
    621   * @return:
    622   *   FreeType error code.  0~means success.
    623   *
    624   * @since:
    625   *   2.7.1
    626   */
    627  FT_EXPORT( FT_Error )
    628  FT_Get_MM_Blend_Coordinates( FT_Face    face,
    629                               FT_UInt    num_coords,
    630                               FT_Fixed*  coords );
    631 
    632 
    633  /**************************************************************************
    634   *
    635   * @function:
    636   *   FT_Set_Var_Blend_Coordinates
    637   *
    638   * @description:
    639   *   This is another name of @FT_Set_MM_Blend_Coordinates.
    640   */
    641  FT_EXPORT( FT_Error )
    642  FT_Set_Var_Blend_Coordinates( FT_Face    face,
    643                                FT_UInt    num_coords,
    644                                FT_Fixed*  coords );
    645 
    646 
    647  /**************************************************************************
    648   *
    649   * @function:
    650   *   FT_Get_Var_Blend_Coordinates
    651   *
    652   * @description:
    653   *   This is another name of @FT_Get_MM_Blend_Coordinates.
    654   *
    655   * @since:
    656   *   2.7.1
    657   */
    658  FT_EXPORT( FT_Error )
    659  FT_Get_Var_Blend_Coordinates( FT_Face    face,
    660                                FT_UInt    num_coords,
    661                                FT_Fixed*  coords );
    662 
    663 
    664  /**************************************************************************
    665   *
    666   * @function:
    667   *   FT_Set_MM_WeightVector
    668   *
    669   * @description:
    670   *   For Adobe MM fonts, choose an interpolated font design by directly
    671   *   setting the weight vector.
    672   *
    673   *   This function can't be used with TrueType GX or OpenType Font
    674   *   Variations.
    675   *
    676   * @inout:
    677   *   face ::
    678   *     A handle to the source face.
    679   *
    680   * @input:
    681   *   len ::
    682   *     The length of the weight vector array.  If it is larger than the
    683   *     number of designs, the extra values are ignored.  If it is less than
    684   *     the number of designs, the remaining values are set to zero.
    685   *
    686   *   weightvector ::
    687   *     An array representing the weight vector.
    688   *
    689   * @return:
    690   *   FreeType error code.  0~means success.
    691   *
    692   * @note:
    693   *   Adobe MM fonts limit the number of designs, and thus the length of the
    694   *   weight vector, to 16~elements.
    695   *
    696   *   If `len` is larger than zero, this function sets the
    697   *   @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field (i.e.,
    698   *   @FT_IS_VARIATION returns true).  If `len` is zero, this bit flag is
    699   *   unset and the weight vector array is reset to the default values.
    700   *
    701   *   The Adobe documentation also states that the values in the
    702   *   `WeightVector` array must total 1.0 +/-~0.001.  In practice this does
    703   *   not seem to be enforced, so is not enforced here, either.
    704   *
    705   * @since:
    706   *   2.10
    707   */
    708  FT_EXPORT( FT_Error )
    709  FT_Set_MM_WeightVector( FT_Face    face,
    710                          FT_UInt    len,
    711                          FT_Fixed*  weightvector );
    712 
    713 
    714  /**************************************************************************
    715   *
    716   * @function:
    717   *   FT_Get_MM_WeightVector
    718   *
    719   * @description:
    720   *   For Adobe MM fonts, retrieve the current weight vector of the font.
    721   *
    722   *   This function can't be used with TrueType GX or OpenType Font
    723   *   Variations.
    724   *
    725   * @inout:
    726   *   face ::
    727   *     A handle to the source face.
    728   *
    729   *   len ::
    730   *     A pointer to the size of the array to be filled.  If the size of the
    731   *     array is less than the number of designs, `FT_Err_Invalid_Argument`
    732   *     is returned, and `len` is set to the required size (the number of
    733   *     designs).  If the size of the array is greater than the number of
    734   *     designs, the remaining entries are set to~0.  On successful
    735   *     completion, `len` is set to the number of designs (i.e., the number
    736   *     of values written to the array).
    737   *
    738   * @output:
    739   *   weightvector ::
    740   *     An array to be filled; it must be allocated by the user.
    741   *
    742   * @return:
    743   *   FreeType error code.  0~means success.
    744   *
    745   * @note:
    746   *   Adobe MM fonts limit the number of designs, and thus the length of the
    747   *   weight vector, to~16 elements.
    748   *
    749   * @since:
    750   *   2.10
    751   */
    752  FT_EXPORT( FT_Error )
    753  FT_Get_MM_WeightVector( FT_Face    face,
    754                          FT_UInt*   len,
    755                          FT_Fixed*  weightvector );
    756 
    757 
    758  /**************************************************************************
    759   *
    760   * @enum:
    761   *   FT_VAR_AXIS_FLAG_XXX
    762   *
    763   * @description:
    764   *   A list of bit flags used in the return value of
    765   *   @FT_Get_Var_Axis_Flags.
    766   *
    767   * @values:
    768   *   FT_VAR_AXIS_FLAG_HIDDEN ::
    769   *     The variation axis should not be exposed to user interfaces.
    770   *
    771   * @since:
    772   *   2.8.1
    773   */
    774 #define FT_VAR_AXIS_FLAG_HIDDEN  1
    775 
    776 
    777  /**************************************************************************
    778   *
    779   * @function:
    780   *   FT_Get_Var_Axis_Flags
    781   *
    782   * @description:
    783   *   Get the 'flags' field of an OpenType Variation Axis Record.
    784   *
    785   *   Not meaningful for Adobe MM fonts (`*flags` is always zero).
    786   *
    787   * @input:
    788   *   master ::
    789   *     The variation descriptor.
    790   *
    791   *   axis_index ::
    792   *     The index of the requested variation axis.
    793   *
    794   * @output:
    795   *   flags ::
    796   *     The 'flags' field.  See @FT_VAR_AXIS_FLAG_XXX for possible values.
    797   *
    798   * @return:
    799   *   FreeType error code.  0~means success.
    800   *
    801   * @since:
    802   *   2.8.1
    803   */
    804  FT_EXPORT( FT_Error )
    805  FT_Get_Var_Axis_Flags( FT_MM_Var*  master,
    806                         FT_UInt     axis_index,
    807                         FT_UInt*    flags );
    808 
    809 
    810  /**************************************************************************
    811   *
    812   * @function:
    813   *   FT_Set_Named_Instance
    814   *
    815   * @description:
    816   *   Set or change the current named instance.
    817   *
    818   * @input:
    819   *   face ::
    820   *     A handle to the source face.
    821   *
    822   *   instance_index ::
    823   *     The index of the requested instance, starting with value~1.  If set
    824   *     to value~0, FreeType switches to font access without a named
    825   *     instance.
    826   *
    827   * @return:
    828   *   FreeType error code.  0~means success.
    829   *
    830   * @note:
    831   *   The function uses the value of `instance_index` to set bits 16-30 of
    832   *   the face's `face_index` field.  It also resets any variation applied
    833   *   to the font, and the @FT_FACE_FLAG_VARIATION bit of the face's
    834   *   `face_flags` field gets reset to zero (i.e., @FT_IS_VARIATION returns
    835   *   false).
    836   *
    837   *   For Adobe MM fonts, this function resets the current face to the
    838   *   default instance.
    839   *
    840   * @since:
    841   *   2.9
    842   */
    843  FT_EXPORT( FT_Error )
    844  FT_Set_Named_Instance( FT_Face  face,
    845                         FT_UInt  instance_index );
    846 
    847 
    848  /**************************************************************************
    849   *
    850   * @function:
    851   *   FT_Get_Default_Named_Instance
    852   *
    853   * @description:
    854   *   Retrieve the index of the default named instance, to be used with
    855   *   @FT_Set_Named_Instance.
    856   *
    857   *   FreeType synthesizes a named instance for the default instance if the
    858   *   font does not contain such an entry.
    859   *
    860   * @input:
    861   *   face ::
    862   *     A handle to the source face.
    863   *
    864   * @output:
    865   *   instance_index ::
    866   *     The index of the default named instance.
    867   *
    868   * @return:
    869   *   FreeType error code.  0~means success.
    870   *
    871   * @note:
    872   *   For Adobe MM fonts, this function always returns zero for
    873   *   `instance_index`.
    874   *
    875   * @since:
    876   *   2.13.1
    877   */
    878  FT_EXPORT( FT_Error )
    879  FT_Get_Default_Named_Instance( FT_Face   face,
    880                                 FT_UInt  *instance_index );
    881 
    882  /* */
    883 
    884 
    885 FT_END_HEADER
    886 
    887 #endif /* FTMM_H_ */
    888 
    889 
    890 /* END */