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]
otvcommn.h
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* otvcommn.h */
4 /* */
5 /* OpenType common tables validation (specification). */
6 /* */
7 /* Copyright 2004, 2005, 2007, 2009 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
17 
18 
19 #ifndef __OTVCOMMN_H__
20 #define __OTVCOMMN_H__
21 
22 
23 #include <ft2build.h>
24 #include "otvalid.h"
25 #include FT_INTERNAL_DEBUG_H
26 
27 
29 
30 
31  /*************************************************************************/
32  /*************************************************************************/
33  /***** *****/
34  /***** VALIDATION *****/
35  /***** *****/
36  /*************************************************************************/
37  /*************************************************************************/
38 
40 
42  OTV_Validator valid );
43 
44  typedef struct OTV_ValidatorRec_
45  {
49 
52 
54 
56 
57  FT_UInt extra1; /* for passing parameters */
60 
61 #ifdef FT_DEBUG_LEVEL_TRACE
62  FT_UInt debug_indent;
63  const FT_String* debug_function_name[3];
64 #endif
65 
67 
68 
69 #undef FT_INVALID_
70 #define FT_INVALID_( _prefix, _error ) \
71  ft_validator_error( valid->root, _prefix ## _error )
72 
73 #define OTV_OPTIONAL_TABLE( _table ) FT_UShort _table; \
74  FT_Bytes _table ## _p
75 
76 #define OTV_OPTIONAL_OFFSET( _offset ) \
77  FT_BEGIN_STMNT \
78  _offset ## _p = p; \
79  _offset = FT_NEXT_USHORT( p ); \
80  FT_END_STMNT
81 
82 #define OTV_LIMIT_CHECK( _count ) \
83  FT_BEGIN_STMNT \
84  if ( p + (_count) > valid->root->limit ) \
85  FT_INVALID_TOO_SHORT; \
86  FT_END_STMNT
87 
88 #define OTV_SIZE_CHECK( _size ) \
89  FT_BEGIN_STMNT \
90  if ( _size > 0 && _size < table_size ) \
91  { \
92  if ( valid->root->level == FT_VALIDATE_PARANOID ) \
93  FT_INVALID_OFFSET; \
94  else \
95  { \
96  /* strip off `const' */ \
97  FT_Byte* pp = (FT_Byte*)_size ## _p; \
98  \
99  \
100  FT_TRACE3(( "\n" \
101  "Invalid offset to optional table `%s'" \
102  " set to zero.\n" \
103  "\n", #_size )); \
104  \
105  /* always assume 16bit entities */ \
106  _size = pp[0] = pp[1] = 0; \
107  } \
108  } \
109  FT_END_STMNT
110 
111 
112 #define OTV_NAME_(x) #x
113 #define OTV_NAME(x) OTV_NAME_(x)
114 
115 #define OTV_FUNC_(x) x##Func
116 #define OTV_FUNC(x) OTV_FUNC_(x)
117 
118 #ifdef FT_DEBUG_LEVEL_TRACE
119 
120 #define OTV_NEST1( x ) \
121  FT_BEGIN_STMNT \
122  valid->nesting_level = 0; \
123  valid->func[0] = OTV_FUNC( x ); \
124  valid->debug_function_name[0] = OTV_NAME( x ); \
125  FT_END_STMNT
126 
127 #define OTV_NEST2( x, y ) \
128  FT_BEGIN_STMNT \
129  valid->nesting_level = 0; \
130  valid->func[0] = OTV_FUNC( x ); \
131  valid->func[1] = OTV_FUNC( y ); \
132  valid->debug_function_name[0] = OTV_NAME( x ); \
133  valid->debug_function_name[1] = OTV_NAME( y ); \
134  FT_END_STMNT
135 
136 #define OTV_NEST3( x, y, z ) \
137  FT_BEGIN_STMNT \
138  valid->nesting_level = 0; \
139  valid->func[0] = OTV_FUNC( x ); \
140  valid->func[1] = OTV_FUNC( y ); \
141  valid->func[2] = OTV_FUNC( z ); \
142  valid->debug_function_name[0] = OTV_NAME( x ); \
143  valid->debug_function_name[1] = OTV_NAME( y ); \
144  valid->debug_function_name[2] = OTV_NAME( z ); \
145  FT_END_STMNT
146 
147 #define OTV_INIT valid->debug_indent = 0
148 
149 #define OTV_ENTER \
150  FT_BEGIN_STMNT \
151  valid->debug_indent += 2; \
152  FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \
153  FT_TRACE4(( "%s table\n", \
154  valid->debug_function_name[valid->nesting_level] )); \
155  FT_END_STMNT
156 
157 #define OTV_NAME_ENTER( name ) \
158  FT_BEGIN_STMNT \
159  valid->debug_indent += 2; \
160  FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \
161  FT_TRACE4(( "%s table\n", name )); \
162  FT_END_STMNT
163 
164 #define OTV_EXIT valid->debug_indent -= 2
165 
166 #define OTV_TRACE( s ) \
167  FT_BEGIN_STMNT \
168  FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \
169  FT_TRACE4( s ); \
170  FT_END_STMNT
171 
172 #else /* !FT_DEBUG_LEVEL_TRACE */
173 
174 #define OTV_NEST1( x ) \
175  FT_BEGIN_STMNT \
176  valid->nesting_level = 0; \
177  valid->func[0] = OTV_FUNC( x ); \
178  FT_END_STMNT
179 
180 #define OTV_NEST2( x, y ) \
181  FT_BEGIN_STMNT \
182  valid->nesting_level = 0; \
183  valid->func[0] = OTV_FUNC( x ); \
184  valid->func[1] = OTV_FUNC( y ); \
185  FT_END_STMNT
186 
187 #define OTV_NEST3( x, y, z ) \
188  FT_BEGIN_STMNT \
189  valid->nesting_level = 0; \
190  valid->func[0] = OTV_FUNC( x ); \
191  valid->func[1] = OTV_FUNC( y ); \
192  valid->func[2] = OTV_FUNC( z ); \
193  FT_END_STMNT
194 
195 #define OTV_INIT do { } while ( 0 )
196 #define OTV_ENTER do { } while ( 0 )
197 #define OTV_NAME_ENTER( name ) do { } while ( 0 )
198 #define OTV_EXIT do { } while ( 0 )
199 
200 #define OTV_TRACE( s ) do { } while ( 0 )
201 
202 #endif /* !FT_DEBUG_LEVEL_TRACE */
203 
204 
205 #define OTV_RUN valid->func[0]
206 
207 
208  /*************************************************************************/
209  /*************************************************************************/
210  /***** *****/
211  /***** COVERAGE TABLE *****/
212  /***** *****/
213  /*************************************************************************/
214  /*************************************************************************/
215 
216  FT_LOCAL( void )
218  OTV_Validator valid,
219  FT_Int expected_count );
220 
221  /* return first covered glyph */
222  FT_LOCAL( FT_UInt )
224 
225  /* return last covered glyph */
226  FT_LOCAL( FT_UInt )
228 
229  /* return number of covered glyphs */
230  FT_LOCAL( FT_UInt )
232 
233 
234  /*************************************************************************/
235  /*************************************************************************/
236  /***** *****/
237  /***** CLASS DEFINITION TABLE *****/
238  /***** *****/
239  /*************************************************************************/
240  /*************************************************************************/
241 
242  FT_LOCAL( void )
244  OTV_Validator valid );
245 
246 
247  /*************************************************************************/
248  /*************************************************************************/
249  /***** *****/
250  /***** DEVICE TABLE *****/
251  /***** *****/
252  /*************************************************************************/
253  /*************************************************************************/
254 
255  FT_LOCAL( void )
257  OTV_Validator valid );
258 
259 
260  /*************************************************************************/
261  /*************************************************************************/
262  /***** *****/
263  /***** LOOKUPS *****/
264  /***** *****/
265  /*************************************************************************/
266  /*************************************************************************/
267 
268  FT_LOCAL( void )
270  OTV_Validator valid );
271 
272  FT_LOCAL( void )
274  OTV_Validator valid );
275 
276 
277  /*************************************************************************/
278  /*************************************************************************/
279  /***** *****/
280  /***** FEATURES *****/
281  /***** *****/
282  /*************************************************************************/
283  /*************************************************************************/
284 
285  FT_LOCAL( void )
287  OTV_Validator valid );
288 
289  /* lookups must already be validated */
290  FT_LOCAL( void )
292  FT_Bytes lookups,
293  OTV_Validator valid );
294 
295 
296  /*************************************************************************/
297  /*************************************************************************/
298  /***** *****/
299  /***** LANGUAGE SYSTEM *****/
300  /***** *****/
301  /*************************************************************************/
302  /*************************************************************************/
303 
304  FT_LOCAL( void )
306  OTV_Validator valid );
307 
308 
309  /*************************************************************************/
310  /*************************************************************************/
311  /***** *****/
312  /***** SCRIPTS *****/
313  /***** *****/
314  /*************************************************************************/
315  /*************************************************************************/
316 
317  FT_LOCAL( void )
319  OTV_Validator valid );
320 
321  /* features must already be validated */
322  FT_LOCAL( void )
324  FT_Bytes features,
325  OTV_Validator valid );
326 
327 
328  /*************************************************************************/
329  /*************************************************************************/
330  /***** *****/
331  /***** UTILITY FUNCTIONS *****/
332  /***** *****/
333  /*************************************************************************/
334  /*************************************************************************/
335 
336 #define ChainPosClassSetFunc otv_x_Ox
337 #define ChainPosRuleSetFunc otv_x_Ox
338 #define ChainSubClassSetFunc otv_x_Ox
339 #define ChainSubRuleSetFunc otv_x_Ox
340 #define JstfLangSysFunc otv_x_Ox
341 #define JstfMaxFunc otv_x_Ox
342 #define LigGlyphFunc otv_x_Ox
343 #define LigatureArrayFunc otv_x_Ox
344 #define LigatureSetFunc otv_x_Ox
345 #define PosClassSetFunc otv_x_Ox
346 #define PosRuleSetFunc otv_x_Ox
347 #define SubClassSetFunc otv_x_Ox
348 #define SubRuleSetFunc otv_x_Ox
349 
350  FT_LOCAL( void )
352  OTV_Validator valid );
353 
354 #define AlternateSubstFormat1Func otv_u_C_x_Ox
355 #define ChainContextPosFormat1Func otv_u_C_x_Ox
356 #define ChainContextSubstFormat1Func otv_u_C_x_Ox
357 #define ContextPosFormat1Func otv_u_C_x_Ox
358 #define ContextSubstFormat1Func otv_u_C_x_Ox
359 #define LigatureSubstFormat1Func otv_u_C_x_Ox
360 #define MultipleSubstFormat1Func otv_u_C_x_Ox
361 
362  FT_LOCAL( void )
364  OTV_Validator valid );
365 
366 #define AlternateSetFunc otv_x_ux
367 #define AttachPointFunc otv_x_ux
368 #define ExtenderGlyphFunc otv_x_ux
369 #define JstfGPOSModListFunc otv_x_ux
370 #define JstfGSUBModListFunc otv_x_ux
371 #define SequenceFunc otv_x_ux
372 
373  FT_LOCAL( void )
375  OTV_Validator valid );
376 
377 #define PosClassRuleFunc otv_x_y_ux_sy
378 #define PosRuleFunc otv_x_y_ux_sy
379 #define SubClassRuleFunc otv_x_y_ux_sy
380 #define SubRuleFunc otv_x_y_ux_sy
381 
382  FT_LOCAL( void )
384  OTV_Validator valid );
385 
386 #define ChainPosClassRuleFunc otv_x_ux_y_uy_z_uz_p_sp
387 #define ChainPosRuleFunc otv_x_ux_y_uy_z_uz_p_sp
388 #define ChainSubClassRuleFunc otv_x_ux_y_uy_z_uz_p_sp
389 #define ChainSubRuleFunc otv_x_ux_y_uy_z_uz_p_sp
390 
391  FT_LOCAL( void )
393  OTV_Validator valid );
394 
395 #define ContextPosFormat2Func otv_u_O_O_x_Onx
396 #define ContextSubstFormat2Func otv_u_O_O_x_Onx
397 
398  FT_LOCAL( void )
400  OTV_Validator valid );
401 
402 #define ContextPosFormat3Func otv_u_x_y_Ox_sy
403 #define ContextSubstFormat3Func otv_u_x_y_Ox_sy
404 
405  FT_LOCAL( void )
407  OTV_Validator valid );
408 
409 #define ChainContextPosFormat2Func otv_u_O_O_O_O_x_Onx
410 #define ChainContextSubstFormat2Func otv_u_O_O_O_O_x_Onx
411 
412  FT_LOCAL( void )
414  OTV_Validator valid );
415 
416 #define ChainContextPosFormat3Func otv_u_x_Ox_y_Oy_z_Oz_p_sp
417 #define ChainContextSubstFormat3Func otv_u_x_Ox_y_Oy_z_Oz_p_sp
418 
419  FT_LOCAL( void )
421  OTV_Validator valid );
422 
423 
424  FT_LOCAL( FT_UInt )
426 
427  FT_LOCAL( FT_UInt )
429 
430  /* */
431 
433 
434 #endif /* __OTVCOMMN_H__ */
435 
436 
437 /* END */
otv_ClassDef_validate(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:221
FT_UInt nesting_level
Definition: otvcommn.h:53
otv_LangSys_validate(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:507
#define FT_END_HEADER
Definition: ftheader.h:54
otv_u_x_Ox_y_Oy_z_Oz_p_sp(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:977
signed int FT_Int
Definition: fttypes.h:216
void(* OTV_Validate_Func)(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.h:41
otv_u_O_O_O_O_x_Onx(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:924
FT_UInt extra1
Definition: otvcommn.h:57
FT_UInt glyph_count
Definition: otvcommn.h:51
FT_UInt type_count
Definition: otvcommn.h:47
otv_x_ux_y_uy_z_uz_p_sp(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:783
otv_u_C_x_Ox(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:672
otv_Device_validate(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:307
otv_x_ux(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:709
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
otv_GSUBGPOS_have_MarkAttachmentType_flag(FT_Bytes table)
Definition: otvcommn.c:1047
otv_ScriptList_validate(FT_Bytes table, FT_Bytes features, OTV_Validator valid)
Definition: otvcommn.c:584
otv_Coverage_validate(FT_Bytes table, OTV_Validator valid, FT_Int expected_count)
Definition: otvcommn.c:41
otv_FeatureList_validate(FT_Bytes table, FT_Bytes lookups, OTV_Validator valid)
Definition: otvcommn.c:463
#define FT_BEGIN_HEADER
Definition: ftheader.h:36
otv_Coverage_get_first(FT_Bytes table)
Definition: otvcommn.c:134
FT_UInt extra2
Definition: otvcommn.h:58
otv_u_O_O_x_Onx(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:839
FT_Validator root
Definition: otvcommn.h:46
FT_Bytes extra3
Definition: otvcommn.h:59
#define FT_LOCAL(x)
Definition: ftconfig.h:235
char FT_String
Definition: fttypes.h:183
otv_u_x_y_Ox_sy(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:885
typedefFT_BEGIN_HEADER struct FT_ValidatorRec_ volatile * FT_Validator
Definition: ftvalid.h:42
otv_Coverage_get_count(FT_Bytes table)
Definition: otvcommn.c:175
OTV_Validate_Func * type_funcs
Definition: otvcommn.h:48
otv_x_y_ux_sy(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:742
otv_Script_validate(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:548
const FT_Byte * FT_Bytes
Definition: fttypes.h:161
otv_Feature_validate(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:427
otv_GSUBGPOS_get_Lookup_count(FT_Bytes table)
Definition: otvcommn.c:1037
typedefFT_BEGIN_HEADER struct OTV_ValidatorRec_ * OTV_Validator
Definition: otvcommn.h:39
otv_LookupList_validate(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:383
FT_UInt lookup_count
Definition: otvcommn.h:50
unsigned int FT_UInt
Definition: fttypes.h:227
GLenum func
otv_Coverage_get_last(FT_Bytes table)
Definition: otvcommn.c:146
otv_x_Ox(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:642
otv_Lookup_validate(FT_Bytes table, OTV_Validator valid)
Definition: otvcommn.c:346
GLenum GLsizei GLenum GLenum const GLvoid * table
struct OTV_ValidatorRec_ OTV_ValidatorRec