31#include FT_SFNT_NAMES_H
32#include FT_SERVICE_GX_VALIDATE_H
42#define FT_COMPONENT trace_gxvkern
80#define GXV_KERN_DATA( field ) GXV_TABLE_DATA( kern, field )
82#define KERN_IS_CLASSIC( gxvalid ) \
83 ( KERN_VERSION_CLASSIC == GXV_KERN_DATA( version ) )
84#define KERN_IS_NEW( gxvalid ) \
85 ( KERN_VERSION_NEW == GXV_KERN_DATA( version ) )
87#define KERN_DIALECT( gxvalid ) \
88 GXV_KERN_DATA( dialect_request )
89#define KERN_ALLOWS_MS( gxvalid ) \
90 ( KERN_DIALECT( gxvalid ) & KERN_DIALECT_MS )
91#define KERN_ALLOWS_APPLE( gxvalid ) \
92 ( KERN_DIALECT( gxvalid ) & KERN_DIALECT_APPLE )
94#define GXV_KERN_HEADER_SIZE ( KERN_IS_NEW( gxvalid ) ? 8 : 4 )
95#define GXV_KERN_SUBTABLE_HEADER_SIZE ( KERN_IS_NEW( gxvalid ) ? 8 : 6 )
126 for (
i = 0;
i < nPairs;
i++ )
130#ifdef GXV_LOAD_UNUSED_VARS
144 GXV_TRACE((
"left gid = %u, right gid = %u\n", gid_left, gid_right ));
145 if ( gid_left == last_gid_left )
147 if ( last_gid_right < gid_right )
148 last_gid_right = gid_right;
152 else if ( last_gid_left < gid_left )
154 last_gid_left = gid_left;
155 last_gid_right = gid_right;
161#ifdef GXV_LOAD_UNUSED_VARS
184 unitSize = 2 + 2 + 2;
249 l[0] = classTable_length_p;
250 l[1] = stateArray_length_p;
251 l[2] = entryTable_length_p;
270#ifdef GXV_LOAD_UNUSED_VARS
275#ifdef GXV_LOAD_UNUSED_VARS
284#ifdef GXV_LOAD_UNUSED_VARS
296 if ( valueOffset < vt_rec->valueTable )
303#ifdef GXV_LOAD_UNUSED_VARS
365#define GXV_KERN_FMT2_DATA( field ) \
366 ( ( (GXV_kern_subtable_fmt2_DataRec *) \
367 ( GXV_KERN_DATA( subtable_data ) ) )->field )
391 GXV_TRACE((
" %s firstGlyph=%d, nGlyphs=%d\n",
415 { 0, 0, { 0, 0 }, { 0, 0 }, {
"leftClass",
"rightClass" },
NULL };
490 GXV_TRACE((
"maxGID=%d, but glyphCount=%d\n",
496 GXV_TRACE((
"kern subtable fmt3 has nonzero value"
497 " (%d) in unused flag\n",
flags ));
502 p += 2 * kernValueCount;
515 if ( leftClassCount <
max )
530 if ( rightClassCount <
max )
541 for (
i = 0;
i < leftClassCount;
i++ )
543 for (
j = 0;
j < rightClassCount;
j++ )
564#ifdef GXV_LOAD_TRACE_VARS
574 if ( coverage & 0x1FFC )
577#ifdef GXV_LOAD_TRACE_VARS
578 kernVertical =
FT_BOOL( ( coverage >> 15 ) & 1 );
579 kernCrossStream =
FT_BOOL( ( coverage >> 14 ) & 1 );
580 kernVariation =
FT_BOOL( ( coverage >> 13 ) & 1 );
586 "horizontal=%d, cross-stream=%d, variation=%d, format=%d\n",
587 !kernVertical, kernCrossStream, kernVariation, *
format ));
589 GXV_TRACE((
"kerning values in Apple format subtable are ignored\n" ));
601#ifdef GXV_LOAD_TRACE_VARS
612 if ( coverage & 0x02FC )
615#ifdef GXV_LOAD_TRACE_VARS
616 horizontal =
FT_BOOL( ( coverage >> 15 ) & 1 );
617 cross_stream =
FT_BOOL( ( coverage >> 13 ) & 1 );
623 "horizontal=%d, cross-stream=%d, format=%d\n",
624 horizontal, cross_stream, *
format ));
630 GXV_TRACE((
"kerning values in Apple format subtable are ignored\n" ));
642#ifdef GXV_LOAD_TRACE_VARS
653 if ( coverage & 0xFDF0 )
656#ifdef GXV_LOAD_TRACE_VARS
657 horizontal =
FT_BOOL( coverage & 1 );
658 minimum =
FT_BOOL( ( coverage >> 1 ) & 1 );
659 cross_stream =
FT_BOOL( ( coverage >> 2 ) & 1 );
660 override =
FT_BOOL( ( coverage >> 3 ) & 1 );
665 GXV_TRACE((
"classic Microsoft-dialect: "
666 "horizontal=%d, minimum=%d, cross-stream=%d, "
667 "override=%d, format=%d\n",
668 horizontal, minimum, cross_stream,
override, *
format ));
672 "kerning values in Microsoft format 2 subtable are ignored\n" ));
696 GXV_TRACE((
"interpret coverage 0x%04x by Apple style\n", coverage ));
731 GXV_TRACE((
"cannot interpret coverage, broken kern subtable\n" ));
745#ifdef GXV_LOAD_TRACE_VARS
750#ifdef GXV_LOAD_TRACE_VARS
767#ifdef GXV_LOAD_TRACE_VARS
771#ifdef GXV_LOAD_TRACE_VARS
779#ifdef GXV_LOAD_TRACE_VARS
783#ifdef GXV_LOAD_TRACE_VARS
791#ifdef GXV_LOAD_TRACE_VARS
796 GXV_TRACE((
"Subtable tupleIndex = %d\n", tupleIndex ));
802 GXV_TRACE((
"cannot detect subtable dialect, "
803 "just skip %d byte\n",
length ));
853 gxvalid->
root = ftvalid;
857 FT_TRACE3((
"validating `kern' table\n" ));
863 GXV_TRACE((
"version 0x%04x (higher 16bit)\n",
885 for (
i = 0;
i < nTables;
i++ )
887 GXV_TRACE((
"validating subtable %d/%d\n",
i, nTables ));
static const WCHAR version[]
static unsigned char buff[32768]
#define FT_TRACE3(varformat)
#define FT_TRACE4(varformat)
#define FT_VALIDATE_APPLE
#define FT_VALIDATE_CKERN
#define FT_NEXT_USHORT(buffer)
#define FT_NEXT_SHORT(buffer)
#define FT_NEXT_ULONG(buffer)
#define FT_NEXT_BYTE(buffer)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
#define FT_INVALID_FORMAT
#define FT_INVALID_OFFSET
typedefFT_BEGIN_HEADER struct FT_ValidatorRec_ volatile * FT_Validator
#define FT_INVALID_GLYPH_ID
GLenum GLuint GLint GLenum face
GLuint GLsizei GLsizei * length
GLenum const GLvoid GLbitfield GLuint firstGlyph
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
gxv_array_getlimits_byte(FT_Bytes table, FT_Bytes limit, FT_Byte *min, FT_Byte *max, GXV_Validator gxvalid)
gxv_BinSrchHeader_validate(FT_Bytes table, FT_Bytes limit, FT_UShort *unitSize_p, FT_UShort *nUnits_p, GXV_Validator gxvalid)
gxv_array_getlimits_ushort(FT_Bytes table, FT_Bytes limit, FT_UShort *min, FT_UShort *max, GXV_Validator gxvalid)
gxv_set_length_by_ushort_offset(FT_UShort *offset, FT_UShort **length, FT_UShort *buff, FT_UInt nmemb, FT_UShort limit, GXV_Validator gxvalid)
gxv_StateTable_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
gxv_odtect_add_range(FT_Bytes start, FT_ULong length, const FT_String *name, GXV_odtect_Range odtect)
gxv_glyphid_validate(FT_UShort gid, GXV_Validator gxvalid)
gxv_odtect_validate(GXV_odtect_Range odtect, GXV_Validator gxvalid)
#define GXV_ODTECT(n, odtect)
#define GXV_NAME_ENTER(name)
#define GXV_SET_ERR_IF_PARANOID(err)
#define GXV_ODTECT_INIT(odtect)
#define GXV_LIMIT_CHECK(_count)
struct GXV_kern_DataRec_ * GXV_kern_Data
#define KERN_IS_CLASSIC(gxvalid)
static void gxv_kern_subtable_fmt1_entry_validate(FT_Byte state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
static void gxv_kern_subtable_fmt2_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
struct GXV_kern_fmt1_StateOptRec_ GXV_kern_fmt1_StateOptRec
static FT_Bool gxv_kern_coverage_classic_apple_validate(FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
struct GXV_kern_DataRec_ GXV_kern_DataRec
static FT_Bool gxv_kern_coverage_new_apple_validate(FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
#define KERN_ALLOWS_MS(gxvalid)
static void gxv_kern_subtable_fmt3_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
static void gxv_kern_validate_generic(FT_Bytes table, FT_Face face, FT_Bool classic_only, GXV_kern_Dialect dialect_request, FT_Validator ftvalid)
enum GXV_kern_Version_ GXV_kern_Version
gxv_kern_validate_classic(FT_Bytes table, FT_Face face, FT_Int dialect_flags, FT_Validator ftvalid)
struct GXV_kern_subtable_fmt2_DataRec_ * GXV_kern_subtable_fmt2_Data
enum GXV_kern_ClassSpec_ GXV_kern_ClassSpec
#define KERN_IS_NEW(gxvalid)
static void gxv_kern_subtable_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
#define GXV_KERN_SUBTABLE_HEADER_SIZE
#define KERN_DIALECT(gxvalid)
static void gxv_kern_subtable_fmt0_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
#define KERN_ALLOWS_APPLE(gxvalid)
static void gxv_kern_subtable_fmt1_subtable_setup(FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid)
static void gxv_kern_subtable_fmt2_clstbl_validate(FT_Bytes table, FT_Bytes limit, GXV_kern_ClassSpec spec, GXV_Validator gxvalid)
static FT_Bool gxv_kern_coverage_classic_microsoft_validate(FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
static void gxv_kern_subtable_fmt1_valueTable_load(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
enum GXV_kern_Dialect_ GXV_kern_Dialect
gxv_kern_validate(FT_Bytes table, FT_Face face, FT_Validator ftvalid)
static void gxv_kern_subtable_fmt0_pairs_validate(FT_Bytes table, FT_Bytes limit, FT_UShort nPairs, GXV_Validator gxvalid)
#define GXV_KERN_DATA(field)
static GXV_kern_Dialect gxv_kern_coverage_validate(FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
static void gxv_kern_subtable_fmt1_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
#define GXV_KERN_FMT2_DATA(field)
struct GXV_kern_fmt1_StateOptRec_ * GXV_kern_fmt1_StateOptRecData
struct GXV_kern_subtable_fmt2_DataRec_ GXV_kern_subtable_fmt2_DataRec
static void push(calc_node_t *op)
GXV_StateTable_Entry_Validate_Func entry_validate_func
GXV_StateTable_Subtable_Setup_Func subtable_setup_func
GXV_GlyphOffset_Format entry_glyphoffset_fmt
GXV_StateTable_OptData_Load_Func optdata_load_func
GXV_StateTable_ValidatorRec statetable
GXV_kern_Dialect dialect_request
FT_UShort valueTable_length
const FT_String * class_tag[2]