1 /***************************************************************************/
   2 /*                                                                         */
   3 /*  svmetric.h                                                             */
   4 /*                                                                         */
   5 /*    The FreeType services for metrics variations (specification).        */
   6 /*                                                                         */
   7 /*  Copyright 2016-2018 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 SVMETRIC_H_
  20 #define SVMETRIC_H_
  21 
  22 #include FT_INTERNAL_SERVICE_H
  23 
  24 
  25 FT_BEGIN_HEADER
  26 
  27 
  28   /*
  29    *  A service to manage the `HVAR, `MVAR', and `VVAR' OpenType tables.
  30    *
  31    */
  32 
  33 #define FT_SERVICE_ID_METRICS_VARIATIONS  "metrics-variations"
  34 
  35 
  36   /* HVAR */
  37 
  38   typedef FT_Error
  39   (*FT_HAdvance_Adjust_Func)( FT_Face  face,
  40                               FT_UInt  gindex,
  41                               FT_Int  *avalue );
  42 
  43   typedef FT_Error
  44   (*FT_LSB_Adjust_Func)( FT_Face  face,
  45                          FT_UInt  gindex,
  46                          FT_Int  *avalue );
  47 
  48   typedef FT_Error
  49   (*FT_RSB_Adjust_Func)( FT_Face  face,
  50                          FT_UInt  gindex,
  51                          FT_Int  *avalue );
  52 
  53   /* VVAR */
  54 
  55   typedef FT_Error
  56   (*FT_VAdvance_Adjust_Func)( FT_Face  face,
  57                               FT_UInt  gindex,
  58                               FT_Int  *avalue );
  59 
  60   typedef FT_Error
  61   (*FT_TSB_Adjust_Func)( FT_Face  face,
  62                          FT_UInt  gindex,
  63                          FT_Int  *avalue );
  64 
  65   typedef FT_Error
  66   (*FT_BSB_Adjust_Func)( FT_Face  face,
  67                          FT_UInt  gindex,
  68                          FT_Int  *avalue );
  69 
  70   typedef FT_Error
  71   (*FT_VOrg_Adjust_Func)( FT_Face  face,
  72                           FT_UInt  gindex,
  73                           FT_Int  *avalue );
  74 
  75   /* MVAR */
  76 
  77   typedef void
  78   (*FT_Metrics_Adjust_Func)( FT_Face  face );
  79 
  80 
  81   FT_DEFINE_SERVICE( MetricsVariations )
  82   {
  83     FT_HAdvance_Adjust_Func  hadvance_adjust;
  84     FT_LSB_Adjust_Func       lsb_adjust;
  85     FT_RSB_Adjust_Func       rsb_adjust;
  86 
  87     FT_VAdvance_Adjust_Func  vadvance_adjust;
  88     FT_TSB_Adjust_Func       tsb_adjust;
  89     FT_BSB_Adjust_Func       bsb_adjust;
  90     FT_VOrg_Adjust_Func      vorg_adjust;
  91 
  92     FT_Metrics_Adjust_Func   metrics_adjust;
  93   };
  94 
  95 
  96 #ifndef FT_CONFIG_OPTION_PIC
  97 
  98 #define FT_DEFINE_SERVICE_METRICSVARIATIONSREC( class_,            \
  99                                                 hadvance_adjust_,  \
 100                                                 lsb_adjust_,       \
 101                                                 rsb_adjust_,       \
 102                                                 vadvance_adjust_,  \
 103                                                 tsb_adjust_,       \
 104                                                 bsb_adjust_,       \
 105                                                 vorg_adjust_,      \
 106                                                 metrics_adjust_  ) \
 107   static const FT_Service_MetricsVariationsRec  class_ =           \
 108   {                                                                \
 109     hadvance_adjust_,                                              \
 110     lsb_adjust_,                                                   \
 111     rsb_adjust_,                                                   \
 112     vadvance_adjust_,                                              \
 113     tsb_adjust_,                                                   \
 114     bsb_adjust_,                                                   \
 115     vorg_adjust_,                                                  \
 116     metrics_adjust_                                                \
 117   };
 118 
 119 #else /* FT_CONFIG_OPTION_PIC */
 120 
 121 #define FT_DEFINE_SERVICE_METRICSVARIATIONSREC( class_,               \
 122                                                 hadvance_adjust_,     \
 123                                                 lsb_adjust_,          \
 124                                                 rsb_adjust_,          \
 125                                                 vadvance_adjust_,     \
 126                                                 tsb_adjust_,          \
 127                                                 bsb_adjust_,          \
 128                                                 vorg_adjust_,         \
 129                                                 metrics_adjust_  )    \
 130   void                                                                \
 131   FT_Init_Class_ ## class_( FT_Service_MetricsVariationsRec*  clazz ) \
 132   {                                                                   \
 133     clazz->hadvance_adjust = hadvance_adjust_;                        \
 134     clazz->lsb_adjust      = lsb_adjust_;                             \
 135     clazz->rsb_adjust      = rsb_adjust_;                             \
 136     clazz->vadvance_adjust = vadvance_adjust_;                        \
 137     clazz->tsb_adjust      = tsb_adjust_;                             \
 138     clazz->bsb_adjust      = bsb_adjust_;                             \
 139     clazz->vorg_adjust     = vorg_adjust_;                            \
 140     clazz->metrics_adjust  = metrics_adjust_;                         \
 141   }
 142 
 143 #endif /* FT_CONFIG_OPTION_PIC */
 144 
 145   /* */
 146 
 147 
 148 FT_END_HEADER
 149 
 150 #endif /* SVMETRIC_H_ */
 151 
 152 
 153 /* END */