vrshoot

diff libs/ft2static/freetype/ftgxval.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/ft2static/freetype/ftgxval.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,358 @@
     1.4 +/***************************************************************************/
     1.5 +/*                                                                         */
     1.6 +/*  ftgxval.h                                                              */
     1.7 +/*                                                                         */
     1.8 +/*    FreeType API for validating TrueTypeGX/AAT tables (specification).   */
     1.9 +/*                                                                         */
    1.10 +/*  Copyright 2004, 2005, 2006 by                                          */
    1.11 +/*  Masatake YAMATO, Redhat K.K,                                           */
    1.12 +/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
    1.13 +/*                                                                         */
    1.14 +/*  This file is part of the FreeType project, and may only be used,       */
    1.15 +/*  modified, and distributed under the terms of the FreeType project      */
    1.16 +/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    1.17 +/*  this file you indicate that you have read the license and              */
    1.18 +/*  understand and accept it fully.                                        */
    1.19 +/*                                                                         */
    1.20 +/***************************************************************************/
    1.21 +
    1.22 +/***************************************************************************/
    1.23 +/*                                                                         */
    1.24 +/* gxvalid is derived from both gxlayout module and otvalid module.        */
    1.25 +/* Development of gxlayout is supported by the Information-technology      */
    1.26 +/* Promotion Agency(IPA), Japan.                                           */
    1.27 +/*                                                                         */
    1.28 +/***************************************************************************/
    1.29 +
    1.30 +
    1.31 +#ifndef __FTGXVAL_H__
    1.32 +#define __FTGXVAL_H__
    1.33 +
    1.34 +#include <ft2build.h>
    1.35 +#include FT_FREETYPE_H
    1.36 +
    1.37 +#ifdef FREETYPE_H
    1.38 +#error "freetype.h of FreeType 1 has been loaded!"
    1.39 +#error "Please fix the directory search order for header files"
    1.40 +#error "so that freetype.h of FreeType 2 is found first."
    1.41 +#endif
    1.42 +
    1.43 +
    1.44 +FT_BEGIN_HEADER
    1.45 +
    1.46 +
    1.47 +  /*************************************************************************/
    1.48 +  /*                                                                       */
    1.49 +  /* <Section>                                                             */
    1.50 +  /*    gx_validation                                                      */
    1.51 +  /*                                                                       */
    1.52 +  /* <Title>                                                               */
    1.53 +  /*    TrueTypeGX/AAT Validation                                          */
    1.54 +  /*                                                                       */
    1.55 +  /* <Abstract>                                                            */
    1.56 +  /*    An API to validate TrueTypeGX/AAT tables.                          */
    1.57 +  /*                                                                       */
    1.58 +  /* <Description>                                                         */
    1.59 +  /*    This section contains the declaration of functions to validate     */
    1.60 +  /*    some TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd,  */
    1.61 +  /*    trak, prop, lcar).                                                 */
    1.62 +  /*                                                                       */
    1.63 +  /*************************************************************************/
    1.64 +
    1.65 +
    1.66 +  /*************************************************************************/
    1.67 +  /*                                                                       */
    1.68 +  /*                                                                       */
    1.69 +  /* Warning: Use FT_VALIDATE_XXX to validate a table.                     */
    1.70 +  /*          Following definitions are for gxvalid developers.            */
    1.71 +  /*                                                                       */
    1.72 +  /*                                                                       */
    1.73 +  /*************************************************************************/
    1.74 +
    1.75 +#define FT_VALIDATE_feat_INDEX     0
    1.76 +#define FT_VALIDATE_mort_INDEX     1
    1.77 +#define FT_VALIDATE_morx_INDEX     2
    1.78 +#define FT_VALIDATE_bsln_INDEX     3
    1.79 +#define FT_VALIDATE_just_INDEX     4
    1.80 +#define FT_VALIDATE_kern_INDEX     5
    1.81 +#define FT_VALIDATE_opbd_INDEX     6
    1.82 +#define FT_VALIDATE_trak_INDEX     7
    1.83 +#define FT_VALIDATE_prop_INDEX     8
    1.84 +#define FT_VALIDATE_lcar_INDEX     9
    1.85 +#define FT_VALIDATE_GX_LAST_INDEX  FT_VALIDATE_lcar_INDEX
    1.86 +
    1.87 +
    1.88 +  /*************************************************************************
    1.89 +   *
    1.90 +   * @macro:
    1.91 +   *   FT_VALIDATE_GX_LENGTH
    1.92 +   *
    1.93 +   * @description:
    1.94 +   *   The number of tables checked in this module.  Use it as a parameter
    1.95 +   *   for the `table-length' argument of function @FT_TrueTypeGX_Validate.
    1.96 +   */
    1.97 +#define FT_VALIDATE_GX_LENGTH     (FT_VALIDATE_GX_LAST_INDEX + 1)
    1.98 +
    1.99 +  /* */
   1.100 +
   1.101 +  /* Up to 0x1000 is used by otvalid.
   1.102 +     Ox2xxx is reserved for feature OT extension. */
   1.103 +#define FT_VALIDATE_GX_START 0x4000
   1.104 +#define FT_VALIDATE_GX_BITFIELD( tag )                  \
   1.105 +  ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )
   1.106 +
   1.107 +
   1.108 + /**********************************************************************
   1.109 +  *
   1.110 +  * @enum:
   1.111 +  *    FT_VALIDATE_GXXXX
   1.112 +  *
   1.113 +  * @description:
   1.114 +  *    A list of bit-field constants used with @FT_TrueTypeGX_Validate to
   1.115 +  *    indicate which TrueTypeGX/AAT Type tables should be validated.
   1.116 +  *
   1.117 +  * @values:
   1.118 +  *    FT_VALIDATE_feat ::
   1.119 +  *      Validate `feat' table.
   1.120 +  *
   1.121 +  *    FT_VALIDATE_mort ::
   1.122 +  *      Validate `mort' table.
   1.123 +  *
   1.124 +  *    FT_VALIDATE_morx ::
   1.125 +  *      Validate `morx' table.
   1.126 +  *
   1.127 +  *    FT_VALIDATE_bsln ::
   1.128 +  *      Validate `bsln' table.
   1.129 +  *
   1.130 +  *    FT_VALIDATE_just ::
   1.131 +  *      Validate `just' table.
   1.132 +  *
   1.133 +  *    FT_VALIDATE_kern ::
   1.134 +  *      Validate `kern' table.
   1.135 +  *
   1.136 +  *    FT_VALIDATE_opbd ::
   1.137 +  *      Validate `opbd' table.
   1.138 +  *
   1.139 +  *    FT_VALIDATE_trak ::
   1.140 +  *      Validate `trak' table.
   1.141 +  *
   1.142 +  *    FT_VALIDATE_prop ::
   1.143 +  *      Validate `prop' table.
   1.144 +  *
   1.145 +  *    FT_VALIDATE_lcar ::
   1.146 +  *      Validate `lcar' table.
   1.147 +  *
   1.148 +  *    FT_VALIDATE_GX ::
   1.149 +  *      Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,
   1.150 +  *      opbd, trak, prop and lcar).
   1.151 +  *
   1.152 +  */
   1.153 +
   1.154 +#define FT_VALIDATE_feat  FT_VALIDATE_GX_BITFIELD( feat )
   1.155 +#define FT_VALIDATE_mort  FT_VALIDATE_GX_BITFIELD( mort )
   1.156 +#define FT_VALIDATE_morx  FT_VALIDATE_GX_BITFIELD( morx )
   1.157 +#define FT_VALIDATE_bsln  FT_VALIDATE_GX_BITFIELD( bsln )
   1.158 +#define FT_VALIDATE_just  FT_VALIDATE_GX_BITFIELD( just )
   1.159 +#define FT_VALIDATE_kern  FT_VALIDATE_GX_BITFIELD( kern )
   1.160 +#define FT_VALIDATE_opbd  FT_VALIDATE_GX_BITFIELD( opbd )
   1.161 +#define FT_VALIDATE_trak  FT_VALIDATE_GX_BITFIELD( trak )
   1.162 +#define FT_VALIDATE_prop  FT_VALIDATE_GX_BITFIELD( prop )
   1.163 +#define FT_VALIDATE_lcar  FT_VALIDATE_GX_BITFIELD( lcar )
   1.164 +
   1.165 +#define FT_VALIDATE_GX  ( FT_VALIDATE_feat | \
   1.166 +                          FT_VALIDATE_mort | \
   1.167 +                          FT_VALIDATE_morx | \
   1.168 +                          FT_VALIDATE_bsln | \
   1.169 +                          FT_VALIDATE_just | \
   1.170 +                          FT_VALIDATE_kern | \
   1.171 +                          FT_VALIDATE_opbd | \
   1.172 +                          FT_VALIDATE_trak | \
   1.173 +                          FT_VALIDATE_prop | \
   1.174 +                          FT_VALIDATE_lcar )
   1.175 +
   1.176 +
   1.177 +  /* */
   1.178 +
   1.179 + /**********************************************************************
   1.180 +  *
   1.181 +  * @function:
   1.182 +  *    FT_TrueTypeGX_Validate
   1.183 +  *
   1.184 +  * @description:
   1.185 +  *    Validate various TrueTypeGX tables to assure that all offsets and
   1.186 +  *    indices are valid.  The idea is that a higher-level library which
   1.187 +  *    actually does the text layout can access those tables without
   1.188 +  *    error checking (which can be quite time consuming).
   1.189 +  *
   1.190 +  * @input:
   1.191 +  *    face ::
   1.192 +  *       A handle to the input face.
   1.193 +  *
   1.194 +  *    validation_flags ::
   1.195 +  *       A bit field which specifies the tables to be validated.  See
   1.196 +  *       @FT_VALIDATE_GXXXX for possible values.
   1.197 +  *
   1.198 +  *    table_length ::
   1.199 +  *       The size of the `tables' array.  Normally, @FT_VALIDATE_GX_LENGTH
   1.200 +  *       should be passed.
   1.201 +  *
   1.202 +  * @output:
   1.203 +  *    tables ::
   1.204 +  *       The array where all validated sfnt tables are stored.
   1.205 +  *       The array itself must be allocated by a client.
   1.206 +  *
   1.207 +  * @return:
   1.208 +  *   FreeType error code.  0~means success.
   1.209 +  *
   1.210 +  * @note:
   1.211 +  *   This function only works with TrueTypeGX fonts, returning an error
   1.212 +  *   otherwise.
   1.213 +  *
   1.214 +  *   After use, the application should deallocate the buffers pointed to by
   1.215 +  *   each `tables' element, by calling @FT_TrueTypeGX_Free.  A NULL value
   1.216 +  *   indicates that the table either doesn't exist in the font, the
   1.217 +  *   application hasn't asked for validation, or the validator doesn't have
   1.218 +  *   the ability to validate the sfnt table.
   1.219 +  */
   1.220 +  FT_EXPORT( FT_Error )
   1.221 +  FT_TrueTypeGX_Validate( FT_Face   face,
   1.222 +                          FT_UInt   validation_flags,
   1.223 +                          FT_Bytes  tables[FT_VALIDATE_GX_LENGTH],
   1.224 +                          FT_UInt   table_length );
   1.225 +
   1.226 +
   1.227 +  /* */
   1.228 +
   1.229 + /**********************************************************************
   1.230 +  *
   1.231 +  * @function:
   1.232 +  *    FT_TrueTypeGX_Free
   1.233 +  *
   1.234 +  * @description:
   1.235 +  *    Free the buffer allocated by TrueTypeGX validator.
   1.236 +  *
   1.237 +  * @input:
   1.238 +  *    face ::
   1.239 +  *       A handle to the input face.
   1.240 +  *
   1.241 +  *    table ::
   1.242 +  *       The pointer to the buffer allocated by
   1.243 +  *       @FT_TrueTypeGX_Validate.
   1.244 +  *
   1.245 +  * @note:
   1.246 +  *   This function must be used to free the buffer allocated by
   1.247 +  *   @FT_TrueTypeGX_Validate only.
   1.248 +  */
   1.249 +  FT_EXPORT( void )
   1.250 +  FT_TrueTypeGX_Free( FT_Face   face,
   1.251 +                      FT_Bytes  table );
   1.252 +
   1.253 +
   1.254 +  /* */
   1.255 +
   1.256 + /**********************************************************************
   1.257 +  *
   1.258 +  * @enum:
   1.259 +  *    FT_VALIDATE_CKERNXXX
   1.260 +  *
   1.261 +  * @description:
   1.262 +  *    A list of bit-field constants used with @FT_ClassicKern_Validate
   1.263 +  *    to indicate the classic kern dialect or dialects.  If the selected
   1.264 +  *    type doesn't fit, @FT_ClassicKern_Validate regards the table as
   1.265 +  *    invalid.
   1.266 +  *
   1.267 +  * @values:
   1.268 +  *    FT_VALIDATE_MS ::
   1.269 +  *      Handle the `kern' table as a classic Microsoft kern table.
   1.270 +  *
   1.271 +  *    FT_VALIDATE_APPLE ::
   1.272 +  *      Handle the `kern' table as a classic Apple kern table.
   1.273 +  *
   1.274 +  *    FT_VALIDATE_CKERN ::
   1.275 +  *      Handle the `kern' as either classic Apple or Microsoft kern table.
   1.276 +  */
   1.277 +#define FT_VALIDATE_MS     ( FT_VALIDATE_GX_START << 0 )
   1.278 +#define FT_VALIDATE_APPLE  ( FT_VALIDATE_GX_START << 1 )
   1.279 +
   1.280 +#define FT_VALIDATE_CKERN  ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )
   1.281 +
   1.282 +
   1.283 +  /* */
   1.284 +
   1.285 + /**********************************************************************
   1.286 +  *
   1.287 +  * @function:
   1.288 +  *    FT_ClassicKern_Validate
   1.289 +  *
   1.290 +  * @description:
   1.291 +  *    Validate classic (16-bit format) kern table to assure that the offsets
   1.292 +  *    and indices are valid.  The idea is that a higher-level library which
   1.293 +  *    actually does the text layout can access those tables without error
   1.294 +  *    checking (which can be quite time consuming).
   1.295 +  *
   1.296 +  *    The `kern' table validator in @FT_TrueTypeGX_Validate deals with both
   1.297 +  *    the new 32-bit format and the classic 16-bit format, while
   1.298 +  *    FT_ClassicKern_Validate only supports the classic 16-bit format.
   1.299 +  *
   1.300 +  * @input:
   1.301 +  *    face ::
   1.302 +  *       A handle to the input face.
   1.303 +  *
   1.304 +  *    validation_flags ::
   1.305 +  *       A bit field which specifies the dialect to be validated.  See
   1.306 +  *       @FT_VALIDATE_CKERNXXX for possible values.
   1.307 +  *
   1.308 +  * @output:
   1.309 +  *    ckern_table ::
   1.310 +  *       A pointer to the kern table.
   1.311 +  *
   1.312 +  * @return:
   1.313 +  *   FreeType error code.  0~means success.
   1.314 +  *
   1.315 +  * @note:
   1.316 +  *   After use, the application should deallocate the buffers pointed to by
   1.317 +  *   `ckern_table', by calling @FT_ClassicKern_Free.  A NULL value
   1.318 +  *   indicates that the table doesn't exist in the font.
   1.319 +  */
   1.320 +  FT_EXPORT( FT_Error )
   1.321 +  FT_ClassicKern_Validate( FT_Face    face,
   1.322 +                           FT_UInt    validation_flags,
   1.323 +                           FT_Bytes  *ckern_table );
   1.324 +
   1.325 +
   1.326 +  /* */
   1.327 +
   1.328 + /**********************************************************************
   1.329 +  *
   1.330 +  * @function:
   1.331 +  *    FT_ClassicKern_Free
   1.332 +  *
   1.333 +  * @description:
   1.334 +  *    Free the buffer allocated by classic Kern validator.
   1.335 +  *
   1.336 +  * @input:
   1.337 +  *    face ::
   1.338 +  *       A handle to the input face.
   1.339 +  *
   1.340 +  *    table ::
   1.341 +  *       The pointer to the buffer that is allocated by
   1.342 +  *       @FT_ClassicKern_Validate.
   1.343 +  *
   1.344 +  * @note:
   1.345 +  *   This function must be used to free the buffer allocated by
   1.346 +  *   @FT_ClassicKern_Validate only.
   1.347 +  */
   1.348 +  FT_EXPORT( void )
   1.349 +  FT_ClassicKern_Free( FT_Face   face,
   1.350 +                       FT_Bytes  table );
   1.351 +
   1.352 +
   1.353 + /* */
   1.354 +
   1.355 +
   1.356 +FT_END_HEADER
   1.357 +
   1.358 +#endif /* __FTGXVAL_H__ */
   1.359 +
   1.360 +
   1.361 +/* END */