2018-06-03 22:00:42 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* ftgxval.h
|
|
|
|
*
|
|
|
|
* FreeType API for validating TrueTypeGX/AAT tables (specification).
|
|
|
|
*
|
2019-02-23 10:07:09 +01:00
|
|
|
* Copyright (C) 2004-2019 by
|
2018-06-03 22:00:42 +02:00
|
|
|
* Masatake YAMATO, Redhat K.K,
|
|
|
|
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* gxvalid is derived from both gxlayout module and otvalid module.
|
|
|
|
* Development of gxlayout is supported by the Information-technology
|
|
|
|
* Promotion Agency(IPA), Japan.
|
|
|
|
*
|
|
|
|
*/
|
2005-08-24 06:31:31 +02:00
|
|
|
|
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#ifndef FTGXVAL_H_
|
|
|
|
#define FTGXVAL_H_
|
2005-08-24 06:31:31 +02:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_FREETYPE_H
|
|
|
|
|
|
|
|
#ifdef FREETYPE_H
|
|
|
|
#error "freetype.h of FreeType 1 has been loaded!"
|
|
|
|
#error "Please fix the directory search order for header files"
|
|
|
|
#error "so that freetype.h of FreeType 2 is found first."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
FT_BEGIN_HEADER
|
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @section:
|
2018-06-03 22:00:42 +02:00
|
|
|
* gx_validation
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @title:
|
2018-06-03 22:00:42 +02:00
|
|
|
* TrueTypeGX/AAT Validation
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @abstract:
|
2018-06-03 22:00:42 +02:00
|
|
|
* An API to validate TrueTypeGX/AAT tables.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-08-24 18:52:30 +02:00
|
|
|
* This section contains the declaration of functions to validate some
|
|
|
|
* TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, trak,
|
|
|
|
* prop, lcar).
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @order:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_TrueTypeGX_Validate
|
|
|
|
* FT_TrueTypeGX_Free
|
|
|
|
*
|
|
|
|
* FT_ClassicKern_Validate
|
|
|
|
* FT_ClassicKern_Free
|
|
|
|
*
|
|
|
|
* FT_VALIDATE_GX_LENGTH
|
|
|
|
* FT_VALIDATE_GXXXX
|
|
|
|
* FT_VALIDATE_CKERNXXX
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
*
|
2018-09-04 10:37:44 +02:00
|
|
|
* Warning: Use `FT_VALIDATE_XXX` to validate a table.
|
|
|
|
* Following definitions are for gxvalid developers.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2005-08-25 08:00:55 +02:00
|
|
|
|
2005-08-24 06:31:31 +02:00
|
|
|
#define FT_VALIDATE_feat_INDEX 0
|
|
|
|
#define FT_VALIDATE_mort_INDEX 1
|
|
|
|
#define FT_VALIDATE_morx_INDEX 2
|
|
|
|
#define FT_VALIDATE_bsln_INDEX 3
|
|
|
|
#define FT_VALIDATE_just_INDEX 4
|
|
|
|
#define FT_VALIDATE_kern_INDEX 5
|
|
|
|
#define FT_VALIDATE_opbd_INDEX 6
|
|
|
|
#define FT_VALIDATE_trak_INDEX 7
|
|
|
|
#define FT_VALIDATE_prop_INDEX 8
|
|
|
|
#define FT_VALIDATE_lcar_INDEX 9
|
|
|
|
#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX
|
2006-05-12 15:55:04 +02:00
|
|
|
|
|
|
|
|
2018-09-04 08:00:58 +02:00
|
|
|
/**************************************************************************
|
2006-05-12 15:55:04 +02:00
|
|
|
*
|
|
|
|
* @macro:
|
|
|
|
* FT_VALIDATE_GX_LENGTH
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* The number of tables checked in this module. Use it as a parameter
|
2018-09-04 10:37:44 +02:00
|
|
|
* for the `table-length` argument of function @FT_TrueTypeGX_Validate.
|
2006-05-12 15:55:04 +02:00
|
|
|
*/
|
2017-09-30 16:16:03 +02:00
|
|
|
#define FT_VALIDATE_GX_LENGTH ( FT_VALIDATE_GX_LAST_INDEX + 1 )
|
2005-08-24 06:31:31 +02:00
|
|
|
|
2006-05-12 15:55:04 +02:00
|
|
|
/* */
|
|
|
|
|
2005-08-25 08:00:55 +02:00
|
|
|
/* Up to 0x1000 is used by otvalid.
|
|
|
|
Ox2xxx is reserved for feature OT extension. */
|
2017-09-30 16:16:03 +02:00
|
|
|
#define FT_VALIDATE_GX_START 0x4000
|
|
|
|
#define FT_VALIDATE_GX_BITFIELD( tag ) \
|
|
|
|
( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )
|
2005-08-24 06:31:31 +02:00
|
|
|
|
|
|
|
|
2018-09-04 08:00:58 +02:00
|
|
|
/**************************************************************************
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* @enum:
|
|
|
|
* FT_VALIDATE_GXXXX
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A list of bit-field constants used with @FT_TrueTypeGX_Validate to
|
|
|
|
* indicate which TrueTypeGX/AAT Type tables should be validated.
|
|
|
|
*
|
|
|
|
* @values:
|
|
|
|
* FT_VALIDATE_feat ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Validate 'feat' table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_mort ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Validate 'mort' table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_morx ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Validate 'morx' table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_bsln ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Validate 'bsln' table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_just ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Validate 'just' table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_kern ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Validate 'kern' table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_opbd ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Validate 'opbd' table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_trak ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Validate 'trak' table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_prop ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Validate 'prop' table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_lcar ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Validate 'lcar' table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_GX ::
|
|
|
|
* Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,
|
|
|
|
* opbd, trak, prop and lcar).
|
|
|
|
*
|
|
|
|
*/
|
2005-08-24 06:31:31 +02:00
|
|
|
|
2005-08-25 08:00:55 +02:00
|
|
|
#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat )
|
|
|
|
#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort )
|
|
|
|
#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx )
|
|
|
|
#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln )
|
|
|
|
#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just )
|
|
|
|
#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern )
|
|
|
|
#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd )
|
|
|
|
#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak )
|
|
|
|
#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop )
|
|
|
|
#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar )
|
|
|
|
|
|
|
|
#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \
|
|
|
|
FT_VALIDATE_mort | \
|
|
|
|
FT_VALIDATE_morx | \
|
|
|
|
FT_VALIDATE_bsln | \
|
|
|
|
FT_VALIDATE_just | \
|
|
|
|
FT_VALIDATE_kern | \
|
|
|
|
FT_VALIDATE_opbd | \
|
|
|
|
FT_VALIDATE_trak | \
|
|
|
|
FT_VALIDATE_prop | \
|
2005-08-24 06:31:31 +02:00
|
|
|
FT_VALIDATE_lcar )
|
|
|
|
|
|
|
|
|
2018-09-04 08:00:58 +02:00
|
|
|
/**************************************************************************
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_TrueTypeGX_Validate
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Validate various TrueTypeGX tables to assure that all offsets and
|
|
|
|
* indices are valid. The idea is that a higher-level library that
|
2018-08-24 18:52:30 +02:00
|
|
|
* actually does the text layout can access those tables without error
|
|
|
|
* checking (which can be quite time consuming).
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* face ::
|
|
|
|
* A handle to the input face.
|
|
|
|
*
|
|
|
|
* validation_flags ::
|
|
|
|
* A bit field that specifies the tables to be validated. See
|
|
|
|
* @FT_VALIDATE_GXXXX for possible values.
|
|
|
|
*
|
|
|
|
* table_length ::
|
2018-09-04 10:37:44 +02:00
|
|
|
* The size of the `tables` array. Normally, @FT_VALIDATE_GX_LENGTH
|
2018-06-17 11:22:37 +02:00
|
|
|
* should be passed.
|
|
|
|
*
|
|
|
|
* @output:
|
|
|
|
* tables ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* The array where all validated sfnt tables are stored. The array
|
|
|
|
* itself must be allocated by a client.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* @return:
|
|
|
|
* FreeType error code. 0~means success.
|
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* This function only works with TrueTypeGX fonts, returning an error
|
|
|
|
* otherwise.
|
|
|
|
*
|
|
|
|
* After use, the application should deallocate the buffers pointed to by
|
2019-02-20 16:18:40 +01:00
|
|
|
* each `tables` element, by calling @FT_TrueTypeGX_Free. A `NULL` value
|
2018-06-17 11:22:37 +02:00
|
|
|
* indicates that the table either doesn't exist in the font, the
|
|
|
|
* application hasn't asked for validation, or the validator doesn't have
|
|
|
|
* the ability to validate the sfnt table.
|
|
|
|
*/
|
2005-08-24 06:31:31 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
2005-08-25 08:00:55 +02:00
|
|
|
FT_TrueTypeGX_Validate( FT_Face face,
|
|
|
|
FT_UInt validation_flags,
|
|
|
|
FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
|
|
|
|
FT_UInt table_length );
|
2005-08-24 06:31:31 +02:00
|
|
|
|
|
|
|
|
2018-09-04 08:00:58 +02:00
|
|
|
/**************************************************************************
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_TrueTypeGX_Free
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Free the buffer allocated by TrueTypeGX validator.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* face ::
|
|
|
|
* A handle to the input face.
|
|
|
|
*
|
|
|
|
* table ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* The pointer to the buffer allocated by @FT_TrueTypeGX_Validate.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* This function must be used to free the buffer allocated by
|
|
|
|
* @FT_TrueTypeGX_Validate only.
|
|
|
|
*/
|
2005-11-18 08:47:06 +01:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_TrueTypeGX_Free( FT_Face face,
|
|
|
|
FT_Bytes table );
|
|
|
|
|
|
|
|
|
2018-09-04 08:00:58 +02:00
|
|
|
/**************************************************************************
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* @enum:
|
|
|
|
* FT_VALIDATE_CKERNXXX
|
|
|
|
*
|
|
|
|
* @description:
|
2018-08-24 18:52:30 +02:00
|
|
|
* A list of bit-field constants used with @FT_ClassicKern_Validate to
|
|
|
|
* indicate the classic kern dialect or dialects. If the selected type
|
|
|
|
* doesn't fit, @FT_ClassicKern_Validate regards the table as invalid.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* @values:
|
|
|
|
* FT_VALIDATE_MS ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Handle the 'kern' table as a classic Microsoft kern table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_APPLE ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Handle the 'kern' table as a classic Apple kern table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* FT_VALIDATE_CKERN ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* Handle the 'kern' as either classic Apple or Microsoft kern table.
|
2018-06-17 11:22:37 +02:00
|
|
|
*/
|
2005-08-25 08:00:55 +02:00
|
|
|
#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 )
|
|
|
|
#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 )
|
2005-08-24 06:31:31 +02:00
|
|
|
|
|
|
|
#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )
|
|
|
|
|
|
|
|
|
2018-09-04 08:00:58 +02:00
|
|
|
/**************************************************************************
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_ClassicKern_Validate
|
|
|
|
*
|
|
|
|
* @description:
|
2018-08-24 18:52:30 +02:00
|
|
|
* Validate classic (16-bit format) kern table to assure that the
|
|
|
|
* offsets and indices are valid. The idea is that a higher-level
|
|
|
|
* library that actually does the text layout can access those tables
|
|
|
|
* without error checking (which can be quite time consuming).
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
2019-02-21 09:19:09 +01:00
|
|
|
* The 'kern' table validator in @FT_TrueTypeGX_Validate deals with both
|
2018-06-17 11:22:37 +02:00
|
|
|
* the new 32-bit format and the classic 16-bit format, while
|
|
|
|
* FT_ClassicKern_Validate only supports the classic 16-bit format.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* face ::
|
|
|
|
* A handle to the input face.
|
|
|
|
*
|
|
|
|
* validation_flags ::
|
|
|
|
* A bit field that specifies the dialect to be validated. See
|
|
|
|
* @FT_VALIDATE_CKERNXXX for possible values.
|
|
|
|
*
|
|
|
|
* @output:
|
|
|
|
* ckern_table ::
|
|
|
|
* A pointer to the kern table.
|
|
|
|
*
|
|
|
|
* @return:
|
|
|
|
* FreeType error code. 0~means success.
|
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* After use, the application should deallocate the buffers pointed to by
|
2019-02-20 16:18:40 +01:00
|
|
|
* `ckern_table`, by calling @FT_ClassicKern_Free. A `NULL` value
|
2018-06-17 11:22:37 +02:00
|
|
|
* indicates that the table doesn't exist in the font.
|
|
|
|
*/
|
2005-08-24 06:31:31 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
2005-08-25 08:00:55 +02:00
|
|
|
FT_ClassicKern_Validate( FT_Face face,
|
|
|
|
FT_UInt validation_flags,
|
|
|
|
FT_Bytes *ckern_table );
|
2005-08-24 06:31:31 +02:00
|
|
|
|
|
|
|
|
2018-09-04 08:00:58 +02:00
|
|
|
/**************************************************************************
|
2018-06-17 11:22:37 +02:00
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FT_ClassicKern_Free
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Free the buffer allocated by classic Kern validator.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* face ::
|
|
|
|
* A handle to the input face.
|
|
|
|
*
|
|
|
|
* table ::
|
|
|
|
* The pointer to the buffer that is allocated by
|
|
|
|
* @FT_ClassicKern_Validate.
|
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* This function must be used to free the buffer allocated by
|
|
|
|
* @FT_ClassicKern_Validate only.
|
|
|
|
*/
|
2005-11-18 08:47:06 +01:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_ClassicKern_Free( FT_Face face,
|
|
|
|
FT_Bytes table );
|
|
|
|
|
2014-12-02 23:06:04 +01:00
|
|
|
/* */
|
2005-08-24 06:31:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
FT_END_HEADER
|
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#endif /* FTGXVAL_H_ */
|
2005-08-24 06:31:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|