godot/thirdparty/freetype/src/truetype/ttgxvar.h

/****************************************************************************
 *
 * ttgxvar.h
 *
 *   TrueType GX Font Variation loader (specification)
 *
 * Copyright (C) 2004-2023 by
 * David Turner, Robert Wilhelm, Werner Lemberg and George Williams.
 *
 * This file is part of the FreeType project, and may only be used,
 * modified, and distributed under the terms of the FreeType project
 * license, LICENSE.TXT.  By continuing to use, modify, or distribute
 * this file you indicate that you have read the license and
 * understand and accept it fully.
 *
 */


#ifndef TTGXVAR_H_
#define TTGXVAR_H_


#include <freetype/internal/ftmmtypes.h>
#include "ttobjs.h"


FT_BEGIN_HEADER


#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT

  /**************************************************************************
   *
   * @Struct:
   *   GX_AVarCorrespondenceRec
   *
   * @Description:
   *   A data structure representing `shortFracCorrespondence' in `avar'
   *   table according to the specifications from Apple.
   */
  GX_AVarCorrespondence;


  /**************************************************************************
   *
   * @Struct:
   *   GX_AVarRec
   *
   * @Description:
   *   Data from the segment field of `avar' table.
   *   There is one of these for each axis.
   */
  GX_AVarSegment;


  /**************************************************************************
   *
   * @Struct:
   *   GX_AVarTableRec
   *
   * @Description:
   *   Data from the `avar' table.
   */
  GX_AVarTable;


  /**************************************************************************
   *
   * @Struct:
   *   GX_HVVarTableRec
   *
   * @Description:
   *   Data from either the `HVAR' or `VVAR' table.
   */
  GX_HVVarTable;


#define MVAR_TAG_GASP_0
#define MVAR_TAG_GASP_1
#define MVAR_TAG_GASP_2
#define MVAR_TAG_GASP_3
#define MVAR_TAG_GASP_4
#define MVAR_TAG_GASP_5
#define MVAR_TAG_GASP_6
#define MVAR_TAG_GASP_7
#define MVAR_TAG_GASP_8
#define MVAR_TAG_GASP_9

#define MVAR_TAG_CPHT
#define MVAR_TAG_HASC
#define MVAR_TAG_HCLA
#define MVAR_TAG_HCLD
#define MVAR_TAG_HCOF
#define MVAR_TAG_HCRN
#define MVAR_TAG_HCRS
#define MVAR_TAG_HDSC
#define MVAR_TAG_HLGP
#define MVAR_TAG_SBXO
#define MVAR_TAG_SBXS
#define MVAR_TAG_SBYO
#define MVAR_TAG_SBYS
#define MVAR_TAG_SPXO
#define MVAR_TAG_SPXS
#define MVAR_TAG_SPYO
#define MVAR_TAG_SPYS
#define MVAR_TAG_STRO
#define MVAR_TAG_STRS
#define MVAR_TAG_UNDO
#define MVAR_TAG_UNDS
#define MVAR_TAG_VASC
#define MVAR_TAG_VCOF
#define MVAR_TAG_VCRN
#define MVAR_TAG_VCRS
#define MVAR_TAG_VDSC
#define MVAR_TAG_VLGP
#define MVAR_TAG_XHGT


  GX_Value;


  /**************************************************************************
   *
   * @Struct:
   *   GX_MVarTableRec
   *
   * @Description:
   *   Data from the `MVAR' table.
   */
  GX_MVarTable;


  /**************************************************************************
   *
   * @Struct:
   *   GX_BlendRec
   *
   * @Description:
   *   Data for interpolating a font from a distortable font specified
   *   by the GX *var tables ([fgcahvm]var).
   *
   * @Fields:
   *   num_axis ::
   *     The number of axes along which interpolation may happen.
   *
   *   coords ::
   *     An array of design coordinates (in user space) indicating the
   *     contribution along each axis to the final interpolated font.
   *     `normalizedcoords' holds the same values.
   *
   *   normalizedcoords ::
   *     An array of normalized values (between [-1,1]) indicating the
   *     contribution along each axis to the final interpolated font.
   *     `coords' holds the same values.
   *
   *   mmvar ::
   *     Data from the `fvar' table.
   *
   *   mmvar_len ::
   *     The length of the `mmvar' structure.
   *
   *   normalized_stylecoords ::
   *     A two-dimensional array that holds the named instance data from
   *     `mmvar' as normalized values.
   *
   *   avar_loaded ::
   *     A Boolean; if set, FreeType tried to load (and parse) the `avar'
   *     table.
   *
   *   avar_table ::
   *     Data from the `avar' table.
   *
   *   hvar_loaded ::
   *     A Boolean; if set, FreeType tried to load (and parse) the `hvar'
   *     table.
   *
   *   hvar_checked ::
   *     A Boolean; if set, FreeType successfully loaded and parsed the
   *     `hvar' table.
   *
   *   hvar_error ::
   *     If loading and parsing of the `hvar' table failed, this field
   *     holds the corresponding error code.
   *
   *   hvar_table ::
   *     Data from the `hvar' table.
   *
   *   vvar_loaded ::
   *     A Boolean; if set, FreeType tried to load (and parse) the `vvar'
   *     table.
   *
   *   vvar_checked ::
   *     A Boolean; if set, FreeType successfully loaded and parsed the
   *     `vvar' table.
   *
   *   vvar_error ::
   *     If loading and parsing of the `vvar' table failed, this field
   *     holds the corresponding error code.
   *
   *   vvar_table ::
   *     Data from the `vvar' table.
   *
   *   mvar_table ::
   *     Data from the `mvar' table.
   *
   *   tuplecount ::
   *     The number of shared tuples in the `gvar' table.
   *
   *   tuplecoords ::
   *     A two-dimensional array that holds the shared tuple coordinates
   *     in the `gvar' table.
   *
   *   gv_glyphcnt ::
   *     The number of glyphs handled in the `gvar' table.
   *
   *   glyphoffsets ::
   *     Offsets into the glyph variation data array.
   *
   *   gvar_size ::
   *     The size of the `gvar' table.
   */
  GX_BlendRec;


  /**************************************************************************
   *
   * @enum:
   *   GX_TupleCountFlags
   *
   * @Description:
   *   Flags used within the `TupleCount' field of the `gvar' table.
   */
  GX_TupleCountFlags;


  /**************************************************************************
   *
   * @enum:
   *   GX_TupleIndexFlags
   *
   * @Description:
   *   Flags used within the `TupleIndex' field of the `gvar' and `cvar'
   *   tables.
   */
  GX_TupleIndexFlags;


#define TTAG_wght
#define TTAG_wdth
#define TTAG_opsz
#define TTAG_slnt
#define TTAG_ital


  FT_LOCAL( FT_Error )
  TT_Set_MM_Blend( FT_Face    face,
                   FT_UInt    num_coords,
                   FT_Fixed*  coords );

  FT_LOCAL( FT_Error )
  TT_Get_MM_Blend( FT_Face    face,
                   FT_UInt    num_coords,
                   FT_Fixed*  coords );

  FT_LOCAL( FT_Error )
  TT_Set_Var_Design( FT_Face    face,
                     FT_UInt    num_coords,
                     FT_Fixed*  coords );

  FT_LOCAL( FT_Error )
  TT_Get_MM_Var( FT_Face      face,
                 FT_MM_Var*  *master );

  FT_LOCAL( FT_Error )
  TT_Get_Var_Design( FT_Face    face,
                     FT_UInt    num_coords,
                     FT_Fixed*  coords );

  FT_LOCAL( FT_Error )
  TT_Set_Named_Instance( FT_Face  face,
                         FT_UInt  instance_index );

  FT_LOCAL( FT_Error )
  TT_Get_Default_Named_Instance( FT_Face   face,
                                 FT_UInt  *instance_index );

  FT_LOCAL( void )
  tt_construct_ps_name( FT_Face  face );

  FT_LOCAL( FT_Error )
  tt_face_vary_cvt( TT_Face    face,
                    FT_Stream  stream );


  FT_LOCAL( FT_Error )
  TT_Vary_Apply_Glyph_Deltas( TT_Loader    loader,
                              FT_Outline*  outline,
                              FT_Vector*   unrounded );

  FT_LOCAL( FT_Error )
  tt_hadvance_adjust( FT_Face  face,
                      FT_UInt  gindex,
                      FT_Int  *adelta );

  FT_LOCAL( FT_Error )
  tt_vadvance_adjust( FT_Face  face,
                      FT_UInt  gindex,
                      FT_Int  *adelta );

  FT_LOCAL( void )
  tt_apply_mvar( FT_Face  face );

  FT_LOCAL( FT_Error )
  tt_var_load_item_variation_store( FT_Face          face,
                                    FT_ULong         offset,
                                    GX_ItemVarStore  itemStore );

  FT_LOCAL( FT_Error )
  tt_var_load_delta_set_index_mapping( FT_Face            face,
                                       FT_ULong           offset,
                                       GX_DeltaSetIdxMap  map,
                                       GX_ItemVarStore    itemStore,
                                       FT_ULong           table_len );

  FT_LOCAL( FT_ItemVarDelta )
  tt_var_get_item_delta( FT_Face          face,
                         GX_ItemVarStore  itemStore,
                         FT_UInt          outerIndex,
                         FT_UInt          innerIndex );

  FT_LOCAL( void )
  tt_var_done_item_variation_store( FT_Face          face,
                                    GX_ItemVarStore  itemStore );

  FT_LOCAL( void )
  tt_var_done_delta_set_index_map( FT_Face            face,
                                   GX_DeltaSetIdxMap  deltaSetIdxMap );


  FT_LOCAL( FT_Error )
  tt_get_var_blend( FT_Face      face,
                    FT_UInt     *num_coords,
                    FT_Fixed*   *coords,
                    FT_Fixed*   *normalizedcoords,
                    FT_MM_Var*  *mm_var );

  FT_LOCAL( void )
  tt_done_blend( FT_Face  face );

#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */


FT_END_HEADER


#endif /* TTGXVAR_H_ */


/* END */