ReactOS 0.4.16-dev-297-gc569aee
gxvkern.c File Reference
#include "gxvalid.h"
#include "gxvcommn.h"
Include dependency graph for gxvkern.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GXV_kern_DataRec_
 
struct  GXV_kern_fmt1_StateOptRec_
 
struct  GXV_kern_subtable_fmt2_DataRec_
 

Macros

#define FT_COMPONENT   trace_gxvkern
 
#define GXV_KERN_DATA(field)   GXV_TABLE_DATA( kern, field )
 
#define KERN_IS_CLASSIC(gxvalid)    ( KERN_VERSION_CLASSIC == GXV_KERN_DATA( version ) )
 
#define KERN_IS_NEW(gxvalid)    ( KERN_VERSION_NEW == GXV_KERN_DATA( version ) )
 
#define KERN_DIALECT(gxvalid)    GXV_KERN_DATA( dialect_request )
 
#define KERN_ALLOWS_MS(gxvalid)    ( KERN_DIALECT( gxvalid ) & KERN_DIALECT_MS )
 
#define KERN_ALLOWS_APPLE(gxvalid)    ( KERN_DIALECT( gxvalid ) & KERN_DIALECT_APPLE )
 
#define GXV_KERN_HEADER_SIZE   ( KERN_IS_NEW( gxvalid ) ? 8 : 4 )
 
#define GXV_KERN_SUBTABLE_HEADER_SIZE   ( KERN_IS_NEW( gxvalid ) ? 8 : 6 )
 
#define GXV_KERN_FMT2_DATA(field)
 

Typedefs

typedef enum GXV_kern_Version_ GXV_kern_Version
 
typedef enum GXV_kern_Dialect_ GXV_kern_Dialect
 
typedef struct GXV_kern_DataRec_ GXV_kern_DataRec
 
typedef struct GXV_kern_DataRec_GXV_kern_Data
 
typedef struct GXV_kern_fmt1_StateOptRec_ GXV_kern_fmt1_StateOptRec
 
typedef struct GXV_kern_fmt1_StateOptRec_GXV_kern_fmt1_StateOptRecData
 
typedef enum GXV_kern_ClassSpec_ GXV_kern_ClassSpec
 
typedef struct GXV_kern_subtable_fmt2_DataRec_ GXV_kern_subtable_fmt2_DataRec
 
typedef struct GXV_kern_subtable_fmt2_DataRec_GXV_kern_subtable_fmt2_Data
 

Enumerations

enum  GXV_kern_Version_ { KERN_VERSION_CLASSIC = 0x0000 , KERN_VERSION_NEW = 0x0001 }
 
enum  GXV_kern_Dialect_ { KERN_DIALECT_UNKNOWN = 0 , KERN_DIALECT_MS = FT_VALIDATE_MS , KERN_DIALECT_APPLE = FT_VALIDATE_APPLE , KERN_DIALECT_ANY = FT_VALIDATE_CKERN }
 
enum  GXV_kern_ClassSpec_ { GXV_KERN_CLS_L = 0 , GXV_KERN_CLS_R }
 

Functions

static void gxv_kern_subtable_fmt0_pairs_validate (FT_Bytes table, FT_Bytes limit, FT_UShort nPairs, GXV_Validator gxvalid)
 
static void gxv_kern_subtable_fmt0_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_kern_subtable_fmt1_valueTable_load (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_kern_subtable_fmt1_subtable_setup (FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid)
 
static void gxv_kern_subtable_fmt1_entry_validate (FT_Byte state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_kern_subtable_fmt1_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_kern_subtable_fmt2_clstbl_validate (FT_Bytes table, FT_Bytes limit, GXV_kern_ClassSpec spec, GXV_Validator gxvalid)
 
static void gxv_kern_subtable_fmt2_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_kern_subtable_fmt3_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static FT_Bool gxv_kern_coverage_new_apple_validate (FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
 
static FT_Bool gxv_kern_coverage_classic_apple_validate (FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
 
static FT_Bool gxv_kern_coverage_classic_microsoft_validate (FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
 
static GXV_kern_Dialect gxv_kern_coverage_validate (FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
 
static void gxv_kern_subtable_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_kern_validate_generic (FT_Bytes table, FT_Face face, FT_Bool classic_only, GXV_kern_Dialect dialect_request, FT_Validator ftvalid)
 
 gxv_kern_validate (FT_Bytes table, FT_Face face, FT_Validator ftvalid)
 
 gxv_kern_validate_classic (FT_Bytes table, FT_Face face, FT_Int dialect_flags, FT_Validator ftvalid)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_gxvkern

Definition at line 42 of file gxvkern.c.

◆ GXV_KERN_DATA

#define GXV_KERN_DATA (   field)    GXV_TABLE_DATA( kern, field )

Definition at line 80 of file gxvkern.c.

◆ GXV_KERN_FMT2_DATA

#define GXV_KERN_FMT2_DATA (   field)
Value:
( GXV_KERN_DATA( subtable_data ) ) )->field )
#define GXV_KERN_DATA(field)
Definition: gxvkern.c:80

Definition at line 365 of file gxvkern.c.

◆ GXV_KERN_HEADER_SIZE

#define GXV_KERN_HEADER_SIZE   ( KERN_IS_NEW( gxvalid ) ? 8 : 4 )

Definition at line 94 of file gxvkern.c.

◆ GXV_KERN_SUBTABLE_HEADER_SIZE

#define GXV_KERN_SUBTABLE_HEADER_SIZE   ( KERN_IS_NEW( gxvalid ) ? 8 : 6 )

Definition at line 95 of file gxvkern.c.

◆ KERN_ALLOWS_APPLE

#define KERN_ALLOWS_APPLE (   gxvalid)     ( KERN_DIALECT( gxvalid ) & KERN_DIALECT_APPLE )

Definition at line 91 of file gxvkern.c.

◆ KERN_ALLOWS_MS

#define KERN_ALLOWS_MS (   gxvalid)     ( KERN_DIALECT( gxvalid ) & KERN_DIALECT_MS )

Definition at line 89 of file gxvkern.c.

◆ KERN_DIALECT

#define KERN_DIALECT (   gxvalid)     GXV_KERN_DATA( dialect_request )

Definition at line 87 of file gxvkern.c.

◆ KERN_IS_CLASSIC

#define KERN_IS_CLASSIC (   gxvalid)     ( KERN_VERSION_CLASSIC == GXV_KERN_DATA( version ) )

Definition at line 82 of file gxvkern.c.

◆ KERN_IS_NEW

#define KERN_IS_NEW (   gxvalid)     ( KERN_VERSION_NEW == GXV_KERN_DATA( version ) )

Definition at line 84 of file gxvkern.c.

Typedef Documentation

◆ GXV_kern_ClassSpec

◆ GXV_kern_Data

◆ GXV_kern_DataRec

◆ GXV_kern_Dialect

◆ GXV_kern_fmt1_StateOptRec

◆ GXV_kern_fmt1_StateOptRecData

◆ GXV_kern_subtable_fmt2_Data

◆ GXV_kern_subtable_fmt2_DataRec

◆ GXV_kern_Version

Enumeration Type Documentation

◆ GXV_kern_ClassSpec_

Enumerator
GXV_KERN_CLS_L 
GXV_KERN_CLS_R 

Definition at line 341 of file gxvkern.c.

342 {
343 GXV_KERN_CLS_L = 0,
345
@ GXV_KERN_CLS_R
Definition: gxvkern.c:344
@ GXV_KERN_CLS_L
Definition: gxvkern.c:343
enum GXV_kern_ClassSpec_ GXV_kern_ClassSpec

◆ GXV_kern_Dialect_

Enumerator
KERN_DIALECT_UNKNOWN 
KERN_DIALECT_MS 
KERN_DIALECT_APPLE 
KERN_DIALECT_ANY 

Definition at line 61 of file gxvkern.c.

62 {
67
#define FT_VALIDATE_APPLE
Definition: ftgxval.h:279
#define FT_VALIDATE_CKERN
Definition: ftgxval.h:281
#define FT_VALIDATE_MS
Definition: ftgxval.h:278
@ KERN_DIALECT_MS
Definition: gxvkern.c:64
@ KERN_DIALECT_APPLE
Definition: gxvkern.c:65
@ KERN_DIALECT_UNKNOWN
Definition: gxvkern.c:63
@ KERN_DIALECT_ANY
Definition: gxvkern.c:66
enum GXV_kern_Dialect_ GXV_kern_Dialect

◆ GXV_kern_Version_

Enumerator
KERN_VERSION_CLASSIC 
KERN_VERSION_NEW 

Definition at line 53 of file gxvkern.c.

54 {
55 KERN_VERSION_CLASSIC = 0x0000,
56 KERN_VERSION_NEW = 0x0001
57
@ KERN_VERSION_CLASSIC
Definition: gxvkern.c:55
@ KERN_VERSION_NEW
Definition: gxvkern.c:56
enum GXV_kern_Version_ GXV_kern_Version

Function Documentation

◆ gxv_kern_coverage_classic_apple_validate()

static FT_Bool gxv_kern_coverage_classic_apple_validate ( FT_UShort  coverage,
FT_UShort format,
GXV_Validator  gxvalid 
)
static

Definition at line 596 of file gxvkern.c.

599 {
600 /* classic Apple-dialect */
601#ifdef GXV_LOAD_TRACE_VARS
602 FT_Bool horizontal;
603 FT_Bool cross_stream;
604#endif
605
606
607 /* check expected flags, but don't check if MS-dialect is impossible */
608 if ( !( coverage & 0xFD00 ) && KERN_ALLOWS_MS( gxvalid ) )
609 return FALSE;
610
611 /* reserved bits = 0 */
612 if ( coverage & 0x02FC )
613 return FALSE;
614
615#ifdef GXV_LOAD_TRACE_VARS
616 horizontal = FT_BOOL( ( coverage >> 15 ) & 1 );
617 cross_stream = FT_BOOL( ( coverage >> 13 ) & 1 );
618#endif
619
620 *format = (FT_UShort)( coverage & 0x0003 );
621
622 GXV_TRACE(( "classic Apple-dialect: "
623 "horizontal=%d, cross-stream=%d, format=%d\n",
624 horizontal, cross_stream, *format ));
625
626 /* format 1 requires GX State Machine, too new for classic */
627 if ( *format == 1 )
628 return FALSE;
629
630 GXV_TRACE(( "kerning values in Apple format subtable are ignored\n" ));
631
632 return TRUE;
633 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned short FT_UShort
Definition: fttypes.h:209
#define FT_BOOL(x)
Definition: fttypes.h:578
#define GXV_TRACE(s)
Definition: gxvcommn.h:304
#define KERN_ALLOWS_MS(gxvalid)
Definition: gxvkern.c:89
Definition: format.c:58

Referenced by gxv_kern_coverage_validate().

◆ gxv_kern_coverage_classic_microsoft_validate()

static FT_Bool gxv_kern_coverage_classic_microsoft_validate ( FT_UShort  coverage,
FT_UShort format,
GXV_Validator  gxvalid 
)
static

Definition at line 637 of file gxvkern.c.

640 {
641 /* classic Microsoft-dialect */
642#ifdef GXV_LOAD_TRACE_VARS
643 FT_Bool horizontal;
644 FT_Bool minimum;
645 FT_Bool cross_stream;
646 FT_Bool override;
647#endif
648
649 FT_UNUSED( gxvalid );
650
651
652 /* reserved bits = 0 */
653 if ( coverage & 0xFDF0 )
654 return FALSE;
655
656#ifdef GXV_LOAD_TRACE_VARS
657 horizontal = FT_BOOL( coverage & 1 );
658 minimum = FT_BOOL( ( coverage >> 1 ) & 1 );
659 cross_stream = FT_BOOL( ( coverage >> 2 ) & 1 );
660 override = FT_BOOL( ( coverage >> 3 ) & 1 );
661#endif
662
663 *format = (FT_UShort)( ( coverage >> 8 ) & 0x0003 );
664
665 GXV_TRACE(( "classic Microsoft-dialect: "
666 "horizontal=%d, minimum=%d, cross-stream=%d, "
667 "override=%d, format=%d\n",
668 horizontal, minimum, cross_stream, override, *format ));
669
670 if ( *format == 2 )
671 GXV_TRACE((
672 "kerning values in Microsoft format 2 subtable are ignored\n" ));
673
674 return TRUE;
675 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

Referenced by gxv_kern_coverage_validate().

◆ gxv_kern_coverage_new_apple_validate()

static FT_Bool gxv_kern_coverage_new_apple_validate ( FT_UShort  coverage,
FT_UShort format,
GXV_Validator  gxvalid 
)
static

Definition at line 559 of file gxvkern.c.

562 {
563 /* new Apple-dialect */
564#ifdef GXV_LOAD_TRACE_VARS
565 FT_Bool kernVertical;
566 FT_Bool kernCrossStream;
567 FT_Bool kernVariation;
568#endif
569
570 FT_UNUSED( gxvalid );
571
572
573 /* reserved bits = 0 */
574 if ( coverage & 0x1FFC )
575 return FALSE;
576
577#ifdef GXV_LOAD_TRACE_VARS
578 kernVertical = FT_BOOL( ( coverage >> 15 ) & 1 );
579 kernCrossStream = FT_BOOL( ( coverage >> 14 ) & 1 );
580 kernVariation = FT_BOOL( ( coverage >> 13 ) & 1 );
581#endif
582
583 *format = (FT_UShort)( coverage & 0x0003 );
584
585 GXV_TRACE(( "new Apple-dialect: "
586 "horizontal=%d, cross-stream=%d, variation=%d, format=%d\n",
587 !kernVertical, kernCrossStream, kernVariation, *format ));
588
589 GXV_TRACE(( "kerning values in Apple format subtable are ignored\n" ));
590
591 return TRUE;
592 }

Referenced by gxv_kern_coverage_validate().

◆ gxv_kern_coverage_validate()

static GXV_kern_Dialect gxv_kern_coverage_validate ( FT_UShort  coverage,
FT_UShort format,
GXV_Validator  gxvalid 
)
static

Definition at line 687 of file gxvkern.c.

690 {
692
693
694 GXV_NAME_ENTER( "validating coverage" );
695
696 GXV_TRACE(( "interpret coverage 0x%04x by Apple style\n", coverage ));
697
698 if ( KERN_IS_NEW( gxvalid ) )
699 {
701 format,
702 gxvalid ) )
703 {
705 goto Exit;
706 }
707 }
708
709 if ( KERN_IS_CLASSIC( gxvalid ) && KERN_ALLOWS_APPLE( gxvalid ) )
710 {
712 format,
713 gxvalid ) )
714 {
716 goto Exit;
717 }
718 }
719
720 if ( KERN_IS_CLASSIC( gxvalid ) && KERN_ALLOWS_MS( gxvalid ) )
721 {
723 format,
724 gxvalid ) )
725 {
727 goto Exit;
728 }
729 }
730
731 GXV_TRACE(( "cannot interpret coverage, broken kern subtable\n" ));
732
733 Exit:
734 GXV_EXIT;
735 return result;
736 }
GLuint64EXT * result
Definition: glext.h:11304
#define GXV_NAME_ENTER(name)
Definition: gxvcommn.h:301
#define GXV_EXIT
Definition: gxvcommn.h:302
#define KERN_IS_CLASSIC(gxvalid)
Definition: gxvkern.c:82
static FT_Bool gxv_kern_coverage_classic_apple_validate(FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
Definition: gxvkern.c:596
static FT_Bool gxv_kern_coverage_new_apple_validate(FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
Definition: gxvkern.c:559
#define KERN_IS_NEW(gxvalid)
Definition: gxvkern.c:84
#define KERN_ALLOWS_APPLE(gxvalid)
Definition: gxvkern.c:91
static FT_Bool gxv_kern_coverage_classic_microsoft_validate(FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
Definition: gxvkern.c:637
static void Exit(void)
Definition: sock.c:1330

Referenced by gxv_kern_subtable_validate().

◆ gxv_kern_subtable_fmt0_pairs_validate()

static void gxv_kern_subtable_fmt0_pairs_validate ( FT_Bytes  table,
FT_Bytes  limit,
FT_UShort  nPairs,
GXV_Validator  gxvalid 
)
static

Definition at line 110 of file gxvkern.c.

114 {
115 FT_Bytes p = table;
116 FT_UShort i;
117
118 FT_UShort last_gid_left = 0;
119 FT_UShort last_gid_right = 0;
120
121 FT_UNUSED( limit );
122
123
124 GXV_NAME_ENTER( "kern format 0 pairs" );
125
126 for ( i = 0; i < nPairs; i++ )
127 {
128 FT_UShort gid_left;
129 FT_UShort gid_right;
130#ifdef GXV_LOAD_UNUSED_VARS
131 FT_Short kernValue;
132#endif
133
134
135 /* left */
136 gid_left = FT_NEXT_USHORT( p );
137 gxv_glyphid_validate( gid_left, gxvalid );
138
139 /* right */
140 gid_right = FT_NEXT_USHORT( p );
141 gxv_glyphid_validate( gid_right, gxvalid );
142
143 /* Pairs of left and right GIDs must be unique and sorted. */
144 GXV_TRACE(( "left gid = %u, right gid = %u\n", gid_left, gid_right ));
145 if ( gid_left == last_gid_left )
146 {
147 if ( last_gid_right < gid_right )
148 last_gid_right = gid_right;
149 else
151 }
152 else if ( last_gid_left < gid_left )
153 {
154 last_gid_left = gid_left;
155 last_gid_right = gid_right;
156 }
157 else
159
160 /* skip the kern value */
161#ifdef GXV_LOAD_UNUSED_VARS
162 kernValue = FT_NEXT_SHORT( p );
163#else
164 p += 2;
165#endif
166 }
167
168 GXV_EXIT;
169 }
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
#define FT_NEXT_SHORT(buffer)
Definition: ftstream.h:223
signed short FT_Short
Definition: fttypes.h:198
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
#define FT_INVALID_DATA
Definition: ftvalid.h:150
GLint limit
Definition: glext.h:10326
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
gxv_glyphid_validate(FT_UShort gid, GXV_Validator gxvalid)
Definition: gxvcommn.c:813

Referenced by gxv_kern_subtable_fmt0_validate().

◆ gxv_kern_subtable_fmt0_validate()

static void gxv_kern_subtable_fmt0_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 172 of file gxvkern.c.

175 {
177
178 FT_UShort nPairs;
179 FT_UShort unitSize;
180
181
182 GXV_NAME_ENTER( "kern subtable format 0" );
183
184 unitSize = 2 + 2 + 2;
185 nPairs = 0;
186
187 /* nPairs, searchRange, entrySelector, rangeShift */
188 GXV_LIMIT_CHECK( 2 + 2 + 2 + 2 );
189 gxv_BinSrchHeader_validate( p, limit, &unitSize, &nPairs, gxvalid );
190 p += 2 + 2 + 2 + 2;
191
192 gxv_kern_subtable_fmt0_pairs_validate( p, limit, nPairs, gxvalid );
193
194 GXV_EXIT;
195 }
gxv_BinSrchHeader_validate(FT_Bytes table, FT_Bytes limit, FT_UShort *unitSize_p, FT_UShort *nUnits_p, GXV_Validator gxvalid)
Definition: gxvcommn.c:328
#define GXV_LIMIT_CHECK(_count)
Definition: gxvcommn.h:272
#define GXV_KERN_SUBTABLE_HEADER_SIZE
Definition: gxvkern.c:95
static void gxv_kern_subtable_fmt0_pairs_validate(FT_Bytes table, FT_Bytes limit, FT_UShort nPairs, GXV_Validator gxvalid)
Definition: gxvkern.c:110

Referenced by gxv_kern_subtable_validate().

◆ gxv_kern_subtable_fmt1_entry_validate()

static void gxv_kern_subtable_fmt1_entry_validate ( FT_Byte  state,
FT_UShort  flags,
GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 262 of file gxvkern.c.

269 {
270#ifdef GXV_LOAD_UNUSED_VARS
272 FT_UShort dontAdvance;
273#endif
274 FT_UShort valueOffset;
275#ifdef GXV_LOAD_UNUSED_VARS
276 FT_UShort kernAction;
277 FT_UShort kernValue;
278#endif
279
280 FT_UNUSED( state );
281 FT_UNUSED( glyphOffset_p );
282
283
284#ifdef GXV_LOAD_UNUSED_VARS
285 push = (FT_UShort)( ( flags >> 15 ) & 1 );
286 dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );
287#endif
288 valueOffset = (FT_UShort)( flags & 0x3FFF );
289
290 {
293 FT_Bytes p;
294
295
296 if ( valueOffset < vt_rec->valueTable )
298
299 p = table + valueOffset;
300 limit = table + vt_rec->valueTable + vt_rec->valueTable_length;
301
302 GXV_LIMIT_CHECK( 2 + 2 );
303#ifdef GXV_LOAD_UNUSED_VARS
304 kernAction = FT_NEXT_USHORT( p );
305 kernValue = FT_NEXT_USHORT( p );
306#endif
307 }
308 }
static int state
Definition: maze.c:121
#define FT_INVALID_OFFSET
Definition: ftvalid.h:138
GLbitfield flags
Definition: glext.h:7161
struct GXV_kern_fmt1_StateOptRec_ * GXV_kern_fmt1_StateOptRecData
if(dx< 0)
Definition: linetemp.h:194
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
GXV_StateTable_ValidatorRec statetable
Definition: gxvcommn.h:254
FT_UShort valueTable_length
Definition: gxvkern.c:204

Referenced by gxv_kern_subtable_fmt1_validate().

◆ gxv_kern_subtable_fmt1_subtable_setup()

static void gxv_kern_subtable_fmt1_subtable_setup ( FT_UShort  table_size,
FT_UShort  classTable,
FT_UShort  stateArray,
FT_UShort  entryTable,
FT_UShort classTable_length_p,
FT_UShort stateArray_length_p,
FT_UShort entryTable_length_p,
GXV_Validator  gxvalid 
)
static

Definition at line 228 of file gxvkern.c.

236 {
237 FT_UShort o[4];
238 FT_UShort *l[4];
239 FT_UShort buff[5];
240
243
244
245 o[0] = classTable;
246 o[1] = stateArray;
247 o[2] = entryTable;
248 o[3] = optdata->valueTable;
249 l[0] = classTable_length_p;
250 l[1] = stateArray_length_p;
251 l[2] = entryTable_length_p;
252 l[3] = &(optdata->valueTable_length);
253
255 }
r l[0]
Definition: byte_order.h:168
static unsigned char buff[32768]
Definition: fatten.c:17
gxv_set_length_by_ushort_offset(FT_UShort *offset, FT_UShort **length, FT_UShort *buff, FT_UInt nmemb, FT_UShort limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:63
LOCAL int table_size
Definition: write.c:65

Referenced by gxv_kern_subtable_fmt1_validate().

◆ gxv_kern_subtable_fmt1_validate()

static void gxv_kern_subtable_fmt1_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 312 of file gxvkern.c.

315 {
316 FT_Bytes p = table;
318
319
320 GXV_NAME_ENTER( "kern subtable format 1" );
321
322 gxvalid->statetable.optdata =
323 &vt_rec;
332
333 gxv_StateTable_validate( p, limit, gxvalid );
334
335 GXV_EXIT;
336 }
gxv_StateTable_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:1208
@ GXV_GLYPHOFFSET_NONE
Definition: gxvcommn.h:122
static void gxv_kern_subtable_fmt1_entry_validate(FT_Byte state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvkern.c:262
static void gxv_kern_subtable_fmt1_subtable_setup(FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid)
Definition: gxvkern.c:228
static void gxv_kern_subtable_fmt1_valueTable_load(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvkern.c:210
GXV_StateTable_Entry_Validate_Func entry_validate_func
Definition: gxvcommn.h:185
GXV_StateTable_Subtable_Setup_Func subtable_setup_func
Definition: gxvcommn.h:184
GXV_GlyphOffset_Format entry_glyphoffset_fmt
Definition: gxvcommn.h:181
GXV_StateTable_OptData_Load_Func optdata_load_func
Definition: gxvcommn.h:186

Referenced by gxv_kern_subtable_validate().

◆ gxv_kern_subtable_fmt1_valueTable_load()

static void gxv_kern_subtable_fmt1_valueTable_load ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 210 of file gxvkern.c.

213 {
214 FT_Bytes p = table;
217
218
219 GXV_LIMIT_CHECK( 2 );
220 optdata->valueTable = FT_NEXT_USHORT( p );
221 }

Referenced by gxv_kern_subtable_fmt1_validate().

◆ gxv_kern_subtable_fmt2_clstbl_validate()

static void gxv_kern_subtable_fmt2_clstbl_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_kern_ClassSpec  spec,
GXV_Validator  gxvalid 
)
static

Definition at line 373 of file gxvkern.c.

377 {
378 const FT_String* tag = GXV_KERN_FMT2_DATA( class_tag[spec] );
379 GXV_odtect_Range odtect = GXV_KERN_FMT2_DATA( odtect );
380
381 FT_Bytes p = table;
383 FT_UShort nGlyphs;
384
385
386 GXV_NAME_ENTER( "kern format 2 classTable" );
387
388 GXV_LIMIT_CHECK( 2 + 2 );
390 nGlyphs = FT_NEXT_USHORT( p );
391 GXV_TRACE(( " %s firstGlyph=%d, nGlyphs=%d\n",
392 tag, firstGlyph, nGlyphs ));
393
395 gxv_glyphid_validate( (FT_UShort)( firstGlyph + nGlyphs - 1 ), gxvalid );
396
397 gxv_array_getlimits_ushort( p, p + ( 2 * nGlyphs ),
398 &( GXV_KERN_FMT2_DATA( offset_min[spec] ) ),
399 &( GXV_KERN_FMT2_DATA( offset_max[spec] ) ),
400 gxvalid );
401
402 gxv_odtect_add_range( table, 2 * nGlyphs, tag, odtect );
403
404 GXV_EXIT;
405 }
char FT_String
Definition: fttypes.h:187
GLenum const GLvoid GLbitfield GLuint firstGlyph
Definition: glext.h:11716
gxv_array_getlimits_ushort(FT_Bytes table, FT_Bytes limit, FT_UShort *min, FT_UShort *max, GXV_Validator gxvalid)
Definition: gxvcommn.c:210
gxv_odtect_add_range(FT_Bytes start, FT_ULong length, const FT_String *name, GXV_odtect_Range odtect)
Definition: gxvcommn.c:1702
#define GXV_KERN_FMT2_DATA(field)
Definition: gxvkern.c:365
Definition: ecma_167.h:138

Referenced by gxv_kern_subtable_fmt2_validate().

◆ gxv_kern_subtable_fmt2_validate()

static void gxv_kern_subtable_fmt2_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 409 of file gxvkern.c.

412 {
413 GXV_ODTECT( 3, odtect );
415 { 0, 0, { 0, 0 }, { 0, 0 }, { "leftClass", "rightClass" }, NULL };
416
418 FT_UShort leftOffsetTable;
419 FT_UShort rightOffsetTable;
420
421
422 GXV_NAME_ENTER( "kern subtable format 2" );
423
424 GXV_ODTECT_INIT( odtect );
425 fmt2_rec.odtect = odtect;
426 GXV_KERN_DATA( subtable_data ) = &fmt2_rec;
427
428 GXV_LIMIT_CHECK( 2 + 2 + 2 + 2 );
429 GXV_KERN_FMT2_DATA( rowWidth ) = FT_NEXT_USHORT( p );
430 leftOffsetTable = FT_NEXT_USHORT( p );
431 rightOffsetTable = FT_NEXT_USHORT( p );
433
434 GXV_TRACE(( "rowWidth = %d\n", GXV_KERN_FMT2_DATA( rowWidth ) ));
435
436
437 GXV_LIMIT_CHECK( leftOffsetTable );
438 GXV_LIMIT_CHECK( rightOffsetTable );
440
442 GXV_KERN_CLS_L, gxvalid );
443
445 GXV_KERN_CLS_R, gxvalid );
446
447 if ( GXV_KERN_FMT2_DATA( offset_min[GXV_KERN_CLS_L] ) +
451
454 + GXV_KERN_FMT2_DATA( offset_max[GXV_KERN_CLS_R] )
456 "array", odtect );
457
458 gxv_odtect_validate( odtect, gxvalid );
459
460 GXV_EXIT;
461 }
#define NULL
Definition: types.h:112
gxv_odtect_validate(GXV_odtect_Range odtect, GXV_Validator gxvalid)
Definition: gxvcommn.c:1715
#define GXV_ODTECT(n, odtect)
Definition: gxvcommn.h:562
#define GXV_ODTECT_INIT(odtect)
Definition: gxvcommn.h:567
static void gxv_kern_subtable_fmt2_clstbl_validate(FT_Bytes table, FT_Bytes limit, GXV_kern_ClassSpec spec, GXV_Validator gxvalid)
Definition: gxvkern.c:373
GXV_odtect_Range odtect
Definition: gxvkern.c:360

Referenced by gxv_kern_subtable_validate().

◆ gxv_kern_subtable_fmt3_validate()

static void gxv_kern_subtable_fmt3_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 467 of file gxvkern.c.

470 {
472 FT_UShort glyphCount;
473 FT_Byte kernValueCount;
474 FT_Byte leftClassCount;
475 FT_Byte rightClassCount;
477
478
479 GXV_NAME_ENTER( "kern subtable format 3" );
480
481 GXV_LIMIT_CHECK( 2 + 1 + 1 + 1 + 1 );
482 glyphCount = FT_NEXT_USHORT( p );
483 kernValueCount = FT_NEXT_BYTE( p );
484 leftClassCount = FT_NEXT_BYTE( p );
485 rightClassCount = FT_NEXT_BYTE( p );
486 flags = FT_NEXT_BYTE( p );
487
488 if ( gxvalid->face->num_glyphs != glyphCount )
489 {
490 GXV_TRACE(( "maxGID=%d, but glyphCount=%d\n",
491 gxvalid->face->num_glyphs, glyphCount ));
493 }
494
495 if ( flags != 0 )
496 GXV_TRACE(( "kern subtable fmt3 has nonzero value"
497 " (%d) in unused flag\n", flags ));
498 /*
499 * just skip kernValue[kernValueCount]
500 */
501 GXV_LIMIT_CHECK( 2 * kernValueCount );
502 p += 2 * kernValueCount;
503
504 /*
505 * check leftClass[gid] < leftClassCount
506 */
507 {
508 FT_Byte min, max;
509
510
511 GXV_LIMIT_CHECK( glyphCount );
512 gxv_array_getlimits_byte( p, p + glyphCount, &min, &max, gxvalid );
513 p += gxvalid->subtable_length;
514
515 if ( leftClassCount < max )
517 }
518
519 /*
520 * check rightClass[gid] < rightClassCount
521 */
522 {
523 FT_Byte min, max;
524
525
526 GXV_LIMIT_CHECK( glyphCount );
527 gxv_array_getlimits_byte( p, p + glyphCount, &min, &max, gxvalid );
528 p += gxvalid->subtable_length;
529
530 if ( rightClassCount < max )
532 }
533
534 /*
535 * check kernIndex[i, j] < kernValueCount
536 */
537 {
538 FT_UShort i, j;
539
540
541 for ( i = 0; i < leftClassCount; i++ )
542 {
543 for ( j = 0; j < rightClassCount; j++ )
544 {
545 GXV_LIMIT_CHECK( 1 );
546 if ( kernValueCount < FT_NEXT_BYTE( p ) )
548 }
549 }
550 }
551
552 gxvalid->subtable_length = (FT_ULong)( p - table );
553
554 GXV_EXIT;
555 }
#define FT_NEXT_BYTE(buffer)
Definition: ftstream.h:220
unsigned long FT_ULong
Definition: fttypes.h:253
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_INVALID_GLYPH_ID
Definition: ftvalid.h:146
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
gxv_array_getlimits_byte(FT_Bytes table, FT_Bytes limit, FT_Byte *min, FT_Byte *max, GXV_Validator gxvalid)
Definition: gxvcommn.c:181
#define GXV_SET_ERR_IF_PARANOID(err)
Definition: gxvcommn.h:66
#define min(a, b)
Definition: monoChain.cc:55
FT_Long num_glyphs
Definition: freetype.h:1076
FT_ULong subtable_length
Definition: gxvcommn.h:244
#define max(a, b)
Definition: svc.c:63

Referenced by gxv_kern_subtable_validate().

◆ gxv_kern_subtable_validate()

static void gxv_kern_subtable_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 740 of file gxvkern.c.

743 {
744 FT_Bytes p = table;
745#ifdef GXV_LOAD_TRACE_VARS
746 FT_UShort version = 0; /* MS only: subtable version, unused */
747#endif
748 FT_ULong length; /* MS: 16bit, Apple: 32bit*/
749 FT_UShort coverage;
750#ifdef GXV_LOAD_TRACE_VARS
751 FT_UShort tupleIndex = 0; /* Apple only */
752#endif
753 FT_UShort u16[2];
754 FT_UShort format = 255; /* subtable format */
755
756
757 GXV_NAME_ENTER( "kern subtable" );
758
759 GXV_LIMIT_CHECK( 2 + 2 + 2 );
760 u16[0] = FT_NEXT_USHORT( p ); /* Apple: length_hi MS: version */
761 u16[1] = FT_NEXT_USHORT( p ); /* Apple: length_lo MS: length */
762 coverage = FT_NEXT_USHORT( p );
763
764 switch ( gxv_kern_coverage_validate( coverage, &format, gxvalid ) )
765 {
766 case KERN_DIALECT_MS:
767#ifdef GXV_LOAD_TRACE_VARS
768 version = u16[0];
769#endif
770 length = u16[1];
771#ifdef GXV_LOAD_TRACE_VARS
772 tupleIndex = 0;
773#endif
774 GXV_TRACE(( "Subtable version = %d\n", version ));
775 GXV_TRACE(( "Subtable length = %d\n", length ));
776 break;
777
779#ifdef GXV_LOAD_TRACE_VARS
780 version = 0;
781#endif
782 length = ( (FT_ULong)u16[0] << 16 ) + u16[1];
783#ifdef GXV_LOAD_TRACE_VARS
784 tupleIndex = 0;
785#endif
786 GXV_TRACE(( "Subtable length = %d\n", length ));
787
788 if ( KERN_IS_NEW( gxvalid ) )
789 {
790 GXV_LIMIT_CHECK( 2 );
791#ifdef GXV_LOAD_TRACE_VARS
792 tupleIndex = FT_NEXT_USHORT( p );
793#else
794 p += 2;
795#endif
796 GXV_TRACE(( "Subtable tupleIndex = %d\n", tupleIndex ));
797 }
798 break;
799
800 default:
801 length = u16[1];
802 GXV_TRACE(( "cannot detect subtable dialect, "
803 "just skip %d byte\n", length ));
804 goto Exit;
805 }
806
807 /* formats 1, 2, 3 require the position of the start of this subtable */
808 if ( format == 0 )
810 else if ( format == 1 )
812 else if ( format == 2 )
814 else if ( format == 3 )
816 else
818
819 Exit:
820 gxvalid->subtable_length = length;
821 GXV_EXIT;
822 }
USHORT u16
Definition: btrfs.h:13
static const WCHAR version[]
Definition: asmname.c:66
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
static void gxv_kern_subtable_fmt2_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvkern.c:409
static void gxv_kern_subtable_fmt3_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvkern.c:467
static void gxv_kern_subtable_fmt0_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvkern.c:172
static GXV_kern_Dialect gxv_kern_coverage_validate(FT_UShort coverage, FT_UShort *format, GXV_Validator gxvalid)
Definition: gxvkern.c:687
static void gxv_kern_subtable_fmt1_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvkern.c:312

Referenced by gxv_kern_validate_generic().

◆ gxv_kern_validate()

gxv_kern_validate ( FT_Bytes  table,
FT_Face  face,
FT_Validator  ftvalid 
)

Definition at line 898 of file gxvkern.c.

901 {
903 }
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
static void gxv_kern_validate_generic(FT_Bytes table, FT_Face face, FT_Bool classic_only, GXV_kern_Dialect dialect_request, FT_Validator ftvalid)
Definition: gxvkern.c:834

◆ gxv_kern_validate_classic()

gxv_kern_validate_classic ( FT_Bytes  table,
FT_Face  face,
FT_Int  dialect_flags,
FT_Validator  ftvalid 
)

Definition at line 907 of file gxvkern.c.

911 {
912 GXV_kern_Dialect dialect_request;
913
914
915 dialect_request = (GXV_kern_Dialect)dialect_flags;
916 gxv_kern_validate_generic( table, face, 1, dialect_request, ftvalid );
917 }

Referenced by classic_kern_validate().

◆ gxv_kern_validate_generic()

static void gxv_kern_validate_generic ( FT_Bytes  table,
FT_Face  face,
FT_Bool  classic_only,
GXV_kern_Dialect  dialect_request,
FT_Validator  ftvalid 
)
static

Definition at line 834 of file gxvkern.c.

839 {
840 GXV_ValidatorRec gxvalidrec;
841 GXV_Validator gxvalid = &gxvalidrec;
842
843 GXV_kern_DataRec kernrec;
844 GXV_kern_Data kern = &kernrec;
845
846 FT_Bytes p = table;
847 FT_Bytes limit = 0;
848
849 FT_ULong nTables = 0;
850 FT_UInt i;
851
852
853 gxvalid->root = ftvalid;
854 gxvalid->table_data = kern;
855 gxvalid->face = face;
856
857 FT_TRACE3(( "validating `kern' table\n" ));
858 GXV_INIT;
859 KERN_DIALECT( gxvalid ) = dialect_request;
860
861 GXV_LIMIT_CHECK( 2 );
863 GXV_TRACE(( "version 0x%04x (higher 16bit)\n",
865
866 if ( 0x0001 < GXV_KERN_DATA( version ) )
868 else if ( KERN_IS_CLASSIC( gxvalid ) )
869 {
870 GXV_LIMIT_CHECK( 2 );
871 nTables = FT_NEXT_USHORT( p );
872 }
873 else if ( KERN_IS_NEW( gxvalid ) )
874 {
875 if ( classic_only )
877
878 if ( 0x0000 != FT_NEXT_USHORT( p ) )
880
881 GXV_LIMIT_CHECK( 4 );
882 nTables = FT_NEXT_ULONG( p );
883 }
884
885 for ( i = 0; i < nTables; i++ )
886 {
887 GXV_TRACE(( "validating subtable %d/%d\n", i, nTables ));
888 /* p should be 32bit-aligned? */
889 gxv_kern_subtable_validate( p, 0, gxvalid );
890 p += gxvalid->subtable_length;
891 }
892
893 FT_TRACE4(( "\n" ));
894 }
WORD face[3]
Definition: mesh.c:4747
#define FT_TRACE3(varformat)
Definition: ftdebug.h:160
#define FT_TRACE4(varformat)
Definition: ftdebug.h:161
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238
unsigned int FT_UInt
Definition: fttypes.h:231
#define FT_INVALID_FORMAT
Definition: ftvalid.h:142
#define GXV_INIT
Definition: gxvcommn.h:300
static void gxv_kern_subtable_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvkern.c:740
#define KERN_DIALECT(gxvalid)
Definition: gxvkern.c:87
FT_Validator root
Definition: gxvcommn.h:239
void * table_data
Definition: gxvcommn.h:242

Referenced by gxv_kern_validate(), and gxv_kern_validate_classic().