1
/***************************************************************************/
5
/* TrueTypeGX/AAT morx table validation */
6
/* body for type5 (Contextual Glyph Insertion) subtable. */
8
/* Copyright 2005, 2007 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
9
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
11
/* This file is part of the FreeType project, and may only be used, */
12
/* modified, and distributed under the terms of the FreeType project */
13
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
14
/* this file you indicate that you have read the license and */
15
/* understand and accept it fully. */
17
/***************************************************************************/
19
/***************************************************************************/
21
/* gxvalid is derived from both gxlayout module and otvalid module. */
22
/* Development of gxlayout is supported by the Information-technology */
23
/* Promotion Agency(IPA), Japan. */
25
/***************************************************************************/
31
/*************************************************************************/
33
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
34
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
35
/* messages during execution. */
38
#define FT_COMPONENT trace_gxvmorx
42
* `morx' subtable type5 (Contextual Glyph Insertion)
43
* has format of a StateTable with insertion-glyph-list
44
* without name. However, the 32bit offset from the head
45
* of subtable to the i-g-l is given after `entryTable',
46
* without variable name specification (the existence of
47
* this offset to the table is different from mort type5).
51
typedef struct GXV_morx_subtable_type5_StateOptRec_
53
FT_ULong insertionGlyphList;
54
FT_ULong insertionGlyphList_length;
56
} GXV_morx_subtable_type5_StateOptRec,
57
*GXV_morx_subtable_type5_StateOptRecData;
60
#define GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE \
61
( GXV_STATETABLE_HEADER_SIZE + 4 )
65
gxv_morx_subtable_type5_insertionGlyphList_load( FT_Bytes table,
71
GXV_morx_subtable_type5_StateOptRecData optdata =
72
(GXV_morx_subtable_type5_StateOptRecData)valid->xstatetable.optdata;
76
optdata->insertionGlyphList = FT_NEXT_ULONG( p );
81
gxv_morx_subtable_type5_subtable_setup( FT_ULong table_size,
85
FT_ULong* classTable_length_p,
86
FT_ULong* stateArray_length_p,
87
FT_ULong* entryTable_length_p,
94
GXV_morx_subtable_type5_StateOptRecData optdata =
95
(GXV_morx_subtable_type5_StateOptRecData)valid->xstatetable.optdata;
101
o[3] = optdata->insertionGlyphList;
102
l[0] = classTable_length_p;
103
l[1] = stateArray_length_p;
104
l[2] = entryTable_length_p;
105
l[3] = &(optdata->insertionGlyphList_length);
107
gxv_set_length_by_ulong_offset( o, l, buff, 4, table_size, valid );
112
gxv_morx_subtable_type5_InsertList_validate( FT_UShort table_index,
116
GXV_Validator valid )
118
FT_Bytes p = table + table_index * 2;
121
while ( p < table + count * 2 + table_index * 2 )
123
FT_UShort insert_glyphID;
126
GXV_LIMIT_CHECK( 2 );
127
insert_glyphID = FT_NEXT_USHORT( p );
128
GXV_TRACE(( " 0x%04x", insert_glyphID ));
136
gxv_morx_subtable_type5_entry_validate(
139
GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
142
GXV_Validator valid )
146
FT_Bool currentIsKashidaLike;
147
FT_Bool markedIsKashidaLike;
148
FT_Bool currentInsertBefore;
149
FT_Bool markedInsertBefore;
150
FT_Byte currentInsertCount;
151
FT_Byte markedInsertCount;
152
FT_Byte currentInsertList;
153
FT_UShort markedInsertList;
158
setMark = FT_BOOL( ( flags >> 15 ) & 1 );
159
dontAdvance = FT_BOOL( ( flags >> 14 ) & 1 );
160
currentIsKashidaLike = FT_BOOL( ( flags >> 13 ) & 1 );
161
markedIsKashidaLike = FT_BOOL( ( flags >> 12 ) & 1 );
162
currentInsertBefore = FT_BOOL( ( flags >> 11 ) & 1 );
163
markedInsertBefore = FT_BOOL( ( flags >> 10 ) & 1 );
165
currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F );
166
markedInsertCount = (FT_Byte)( flags & 0x001F );
168
currentInsertList = (FT_Byte) ( glyphOffset_p->ul >> 16 );
169
markedInsertList = (FT_UShort)( glyphOffset_p->ul );
171
if ( currentInsertList && 0 != currentInsertCount )
172
gxv_morx_subtable_type5_InsertList_validate( currentInsertList,
177
if ( markedInsertList && 0 != markedInsertCount )
178
gxv_morx_subtable_type5_InsertList_validate( markedInsertList,
186
gxv_morx_subtable_type5_validate( FT_Bytes table,
188
GXV_Validator valid )
192
GXV_morx_subtable_type5_StateOptRec et_rec;
193
GXV_morx_subtable_type5_StateOptRecData et = &et_rec;
196
GXV_NAME_ENTER( "morx chain subtable type5 (Glyph Insertion)" );
198
GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE );
200
valid->xstatetable.optdata =
202
valid->xstatetable.optdata_load_func =
203
gxv_morx_subtable_type5_insertionGlyphList_load;
204
valid->xstatetable.subtable_setup_func =
205
gxv_morx_subtable_type5_subtable_setup;
206
valid->xstatetable.entry_glyphoffset_fmt =
207
GXV_GLYPHOFFSET_ULONG;
208
valid->xstatetable.entry_validate_func =
209
gxv_morx_subtable_type5_entry_validate;
211
gxv_XStateTable_validate( p, limit, valid );