Visualization Library 2.0.0-b5

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
gxvmort0.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* gxvmort0.c */
4 /* */
5 /* TrueTypeGX/AAT mort table validation */
6 /* body for type0 (Indic Script Rearrangement) subtable. */
7 /* */
8 /* Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 /* */
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. */
16 /* */
17 /***************************************************************************/
18 
19 /***************************************************************************/
20 /* */
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. */
24 /* */
25 /***************************************************************************/
26 
27 
28 #include "gxvmort.h"
29 
30 
31  /*************************************************************************/
32  /* */
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. */
36  /* */
37 #undef FT_COMPONENT
38 #define FT_COMPONENT trace_gxvmort
39 
40 
41  static const char* GXV_Mort_IndicScript_Msg[] =
42  {
43  "no change",
44  "Ax => xA",
45  "xD => Dx",
46  "AxD => DxA",
47  "ABx => xAB",
48  "ABx => xBA",
49  "xCD => CDx",
50  "xCD => DCx",
51  "AxCD => CDxA",
52  "AxCD => DCxA",
53  "ABxD => DxAB",
54  "ABxD => DxBA",
55  "ABxCD => CDxAB",
56  "ABxCD => CDxBA",
57  "ABxCD => DCxAB",
58  "ABxCD => DCxBA",
59 
60  };
61 
62 
63  static void
64  gxv_mort_subtable_type0_entry_validate(
65  FT_Byte state,
67  GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
70  GXV_Validator valid )
71  {
72  FT_UShort markFirst;
73  FT_UShort dontAdvance;
74  FT_UShort markLast;
75  FT_UShort reserved;
76  FT_UShort verb = 0;
77 
78  FT_UNUSED( state );
79  FT_UNUSED( table );
80  FT_UNUSED( limit );
81 
82  FT_UNUSED( GXV_Mort_IndicScript_Msg[verb] ); /* for the non-debugging */
83  FT_UNUSED( glyphOffset_p ); /* case */
84 
85 
86  markFirst = (FT_UShort)( ( flags >> 15 ) & 1 );
87  dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );
88  markLast = (FT_UShort)( ( flags >> 13 ) & 1 );
89 
90  reserved = (FT_UShort)( flags & 0x1FF0 );
91  verb = (FT_UShort)( flags & 0x000F );
92 
93  GXV_TRACE(( " IndicScript MorphRule for glyphOffset 0x%04x",
94  glyphOffset_p->u ));
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] ));
100 
101  if ( markFirst > 0 && markLast > 0 )
102  {
103  GXV_TRACE(( " [odd] a glyph is marked as the first and last"
104  " in Indic rearrangement\n" ));
106  }
107 
108  if ( markFirst > 0 && dontAdvance > 0 )
109  {
110  GXV_TRACE(( " [odd] the first glyph is marked as dontAdvance"
111  " in Indic rearrangement\n" ));
113  }
114 
115  if ( 0 < reserved )
116  {
117  GXV_TRACE(( " non-zero bits found in reserved range\n" ));
119  }
120  else
121  GXV_TRACE(( "\n" ));
122  }
123 
124 
125  FT_LOCAL_DEF( void )
127  FT_Bytes limit,
128  GXV_Validator valid )
129  {
130  FT_Bytes p = table;
131 
132 
134  "mort chain subtable type0 (Indic-Script Rearrangement)" );
135 
137 
138  valid->statetable.optdata = NULL;
143  gxv_mort_subtable_type0_entry_validate;
144 
145  gxv_StateTable_validate( p, limit, valid );
146 
147  GXV_EXIT;
148  }
149 
150 
151 /* END */
GLfloat GLfloat p
GXV_StateTable_Subtable_Setup_Func subtable_setup_func
Definition: gxvcommn.h:184
#define NULL
Definition: ftobjs.h:61
#define GXV_NAME_ENTER(name)
Definition: gxvcommn.h:301
#define GXV_TRACE(s)
Definition: gxvcommn.h:304
#define FT_UNUSED(arg)
Definition: ftconfig.h:76
#define GXV_SET_ERR_IF_PARANOID(err)
Definition: gxvcommn.h:66
GXV_StateTable_Entry_Validate_Func entry_validate_func
Definition: gxvcommn.h:185
unsigned char FT_Byte
Definition: fttypes.h:150
GXV_StateTable_ValidatorRec statetable
Definition: gxvcommn.h:254
GXV_GlyphOffset_Format entry_glyphoffset_fmt
Definition: gxvcommn.h:181
#define GXV_EXIT
Definition: gxvcommn.h:302
GXV_StateTable_OptData_Load_Func optdata_load_func
Definition: gxvcommn.h:186
GLbitfield flags
const FT_Byte * FT_Bytes
Definition: fttypes.h:161
#define GXV_STATETABLE_HEADER_SIZE
Definition: gxvcommn.h:520
#define FT_INVALID_DATA
Definition: ftvalid.h:141
unsigned short FT_UShort
Definition: fttypes.h:205
GLenum GLsizei GLenum GLenum const GLvoid * table
gxv_StateTable_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator valid)
Definition: gxvcommn.c:1214
GLint limit
#define FT_LOCAL_DEF(x)
Definition: ftconfig.h:236
#define GXV_LIMIT_CHECK(_count)
Definition: gxvcommn.h:272
gxv_mort_subtable_type0_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator valid)
Definition: gxvmort0.c:126