ref: e72c9fec173186df4871617a767c0bf8ddfdde84
parent: 35ca3426ebfd290956dfd79e0e5c27ff1c9db6d9
author: Werner Lemberg <[email protected]>
date: Mon Jul 31 14:59:02 EDT 2000
Simplifying the FIELD_* and FRAME_* macros. Before calling these macros, you should #define FT_STRUCTURE to the structure which will be filled. Replaced FT_FIELD_REF with FT_FIELD_SIZE, FT_FIELD_SIZE_DELTA, and FT_FIELD_OFFSET to make the code more readable; additionally, it should be more portable because we no longer cast a pointer to an FT_UShort (which e.g. fails with Sun's C++ compiler) but computes the difference between two pointers which is guaranteed to work. Fixing warnings (and C++ errors) while using Sun's latest cc and CC incarnations. Most of them are related to variable shadowing.
--- a/builds/unix/ftsystem.c
+++ b/builds/unix/ftsystem.c
@@ -235,12 +235,12 @@
stream->size = stat_buf.st_size;
stream->pos = 0;
- stream->base = mmap( NULL,
- stream->size,
- PROT_READ,
- MAP_FILE | MAP_PRIVATE,
- file,
- 0 );
+ stream->base = (unsigned char*)mmap( NULL,
+ stream->size,
+ PROT_READ,
+ MAP_FILE | MAP_PRIVATE,
+ file,
+ 0 );
if ( (long)stream->base == -1 )
{
--- a/include/freetype/internal/ftstream.h
+++ b/include/freetype/internal/ftstream.h
@@ -81,48 +81,55 @@
typedef struct FT_Frame_Field_
{
FT_Frame_Op value;
- char size;
+ FT_Byte size;
FT_UShort offset;
} FT_Frame_Field;
- /* make-up a FT_Frame_Field out of a structure type and a field name */
-#define FT_FIELD_REF( s, f ) (((s*)0)->f)
+ /* Construct an FT_Frame_Field out of a structure type and a field name. */
+ /* The structure type must be set in the FT_STRUCTURE macro before */
+ /* calling the FT_FRAME_START() macro. */
+#define FT_FIELD_SIZE( f ) \
+ (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )
+#define FT_FIELD_SIZE_DELTA( f ) \
+ (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )
+#define FT_FIELD_OFFSET( f ) \
+ (FT_UShort)( (char*)&(((FT_STRUCTURE*)0)->f) - (char*)0 )
-#define FT_FRAME_FIELD( frame_op, struct_type, field ) \
- { \
- frame_op, \
- sizeof ( FT_FIELD_REF( struct_type,field ) ), \
- (FT_UShort)(char*)&FT_FIELD_REF( struct_type, field ) \
+#define FT_FRAME_FIELD( frame_op, field ) \
+ { \
+ frame_op, \
+ FT_FIELD_SIZE( field ), \
+ FT_FIELD_OFFSET( field ) \
}
#define FT_MAKE_EMPTY_FIELD( frame_op ) { frame_op, 0, 0 }
-#define FT_FRAME_START( s ) { ft_frame_start, 0, s }
-#define FT_FRAME_END { ft_frame_end, 0, 0 }
+#define FT_FRAME_START( size ) { ft_frame_start, 0, size }
+#define FT_FRAME_END { ft_frame_end, 0, 0 }
-#define FT_FRAME_LONG( s, f ) FT_FRAME_FIELD( ft_frame_long_be, s, f )
-#define FT_FRAME_ULONG( s, f ) FT_FRAME_FIELD( ft_frame_ulong_be, s, f )
-#define FT_FRAME_SHORT( s, f ) FT_FRAME_FIELD( ft_frame_short_be, s, f )
-#define FT_FRAME_USHORT( s, f ) FT_FRAME_FIELD( ft_frame_ushort_be, s, f )
-#define FT_FRAME_BYTE( s, f ) FT_FRAME_FIELD( ft_frame_byte, s, f )
-#define FT_FRAME_CHAR( s, f ) FT_FRAME_FIELD( ft_frame_schar, s, f )
+#define FT_FRAME_LONG( f ) FT_FRAME_FIELD( ft_frame_long_be, f )
+#define FT_FRAME_ULONG( f ) FT_FRAME_FIELD( ft_frame_ulong_be, f )
+#define FT_FRAME_SHORT( f ) FT_FRAME_FIELD( ft_frame_short_be, f )
+#define FT_FRAME_USHORT( f ) FT_FRAME_FIELD( ft_frame_ushort_be, f )
+#define FT_FRAME_BYTE( f ) FT_FRAME_FIELD( ft_frame_byte, f )
+#define FT_FRAME_CHAR( f ) FT_FRAME_FIELD( ft_frame_schar, f )
-#define FT_FRAME_LONG_LE( s, f ) FT_FRAME_FIELD( ft_frame_long_le, s, f )
-#define FT_FRAME_ULONG_LE( s, f ) FT_FRAME_FIELD( ft_frame_ulong_le, s, f )
-#define FT_FRAME_SHORT_LE( s, f ) FT_FRAME_FIELD( ft_frame_short_le, s, f )
-#define FT_FRAME_USHORT_LE( s, f ) FT_FRAME_FIELD( ft_frame_ushort_le, s, f )
+#define FT_FRAME_LONG_LE( f ) FT_FRAME_FIELD( ft_frame_long_le, f )
+#define FT_FRAME_ULONG_LE( f ) FT_FRAME_FIELD( ft_frame_ulong_le, f )
+#define FT_FRAME_SHORT_LE( f ) FT_FRAME_FIELD( ft_frame_short_le, f )
+#define FT_FRAME_USHORT_LE( f ) FT_FRAME_FIELD( ft_frame_ushort_le, f )
-#define FT_FRAME_SKIP_LONG { ft_frame_long_be, 0, 0 }
-#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 }
-#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 }
+#define FT_FRAME_SKIP_LONG { ft_frame_long_be, 0, 0 }
+#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 }
+#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 }
-#define FT_FRAME_BYTES( struct_type, field, count ) \
- { \
- ft_frame_bytes, \
- count, \
- (FT_UShort)(char*)&FT_FIELD_REF( struct_type, field ) \
+#define FT_FRAME_BYTES( field, count ) \
+ { \
+ ft_frame_bytes, \
+ count, \
+ FT_FIELD_OFFSET( field ) \
}
#define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 }
--- a/src/autohint/ahglyph.c
+++ b/src/autohint/ahglyph.c
@@ -260,14 +260,14 @@
void ah_outline_save( AH_Outline* outline,
AH_Loader* gloader )
{
- AH_Point* point = outline->points;
- AH_Point* limit = point + outline->num_points;
- FT_Vector* vec = gloader->current.outline.points;
- char* tag = gloader->current.outline.tags;
+ AH_Point* point = outline->points;
+ AH_Point* point_limit = point + outline->num_points;
+ FT_Vector* vec = gloader->current.outline.points;
+ char* tag = gloader->current.outline.tags;
/* we assume that the glyph loader has already been checked for storage */
- for ( ; point < limit; point++, vec++, tag++ )
+ for ( ; point < point_limit; point++, vec++, tag++ )
{
vec->x = point->x;
vec->y = point->y;
@@ -393,8 +393,8 @@
{
/* do one thing at a time -- it is easier to understand, and */
/* the code is clearer */
- AH_Point* point = points;
- AH_Point* limit = point + outline->num_points;
+ AH_Point* point;
+ AH_Point* point_limit = points + outline->num_points;
/* compute coordinates */
@@ -404,7 +404,7 @@
FT_Fixed y_scale = outline->y_scale;
- for (; point < limit; vec++, point++ )
+ for ( point = points; point < point_limit; vec++, point++ )
{
point->fx = vec->x;
point->fy = vec->y;
@@ -420,7 +420,7 @@
char* tag = source->tags;
- for ( point = points; point < limit; point++, tag++ )
+ for ( point = points; point < point_limit; point++, tag++ )
{
switch ( FT_CURVE_TAG( *tag ) )
{
@@ -448,7 +448,7 @@
end = points + source->contours[0];
prev = end;
- for ( point = points; point < limit; point++ )
+ for ( point = points; point < point_limit; point++ )
{
point->prev = prev;
if ( point < end )
@@ -460,7 +460,7 @@
{
point->next = first;
contour_index++;
- if ( point + 1 < limit )
+ if ( point + 1 < point_limit )
{
end = points + source->contours[contour_index];
first = point + 1;
@@ -472,13 +472,13 @@
/* set-up the contours array */
{
- AH_Point** contour = outline->contours;
- AH_Point** limit = contour + outline->num_contours;
- short* end = source->contours;
- short index = 0;
+ AH_Point** contour = outline->contours;
+ AH_Point** contour_limit = contour + outline->num_contours;
+ short* end = source->contours;
+ short index = 0;
- for ( ; contour < limit; contour++, end++ )
+ for ( ; contour < contour_limit; contour++, end++ )
{
contour[0] = points + index;
index = end[0] + 1;
@@ -487,7 +487,7 @@
/* compute directions of in & out vectors */
{
- for ( point = points; point < limit; point++ )
+ for ( point = points; point < point_limit; point++ )
{
AH_Point* prev;
AH_Point* next;
@@ -546,11 +546,11 @@
void ah_setup_uv( AH_Outline* outline,
AH_UV source )
{
- AH_Point* point = outline->points;
- AH_Point* limit = point + outline->num_points;
+ AH_Point* point = outline->points;
+ AH_Point* point_limit = point + outline->num_points;
- for ( ; point < limit; point++ )
+ for ( ; point < point_limit; point++ )
{
FT_Pos u, v;
@@ -616,16 +616,16 @@
for ( dimension = 1; dimension >= 0; dimension-- )
{
- AH_Point** contour = outline->contours;
- AH_Point** contour_limit = contour + outline->num_contours;
- AH_Segment* segment = segments;
- FT_Int num_segments = 0;
+ AH_Point** contour = outline->contours;
+ AH_Point** contour_limit = contour + outline->num_contours;
+ AH_Segment* segment = segments;
+ FT_Int num_segments = 0;
#ifdef AH_HINT_METRICS
- AH_Point* min_point = 0;
- AH_Point* max_point = 0;
- FT_Pos min_coord = 32000;
- FT_Pos max_coord = -32000;
+ AH_Point* min_point = 0;
+ AH_Point* max_point = 0;
+ FT_Pos min_coord = 32000;
+ FT_Pos max_coord = -32000;
#endif
@@ -747,11 +747,13 @@
segment->contour = contour;
on_edge = 1;
+#ifdef AH_HINT_METRICS
if ( point == max_point )
max_point = 0;
if ( point == min_point )
min_point = 0;
+#endif
}
point = point->next;
@@ -765,17 +767,18 @@
/* we do this by inserting fake segments when needed */
if ( dimension == 0 )
{
- AH_Point* point = outline->points;
- AH_Point* limit = point + outline->num_points;
+ AH_Point* point = outline->points;
+ AH_Point* point_limit = point + outline->num_points;
- AH_Point* min_point = 0;
- AH_Point* max_point = 0;
- FT_Pos min_pos = 32000;
- FT_Pos max_pos = -32000;
+ FT_Pos min_pos = 32000;
+ FT_Pos max_pos = -32000;
+ min_point = 0;
+ max_point = 0;
+
/* compute minimum and maximum points */
- for ( ; point < limit; point++ )
+ for ( ; point < point_limit; point++ )
{
FT_Pos x = point->fx;
@@ -840,14 +843,14 @@
void ah_outline_link_segments( AH_Outline* outline )
{
AH_Segment* segments;
- AH_Segment* limit;
+ AH_Segment* segment_limit;
int dimension;
ah_setup_uv( outline, ah_uv_fyx );
- segments = outline->horz_segments;
- limit = segments + outline->num_hsegments;
+ segments = outline->horz_segments;
+ segment_limit = segments + outline->num_hsegments;
for ( dimension = 1; dimension >= 0; dimension-- )
{
@@ -856,7 +859,7 @@
/* now compare each segment to the others */
- for ( seg1 = segments; seg1 < limit; seg1++ )
+ for ( seg1 = segments; seg1 < segment_limit; seg1++ )
{
FT_Pos best_score = 32000;
AH_Segment* best_segment = 0;
@@ -867,7 +870,7 @@
if ( seg1->first == seg1->last )
continue;
- for ( seg2 = segments; seg2 < limit; seg2++ )
+ for ( seg2 = segments; seg2 < segment_limit; seg2++ )
if ( seg1 != seg2 && seg1->dir + seg2->dir == 0 )
{
FT_Pos pos1 = seg1->pos;
@@ -937,7 +940,7 @@
} /* edges 1 */
/* now, compute the `serif' segments */
- for ( seg1 = segments; seg1 < limit; seg1++ )
+ for ( seg1 = segments; seg1 < segment_limit; seg1++ )
{
seg2 = seg1->link;
@@ -950,8 +953,8 @@
ah_setup_uv( outline, ah_uv_fxy );
- segments = outline->vert_segments;
- limit = segments + outline->num_vsegments;
+ segments = outline->vert_segments;
+ segment_limit = segments + outline->num_vsegments;
}
}
@@ -962,14 +965,14 @@
void ah_dump_segments( AH_Outline* outline )
{
AH_Segment* segments;
- AH_Segment* limit;
+ AH_Segment* segment_limit;
AH_Point* points;
FT_Int dimension;
- points = outline->points;
- segments = outline->horz_segments;
- limit = segments + outline->num_hsegments;
+ points = outline->points;
+ segments = outline->horz_segments;
+ segment_limit = segments + outline->num_hsegments;
for ( dimension = 1; dimension >= 0; dimension-- )
{
@@ -981,7 +984,7 @@
printf ( " [ index | pos | dir | link | serif |"
" numl | first | start ]\n" );
- for ( seg = segments; seg < limit; seg++ )
+ for ( seg = segments; seg < segment_limit; seg++ )
{
printf ( " [ %5d | %4d | %5s | %4d | %5d | %4d | %5d | %5d ]\n",
seg - segments,
@@ -1002,8 +1005,8 @@
seg->last - points );
}
- segments = outline->vert_segments;
- limit = segments + outline->num_vsegments;
+ segments = outline->vert_segments;
+ segment_limit = segments + outline->num_vsegments;
}
}
@@ -1285,14 +1288,14 @@
void ah_outline_compute_blue_edges( AH_Outline* outline,
AH_Face_Globals* face_globals )
{
- AH_Edge* edge = outline->horz_edges;
- AH_Edge* limit = edge + outline->num_hedges;
- AH_Globals* globals = &face_globals->design;
- FT_Fixed y_scale = outline->y_scale;
+ AH_Edge* edge = outline->horz_edges;
+ AH_Edge* edge_limit = edge + outline->num_hedges;
+ AH_Globals* globals = &face_globals->design;
+ FT_Fixed y_scale = outline->y_scale;
/* compute for each horizontal edge, which blue zone is closer */
- for ( ; edge < limit; edge++ )
+ for ( ; edge < edge_limit; edge++ )
{
AH_Blue blue;
FT_Pos* best_blue = 0;
@@ -1381,14 +1384,14 @@
void ah_outline_scale_blue_edges( AH_Outline* outline,
AH_Face_Globals* globals )
{
- AH_Edge* edge = outline->horz_edges;
- AH_Edge* limit = edge + outline->num_hedges;
+ AH_Edge* edge = outline->horz_edges;
+ AH_Edge* edge_limit = edge + outline->num_hedges;
FT_Int delta;
delta = globals->scaled.blue_refs - globals->design.blue_refs;
- for ( ; edge < limit; edge++ )
+ for ( ; edge < edge_limit; edge++ )
{
if ( edge->blue_edge )
edge->blue_edge += delta;
@@ -1401,14 +1404,14 @@
void ah_dump_edges( AH_Outline* outline )
{
AH_Edge* edges;
- AH_Edge* limit;
+ AH_Edge* edge_limit;
AH_Segment* segments;
FT_Int dimension;
- edges = outline->horz_edges;
- limit = edges + outline->num_hedges;
- segments = outline->horz_segments;
+ edges = outline->horz_edges;
+ edge_limit = edges + outline->num_hedges;
+ segments = outline->horz_segments;
for ( dimension = 1; dimension >= 0; dimension-- )
{
@@ -1420,7 +1423,7 @@
printf ( " [ index | pos | dir | link |"
" serif | blue | opos | pos ]\n" );
- for ( edge = edges; edge < limit; edge++ )
+ for ( edge = edges; edge < edge_limit; edge++ )
{
printf ( " [ %5d | %4d | %5s | %4d | %5d | %c | %5.2f | %5.2f ]\n",
edge - edges,
@@ -1441,9 +1444,9 @@
edge->pos / 64.0 );
}
- edges = outline->vert_edges;
- limit = edges + outline->num_vedges;
- segments = outline->vert_segments;
+ edges = outline->vert_edges;
+ edge_limit = edges + outline->num_vedges;
+ segments = outline->vert_segments;
}
}
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -521,13 +521,8 @@
{
AH_Point* point;
AH_Edge* edge;
- AH_Edge* before;
- AH_Edge* after;
- before = 0;
- after = 0;
-
if ( edges < edge_limit )
for ( point = points; point < point_limit; point++ )
{
@@ -670,8 +665,7 @@
{
for ( p = p1; p <= p2; p++ )
{
- FT_Pos u = p->v;
-
+ u = p->v;
if ( u <= v1 )
u += d1;
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -669,7 +669,7 @@
case ft_frame_bytes: /* read a byte sequence */
case ft_frame_skip: /* skip some bytes */
{
- FT_Int len = fields->size;
+ FT_UInt len = fields->size;
if ( stream->cursor + len > stream->limit )
@@ -702,21 +702,16 @@
case ft_frame_short_le:
case ft_frame_ushort_le: /* read a 2-byte little-endian short */
- {
- FT_Byte* p;
+ value = 0;
+ p = stream->cursor;
-
- value = 0;
- p = stream->cursor;
-
- if ( p + 1 < stream->limit )
- {
- value = ( FT_UShort)p[0] | ((FT_UShort)p[1] << 8 );
- stream->cursor += 2;
- }
- sign_shift = 16;
- break;
+ if ( p + 1 < stream->limit )
+ {
+ value = ( FT_UShort)p[0] | ((FT_UShort)p[1] << 8 );
+ stream->cursor += 2;
}
+ sign_shift = 16;
+ break;
case ft_frame_long_be:
case ft_frame_ulong_be: /* read a 4-byte big-endian long */
@@ -726,24 +721,19 @@
case ft_frame_long_le:
case ft_frame_ulong_le: /* read a 4-byte little-endian long */
- {
- FT_Byte* p;
+ value = 0;
+ p = stream->cursor;
-
- value = 0;
- p = stream->cursor;
-
- if ( p + 3 < stream->limit )
- {
- value = (FT_ULong)p[0] |
- ( (FT_ULong)p[1] << 8 ) |
- ( (FT_ULong)p[2] << 16 ) |
- ( (FT_ULong)p[3] << 24 );
- stream->cursor += 4;
- }
- sign_shift = 0;
- break;
+ if ( p + 3 < stream->limit )
+ {
+ value = (FT_ULong)p[0] |
+ ( (FT_ULong)p[1] << 8 ) |
+ ( (FT_ULong)p[2] << 16 ) |
+ ( (FT_ULong)p[3] << 24 );
+ stream->cursor += 4;
}
+ sign_shift = 0;
+ break;
case ft_frame_off3_be:
case ft_frame_uoff3_be: /* read a 3-byte big-endian long */
@@ -753,23 +743,18 @@
case ft_frame_off3_le:
case ft_frame_uoff3_le: /* read a 3-byte little-endian long */
- {
- FT_Byte* p;
+ value = 0;
+ p = stream->cursor;
-
- value = 0;
- p = stream->cursor;
-
- if ( p + 2 < stream->limit )
- {
- value = (FT_ULong)p[0] |
- ( (FT_ULong)p[1] << 8 ) |
- ( (FT_ULong)p[2] << 16 );
- stream->cursor += 3;
- }
- sign_shift = 8;
- break;
+ if ( p + 2 < stream->limit )
+ {
+ value = (FT_ULong)p[0] |
+ ( (FT_ULong)p[1] << 8 ) |
+ ( (FT_ULong)p[2] << 16 );
+ stream->cursor += 3;
}
+ sign_shift = 8;
+ break;
default:
/* otherwise, exit the loop */
--- a/src/cff/t2load.c
+++ b/src/cff/t2load.c
@@ -571,11 +571,14 @@
{
static const FT_Frame_Field cff_header_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE CFF_Font
+
FT_FRAME_START( 4 ),
- FT_FRAME_BYTE( CFF_Font, version_major ),
- FT_FRAME_BYTE( CFF_Font, version_minor ),
- FT_FRAME_BYTE( CFF_Font, header_size ),
- FT_FRAME_BYTE( CFF_Font, absolute_offsize ),
+ FT_FRAME_BYTE( version_major ),
+ FT_FRAME_BYTE( version_minor ),
+ FT_FRAME_BYTE( header_size ),
+ FT_FRAME_BYTE( absolute_offsize ),
FT_FRAME_END
};
--- a/src/cff/t2objs.c
+++ b/src/cff/t2objs.c
@@ -343,7 +343,8 @@
else
{
/* rewind to start of file; we are going to load a pure-CFF font */
- (void)FILE_Seek( 0 );
+ if ( FILE_Seek( 0 ) )
+ goto Exit;
error = FT_Err_Ok;
}
--- a/src/cff/t2parse.c
+++ b/src/cff/t2parse.c
@@ -28,6 +28,7 @@
#include <freetype/internal/t2errors.h>
+#include <freetype/internal/ftstream.h>
/*************************************************************************/
@@ -359,8 +360,8 @@
static
FT_Error parse_cid_ros( T2_Parser* parser )
{
- CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
- FT_Byte** data = parser->stack;
+ CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
+ FT_Byte** data = parser->stack;
FT_Error error;
@@ -386,11 +387,9 @@
T2_FIELD( code, name, t2_kind_string )
#define T2_FIELD_BOOL( code, name ) \
T2_FIELD( code, name, t2_kind_bool )
-#define T2_FIELD_DELTA( code, name,max ) \
+#define T2_FIELD_DELTA( code, name, max ) \
T2_FIELD( code, name, t2_kind_delta )
-#define T2_REF( s, f ) ( ((s*)0)->f )
-
#define T2_FIELD_CALLBACK( code, name ) \
{ \
t2_kind_callback, \
@@ -401,25 +400,25 @@
},
#undef T2_FIELD
-#define T2_FIELD( code, name, kind ) \
- { \
- kind, \
- code | T2CODE, \
- (FT_UInt)(char*)&T2_REF( T2TYPE, name ), \
- sizeof( T2_REF( T2TYPE, name ) ), \
- 0, 0, 0 \
+#define T2_FIELD( code, name, kind ) \
+ { \
+ kind, \
+ code | T2CODE, \
+ FT_FIELD_OFFSET( name ), \
+ FT_FIELD_SIZE( name ), \
+ 0, 0, 0 \
},
#undef T2_FIELD_DELTA
-#define T2_FIELD_DELTA( code, name, max ) \
- { \
- t2_kind_delta, \
- code | T2CODE, \
- (FT_UInt)(char*)&T2_REF( T2TYPE, name ), \
- sizeof( T2_REF( T2TYPE, name )[0] ), \
- 0, \
- max, \
- (FT_UInt)(char*)&T2_REF( T2TYPE, num_ ## name ) \
+#define T2_FIELD_DELTA( code, name, max ) \
+ { \
+ t2_kind_delta, \
+ code | T2CODE, \
+ FT_FIELD_OFFSET( name ), \
+ FT_FIELD_SIZE_DELTA( name ), \
+ 0, \
+ max, \
+ FT_FIELD_OFFSET( num_ ## name ) \
},
#define T2CODE_TOPDICT 0x1000
--- a/src/cff/t2tokens.h
+++ b/src/cff/t2tokens.h
@@ -16,10 +16,10 @@
/***************************************************************************/
-#undef T2TYPE
+#undef FT_STRUCTURE
+#define FT_STRUCTURE CFF_Font_Dict
#undef T2CODE
-#define T2TYPE CFF_Font_Dict
-#define T2CODE T2CODE_TOPDICT
+#define T2CODE T2CODE_TOPDICT
T2_FIELD_STRING ( 0, version )
T2_FIELD_STRING ( 1, notice )
@@ -66,10 +66,10 @@
#endif
-#undef T2TYPE
+#undef FT_STRUCTURE
+#define FT_STRUCTURE CFF_Private
#undef T2CODE
-#define T2TYPE CFF_Private
-#define T2CODE T2CODE_PRIVATE
+#define T2CODE T2CODE_PRIVATE
T2_FIELD_DELTA( 6, blue_values, 14 )
T2_FIELD_DELTA( 7, other_blues, 10 )
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -214,7 +214,7 @@
if ( face->cid.cid_font_name )
{
root->family_name = face->cid.cid_font_name;
- root->style_name = "Regular";
+ root->style_name = (char *)"Regular";
}
}
--- a/src/cid/cidparse.h
+++ b/src/cid/cidparse.h
@@ -20,6 +20,7 @@
#define CIDPARSE_H
#include <freetype/internal/t1types.h>
+#include <freetype/internal/ftstream.h>
#ifdef __cplusplus
@@ -252,7 +253,7 @@
CID_Field_Type type; /* type of field */
CID_Field_Parser reader;
FT_UInt offset; /* offset of field in object */
- FT_UInt size; /* size of field in bytes */
+ FT_Byte size; /* size of field in bytes */
FT_UInt array_max; /* maximal number of elements for */
/* array */
FT_UInt count_offset; /* offset of element count for */
@@ -260,15 +261,13 @@
} CID_Field_Rec;
-#define CID_FIELD_REF( s, f ) ( ((s*)0)->f )
-
-#define CID_NEW_SIMPLE_FIELD( _ident, _type, _fname ) \
- { \
- _ident, T1CODE, _type, \
- 0, \
- (FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, _fname ), \
- sizeof ( CID_FIELD_REF( T1TYPE, _fname ) ), \
- 0, 0 \
+#define CID_NEW_SIMPLE_FIELD( _ident, _type, _fname ) \
+ { \
+ _ident, T1CODE, _type, \
+ 0, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE( _fname ), \
+ 0, 0 \
},
#define CID_NEW_CALLBACK_FIELD( _ident, _reader ) \
@@ -279,23 +278,23 @@
0, 0 \
},
-#define CID_NEW_TABLE_FIELD( _ident, _type, _fname, _max ) \
- { \
- _ident, T1CODE, _type, \
- 0, \
- (FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, _fname ), \
- sizeof ( CID_FIELD_REF( T1TYPE, _fname )[0] ), \
- _max, \
- (FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, num_ ## _fname ) \
+#define CID_NEW_TABLE_FIELD( _ident, _type, _fname, _max ) \
+ { \
+ _ident, T1CODE, _type, \
+ 0, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE_DELTA( _fname ), \
+ _max, \
+ FT_FIELD_OFFSET( num_ ## _fname ) \
},
-#define CID_NEW_TABLE_FIELD2( _ident, _type, _fname, _max ) \
- { \
- _ident, T1CODE, _type, \
- 0, \
- (FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, _fname ), \
- sizeof ( CID_FIELD_REF( T1TYPE, _fname )[0] ), \
- _max, 0 \
+#define CID_NEW_TABLE_FIELD2( _ident, _type, _fname, _max ) \
+ { \
+ _ident, T1CODE, _type, \
+ 0, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE_DELTA( _fname ), \
+ _max, 0 \
},
--- a/src/cid/cidtokens.h
+++ b/src/cid/cidtokens.h
@@ -16,10 +16,10 @@
/***************************************************************************/
-#undef T1TYPE
+#undef FT_STRUCTURE
+#define FT_STRUCTURE CID_Info
#undef T1CODE
-#define T1TYPE CID_Info
-#define T1CODE t1_field_cid_info
+#define T1CODE t1_field_cid_info
CID_FIELD_STRING ( "CIDFontName", cid_font_name )
CID_FIELD_NUM ( "CIDFontVersion", cid_version )
@@ -36,10 +36,10 @@
CID_FIELD_NUM ( "CIDCount", cid_count )
-#undef T1TYPE
+#undef FT_STRUCTURE
+#define FT_STRUCTURE T1_FontInfo
#undef T1CODE
-#define T1TYPE T1_FontInfo
-#define T1CODE t1_field_font_info
+#define T1CODE t1_field_font_info
CID_FIELD_STRING( "version", version )
CID_FIELD_STRING( "Notice", notice )
@@ -52,10 +52,10 @@
CID_FIELD_NUM ( "UnderlineThickness", underline_thickness )
-#undef T1TYPE
+#undef FT_STRUCTURE
+#define FT_STRUCTURE CID_FontDict
#undef T1CODE
-#define T1TYPE CID_FontDict
-#define T1CODE t1_field_font_dict
+#define T1CODE t1_field_font_dict
CID_FIELD_CALLBACK( "FontMatrix", font_matrix )
CID_FIELD_NUM ( "PaintType", paint_type )
@@ -69,10 +69,10 @@
CID_FIELD_NUM ( "StrokeWidth", stroke_width )
-#undef T1TYPE
+#undef FT_STRUCTURE
+#define FT_STRUCTURE T1_Private
#undef T1CODE
-#define T1TYPE T1_Private
-#define T1CODE t1_field_private
+#define T1CODE t1_field_private
CID_FIELD_NUM ( "UniqueID", unique_id )
CID_FIELD_NUM ( "lenIV", lenIV )
--- a/src/raster1/ftraster.c
+++ b/src/raster1/ftraster.c
@@ -2825,31 +2825,22 @@
/* Now finalize the profiles that needs it */
+ P = draw_left;
+ while ( P )
{
- PProfile Q, P;
-
-
- P = draw_left;
- while ( P )
- {
- Q = P->link;
- if ( P->height == 0 )
- DelOld( &draw_left, P );
- P = Q;
- }
+ Q = P->link;
+ if ( P->height == 0 )
+ DelOld( &draw_left, P );
+ P = Q;
}
+ P = draw_right;
+ while ( P )
{
- PProfile Q, P = draw_right;
-
-
- while ( P )
- {
- Q = P->link;
- if ( P->height == 0 )
- DelOld( &draw_right, P );
- P = Q;
- }
+ Q = P->link;
+ if ( P->height == 0 )
+ DelOld( &draw_right, P );
+ P = Q;
}
}
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -19,6 +19,7 @@
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/tterrors.h>
+#include <freetype/internal/ftstream.h>
#include <freetype/tttags.h>
@@ -124,11 +125,13 @@
if ( length )
*length = table->Length;
- (void)FILE_Seek( table->Offset );
+ if ( FILE_Seek( table->Offset ) )
+ goto Exit;
}
else
error = TT_Err_Table_Missing;
+ Exit:
return error;
}
@@ -173,19 +176,25 @@
const FT_Frame_Field sfnt_header_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE SFNT_Header
+
FT_FRAME_START( 8 ),
- FT_FRAME_USHORT( SFNT_Header, num_tables ),
- FT_FRAME_USHORT( SFNT_Header, search_range ),
- FT_FRAME_USHORT( SFNT_Header, entry_selector ),
- FT_FRAME_USHORT( SFNT_Header, range_shift ),
+ FT_FRAME_USHORT( num_tables ),
+ FT_FRAME_USHORT( search_range ),
+ FT_FRAME_USHORT( entry_selector ),
+ FT_FRAME_USHORT( range_shift ),
FT_FRAME_END
};
const FT_Frame_Field ttc_header_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TTC_Header
+
FT_FRAME_START( 8 ),
- FT_FRAME_LONG( TTC_Header, version ),
- FT_FRAME_LONG( TTC_Header, count ),
+ FT_FRAME_LONG( version ),
+ FT_FRAME_LONG( count ),
FT_FRAME_END };
@@ -456,26 +465,29 @@
static const FT_Frame_Field header_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_Header
+
FT_FRAME_START( 54 ),
- FT_FRAME_ULONG( TT_Header, Table_Version ),
- FT_FRAME_ULONG( TT_Header, Font_Revision ),
- FT_FRAME_LONG( TT_Header, CheckSum_Adjust ),
- FT_FRAME_LONG( TT_Header, Magic_Number ),
- FT_FRAME_USHORT( TT_Header, Flags ),
- FT_FRAME_USHORT( TT_Header, Units_Per_EM ),
- FT_FRAME_LONG( TT_Header, Created[0] ),
- FT_FRAME_LONG( TT_Header, Created[1] ),
- FT_FRAME_LONG( TT_Header, Modified[0] ),
- FT_FRAME_LONG( TT_Header, Modified[1] ),
- FT_FRAME_SHORT( TT_Header, xMin ),
- FT_FRAME_SHORT( TT_Header, yMin ),
- FT_FRAME_SHORT( TT_Header, xMax ),
- FT_FRAME_SHORT( TT_Header, yMax ),
- FT_FRAME_USHORT( TT_Header, Mac_Style ),
- FT_FRAME_USHORT( TT_Header, Lowest_Rec_PPEM ),
- FT_FRAME_SHORT( TT_Header, Font_Direction ),
- FT_FRAME_SHORT( TT_Header, Index_To_Loc_Format ),
- FT_FRAME_SHORT( TT_Header, Glyph_Data_Format ),
+ FT_FRAME_ULONG ( Table_Version ),
+ FT_FRAME_ULONG ( Font_Revision ),
+ FT_FRAME_LONG ( CheckSum_Adjust ),
+ FT_FRAME_LONG ( Magic_Number ),
+ FT_FRAME_USHORT( Flags ),
+ FT_FRAME_USHORT( Units_Per_EM ),
+ FT_FRAME_LONG ( Created[0] ),
+ FT_FRAME_LONG ( Created[1] ),
+ FT_FRAME_LONG ( Modified[0] ),
+ FT_FRAME_LONG ( Modified[1] ),
+ FT_FRAME_SHORT ( xMin ),
+ FT_FRAME_SHORT ( yMin ),
+ FT_FRAME_SHORT ( xMax ),
+ FT_FRAME_SHORT ( yMax ),
+ FT_FRAME_USHORT( Mac_Style ),
+ FT_FRAME_USHORT( Lowest_Rec_PPEM ),
+ FT_FRAME_SHORT ( Font_Direction ),
+ FT_FRAME_SHORT ( Index_To_Loc_Format ),
+ FT_FRAME_SHORT ( Glyph_Data_Format ),
FT_FRAME_END
};
@@ -527,22 +539,25 @@
const FT_Frame_Field maxp_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_MaxProfile
+
FT_FRAME_START( 32 ),
- FT_FRAME_ULONG( TT_MaxProfile, version ),
- FT_FRAME_USHORT( TT_MaxProfile, numGlyphs ),
- FT_FRAME_USHORT( TT_MaxProfile, maxPoints ),
- FT_FRAME_USHORT( TT_MaxProfile, maxContours ),
- FT_FRAME_USHORT( TT_MaxProfile, maxCompositePoints ),
- FT_FRAME_USHORT( TT_MaxProfile, maxCompositeContours ),
- FT_FRAME_USHORT( TT_MaxProfile, maxZones ),
- FT_FRAME_USHORT( TT_MaxProfile, maxTwilightPoints ),
- FT_FRAME_USHORT( TT_MaxProfile, maxStorage ),
- FT_FRAME_USHORT( TT_MaxProfile, maxFunctionDefs ),
- FT_FRAME_USHORT( TT_MaxProfile, maxInstructionDefs ),
- FT_FRAME_USHORT( TT_MaxProfile, maxStackElements ),
- FT_FRAME_USHORT( TT_MaxProfile, maxSizeOfInstructions ),
- FT_FRAME_USHORT( TT_MaxProfile, maxComponentElements ),
- FT_FRAME_USHORT( TT_MaxProfile, maxComponentDepth ),
+ FT_FRAME_ULONG ( version ),
+ FT_FRAME_USHORT( numGlyphs ),
+ FT_FRAME_USHORT( maxPoints ),
+ FT_FRAME_USHORT( maxContours ),
+ FT_FRAME_USHORT( maxCompositePoints ),
+ FT_FRAME_USHORT( maxCompositeContours ),
+ FT_FRAME_USHORT( maxZones ),
+ FT_FRAME_USHORT( maxTwilightPoints ),
+ FT_FRAME_USHORT( maxStorage ),
+ FT_FRAME_USHORT( maxFunctionDefs ),
+ FT_FRAME_USHORT( maxInstructionDefs ),
+ FT_FRAME_USHORT( maxStackElements ),
+ FT_FRAME_USHORT( maxSizeOfInstructions ),
+ FT_FRAME_USHORT( maxComponentElements ),
+ FT_FRAME_USHORT( maxComponentDepth ),
FT_FRAME_END };
@@ -758,24 +773,27 @@
const FT_Frame_Field metrics_header_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_HoriHeader
+
FT_FRAME_START( 36 ),
- FT_FRAME_ULONG( TT_HoriHeader, Version ),
- FT_FRAME_SHORT( TT_HoriHeader, Ascender ),
- FT_FRAME_SHORT( TT_HoriHeader, Descender ),
- FT_FRAME_SHORT( TT_HoriHeader, Line_Gap ),
- FT_FRAME_USHORT( TT_HoriHeader, advance_Width_Max ),
- FT_FRAME_SHORT( TT_HoriHeader, min_Left_Side_Bearing ),
- FT_FRAME_SHORT( TT_HoriHeader, min_Right_Side_Bearing ),
- FT_FRAME_SHORT( TT_HoriHeader, xMax_Extent ),
- FT_FRAME_SHORT( TT_HoriHeader, caret_Slope_Rise ),
- FT_FRAME_SHORT( TT_HoriHeader, caret_Slope_Run ),
- FT_FRAME_SHORT( TT_HoriHeader, Reserved[0] ),
- FT_FRAME_SHORT( TT_HoriHeader, Reserved[1] ),
- FT_FRAME_SHORT( TT_HoriHeader, Reserved[2] ),
- FT_FRAME_SHORT( TT_HoriHeader, Reserved[3] ),
- FT_FRAME_SHORT( TT_HoriHeader, Reserved[4] ),
- FT_FRAME_SHORT( TT_HoriHeader, metric_Data_Format ),
- FT_FRAME_USHORT( TT_HoriHeader, number_Of_HMetrics ),
+ FT_FRAME_ULONG ( Version ),
+ FT_FRAME_SHORT ( Ascender ),
+ FT_FRAME_SHORT ( Descender ),
+ FT_FRAME_SHORT ( Line_Gap ),
+ FT_FRAME_USHORT( advance_Width_Max ),
+ FT_FRAME_SHORT ( min_Left_Side_Bearing ),
+ FT_FRAME_SHORT ( min_Right_Side_Bearing ),
+ FT_FRAME_SHORT ( xMax_Extent ),
+ FT_FRAME_SHORT ( caret_Slope_Rise ),
+ FT_FRAME_SHORT ( caret_Slope_Run ),
+ FT_FRAME_SHORT ( Reserved[0] ),
+ FT_FRAME_SHORT ( Reserved[1] ),
+ FT_FRAME_SHORT ( Reserved[2] ),
+ FT_FRAME_SHORT ( Reserved[3] ),
+ FT_FRAME_SHORT ( Reserved[4] ),
+ FT_FRAME_SHORT ( metric_Data_Format ),
+ FT_FRAME_USHORT( number_Of_HMetrics ),
FT_FRAME_END
};
@@ -858,22 +876,28 @@
const FT_Frame_Field name_table_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_NameTable
+
FT_FRAME_START( 6 ),
- FT_FRAME_USHORT( TT_NameTable, format ),
- FT_FRAME_USHORT( TT_NameTable, numNameRecords ),
- FT_FRAME_USHORT( TT_NameTable, storageOffset ),
+ FT_FRAME_USHORT( format ),
+ FT_FRAME_USHORT( numNameRecords ),
+ FT_FRAME_USHORT( storageOffset ),
FT_FRAME_END
};
const FT_Frame_Field name_record_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_NameRec
+
/* no FT_FRAME_START */
- FT_FRAME_USHORT( TT_NameRec, platformID ),
- FT_FRAME_USHORT( TT_NameRec, encodingID ),
- FT_FRAME_USHORT( TT_NameRec, languageID ),
- FT_FRAME_USHORT( TT_NameRec, nameID ),
- FT_FRAME_USHORT( TT_NameRec, stringLength ),
- FT_FRAME_USHORT( TT_NameRec, stringOffset ),
+ FT_FRAME_USHORT( platformID ),
+ FT_FRAME_USHORT( encodingID ),
+ FT_FRAME_USHORT( languageID ),
+ FT_FRAME_USHORT( nameID ),
+ FT_FRAME_USHORT( stringLength ),
+ FT_FRAME_USHORT( stringOffset ),
FT_FRAME_END
};
@@ -1049,18 +1073,24 @@
const FT_Frame_Field cmap_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_CMapDir
+
FT_FRAME_START( 4 ),
- FT_FRAME_USHORT( TT_CMapDir, tableVersionNumber ),
- FT_FRAME_USHORT( TT_CMapDir, numCMaps ),
+ FT_FRAME_USHORT( tableVersionNumber ),
+ FT_FRAME_USHORT( numCMaps ),
FT_FRAME_END
};
const FT_Frame_Field cmap_rec_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_CMapTable
+
FT_FRAME_START( 6 ),
- FT_FRAME_USHORT( TT_CMapTable, format ),
- FT_FRAME_USHORT( TT_CMapTable, length ),
- FT_FRAME_USHORT( TT_CMapTable, version ),
+ FT_FRAME_USHORT( format ),
+ FT_FRAME_USHORT( length ),
+ FT_FRAME_USHORT( version ),
FT_FRAME_END
};
@@ -1154,52 +1184,55 @@
FT_Error error;
TT_OS2* os2;
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_OS2
+
const FT_Frame_Field os2_fields[] =
{
FT_FRAME_START( 78 ),
- FT_FRAME_USHORT( TT_OS2, version ),
- FT_FRAME_SHORT( TT_OS2, xAvgCharWidth ),
- FT_FRAME_USHORT( TT_OS2, usWeightClass ),
- FT_FRAME_USHORT( TT_OS2, usWidthClass ),
- FT_FRAME_SHORT( TT_OS2, fsType ),
- FT_FRAME_SHORT( TT_OS2, ySubscriptXSize ),
- FT_FRAME_SHORT( TT_OS2, ySubscriptYSize ),
- FT_FRAME_SHORT( TT_OS2, ySubscriptXOffset ),
- FT_FRAME_SHORT( TT_OS2, ySubscriptYOffset ),
- FT_FRAME_SHORT( TT_OS2, ySuperscriptXSize ),
- FT_FRAME_SHORT( TT_OS2, ySuperscriptYSize ),
- FT_FRAME_SHORT( TT_OS2, ySuperscriptXOffset ),
- FT_FRAME_SHORT( TT_OS2, ySuperscriptYOffset ),
- FT_FRAME_SHORT( TT_OS2, yStrikeoutSize ),
- FT_FRAME_SHORT( TT_OS2, yStrikeoutPosition ),
- FT_FRAME_SHORT( TT_OS2, sFamilyClass ),
- FT_FRAME_BYTE( TT_OS2, panose[0] ),
- FT_FRAME_BYTE( TT_OS2, panose[1] ),
- FT_FRAME_BYTE( TT_OS2, panose[2] ),
- FT_FRAME_BYTE( TT_OS2, panose[3] ),
- FT_FRAME_BYTE( TT_OS2, panose[4] ),
- FT_FRAME_BYTE( TT_OS2, panose[5] ),
- FT_FRAME_BYTE( TT_OS2, panose[6] ),
- FT_FRAME_BYTE( TT_OS2, panose[7] ),
- FT_FRAME_BYTE( TT_OS2, panose[8] ),
- FT_FRAME_BYTE( TT_OS2, panose[9] ),
- FT_FRAME_ULONG( TT_OS2, ulUnicodeRange1 ),
- FT_FRAME_ULONG( TT_OS2, ulUnicodeRange2 ),
- FT_FRAME_ULONG( TT_OS2, ulUnicodeRange3 ),
- FT_FRAME_ULONG( TT_OS2, ulUnicodeRange4 ),
- FT_FRAME_BYTE( TT_OS2, achVendID[0] ),
- FT_FRAME_BYTE( TT_OS2, achVendID[1] ),
- FT_FRAME_BYTE( TT_OS2, achVendID[2] ),
- FT_FRAME_BYTE( TT_OS2, achVendID[3] ),
+ FT_FRAME_USHORT( version ),
+ FT_FRAME_SHORT ( xAvgCharWidth ),
+ FT_FRAME_USHORT( usWeightClass ),
+ FT_FRAME_USHORT( usWidthClass ),
+ FT_FRAME_SHORT ( fsType ),
+ FT_FRAME_SHORT ( ySubscriptXSize ),
+ FT_FRAME_SHORT ( ySubscriptYSize ),
+ FT_FRAME_SHORT ( ySubscriptXOffset ),
+ FT_FRAME_SHORT ( ySubscriptYOffset ),
+ FT_FRAME_SHORT ( ySuperscriptXSize ),
+ FT_FRAME_SHORT ( ySuperscriptYSize ),
+ FT_FRAME_SHORT ( ySuperscriptXOffset ),
+ FT_FRAME_SHORT ( ySuperscriptYOffset ),
+ FT_FRAME_SHORT ( yStrikeoutSize ),
+ FT_FRAME_SHORT ( yStrikeoutPosition ),
+ FT_FRAME_SHORT ( sFamilyClass ),
+ FT_FRAME_BYTE ( panose[0] ),
+ FT_FRAME_BYTE ( panose[1] ),
+ FT_FRAME_BYTE ( panose[2] ),
+ FT_FRAME_BYTE ( panose[3] ),
+ FT_FRAME_BYTE ( panose[4] ),
+ FT_FRAME_BYTE ( panose[5] ),
+ FT_FRAME_BYTE ( panose[6] ),
+ FT_FRAME_BYTE ( panose[7] ),
+ FT_FRAME_BYTE ( panose[8] ),
+ FT_FRAME_BYTE ( panose[9] ),
+ FT_FRAME_ULONG ( ulUnicodeRange1 ),
+ FT_FRAME_ULONG ( ulUnicodeRange2 ),
+ FT_FRAME_ULONG ( ulUnicodeRange3 ),
+ FT_FRAME_ULONG ( ulUnicodeRange4 ),
+ FT_FRAME_BYTE ( achVendID[0] ),
+ FT_FRAME_BYTE ( achVendID[1] ),
+ FT_FRAME_BYTE ( achVendID[2] ),
+ FT_FRAME_BYTE ( achVendID[3] ),
- FT_FRAME_USHORT( TT_OS2, fsSelection ),
- FT_FRAME_USHORT( TT_OS2, usFirstCharIndex ),
- FT_FRAME_USHORT( TT_OS2, usLastCharIndex ),
- FT_FRAME_SHORT( TT_OS2, sTypoAscender ),
- FT_FRAME_SHORT( TT_OS2, sTypoDescender ),
- FT_FRAME_SHORT( TT_OS2, sTypoLineGap ),
- FT_FRAME_USHORT( TT_OS2, usWinAscent ),
- FT_FRAME_USHORT( TT_OS2, usWinDescent ),
+ FT_FRAME_USHORT( fsSelection ),
+ FT_FRAME_USHORT( usFirstCharIndex ),
+ FT_FRAME_USHORT( usLastCharIndex ),
+ FT_FRAME_SHORT ( sTypoAscender ),
+ FT_FRAME_SHORT ( sTypoDescender ),
+ FT_FRAME_SHORT ( sTypoLineGap ),
+ FT_FRAME_USHORT( usWinAscent ),
+ FT_FRAME_USHORT( usWinDescent ),
FT_FRAME_END
};
@@ -1206,8 +1239,8 @@
const FT_Frame_Field os2_fields_extra[] =
{
FT_FRAME_START( 8 ),
- FT_FRAME_ULONG( TT_OS2, ulCodePageRange1 ),
- FT_FRAME_ULONG( TT_OS2, ulCodePageRange2 ),
+ FT_FRAME_ULONG( ulCodePageRange1 ),
+ FT_FRAME_ULONG( ulCodePageRange2 ),
FT_FRAME_END
};
@@ -1214,11 +1247,11 @@
const FT_Frame_Field os2_fields_extra2[] =
{
FT_FRAME_START( 10 ),
- FT_FRAME_SHORT( TT_OS2, sxHeight ),
- FT_FRAME_SHORT( TT_OS2, sCapHeight ),
- FT_FRAME_USHORT( TT_OS2, usDefaultChar ),
- FT_FRAME_USHORT( TT_OS2, usBreakChar ),
- FT_FRAME_USHORT( TT_OS2, usMaxContext ),
+ FT_FRAME_SHORT ( sxHeight ),
+ FT_FRAME_SHORT ( sCapHeight ),
+ FT_FRAME_USHORT( usDefaultChar ),
+ FT_FRAME_USHORT( usBreakChar ),
+ FT_FRAME_USHORT( usMaxContext ),
FT_FRAME_END
};
@@ -1290,16 +1323,19 @@
static const FT_Frame_Field post_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_Postscript
+
FT_FRAME_START( 32 ),
- FT_FRAME_ULONG( TT_Postscript, FormatType ),
- FT_FRAME_ULONG( TT_Postscript, italicAngle ),
- FT_FRAME_SHORT( TT_Postscript, underlinePosition ),
- FT_FRAME_SHORT( TT_Postscript, underlineThickness ),
- FT_FRAME_ULONG( TT_Postscript, isFixedPitch ),
- FT_FRAME_ULONG( TT_Postscript, minMemType42 ),
- FT_FRAME_ULONG( TT_Postscript, maxMemType42 ),
- FT_FRAME_ULONG( TT_Postscript, minMemType1 ),
- FT_FRAME_ULONG( TT_Postscript, maxMemType1 ),
+ FT_FRAME_ULONG( FormatType ),
+ FT_FRAME_ULONG( italicAngle ),
+ FT_FRAME_SHORT( underlinePosition ),
+ FT_FRAME_SHORT( underlineThickness ),
+ FT_FRAME_ULONG( isFixedPitch ),
+ FT_FRAME_ULONG( minMemType42 ),
+ FT_FRAME_ULONG( maxMemType42 ),
+ FT_FRAME_ULONG( minMemType1 ),
+ FT_FRAME_ULONG( maxMemType1 ),
FT_FRAME_END
};
@@ -1342,21 +1378,24 @@
{
static const FT_Frame_Field pclt_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_PCLT
+
FT_FRAME_START( 54 ),
- FT_FRAME_ULONG ( TT_PCLT, Version ),
- FT_FRAME_ULONG ( TT_PCLT, FontNumber ),
- FT_FRAME_USHORT( TT_PCLT, Pitch ),
- FT_FRAME_USHORT( TT_PCLT, xHeight ),
- FT_FRAME_USHORT( TT_PCLT, Style ),
- FT_FRAME_USHORT( TT_PCLT, TypeFamily ),
- FT_FRAME_USHORT( TT_PCLT, CapHeight ),
- FT_FRAME_BYTES ( TT_PCLT, TypeFace, 16 ),
- FT_FRAME_BYTES ( TT_PCLT, CharacterComplement, 8 ),
- FT_FRAME_BYTES ( TT_PCLT, FileName, 6 ),
- FT_FRAME_CHAR ( TT_PCLT, StrokeWeight ),
- FT_FRAME_CHAR ( TT_PCLT, WidthType ),
- FT_FRAME_BYTE ( TT_PCLT, SerifStyle ),
- FT_FRAME_BYTE ( TT_PCLT, Reserved ),
+ FT_FRAME_ULONG ( Version ),
+ FT_FRAME_ULONG ( FontNumber ),
+ FT_FRAME_USHORT( Pitch ),
+ FT_FRAME_USHORT( xHeight ),
+ FT_FRAME_USHORT( Style ),
+ FT_FRAME_USHORT( TypeFamily ),
+ FT_FRAME_USHORT( CapHeight ),
+ FT_FRAME_BYTES ( TypeFace, 16 ),
+ FT_FRAME_BYTES ( CharacterComplement, 8 ),
+ FT_FRAME_BYTES ( FileName, 6 ),
+ FT_FRAME_CHAR ( StrokeWeight ),
+ FT_FRAME_CHAR ( WidthType ),
+ FT_FRAME_BYTE ( SerifStyle ),
+ FT_FRAME_BYTE ( Reserved ),
FT_FRAME_END
};
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -18,6 +18,7 @@
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/tterrors.h>
+#include <freetype/internal/ftstream.h>
#include <freetype/tttags.h>
@@ -191,17 +192,20 @@
const FT_Frame_Field sbit_metrics_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_SBit_Metrics
+
FT_FRAME_START( 8 ),
- FT_FRAME_BYTE( TT_SBit_Metrics, height ),
- FT_FRAME_BYTE( TT_SBit_Metrics, width ),
+ FT_FRAME_BYTE( height ),
+ FT_FRAME_BYTE( width ),
- FT_FRAME_CHAR( TT_SBit_Metrics, horiBearingX ),
- FT_FRAME_CHAR( TT_SBit_Metrics, horiBearingY ),
- FT_FRAME_BYTE( TT_SBit_Metrics, horiAdvance ),
+ FT_FRAME_CHAR( horiBearingX ),
+ FT_FRAME_CHAR( horiBearingY ),
+ FT_FRAME_BYTE( horiAdvance ),
- FT_FRAME_CHAR( TT_SBit_Metrics, vertBearingX ),
- FT_FRAME_CHAR( TT_SBit_Metrics, vertBearingY ),
- FT_FRAME_BYTE( TT_SBit_Metrics, vertAdvance ),
+ FT_FRAME_CHAR( vertBearingX ),
+ FT_FRAME_CHAR( vertBearingY ),
+ FT_FRAME_BYTE( vertAdvance ),
FT_FRAME_END
};
@@ -404,31 +408,37 @@
const FT_Frame_Field sbit_line_metrics_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_SBit_Line_Metrics
+
/* no FT_FRAME_START */
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, ascender ),
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, descender ),
- FT_FRAME_BYTE( TT_SBit_Line_Metrics, max_width ),
+ FT_FRAME_CHAR( ascender ),
+ FT_FRAME_CHAR( descender ),
+ FT_FRAME_BYTE( max_width ),
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, caret_slope_numerator ),
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, caret_slope_denominator ),
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, caret_offset ),
+ FT_FRAME_CHAR( caret_slope_numerator ),
+ FT_FRAME_CHAR( caret_slope_denominator ),
+ FT_FRAME_CHAR( caret_offset ),
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, min_origin_SB ),
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, min_advance_SB ),
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, max_before_BL ),
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, min_after_BL ),
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, pads[0] ),
- FT_FRAME_CHAR( TT_SBit_Line_Metrics, pads[1] ),
+ FT_FRAME_CHAR( min_origin_SB ),
+ FT_FRAME_CHAR( min_advance_SB ),
+ FT_FRAME_CHAR( max_before_BL ),
+ FT_FRAME_CHAR( min_after_BL ),
+ FT_FRAME_CHAR( pads[0] ),
+ FT_FRAME_CHAR( pads[1] ),
FT_FRAME_END
};
const FT_Frame_Field strike_start_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_SBit_Strike
+
/* no FT_FRAME_START */
- FT_FRAME_ULONG( TT_SBit_Strike, ranges_offset ),
+ FT_FRAME_ULONG( ranges_offset ),
FT_FRAME_SKIP_LONG,
- FT_FRAME_ULONG( TT_SBit_Strike, num_ranges ),
- FT_FRAME_ULONG( TT_SBit_Strike, color_ref ),
+ FT_FRAME_ULONG( num_ranges ),
+ FT_FRAME_ULONG( color_ref ),
FT_FRAME_END
};
@@ -435,12 +445,12 @@
const FT_Frame_Field strike_end_fields[] =
{
/* no FT_FRAME_START */
- FT_FRAME_USHORT( TT_SBit_Strike, start_glyph ),
- FT_FRAME_USHORT( TT_SBit_Strike, end_glyph ),
- FT_FRAME_BYTE ( TT_SBit_Strike, x_ppem ),
- FT_FRAME_BYTE ( TT_SBit_Strike, y_ppem ),
- FT_FRAME_BYTE ( TT_SBit_Strike, bit_depth ),
- FT_FRAME_CHAR ( TT_SBit_Strike, flags ),
+ FT_FRAME_USHORT( start_glyph ),
+ FT_FRAME_USHORT( end_glyph ),
+ FT_FRAME_BYTE ( x_ppem ),
+ FT_FRAME_BYTE ( y_ppem ),
+ FT_FRAME_BYTE ( bit_depth ),
+ FT_FRAME_CHAR ( flags ),
FT_FRAME_END
};
@@ -838,12 +848,15 @@
const FT_Frame_Field sbit_small_metrics_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE TT_SBit_Small_Metrics
+
FT_FRAME_START( 5 ),
- FT_FRAME_BYTE( TT_SBit_Small_Metrics, height ),
- FT_FRAME_BYTE( TT_SBit_Small_Metrics, width ),
- FT_FRAME_CHAR( TT_SBit_Small_Metrics, bearingX ),
- FT_FRAME_CHAR( TT_SBit_Small_Metrics, bearingY ),
- FT_FRAME_BYTE( TT_SBit_Small_Metrics, advance ),
+ FT_FRAME_BYTE( height ),
+ FT_FRAME_BYTE( width ),
+ FT_FRAME_CHAR( bearingX ),
+ FT_FRAME_CHAR( bearingY ),
+ FT_FRAME_BYTE( advance ),
FT_FRAME_END
};
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -213,15 +213,17 @@
FT_ULong offset,
FT_UInt byte_count )
{
- FT_Error error;
- FT_Stream stream = loader->stream;
+ FT_Error error;
+ FT_Stream stream = loader->stream;
+ FT_TRACE5(( "Glyph %ld\n", glyph_index ));
+
/* the following line sets the `error' variable through macros! */
- (void)( FILE_Seek( offset ) || ACCESS_Frame( byte_count ) );
+ if ( FILE_Seek( offset ) || ACCESS_Frame( byte_count ) )
+ return error;
- FT_TRACE5(( "Glyph %ld\n", glyph_index ));
- return error;
+ return TT_Err_Ok;
}
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -460,10 +460,11 @@
Fail_Memory:
-#endif
-
TT_Done_Size( size );
return error;
+
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
}
--- a/src/type1z/z1gload.c
+++ b/src/type1z/z1gload.c
@@ -939,13 +939,13 @@
values = top;
for ( nn = 0; nn < num_points; nn++ )
{
- FT_Int x = values[0];
+ FT_Int tmp = values[0];
for ( mm = 1; mm < blend->num_designs; mm++ )
- x += FT_MulFix( *delta++, blend->weight_vector[mm] );
+ tmp += FT_MulFix( *delta++, blend->weight_vector[mm] );
- *values++ = x;
+ *values++ = tmp;
}
/* note that `top' will be incremented later by calls to `pop' */
break;
--- a/src/type1z/z1load.c
+++ b/src/type1z/z1load.c
@@ -700,42 +700,42 @@
#define Z1_NEW_STRING( _name, _field ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
- Z1_FIELD_STRING( T1TYPE, _field );
+ Z1_FIELD_STRING( _field );
#define Z1_NEW_BOOL( _name, _field ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
- Z1_FIELD_BOOL( T1TYPE, _field );
+ Z1_FIELD_BOOL( _field );
#define Z1_NEW_NUM( _name, _field ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
- Z1_FIELD_NUM( T1TYPE, _field );
+ Z1_FIELD_NUM( _field );
#define Z1_NEW_FIXED( _name, _field ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
- Z1_FIELD_FIXED( T1TYPE, _field, _power );
+ Z1_FIELD_FIXED( _field, _power );
#define Z1_NEW_NUM_TABLE( _name, _field, _max, _count ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
- Z1_FIELD_NUM_ARRAY( T1TYPE, _field, _count, _max );
+ Z1_FIELD_NUM_ARRAY( _field, _count, _max );
#define Z1_NEW_FIXED_TABLE( _name, _field, _max, _count ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
- Z1_FIELD_FIXED_ARRAY( T1TYPE, _field, _count, _max );
+ Z1_FIELD_FIXED_ARRAY( _field, _count, _max );
#define Z1_NEW_NUM_TABLE2( _name, _field, _max ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
- Z1_FIELD_NUM_ARRAY2( T1TYPE, _field, _max );
+ Z1_FIELD_NUM_ARRAY2( _field, _max );
#define Z1_NEW_FIXED_TABLE2( _name, _field, _max ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
- Z1_FIELD_FIXED_ARRAY2( T1TYPE, _field, _max );
+ Z1_FIELD_FIXED_ARRAY2( _field, _max );
#define Z1_FONTINFO_STRING( n, f ) Z1_NEW_STRING( n, f )
--- a/src/type1z/z1objs.c
+++ b/src/type1z/z1objs.c
@@ -243,7 +243,7 @@
if ( face->type1.font_name )
{
root->family_name = face->type1.font_name;
- root->style_name = "Regular";
+ root->style_name = (char *)"Regular";
}
}
@@ -293,11 +293,8 @@
/* synthesize a Unicode charmap if there is support in the `PSNames' */
/* module */
- if ( face->psnames )
+ if ( psnames )
{
- PSNames_Interface* psnames = (PSNames_Interface*)face->psnames;
-
-
if ( psnames->unicode_value )
{
error = psnames->build_unicodes(
--- a/src/type1z/z1parse.c
+++ b/src/type1z/z1parse.c
@@ -1029,10 +1029,10 @@
goto Exit;
/* swap between big and little endianness */
- *size = ( ( asize & 0xFF000000L ) >> 24 ) |
- ( ( asize & 0x00FF0000L ) >> 8 ) |
- ( ( asize & 0x0000FF00L ) << 8 ) |
- ( ( asize & 0x000000FFL ) << 24 );
+ *size = ( ( asize & 0xFF000000UL ) >> 24 ) |
+ ( ( asize & 0x00FF0000UL ) >> 8 ) |
+ ( ( asize & 0x0000FF00UL ) << 8 ) |
+ ( ( asize & 0x000000FFUL ) << 24 );
}
Exit:
@@ -1092,7 +1092,8 @@
{
/* assume that this is a PFA file for now; an error will */
/* be produced later when more things are checked */
- (void)FILE_Seek( 0L );
+ if ( FILE_Seek( 0L ) )
+ goto Exit;
size = stream->size;
}
else
@@ -1221,7 +1222,6 @@
/* then re-read them into memory. */
FT_Long start_pos = FILE_Pos();
FT_UShort tag;
- FT_Long size;
parser->private_len = 0;
--- a/src/type1z/z1parse.h
+++ b/src/type1z/z1parse.h
@@ -20,6 +20,7 @@
#define Z1PARSE_H
#include <freetype/internal/t1types.h>
+#include <freetype/internal/ftstream.h>
#ifdef __cplusplus
extern "C" {
@@ -72,7 +73,7 @@
{
Z1_Field_Type type; /* type of field */
FT_UInt offset; /* offset of field in object */
- FT_UInt size; /* size of field in bytes */
+ FT_Byte size; /* size of field in bytes */
FT_UInt array_max; /* maximum number of elements for array */
FT_UInt count_offset; /* offset of element count for arrays */
FT_Int flag_bit; /* bit number for field flag */
@@ -80,76 +81,74 @@
} Z1_Field_Rec;
-#define Z1_FIELD_REF( s, f ) ( ((s*)0)->f )
-
-#define Z1_FIELD_BOOL( _ftype, _fname ) \
- { \
- t1_field_bool, \
- (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
- sizeof ( Z1_FIELD_REF( _ftype, _fname ) ), \
- 0, 0, 0 \
+#define Z1_FIELD_BOOL( _fname ) \
+ { \
+ t1_field_bool, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE( _fname ), \
+ 0, 0, 0 \
}
-#define Z1_FIELD_NUM( _ftype, _fname ) \
- { \
- t1_field_integer, \
- (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
- sizeof ( Z1_FIELD_REF( _ftype, _fname ) ), \
- 0, 0, 0 \
+#define Z1_FIELD_NUM( _fname ) \
+ { \
+ t1_field_integer, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE( _fname ), \
+ 0, 0, 0 \
}
-#define Z1_FIELD_FIXED( _ftype, _fname, _power ) \
- { \
- t1_field_fixed, \
- (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
- sizeof ( Z1_FIELD_REF( _ftype, _fname ) ), \
- 0, 0, 0 \
+#define Z1_FIELD_FIXED( _fname, _power ) \
+ { \
+ t1_field_fixed, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE( _fname ), \
+ 0, 0, 0 \
}
-#define Z1_FIELD_STRING( _ftype, _fname ) \
- { \
- t1_field_string, \
- (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
- sizeof ( Z1_FIELD_REF( _ftype, _fname ) ), \
- 0, 0, 0 \
+#define Z1_FIELD_STRING( _fname ) \
+ { \
+ t1_field_string, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE( _fname ), \
+ 0, 0, 0 \
}
-#define Z1_FIELD_NUM_ARRAY( _ftype, _fname, _fcount, _fmax ) \
- { \
- t1_field_integer, \
- (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
- sizeof ( Z1_FIELD_REF( _ftype, _fname )[0] ), \
- _fmax, \
- (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fcount ), \
- 0 \
+#define Z1_FIELD_NUM_ARRAY( _fname, _fcount, _fmax ) \
+ { \
+ t1_field_integer, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE_DELTA( _fname ), \
+ _fmax, \
+ FT_FIELD_OFFSET( _fcount ), \
+ 0 \
}
-#define Z1_FIELD_FIXED_ARRAY( _ftype, _fname, _fcount, _fmax ) \
- { \
- t1_field_fixed, \
- (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
- sizeof ( Z1_FIELD_REF( _ftype, _fname )[0] ), \
- _fmax, \
- (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fcount ), \
- 0 \
+#define Z1_FIELD_FIXED_ARRAY( _fname, _fcount, _fmax ) \
+ { \
+ t1_field_fixed, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE_DELTA( _fname ), \
+ _fmax, \
+ FT_FIELD_OFFSET( _fcount ), \
+ 0 \
}
-#define Z1_FIELD_NUM_ARRAY2( _ftype, _fname, _fmax ) \
- { \
- t1_field_integer, \
- (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
- sizeof ( Z1_FIELD_REF( _ftype, _fname )[0] ), \
- _fmax, \
- 0, 0 \
+#define Z1_FIELD_NUM_ARRAY2( _fname, _fmax ) \
+ { \
+ t1_field_integer, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE_DELTA( _fname ), \
+ _fmax, \
+ 0, 0 \
}
-#define Z1_FIELD_FIXED_ARRAY2( _ftype, _fname, _fmax ) \
- { \
- t1_field_fixed, \
- (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
- sizeof ( Z1_FIELD_REF( _ftype, _fname )[0] ), \
- _fmax, \
- 0, 0 \
+#define Z1_FIELD_FIXED_ARRAY2( _fname, _fmax ) \
+ { \
+ t1_field_fixed, \
+ FT_FIELD_OFFSTE( _fname ), \
+ FT_FIELD_SIZE_DELTA( _fname ), \
+ _fmax, \
+ 0, 0 \
}
--- a/src/type1z/z1tokens.h
+++ b/src/type1z/z1tokens.h
@@ -16,8 +16,8 @@
/***************************************************************************/
-#undef T1TYPE
-#define T1TYPE T1_FontInfo
+#undef FT_STRUCTURE
+#define FT_STRUCTURE T1_FontInfo
Z1_FONTINFO_STRING( "version", version )
Z1_FONTINFO_STRING( "Notice", notice )
@@ -31,8 +31,8 @@
Z1_FONTINFO_NUM ( "UnderlineThickness", underline_thickness )
-#undef T1TYPE
-#define T1TYPE T1_Private
+#undef FT_STRUCTURE
+#define FT_STRUCTURE T1_Private
Z1_PRIVATE_NUM ( "UniqueID", unique_id )
Z1_PRIVATE_NUM ( "lenIV", lenIV )
@@ -57,8 +57,8 @@
Z1_PRIVATE_NUM_TABLE ( "StemSnapV", snap_heights, 12, num_snap_heights )
-#undef T1TYPE
-#define T1TYPE T1_Font
+#undef FT_STRUCTURE
+#define FT_STRUCTURE T1_Font
Z1_TOPDICT_NUM( "PaintType", paint_type )
Z1_TOPDICT_NUM( "FontType", font_type )
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -46,10 +46,13 @@
static
const FT_Frame_Field winmz_header_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE WinMZ_Header
+
FT_FRAME_START( 64 ),
- FT_FRAME_USHORT_LE ( WinMZ_Header, magic ),
+ FT_FRAME_USHORT_LE ( magic ),
FT_FRAME_SKIP_BYTES( 29 * 2 ),
- FT_FRAME_ULONG_LE ( WinMZ_Header, lfanew ),
+ FT_FRAME_ULONG_LE ( lfanew ),
FT_FRAME_END
};
@@ -56,11 +59,14 @@
static
const FT_Frame_Field winne_header_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE WinNE_Header
+
FT_FRAME_START( 40 ),
- FT_FRAME_USHORT_LE ( WinNE_Header, magic ),
+ FT_FRAME_USHORT_LE ( magic ),
FT_FRAME_SKIP_BYTES( 34 ),
- FT_FRAME_USHORT_LE ( WinNE_Header, resource_tab_offset ),
- FT_FRAME_USHORT_LE ( WinNE_Header, rname_tab_offset ),
+ FT_FRAME_USHORT_LE ( resource_tab_offset ),
+ FT_FRAME_USHORT_LE ( rname_tab_offset ),
FT_FRAME_END
};
@@ -67,43 +73,46 @@
static
const FT_Frame_Field winfnt_header_fields[] =
{
+#undef FT_STRUCTURE
+#define FT_STRUCTURE WinFNT_Header
+
FT_FRAME_START( 134 ),
- FT_FRAME_USHORT_LE( WinFNT_Header, version ),
- FT_FRAME_ULONG_LE ( WinFNT_Header, file_size ),
- FT_FRAME_BYTES ( WinFNT_Header, copyright, 60 ),
- FT_FRAME_USHORT_LE( WinFNT_Header, file_type ),
- FT_FRAME_USHORT_LE( WinFNT_Header, nominal_point_size ),
- FT_FRAME_USHORT_LE( WinFNT_Header, vertical_resolution ),
- FT_FRAME_USHORT_LE( WinFNT_Header, horizontal_resolution ),
- FT_FRAME_USHORT_LE( WinFNT_Header, ascent ),
- FT_FRAME_USHORT_LE( WinFNT_Header, internal_leading ),
- FT_FRAME_USHORT_LE( WinFNT_Header, external_leading ),
- FT_FRAME_BYTE ( WinFNT_Header, italic ),
- FT_FRAME_BYTE ( WinFNT_Header, underline ),
- FT_FRAME_BYTE ( WinFNT_Header, strike_out ),
- FT_FRAME_USHORT_LE( WinFNT_Header, weight ),
- FT_FRAME_BYTE ( WinFNT_Header, charset ),
- FT_FRAME_USHORT_LE( WinFNT_Header, pixel_width ),
- FT_FRAME_USHORT_LE( WinFNT_Header, pixel_height ),
- FT_FRAME_BYTE ( WinFNT_Header, pitch_and_family ),
- FT_FRAME_USHORT_LE( WinFNT_Header, avg_width ),
- FT_FRAME_USHORT_LE( WinFNT_Header, max_width ),
- FT_FRAME_BYTE ( WinFNT_Header, first_char ),
- FT_FRAME_BYTE ( WinFNT_Header, last_char ),
- FT_FRAME_BYTE ( WinFNT_Header, default_char ),
- FT_FRAME_BYTE ( WinFNT_Header, break_char ),
- FT_FRAME_USHORT_LE( WinFNT_Header, bytes_per_row ),
- FT_FRAME_ULONG_LE ( WinFNT_Header, device_offset ),
- FT_FRAME_ULONG_LE ( WinFNT_Header, face_name_offset ),
- FT_FRAME_ULONG_LE ( WinFNT_Header, bits_pointer ),
- FT_FRAME_ULONG_LE ( WinFNT_Header, bits_offset ),
- FT_FRAME_BYTE ( WinFNT_Header, reserved ),
- FT_FRAME_ULONG_LE ( WinFNT_Header, flags ),
- FT_FRAME_USHORT_LE( WinFNT_Header, A_space ),
- FT_FRAME_USHORT_LE( WinFNT_Header, B_space ),
- FT_FRAME_USHORT_LE( WinFNT_Header, C_space ),
- FT_FRAME_USHORT_LE( WinFNT_Header, color_table_offset ),
- FT_FRAME_BYTES ( WinFNT_Header, reserved, 4 ),
+ FT_FRAME_USHORT_LE( version ),
+ FT_FRAME_ULONG_LE ( file_size ),
+ FT_FRAME_BYTES ( copyright, 60 ),
+ FT_FRAME_USHORT_LE( file_type ),
+ FT_FRAME_USHORT_LE( nominal_point_size ),
+ FT_FRAME_USHORT_LE( vertical_resolution ),
+ FT_FRAME_USHORT_LE( horizontal_resolution ),
+ FT_FRAME_USHORT_LE( ascent ),
+ FT_FRAME_USHORT_LE( internal_leading ),
+ FT_FRAME_USHORT_LE( external_leading ),
+ FT_FRAME_BYTE ( italic ),
+ FT_FRAME_BYTE ( underline ),
+ FT_FRAME_BYTE ( strike_out ),
+ FT_FRAME_USHORT_LE( weight ),
+ FT_FRAME_BYTE ( charset ),
+ FT_FRAME_USHORT_LE( pixel_width ),
+ FT_FRAME_USHORT_LE( pixel_height ),
+ FT_FRAME_BYTE ( pitch_and_family ),
+ FT_FRAME_USHORT_LE( avg_width ),
+ FT_FRAME_USHORT_LE( max_width ),
+ FT_FRAME_BYTE ( first_char ),
+ FT_FRAME_BYTE ( last_char ),
+ FT_FRAME_BYTE ( default_char ),
+ FT_FRAME_BYTE ( break_char ),
+ FT_FRAME_USHORT_LE( bytes_per_row ),
+ FT_FRAME_ULONG_LE ( device_offset ),
+ FT_FRAME_ULONG_LE ( face_name_offset ),
+ FT_FRAME_ULONG_LE ( bits_pointer ),
+ FT_FRAME_ULONG_LE ( bits_offset ),
+ FT_FRAME_BYTE ( reserved ),
+ FT_FRAME_ULONG_LE ( flags ),
+ FT_FRAME_USHORT_LE( A_space ),
+ FT_FRAME_USHORT_LE( B_space ),
+ FT_FRAME_USHORT_LE( C_space ),
+ FT_FRAME_USHORT_LE( color_table_offset ),
+ FT_FRAME_BYTES ( reserved, 4 ),
FT_FRAME_END
};