1 /***************************************************************************/
5 /* TrueTypeGX/AAT mort table validation */
6 /* body for type0 (Indic Script Rearrangement) subtable. */
8 /* Copyright 2005 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_gxvmort
41 static const char* GXV_Mort_IndicScript_Msg[] =
64 gxv_mort_subtable_type0_entry_validate(
67 GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
73 FT_UShort dontAdvance;
82 FT_UNUSED( GXV_Mort_IndicScript_Msg[verb] ); /* for the non-debugging */
83 FT_UNUSED( glyphOffset_p ); /* case */
86 markFirst = (FT_UShort)( ( flags >> 15 ) & 1 );
87 dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );
88 markLast = (FT_UShort)( ( flags >> 13 ) & 1 );
90 reserved = (FT_UShort)( flags & 0x1FF0 );
91 verb = (FT_UShort)( flags & 0x000F );
93 GXV_TRACE(( " IndicScript MorphRule for glyphOffset 0x%04x",
95 GXV_TRACE(( " markFirst=%01d", markFirst ));
96 GXV_TRACE(( " dontAdvance=%01d", dontAdvance ));
97 GXV_TRACE(( " markLast=%01d", markLast ));
98 GXV_TRACE(( " %02d", verb ));
99 GXV_TRACE(( " %s\n", GXV_Mort_IndicScript_Msg[verb] ));
101 if ( markFirst > 0 && markLast > 0 )
103 GXV_TRACE(( " [odd] a glyph is marked as the first and last"
104 " in Indic rearrangement\n" ));
105 GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );
108 if ( markFirst > 0 && dontAdvance > 0 )
110 GXV_TRACE(( " [odd] the first glyph is marked as dontAdvance"
111 " in Indic rearrangement\n" ));
112 GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );
117 GXV_TRACE(( " non-zero bits found in reserved range\n" ));
118 GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );
126 gxv_mort_subtable_type0_validate( FT_Bytes table,
128 GXV_Validator valid )
134 "mort chain subtable type0 (Indic-Script Rearrangement)" );
136 GXV_LIMIT_CHECK( GXV_STATETABLE_HEADER_SIZE );
138 valid->statetable.optdata = NULL;
139 valid->statetable.optdata_load_func = NULL;
140 valid->statetable.subtable_setup_func = NULL;
141 valid->statetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_NONE;
142 valid->statetable.entry_validate_func =
143 gxv_mort_subtable_type0_entry_validate;
145 gxv_StateTable_validate( p, limit, valid );