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