|
|
|
@ -4,7 +4,7 @@ |
|
|
|
|
/* */ |
|
|
|
|
/* FreeType API for validating TrueTypeGX/AAT tables (specification). */ |
|
|
|
|
/* */ |
|
|
|
|
/* Copyright 2004 by */ |
|
|
|
|
/* Copyright 2004, 2005 by */ |
|
|
|
|
/* Masatake YAMATO, Redhat K.K, */ |
|
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
|
|
|
|
/* */ |
|
|
|
@ -17,9 +17,11 @@ |
|
|
|
|
/***************************************************************************/ |
|
|
|
|
|
|
|
|
|
/***************************************************************************/ |
|
|
|
|
/* */ |
|
|
|
|
/* gxvalid is derived from both gxlayout module and otvalid module. */ |
|
|
|
|
/* Development of gxlayout is support of Information-technology Promotion */ |
|
|
|
|
/* Agency(IPA), Japan. */ |
|
|
|
|
/* Development of gxlayout is supported by the Information-technology */ |
|
|
|
|
/* Promotion Agency(IPA), Japan. */ |
|
|
|
|
/* */ |
|
|
|
|
/***************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -57,14 +59,16 @@ FT_BEGIN_HEADER |
|
|
|
|
/* */ |
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
|
|
|
|
/***************************************************************************/ |
|
|
|
|
/* */ |
|
|
|
|
/* */ |
|
|
|
|
/* Warnings: Use FT_VALIDATE_XXX to validate a table. */ |
|
|
|
|
/* Following definitions are for gxvalid developers. */ |
|
|
|
|
/* */ |
|
|
|
|
/* */ |
|
|
|
|
/***************************************************************************/ |
|
|
|
|
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
/* */ |
|
|
|
|
/* */ |
|
|
|
|
/* Warning: Use FT_VALIDATE_XXX to validate a table. */ |
|
|
|
|
/* Following definitions are for gxvalid developers. */ |
|
|
|
|
/* */ |
|
|
|
|
/* */ |
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
|
|
|
|
#define FT_VALIDATE_feat_INDEX 0 |
|
|
|
|
#define FT_VALIDATE_mort_INDEX 1 |
|
|
|
|
#define FT_VALIDATE_morx_INDEX 2 |
|
|
|
@ -78,11 +82,11 @@ FT_BEGIN_HEADER |
|
|
|
|
#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX |
|
|
|
|
#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1) |
|
|
|
|
|
|
|
|
|
/* Up to 0x1000 is used by otvalid.
|
|
|
|
|
Ox2000 is reserved for feature ot extension. */ |
|
|
|
|
/* Up to 0x1000 is used by otvalid.
|
|
|
|
|
Ox2xxx is reserved for feature OT extension. */ |
|
|
|
|
#define FT_VALIDATE_GX_START 0x4000 |
|
|
|
|
#define FT_VALIDATE_GX_BITFIELD(tag) \ |
|
|
|
|
(FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX) |
|
|
|
|
#define FT_VALIDATE_GX_BITFIELD( tag ) \ |
|
|
|
|
( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
@ -96,43 +100,43 @@ FT_BEGIN_HEADER |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_feat :: |
|
|
|
|
* Validate feat table. |
|
|
|
|
* Validate `feat' table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_mort :: |
|
|
|
|
* Validate mort table. |
|
|
|
|
* Validate `mort' table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_morx :: |
|
|
|
|
* Validate morx table. |
|
|
|
|
* Validate `morx' table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_bsln :: |
|
|
|
|
* Validate bsln table. |
|
|
|
|
* Validate `bsln' table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_just :: |
|
|
|
|
* Validate just table. |
|
|
|
|
* Validate `just' table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_kern :: |
|
|
|
|
* Validate kern table. |
|
|
|
|
* Validate `kern' table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_opbd :: |
|
|
|
|
* Validate opbd table. |
|
|
|
|
* Validate `opbd' table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_trak :: |
|
|
|
|
* Validate trak table. |
|
|
|
|
* Validate `trak' table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_prop :: |
|
|
|
|
* Validate prop table. |
|
|
|
|
* Validate `prop' table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_lcar :: |
|
|
|
|
* Validate lcar table. |
|
|
|
|
* Validate `lcar' table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_GX :: |
|
|
|
@ -141,26 +145,26 @@ FT_BEGIN_HEADER |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#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 | \
|
|
|
|
|
#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 | \
|
|
|
|
|
FT_VALIDATE_lcar ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -186,12 +190,12 @@ FT_BEGIN_HEADER |
|
|
|
|
* @FT_VALIDATE_GXXXX for possible values. |
|
|
|
|
* |
|
|
|
|
* table_length :: |
|
|
|
|
* The length of tables. Generally FT_VALIDATE_GX_LENGTH should |
|
|
|
|
* be passed. |
|
|
|
|
* The size of the `tables' array. Normally, `FT_VALIDATE_GX_LENGTH' |
|
|
|
|
* should be passed. |
|
|
|
|
* |
|
|
|
|
* @output |
|
|
|
|
* tables :: |
|
|
|
|
* The array where each validated sfnt tables are stored to. |
|
|
|
|
* The array where all validated sfnt tables are stored. |
|
|
|
|
* The array itself must be allocated by a client. |
|
|
|
|
* |
|
|
|
|
* @return: |
|
|
|
@ -201,17 +205,17 @@ FT_BEGIN_HEADER |
|
|
|
|
* This function only works with TrueTypeGX fonts, returning an error |
|
|
|
|
* otherwise. |
|
|
|
|
* |
|
|
|
|
* After use, the application should deallocate the buffers pointed by each |
|
|
|
|
* tables' element. A NULL value indicates that the table either |
|
|
|
|
* doesn't exist in the font, the application hasn't asked for validation, or |
|
|
|
|
* the validator doesn't have ability to validate the sfnt table. |
|
|
|
|
* After use, the application should deallocate the buffers pointed to by |
|
|
|
|
* each tables' element. A NULL value 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. |
|
|
|
|
*/ |
|
|
|
|
FT_EXPORT( FT_Error ) |
|
|
|
|
FT_TrueTypeGX_Validate( FT_Face face, |
|
|
|
|
FT_UInt validation_flags, |
|
|
|
|
FT_Bytes tables[FT_VALIDATE_GX_LENGTH], |
|
|
|
|
FT_UInt table_length ); |
|
|
|
|
|
|
|
|
|
FT_TrueTypeGX_Validate( FT_Face face, |
|
|
|
|
FT_UInt validation_flags, |
|
|
|
|
FT_Bytes tables[FT_VALIDATE_GX_LENGTH], |
|
|
|
|
FT_UInt table_length ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* */ |
|
|
|
@ -223,27 +227,24 @@ FT_BEGIN_HEADER |
|
|
|
|
* |
|
|
|
|
* @description: |
|
|
|
|
* A list of bit-field constants used with @FT_ClassicKern_Validate |
|
|
|
|
* to indicate (a) classic kern dialect(s). |
|
|
|
|
* to indicate the classic kern dialect or dialects. If the selected |
|
|
|
|
* type doesn't fit, @FT_ClassicKern_Validate regards the table as |
|
|
|
|
* invalid. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_MS :: |
|
|
|
|
* Validate the kern table as it has classic Microsoft kern dialect. |
|
|
|
|
* If @FT_ClassicKern_Validate detects the table has the other |
|
|
|
|
* dialect, it regards the table invalid. |
|
|
|
|
* Handle the `kern' table as a classic Microsoft kern table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_APPLE :: |
|
|
|
|
* Validate the kern table as it has classic Apple kern dialect. |
|
|
|
|
* If @FT_ClassicKern_Validate detects the table has the other |
|
|
|
|
* dialect, it regards the table invalid. |
|
|
|
|
* Handle the `kern' table as a classic Apple kern table. |
|
|
|
|
* |
|
|
|
|
* @values: |
|
|
|
|
* FT_VALIDATE_CKERN :: |
|
|
|
|
* Validate the kern table as it has classic Apple kern dialect or |
|
|
|
|
* Microsoft kern dialect. |
|
|
|
|
* Handle the `kern' as either classic Apple or Microsoft kern table. |
|
|
|
|
*/ |
|
|
|
|
#define FT_VALIDATE_MS (FT_VALIDATE_GX_START << 0) |
|
|
|
|
#define FT_VALIDATE_APPLE (FT_VALIDATE_GX_START << 1) |
|
|
|
|
#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 ) |
|
|
|
|
#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 ) |
|
|
|
|
|
|
|
|
|
#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE ) |
|
|
|
|
|
|
|
|
@ -256,14 +257,14 @@ FT_BEGIN_HEADER |
|
|
|
|
* FT_ClassicKern_Validate |
|
|
|
|
* |
|
|
|
|
* @description: |
|
|
|
|
* Validate classic(16bit format) kern table to assure that the offsets |
|
|
|
|
* and indices are valid. The idea is that a higher-level library |
|
|
|
|
* which actually does the text layout can access those tables without |
|
|
|
|
* error checking (which can be quite time consuming). |
|
|
|
|
* Validate classic (16bit format) kern table to assure that the offsets |
|
|
|
|
* and indices are valid. The idea is that a higher-level library which |
|
|
|
|
* actually does the text layout can access those tables without error |
|
|
|
|
* checking (which can be quite time consuming). |
|
|
|
|
* |
|
|
|
|
* Kern table validator in @FT_TrueTypeGX_Validate deals both |
|
|
|
|
* new 32 bit format and classic 16 bit format. In other hand |
|
|
|
|
* this function supports only the classic 16 bit format. |
|
|
|
|
* The `kern' table validator in @FT_TrueTypeGX_Validate deals with both |
|
|
|
|
* the new 32bit format and the classic 16bit format, while |
|
|
|
|
* FT_ClassicKern_Validate only supports the classic 16bit format. |
|
|
|
|
* |
|
|
|
|
* @input: |
|
|
|
|
* face :: |
|
|
|
@ -281,14 +282,14 @@ FT_BEGIN_HEADER |
|
|
|
|
* FreeType error code. 0 means success. |
|
|
|
|
* |
|
|
|
|
* @note: |
|
|
|
|
* After use, the application should deallocate the buffers pointed by |
|
|
|
|
* ckern_table. A NULL value indicates that the table either |
|
|
|
|
* doesn't exist in the font. |
|
|
|
|
* After use, the application should deallocate the buffers pointed to by |
|
|
|
|
* ckern_table. A NULL value indicates that the table doesn't exist in |
|
|
|
|
* the font. |
|
|
|
|
*/ |
|
|
|
|
FT_EXPORT( FT_Error ) |
|
|
|
|
FT_ClassicKern_Validate( FT_Face face, |
|
|
|
|
FT_UInt validation_flags, |
|
|
|
|
FT_Bytes *ckern_table ); |
|
|
|
|
FT_ClassicKern_Validate( FT_Face face, |
|
|
|
|
FT_UInt validation_flags, |
|
|
|
|
FT_Bytes *ckern_table ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* */ |
|
|
|
|