ReactOS  0.4.15-dev-1207-g698a8e6
gxvmort4.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* gxvmort4.c */
4 /* */
5 /* TrueTypeGX/AAT mort table validation */
6 /* body for type4 (Non-Contextual Glyph Substitution) subtable. */
7 /* */
8 /* Copyright 2005-2018 by */
9 /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
10 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
11 /* */
12 /* This file is part of the FreeType project, and may only be used, */
13 /* modified, and distributed under the terms of the FreeType project */
14 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
15 /* this file you indicate that you have read the license and */
16 /* understand and accept it fully. */
17 /* */
18 /***************************************************************************/
19 
20 /***************************************************************************/
21 /* */
22 /* gxvalid is derived from both gxlayout module and otvalid module. */
23 /* Development of gxlayout is supported by the Information-technology */
24 /* Promotion Agency(IPA), Japan. */
25 /* */
26 /***************************************************************************/
27 
28 
29 #include "gxvmort.h"
30 
31 
32  /*************************************************************************/
33  /* */
34  /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
35  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
36  /* messages during execution. */
37  /* */
38 #undef FT_COMPONENT
39 #define FT_COMPONENT trace_gxvmort
40 
41 
42  static void
44  GXV_LookupValueCPtr value_p,
45  GXV_Validator gxvalid )
46  {
47  FT_UNUSED( glyph );
48 
49  gxv_glyphid_validate( value_p->u, gxvalid );
50  }
51 
52  /*
53  +===============+ --------+
54  | lookup header | |
55  +===============+ |
56  | BinSrchHeader | |
57  +===============+ |
58  | lastGlyph[0] | |
59  +---------------+ |
60  | firstGlyph[0] | | head of lookup table
61  +---------------+ | +
62  | offset[0] | -> | offset [byte]
63  +===============+ | +
64  | lastGlyph[1] | | (glyphID - firstGlyph) * 2 [byte]
65  +---------------+ |
66  | firstGlyph[1] | |
67  +---------------+ |
68  | offset[1] | |
69  +===============+ |
70  |
71  .... |
72  |
73  16bit value array |
74  +===============+ |
75  | value | <-------+
76  ....
77  */
78 
79  static GXV_LookupValueDesc
81  FT_UShort relative_gindex,
82  GXV_LookupValueCPtr base_value_p,
83  FT_Bytes lookuptbl_limit,
84  GXV_Validator gxvalid )
85  {
86  FT_Bytes p;
90 
91  /* XXX: check range? */
92  offset = (FT_UShort)( base_value_p->u +
93  relative_gindex * sizeof ( FT_UShort ) );
94 
95  p = gxvalid->lookuptbl_head + offset;
96  limit = lookuptbl_limit;
97 
98  GXV_LIMIT_CHECK( 2 );
99  value.u = FT_NEXT_USHORT( p );
100 
101  return value;
102  }
103 
104 
105  FT_LOCAL_DEF( void )
107  FT_Bytes limit,
108  GXV_Validator gxvalid )
109  {
110  FT_Bytes p = table;
111 
112 
113  GXV_NAME_ENTER( "mort chain subtable type4 "
114  "(Non-Contextual Glyph Substitution)" );
115 
116  gxvalid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED;
117  gxvalid->lookupval_func = gxv_mort_subtable_type4_lookupval_validate;
118  gxvalid->lookupfmt4_trans = gxv_mort_subtable_type4_lookupfmt4_transit;
119 
120  gxv_LookupTable_validate( p, limit, gxvalid );
121 
122  GXV_EXIT;
123  }
124 
125 
126 /* END */
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define GXV_NAME_ENTER(name)
Definition: gxvcommn.h:301
GLintptr offset
Definition: glext.h:5920
gxv_glyphid_validate(FT_UShort gid, GXV_Validator gxvalid)
Definition: gxvcommn.c:813
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
GLint limit
Definition: glext.h:10326
gxv_LookupTable_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:755
#define GXV_EXIT
Definition: gxvcommn.h:302
gxv_mort_subtable_type4_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmort4.c:106
#define FT_LOCAL_DEF(x)
Definition: ftconfig.h:388
FT_Bytes lookuptbl_head
Definition: gxvcommn.h:249
static void gxv_mort_subtable_type4_lookupval_validate(FT_UShort glyph, GXV_LookupValueCPtr value_p, GXV_Validator gxvalid)
Definition: gxvmort4.c:43
union value::@490 u
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
GLsizei const GLfloat * value
Definition: glext.h:6069
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
static GXV_LookupValueDesc gxv_mort_subtable_type4_lookupfmt4_transit(FT_UShort relative_gindex, GXV_LookupValueCPtr base_value_p, FT_Bytes lookuptbl_limit, GXV_Validator gxvalid)
Definition: gxvmort4.c:80
GLfloat GLfloat p
Definition: glext.h:8902
unsigned short FT_UShort
Definition: fttypes.h:209
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#define GXV_LIMIT_CHECK(_count)
Definition: gxvcommn.h:272