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