Formatting...

Preprocessor lines now always start the line.

Improved error handling in `base' module.

Fixed a out-of-bounds error in ttgload.
This commit is contained in:
Werner Lemberg 2000-06-29 03:14:25 +00:00
parent 63e3c3b529
commit deb4e98396
31 changed files with 773 additions and 666 deletions

View File

@ -106,25 +106,25 @@
} FT_ModuleRec; } FT_ModuleRec;
/* typecast an object to a FT_Module */ /* typecast an object to a FT_Module */
#define FT_MODULE(x) ((FT_Module)(x)) #define FT_MODULE(x) ((FT_Module)(x))
#define FT_MODULE_CLASS(x) FT_MODULE(x)->clazz #define FT_MODULE_CLASS(x) FT_MODULE(x)->clazz
#define FT_MODULE_LIBRARY(x) FT_MODULE(x)->library #define FT_MODULE_LIBRARY(x) FT_MODULE(x)->library
#define FT_MODULE_MEMORY(x) FT_MODULE(x)->memory #define FT_MODULE_MEMORY(x) FT_MODULE(x)->memory
#define FT_MODULE_IS_DRIVER(x) (FT_MODULE_CLASS(x)->module_flags & \ #define FT_MODULE_IS_DRIVER(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_font_driver ) ft_module_font_driver )
#define FT_MODULE_IS_DRIVER(x) (FT_MODULE_CLASS(x)->module_flags & \ #define FT_MODULE_IS_DRIVER(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_font_driver ) ft_module_font_driver )
#define FT_MODULE_IS_RENDERER(x) (FT_MODULE_CLASS(x)->module_flags & \ #define FT_MODULE_IS_RENDERER(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_renderer ) ft_module_renderer )
#define FT_DRIVER_IS_SCALABLE(x) (FT_MODULE_CLASS(x)->module_flags & \ #define FT_DRIVER_IS_SCALABLE(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_driver_scalable ) ft_module_driver_scalable )
#define FT_DRIVER_USES_OUTLINES(x) !(FT_MODULE_CLASS(x)->module_flags & \ #define FT_DRIVER_USES_OUTLINES(x) !(FT_MODULE_CLASS(x)->module_flags & \
ft_module_driver_no_outlines ) ft_module_driver_no_outlines )
/*************************************************************************/ /*************************************************************************/
@ -141,19 +141,19 @@
/* a few macros used to perform easy typecasts with minimal brain damage */ /* a few macros used to perform easy typecasts with minimal brain damage */
#define FT_FACE(x) ((FT_Face)x) #define FT_FACE(x) ((FT_Face)x)
#define FT_SIZE(x) ((FT_Size)x) #define FT_SIZE(x) ((FT_Size)x)
#define FT_SLOT(x) ((FT_GlyphSlot)x) #define FT_SLOT(x) ((FT_GlyphSlot)x)
#define FT_FACE_DRIVER(x) FT_FACE(x)->driver #define FT_FACE_DRIVER(x) FT_FACE(x)->driver
#define FT_FACE_LIBRARY(x) FT_FACE_DRIVER(x)->root.library #define FT_FACE_LIBRARY(x) FT_FACE_DRIVER(x)->root.library
#define FT_FACE_MEMORY(x) FT_FACE(x)->memory #define FT_FACE_MEMORY(x) FT_FACE(x)->memory
#define FT_SIZE_FACE(x) FT_SIZE(x)->face #define FT_SIZE_FACE(x) FT_SIZE(x)->face
#define FT_SLOT_FACE(x) FT_SLOT(x)->face #define FT_SLOT_FACE(x) FT_SLOT(x)->face
#define FT_FACE_SLOT(x) FT_FACE(x)->glyph #define FT_FACE_SLOT(x) FT_FACE(x)->glyph
#define FT_FACE_SIZE(x) FT_FACE(x)->size #define FT_FACE_SIZE(x) FT_FACE(x)->size
/* this must be kept exported - this will be used later in our own */ /* this must be kept exported - this will be used later in our own */
@ -248,7 +248,7 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
#define FT_RENDERER(x) ((FT_Renderer)(x)) #define FT_RENDERER(x) ((FT_Renderer)(x))
typedef struct FT_RendererRec_ typedef struct FT_RendererRec_
{ {
@ -275,10 +275,10 @@
/*************************************************************************/ /*************************************************************************/
/* typecast a module into a driver easily */ /* typecast a module into a driver easily */
#define FT_DRIVER(x) ((FT_Driver)(x)) #define FT_DRIVER(x) ((FT_Driver)(x))
/* typecast a module as a driver, and get its driver class */ /* typecast a module as a driver, and get its driver class */
#define FT_DRIVER_CLASS(x) FT_DRIVER(x)->clazz #define FT_DRIVER_CLASS(x) FT_DRIVER(x)->clazz
/*************************************************************************/ /*************************************************************************/
/* */ /* */

View File

@ -175,8 +175,8 @@
} CFF_SubFont; } CFF_SubFont;
/* maximum number of sub-fonts in a CID-keyed file */ /* maximum number of sub-fonts in a CID-keyed file */
#define CFF_MAX_CID_FONTS 16 #define CFF_MAX_CID_FONTS 16
typedef struct CFF_Font_ typedef struct CFF_Font_
{ {

View File

@ -140,13 +140,13 @@
} T1_Blend_Flags; } T1_Blend_Flags;
/* maximum number of multiple-masters designs, per-se the spec */ /* maximum number of multiple-masters designs, per-se the spec */
#define T1_MAX_MM_DESIGNS 16 #define T1_MAX_MM_DESIGNS 16
/* maximum number of multiple-masters axis, per-se the spec */ /* maximum number of multiple-masters axis, per-se the spec */
#define T1_MAX_MM_AXIS 4 #define T1_MAX_MM_AXIS 4
/* maximum number of elements in a design map */ /* maximum number of elements in a design map */
#define T1_MAX_MM_MAP_POINTS 20 #define T1_MAX_MM_MAP_POINTS 20
/* this structure is used to store the BlendDesignMap entry for an axis */ /* this structure is used to store the BlendDesignMap entry for an axis */
typedef struct T1_DesignMap_ typedef struct T1_DesignMap_

View File

@ -50,19 +50,19 @@
static const FT_Long ft_square_roots[63] = static const FT_Long ft_square_roots[63] =
{ {
1, 1, 2, 3, 4, 5, 8, 11, 1L, 1L, 2L, 3L, 4L, 5L, 8L, 11L,
16, 22, 32, 45, 64, 90, 128, 181, 16L, 22L, 32L, 45L, 64L, 90L, 128L, 181L,
256, 362, 512, 724, 1024, 1448, 2048, 2896, 256L, 362L, 512L, 724L, 1024L, 1448L, 2048L, 2896L,
4096, 5892, 8192, 11585, 16384, 23170, 32768, 46340, 4096L, 5892L, 8192L, 11585L, 16384L, 23170L, 32768L, 46340L,
65536, 92681, 131072, 185363, 262144, 370727, 65536L, 92681L, 131072L, 185363L, 262144L, 370727L,
524288, 741455, 1048576, 1482910, 2097152, 2965820, 524288L, 741455L, 1048576L, 1482910L, 2097152L, 2965820L,
4194304, 5931641, 8388608, 11863283, 16777216, 23726566, 4194304L, 5931641L, 8388608L, 11863283L, 16777216L, 23726566L,
33554432, 47453132, 67108864, 94906265, 33554432L, 47453132L, 67108864L, 94906265L,
134217728, 189812531, 268435456, 379625062, 134217728L, 189812531L, 268435456L, 379625062L,
536870912, 759250125, 1073741824, 1518500250, 536870912L, 759250125L, 1073741824L, 1518500250L,
2147483647 2147483647L
}; };
#else #else
@ -102,8 +102,8 @@
root >>= 1; root >>= 1;
mask >>= 2; mask >>= 2;
}
while ( mask != 0 ); } while ( mask != 0 );
return root; return root;
} }
@ -289,8 +289,8 @@
{ {
s = r; s = r;
r = ( r + l / r ) >> 1; r = ( r + l / r ) >> 1;
}
while ( r > s || r * r > l ); } while ( r > s || r * r > l );
return r; return r;
} }
@ -487,14 +487,14 @@
} }
else else
{ {
/* we need more bits, we'll have to do it by hand */ /* we need more bits; we have to do it by hand */
FT_Word32 c; FT_Word32 c;
q = ( a / b ) << 16; q = ( a / b ) << 16;
c = a % b; c = a % b;
/* we must compute C*0x10000/B; we simply shift C and B so */ /* we must compute C*0x10000/B: we simply shift C and B so */
/* C becomes smaller than 16 bits */ /* C becomes smaller than 16 bits */
while ( c >> 16 ) while ( c >> 16 )
{ {
@ -601,7 +601,7 @@
if ( s < 0 ) if ( s < 0 )
{ {
z->lo = (FT_Word32)-(FT_Int32)z->lo; z->lo = (FT_Word32)-(FT_Int32)z->lo;
z->hi = ~z->hi + !(z->lo); z->hi = ~z->hi + !( z->lo );
} }
} }
@ -636,7 +636,7 @@
if ( s < 0 ) if ( s < 0 )
{ {
x->lo = (FT_Word32)-(FT_Int32)x->lo; x->lo = (FT_Word32)-(FT_Int32)x->lo;
x->hi = ~x->hi + !(x->lo); x->hi = ~x->hi + !( x->lo );
} }
s ^= y; y = ABS( y ); s ^= y; y = ABS( y );
@ -759,8 +759,8 @@
r = ( r + FT_Div64by32( l, r ) ) >> 1; r = ( r + FT_Div64by32( l, r ) ) >> 1;
FT_MulTo64( r, r, &l2 ); FT_MulTo64( r, r, &l2 );
FT_Sub64 ( l, &l2, &l2 ); FT_Sub64 ( l, &l2, &l2 );
}
while ( r > s || (FT_Int32)l2.hi < 0 ); } while ( r > s || (FT_Int32)l2.hi < 0 );
return r; return r;
} }

View File

@ -103,7 +103,7 @@
if ( component >= trace_max ) if ( component >= trace_max )
return; return;
/* if component is `trace_any', then change _all_ levels at once */ /* if component is `trace_any', change _all_ levels at once */
if ( component == trace_any ) if ( component == trace_any )
{ {
int n; int n;

View File

@ -152,7 +152,8 @@
cur->offset = registry->cur_offset; cur->offset = registry->cur_offset;
registry->num_extensions++; registry->num_extensions++;
registry->cur_offset += ( cur->size + FT_ALIGNMENT-1 ) & -FT_ALIGNMENT; registry->cur_offset +=
( cur->size + FT_ALIGNMENT - 1 ) & -FT_ALIGNMENT;
FT_TRACE1(( "FT_Register_Extension: `%s' successfully registered\n", FT_TRACE1(( "FT_Register_Extension: `%s' successfully registered\n",
cur->id )); cur->id ));
@ -180,12 +181,12 @@
/* extension interface. */ /* extension interface. */
/* */ /* */
/* <Return> */ /* <Return> */
/* A pointer to the extension block. */ /* A generic pointer to the extension block. */
/* */ /* */
FT_EXPORT_FUNC( void* ) FT_Get_Extension( FT_EXPORT_FUNC( void* ) FT_Get_Extension(
FT_Face face, FT_Face face,
const char* extension_id, const char* extension_id,
void* *extension_interface ) void** extension_interface )
{ {
FT_Extension_Registry* registry; FT_Extension_Registry* registry;
@ -296,7 +297,7 @@
face->extensions = 0; face->extensions = 0;
/* load extensions registry, exit successfully if none is there */ /* load extensions registry; exit successfully if none is there */
registry = (FT_Extension_Registry*)face->driver->extensions; registry = (FT_Extension_Registry*)face->driver->extensions;
if ( !registry ) if ( !registry )

View File

@ -42,6 +42,7 @@
#define FT_COMPONENT trace_glyph #define FT_COMPONENT trace_glyph
/* a helper function to avoid duplication of code */
static static
void ft_prepare_glyph( FT_Glyph glyph, void ft_prepare_glyph( FT_Glyph glyph,
FT_Face face, FT_Face face,
@ -122,13 +123,13 @@
FT_Vector* origin, FT_Vector* origin,
FT_BitmapGlyph* abitglyph ) FT_BitmapGlyph* abitglyph )
{ {
FT_Error error; FT_Error error;
FT_Memory memory; FT_Memory memory;
FT_BitmapGlyph bitglyph; FT_BitmapGlyph bitglyph;
FT_Glyph glyph; FT_Glyph glyph;
FT_Pos origin_x = 0; FT_Pos origin_x = 0;
FT_Pos origin_y = 0; FT_Pos origin_y = 0;
if ( !face ) if ( !face )
@ -171,6 +172,7 @@
/* now, handle bitmap and outline glyph images */ /* now, handle bitmap and outline glyph images */
memory = face->memory; memory = face->memory;
switch ( face->glyph->format ) switch ( face->glyph->format )
{ {
case ft_glyph_format_bitmap: case ft_glyph_format_bitmap:
@ -230,7 +232,7 @@
else else
pitch = ( width + 7 ) >> 3; pitch = ( width + 7 ) >> 3;
size = pitch * height; size = pitch * height;
if ( ALLOC( bitglyph, sizeof ( *bitglyph ) ) ) if ( ALLOC( bitglyph, sizeof ( *bitglyph ) ) )
goto Exit; goto Exit;
@ -318,7 +320,7 @@
FT_OutlineGlyph glyph; FT_OutlineGlyph glyph;
/* test for valid face delayed to FT_Load_Glyph() */ /* test for valid `face' delayed to FT_Load_Glyph() */
if ( !vecglyph ) if ( !vecglyph )
return FT_Err_Invalid_Argument; return FT_Err_Invalid_Argument;
@ -529,7 +531,7 @@
v = d; v = d;
} }
/* check that we're not trying to normalize zero! */ /* check that we are not trying to normalize zero! */
if ( u == 0 ) if ( u == 0 )
return 0; return 0;
@ -630,8 +632,8 @@
/* Compute the orientation of path filling. It differs between TrueType */ /* Compute the orientation of path filling. It differs between TrueType */
/* and Type1 formats. We could use the `ft_outline_reverse_fill' flag, */ /* and Type1 formats. We could use the `ft_outline_reverse_fill' flag, */
/* but it's better to re-compute it directly (it seems that this flag */ /* but it is better to re-compute it directly (it seems that this flag */
/* isn't correctly set for some weird composite glyphs for now). */ /* isn't correctly set for some weird composite glyphs currently). */
/* */ /* */
/* We do this by computing bounding box points, and computing their */ /* We do this by computing bounding box points, and computing their */
/* curvature. */ /* curvature. */
@ -645,6 +647,7 @@
FT_BBox indices; FT_BBox indices;
int n, last; int n, last;
indices.xMin = -1; indices.xMin = -1;
indices.yMin = -1; indices.yMin = -1;
indices.xMax = -1; indices.xMax = -1;
@ -756,7 +759,7 @@
d = distance; d = distance;
if ( (outline->flags[n] & FT_Curve_Tag_On) == 0 ) if ( ( outline->flags[n] & FT_Curve_Tag_On ) == 0 )
d *= 2; d *= 2;
/* Check discriminant for parallel vectors */ /* Check discriminant for parallel vectors */
@ -781,6 +784,7 @@
/* Vectors are nearly parallel */ /* Vectors are nearly parallel */
FT_Pos x, y; FT_Pos x, y;
x = distance + cur.x + FT_MulFix( d, u.x + v.x ) / 2; x = distance + cur.x + FT_MulFix( d, u.x + v.x ) / 2;
y = distance + cur.y + FT_MulFix( d, u.y + v.y ) / 2; y = distance + cur.y + FT_MulFix( d, u.y + v.y ) / 2;

View File

@ -84,7 +84,8 @@ const FT_Module_Class* ft_default_modules[] =
FT_Error error; FT_Error error;
const FT_Module_Class** cur; const FT_Module_Class** cur;
/* test for valid library delayed to FT_Add_Module() */
/* test for valid `library' delayed to FT_Add_Module() */
cur = ft_default_modules; cur = ft_default_modules;
while ( *cur ) while ( *cur )
@ -114,7 +115,7 @@ const FT_Module_Class* ft_default_modules[] =
/* library :: A handle to a new library object. */ /* library :: A handle to a new library object. */
/* */ /* */
/* <Return> */ /* <Return> */
/* FreeTyoe error code. 0 means success. */ /* FreeType error code. 0 means success. */
/* */ /* */
FT_EXPORT_FUNC( FT_Error ) FT_Init_FreeType( FT_Library* library ) FT_EXPORT_FUNC( FT_Error ) FT_Init_FreeType( FT_Library* library )
{ {
@ -128,13 +129,12 @@ const FT_Module_Class* ft_default_modules[] =
memory = FT_New_Memory(); memory = FT_New_Memory();
if ( !memory ) if ( !memory )
{ {
FT_ERROR(( "FT_Init_FreeType:" )); FT_ERROR(( "FT_Init_FreeType: cannot find memory manager\n" ));
FT_ERROR(( " cannot find memory manager\n" ));
return FT_Err_Unimplemented_Feature; return FT_Err_Unimplemented_Feature;
} }
/* builds a library out of it, then fill it with the set of */ /* build a library out of it, then fill it with the set of */
/* default drivers. */ /* default drivers. */
error = FT_New_Library( memory, library ); error = FT_New_Library( memory, library );
if ( !error ) if ( !error )

File diff suppressed because it is too large Load Diff

View File

@ -174,50 +174,48 @@
} }
case FT_Curve_Tag_Conic: /* consume conic arcs */ case FT_Curve_Tag_Conic: /* consume conic arcs */
v_control.x = SCALED( point->x );
v_control.y = SCALED( point->y );
Do_Conic:
if ( point < limit )
{ {
v_control.x = SCALED( point->x ); FT_Vector vec;
v_control.y = SCALED( point->y ); FT_Vector v_middle;
Do_Conic:
if ( point < limit ) point++;
tags++;
tag = FT_CURVE_TAG( tags[0] );
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
if ( tag == FT_Curve_Tag_On )
{ {
FT_Vector vec; error = interface->conic_to( &v_control, &vec, user );
FT_Vector v_middle;
point++;
tags++;
tag = FT_CURVE_TAG( tags[0] );
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
if ( tag == FT_Curve_Tag_On )
{
error = interface->conic_to( &v_control, &vec, user );
if ( error )
goto Exit;
continue;
}
if ( tag != FT_Curve_Tag_Conic )
goto Invalid_Outline;
v_middle.x = ( v_control.x + vec.x ) / 2;
v_middle.y = ( v_control.y + vec.y ) / 2;
error = interface->conic_to( &v_control, &v_middle, user );
if ( error ) if ( error )
goto Exit; goto Exit;
continue;
v_control = vec;
goto Do_Conic;
} }
error = interface->conic_to( &v_control, &v_start, user ); if ( tag != FT_Curve_Tag_Conic )
goto Close; goto Invalid_Outline;
v_middle.x = ( v_control.x + vec.x ) / 2;
v_middle.y = ( v_control.y + vec.y ) / 2;
error = interface->conic_to( &v_control, &v_middle, user );
if ( error )
goto Exit;
v_control = vec;
goto Do_Conic;
} }
error = interface->conic_to( &v_control, &v_start, user );
goto Close;
default: /* FT_Curve_Tag_Cubic */ default: /* FT_Curve_Tag_Cubic */
{ {
FT_Vector vec1, vec2; FT_Vector vec1, vec2;
@ -256,7 +254,7 @@
/* close the contour with a line segment */ /* close the contour with a line segment */
error = interface->line_to( &v_start, user ); error = interface->line_to( &v_start, user );
Close: Close:
if ( error ) if ( error )
goto Exit; goto Exit;
@ -549,6 +547,7 @@
char* q = outline->tags + last; char* q = outline->tags + last;
char swap; char swap;
while ( p < q ) while ( p < q )
{ {
swap = *p; swap = *p;
@ -604,34 +603,46 @@
FT_Outline* outline, FT_Outline* outline,
FT_Raster_Params* params ) FT_Raster_Params* params )
{ {
FT_Error error; FT_Error error;
FT_Bool update = 0; FT_Bool update = 0;
FT_Renderer renderer = library->cur_renderer; FT_Renderer renderer;
FT_ListNode node = library->renderers.head; FT_ListNode node;
if ( !library )
return FT_Err_Invalid_Library_Handle;
if ( !params )
return FT_Err_Invalid_Argument;
renderer = library->cur_renderer;
node = library->renderers.head;
params->source = (void*)outline; params->source = (void*)outline;
error = FT_Err_Cannot_Render_Glyph; error = FT_Err_Cannot_Render_Glyph;
while (renderer) while ( renderer )
{ {
error = renderer->raster_render( renderer->raster, params ); error = renderer->raster_render( renderer->raster, params );
if (!error || error != FT_Err_Cannot_Render_Glyph) break; if ( !error || error != FT_Err_Cannot_Render_Glyph )
break;
/* FT_Err_Cannot_Render_Glyph is returned when the render mode */ /* FT_Err_Cannot_Render_Glyph is returned when the render mode */
/* is unsupported by the current renderer for this glyph image */ /* is unsupported by the current renderer for this glyph image */
/* format.. */ /* format */
/* now, look for another renderer that supports the same */ /* now, look for another renderer that supports the same */
/* format.. */ /* format */
renderer = FT_Lookup_Renderer( library, ft_glyph_format_outline, &node ); renderer = FT_Lookup_Renderer( library, ft_glyph_format_outline,
&node );
update = 1; update = 1;
} }
/* if we changed the current renderer for the glyph image format */ /* if we changed the current renderer for the glyph image format */
/* we need to select it as the next current one.. */ /* we need to select it as the next current one */
if (!error && update && renderer) if ( !error && update && renderer )
FT_Set_Renderer( library, renderer, 0, 0 ); FT_Set_Renderer( library, renderer, 0, 0 );
return error; return error;
} }
@ -675,7 +686,7 @@
if ( !bitmap ) if ( !bitmap )
return FT_Err_Invalid_Argument; return FT_Err_Invalid_Argument;
/* other checks are delayed to FT_Outline_Render */ /* other checks are delayed to FT_Outline_Render() */
params.target = bitmap; params.target = bitmap;
params.flags = 0; params.flags = 0;
@ -713,6 +724,9 @@
FT_Pos xz, yz; FT_Pos xz, yz;
if ( !vector || !matrix )
return;
xz = FT_MulFix( vector->x, matrix->xx ) + xz = FT_MulFix( vector->x, matrix->xx ) +
FT_MulFix( vector->y, matrix->xy ); FT_MulFix( vector->y, matrix->xy );
@ -750,7 +764,7 @@
{ {
FT_Vector* vec = outline->points; FT_Vector* vec = outline->points;
FT_Vector* limit = vec + outline->n_points; FT_Vector* limit = vec + outline->n_points;
for ( ; vec < limit; vec++ ) for ( ; vec < limit; vec++ )
FT_Vector_Transform( vec, matrix ); FT_Vector_Transform( vec, matrix );

View File

@ -374,9 +374,9 @@
BASE_FUNC( FT_Short ) FT_Read_Short( FT_Stream stream, BASE_FUNC( FT_Short ) FT_Read_Short( FT_Stream stream,
FT_Error* error ) FT_Error* error )
{ {
char reads[2]; char reads[2];
char* p = 0; char* p = 0;
FT_Short result = 0; FT_Short result = 0;
FT_Assert( stream ); FT_Assert( stream );
@ -645,27 +645,24 @@
*(FT_UShort*)p = (FT_UShort)value; *(FT_UShort*)p = (FT_UShort)value;
break; break;
/* A slight note regarding the following: */ /* SIZEOF_INT is defined in <freetype/config/ftconfig.h> */
/* */ /* and gives the size in bytes of the `int' type on the */
/* SIZEOF_INT is defined in <freetype/config/ftconfig.h> */ /* current platform. */
/* and gives the size in bytes of the "int" type on the */ /* */
/* current platform.. */ /* Only on 16-bit systems the value of SIZEOF_INT can be */
/* */ /* less than 4. In this case SIZEOF_LONG is always 4. */
/* Only on 16-bit systems can the value of SIZEOF_INT be */ /* */
/* less than 4. In this case SIZEOF_LONG is always 4 */ /* On a 64-bit system, SIZEOF_LONG can be 8, which is */
/* */ /* handled by the default case. */
/* On a 64-bit system, SIZEOF_LONG can be 8, which is */ /* */
/* handled by the default case.. */
/* */
#if SIZEOF_INT == 4 #if SIZEOF_INT == 4
case 4: case 4:
*(FT_UInt*)p = (FT_UInt)value; *(FT_UInt*)p = (FT_UInt)value;
break; break;
#endif #endif
default: default:
*(FT_ULong*)p = (FT_ULong)value; *(FT_ULong*)p = (FT_ULong)value;
} }
/* go to next field */ /* go to next field */

View File

@ -44,8 +44,9 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* It is not necessary to do any error checking here. This will be done */ /* It is not necessary to do any error checking for the */
/* by the higher level routines like FT_Alloc() or FT_Realloc(). */ /* allocation-related functions. This will be done by the higher level */
/* routines like FT_Alloc() or FT_Realloc(). */
/* */ /* */
/*************************************************************************/ /*************************************************************************/
@ -234,6 +235,9 @@
FILE* file; FILE* file;
if ( !stream )
return FT_Err_Invalid_Stream_Handle;
file = fopen( filepathname, "rb" ); file = fopen( filepathname, "rb" );
if ( !file ) if ( !file )
{ {

View File

@ -303,12 +303,12 @@
0x20000L, 0x20000L,
0, /* module-specific interface */ 0, /* module-specific interface */
(FT_Module_Constructor)T2_Init_Driver, (FT_Module_Constructor)T2_Init_Driver,
(FT_Module_Destructor) T2_Done_Driver, (FT_Module_Destructor) T2_Done_Driver,
(FT_Module_Requester) t2_get_interface, (FT_Module_Requester) t2_get_interface,
}, },
/* now the specific driver fields */ /* now the specific driver fields */
sizeof( TT_FaceRec ), sizeof( TT_FaceRec ),
sizeof( FT_SizeRec ), sizeof( FT_SizeRec ),
@ -323,7 +323,7 @@
(FTDriver_setCharSizes) 0, (FTDriver_setCharSizes) 0,
(FTDriver_setPixelSizes)0, (FTDriver_setPixelSizes)0,
(FTDriver_loadGlyph) Load_Glyph, (FTDriver_loadGlyph) Load_Glyph,
(FTDriver_getCharIndex) Get_Char_Index, (FTDriver_getCharIndex) Get_Char_Index,

View File

@ -233,7 +233,7 @@
{ {
FT_GlyphLoader* loader = glyph->root.loader; FT_GlyphLoader* loader = glyph->root.loader;
builder->loader = loader; builder->loader = loader;
builder->base = &loader->base.outline; builder->base = &loader->base.outline;
builder->current = &loader->current.outline; builder->current = &loader->current.outline;
@ -351,29 +351,31 @@
} }
/* this function is used to select the locals subrs array */ /* this function is used to select the locals subrs array */
LOCAL_DEF LOCAL_DEF
void T2_Prepare_Decoder( T2_Decoder* decoder, void T2_Prepare_Decoder( T2_Decoder* decoder,
FT_UInt glyph_index ) FT_UInt glyph_index )
{ {
CFF_Font* cff = (CFF_Font*)decoder->builder.face->extra.data; CFF_Font* cff = (CFF_Font*)decoder->builder.face->extra.data;
CFF_SubFont* sub = &cff->top_font; CFF_SubFont* sub = &cff->top_font;
/* manage CID fonts */ /* manage CID fonts */
if (cff->num_subfonts >= 1) if ( cff->num_subfonts >= 1 )
{ {
FT_Byte fd_index = CFF_Get_FD( &cff->fd_select, glyph_index ); FT_Byte fd_index = CFF_Get_FD( &cff->fd_select, glyph_index );
sub = cff->subfonts[fd_index]; sub = cff->subfonts[fd_index];
} }
decoder->num_locals = sub->num_local_subrs; decoder->num_locals = sub->num_local_subrs;
decoder->locals = sub->local_subrs; decoder->locals = sub->local_subrs;
decoder->locals_bias = t2_compute_bias( decoder->num_locals ); decoder->locals_bias = t2_compute_bias( decoder->num_locals );
decoder->glyph_width = sub->private_dict.default_width; decoder->glyph_width = sub->private_dict.default_width;
decoder->nominal_width = sub->private_dict.nominal_width; decoder->nominal_width = sub->private_dict.nominal_width;
} }
/* check that there is enough room for `count' more points */ /* check that there is enough room for `count' more points */
@ -382,7 +384,7 @@
FT_Int count ) FT_Int count )
{ {
return FT_GlyphLoader_Check_Points( builder->loader, count, 0 ); return FT_GlyphLoader_Check_Points( builder->loader, count, 0 );
} }
/* add a new point, do not check space */ /* add a new point, do not check space */
@ -447,7 +449,7 @@
{ {
if ( outline->n_contours > 0 ) if ( outline->n_contours > 0 )
outline->contours[outline->n_contours - 1] = outline->n_points - 1; outline->contours[outline->n_contours - 1] = outline->n_points - 1;
outline->n_contours++; outline->n_contours++;
} }
@ -528,6 +530,7 @@
FT_Fixed seed; FT_Fixed seed;
FT_Fixed* stack; FT_Fixed* stack;
/* set default width */ /* set default width */
decoder->num_hints = 0; decoder->num_hints = 0;
decoder->read_width = 1; decoder->read_width = 1;
@ -1087,10 +1090,12 @@
case t2_op_rlinecurve: case t2_op_rlinecurve:
{ {
FT_Int num_lines = (num_args-6)/2; FT_Int num_lines = ( num_args - 6 ) / 2;
FT_TRACE4(( " rlinecurve" )); FT_TRACE4(( " rlinecurve" ));
if ( num_args < 8 || (num_args-6) & 1) if ( num_args < 8 || ( num_args - 6 ) & 1 )
goto Stack_Underflow; goto Stack_Underflow;
if ( start_point( builder, x, y ) || if ( start_point( builder, x, y ) ||
@ -1100,7 +1105,7 @@
args = stack; args = stack;
/* first, add the line segments */ /* first, add the line segments */
while (num_lines > 0) while ( num_lines > 0 )
{ {
x += args[0]; x += args[0];
y += args[1]; y += args[1];
@ -1109,7 +1114,7 @@
num_lines--; num_lines--;
} }
/* then, the curve */ /* then the curve */
x += args[0]; x += args[0];
y += args[1]; y += args[1];
add_point( builder, x, y, 0 ); add_point( builder, x, y, 0 );
@ -1125,12 +1130,12 @@
case t2_op_rcurveline: case t2_op_rcurveline:
{ {
FT_Int num_curves = (num_args-2)/6; FT_Int num_curves = ( num_args - 2 ) / 6;
FT_TRACE4(( " rcurveline" )); FT_TRACE4(( " rcurveline" ));
if ( num_args < 8 || (num_args-2) % 6 ) if ( num_args < 8 || ( num_args - 2 ) % 6 )
goto Stack_Underflow; goto Stack_Underflow;
if ( start_point ( builder, x, y ) || if ( start_point ( builder, x, y ) ||
@ -1138,8 +1143,9 @@
goto Memory_Error; goto Memory_Error;
args = stack; args = stack;
/* first, add the curves */ /* first, add the curves */
while (num_curves > 0) while ( num_curves > 0 )
{ {
x += args[0]; x += args[0];
y += args[1]; y += args[1];
@ -1153,6 +1159,7 @@
args += 6; args += 6;
num_curves--; num_curves--;
} }
/* then the final line */ /* then the final line */
x += args[0]; x += args[0];
y += args[1]; y += args[1];
@ -1549,15 +1556,15 @@
return error; return error;
Syntax_Error: Syntax_Error:
FT_TRACE4(( "** Syntax Error **" )); FT_TRACE4(( "T2_Parse_CharStrings: syntax error!" ));
return T2_Err_Invalid_File_Format; return T2_Err_Invalid_File_Format;
Stack_Underflow: Stack_Underflow:
FT_TRACE4(( "** Stack underflow **" )); FT_TRACE4(( "T2_Parse_CharStrings: stack underflow!" ));
return T2_Err_Too_Few_Arguments; return T2_Err_Too_Few_Arguments;
Stack_Overflow: Stack_Overflow:
FT_TRACE4(( "** Stack overflow**" )); FT_TRACE4(( "T2_Parse_CharStrings: stack overflow!" ));
return T2_Err_Stack_Overflow; return T2_Err_Stack_Overflow;
Memory_Error: Memory_Error:

View File

@ -167,8 +167,8 @@
T2_GlyphSlot slot ); T2_GlyphSlot slot );
LOCAL_DEF LOCAL_DEF
void T2_Prepare_Decoder( T2_Decoder* decoder, void T2_Prepare_Decoder( T2_Decoder* decoder,
FT_UInt glyph_index ); FT_UInt glyph_index );
#if 0 /* unused until we support pure CFF fonts */ #if 0 /* unused until we support pure CFF fonts */

View File

@ -318,26 +318,27 @@
#endif /* 0 */ #endif /* 0 */
/**********************************************************************/
/**********************************************************************/ /*************************************************************************/
/*** ***/ /*************************************************************************/
/*** FD Select table support ***/ /*** ***/
/*** ***/ /*** FD Select table support ***/
/*** ***/ /*** ***/
/**********************************************************************/ /*************************************************************************/
/**********************************************************************/ /*************************************************************************/
static static
void CFF_Done_FD_Select( CFF_FD_Select* select, void CFF_Done_FD_Select( CFF_FD_Select* select,
FT_Stream stream ) FT_Stream stream )
{ {
if (select->data) if ( select->data )
RELEASE_Frame( select->data ); RELEASE_Frame( select->data );
select->data_size = 0; select->data_size = 0;
select->format = 0; select->format = 0;
select->range_count = 0; select->range_count = 0;
} }
static static
@ -349,42 +350,44 @@
FT_Error error; FT_Error error;
FT_Byte format; FT_Byte format;
FT_UInt num_ranges; FT_UInt num_ranges;
/* read format */ /* read format */
if ( FILE_Seek(offset) || READ_Byte(format) ) if ( FILE_Seek( offset ) || READ_Byte( format ) )
goto Exit; goto Exit;
select->format = format; select->format = format;
select->cache_count = 0; /* clear cache */ select->cache_count = 0; /* clear cache */
switch (format)
switch ( format )
{ {
case 0: /* format 0, that's simple */ case 0: /* format 0, that's simple */
{ {
select->data_size = num_glyphs; select->data_size = num_glyphs;
goto Load_Data; goto Load_Data;
} }
case 3: /* format 3, a tad more complex */
case 3: /* format 3, a tad more complex */ {
{ if ( READ_UShort( num_ranges ) )
if ( READ_UShort(num_ranges) ) goto Exit;
goto Exit;
select->data_size = num_ranges * 3 + 2;
select->data_size = num_ranges*3+2;
Load_Data:
Load_Data: if ( EXTRACT_Frame( select->data_size, select->data ) )
if ( EXTRACT_Frame( select->data_size, select->data ) ) goto Exit;
goto Exit; }
} break;
break;
default: /* humm... that's wrong */
default: /* humm.. that's wrong */ error = FT_Err_Invalid_File_Format;
error = FT_Err_Invalid_File_Format;
} }
Exit: Exit:
return error; return error;
} }
LOCAL_FUNC LOCAL_FUNC
@ -392,68 +395,70 @@
FT_UInt glyph_index ) FT_UInt glyph_index )
{ {
FT_Byte fd = 0; FT_Byte fd = 0;
switch (select->format)
switch ( select->format )
{ {
case 0: case 0:
fd = select->data[glyph_index]; fd = select->data[glyph_index];
break;
case 3:
/* first, compare to cache */
if ( (FT_UInt)(glyph_index-select->cache_first) < select->cache_count )
{
fd = select->cache_fd;
break; break;
}
case 3:
/* first, compare to cache */ /* then, lookup the ranges array */
if ((FT_UInt)(glyph_index-select->cache_first) < select->cache_count) {
FT_Byte* p = select->data;
FT_Byte* p_limit = p + select->data_size;
FT_Byte fd2;
FT_UInt first, limit;
first = NEXT_UShort( p );
do
{ {
fd = select->cache_fd; if ( glyph_index < first )
break; break;
}
fd2 = *p++;
/* then, lookup the ranges array */ limit = NEXT_UShort( p );
{
FT_Byte* p = select->data; if ( glyph_index < limit )
FT_Byte* p_limit = p + select->data_size;
FT_Byte fd2;
FT_UInt first, limit;
first = NEXT_UShort(p);
do
{ {
if (glyph_index < first) fd = fd2;
break;
/* update cache */
fd2 = *p++; select->cache_first = first;
limit = NEXT_UShort(p); select->cache_count = limit-first;
select->cache_fd = fd2;
if (glyph_index < limit) break;
{
fd = fd2;
/* update cache */
select->cache_first = first;
select->cache_count = limit-first;
select->cache_fd = fd2;
break;
}
first = limit;
} }
while (p < p_limit); first = limit;
} } while ( p < p_limit );
break; }
break;
default:
; default:
;
} }
return fd; return fd;
} }
/**********************************************************************/ /*************************************************************************/
/**********************************************************************/ /*************************************************************************/
/*** ***/ /*** ***/
/*** CFF font support ***/ /*** CFF font support ***/
/*** ***/ /*** ***/
/*** ***/ /*************************************************************************/
/**********************************************************************/ /*************************************************************************/
/**********************************************************************/
static static
FT_Error CFF_Load_SubFont( CFF_SubFont* font, FT_Error CFF_Load_SubFont( CFF_SubFont* font,
@ -462,12 +467,13 @@
FT_Stream stream, FT_Stream stream,
FT_ULong base_offset ) FT_ULong base_offset )
{ {
FT_Error error; FT_Error error;
T2_Parser parser; T2_Parser parser;
FT_Byte* dict; FT_Byte* dict;
FT_ULong dict_len; FT_ULong dict_len;
CFF_Font_Dict* top = &font->font_dict; CFF_Font_Dict* top = &font->font_dict;
CFF_Private* priv = &font->private_dict; CFF_Private* priv = &font->private_dict;
T2_Parser_Init( &parser, T2CODE_TOPDICT, &font->font_dict ); T2_Parser_Init( &parser, T2CODE_TOPDICT, &font->font_dict );
@ -494,11 +500,11 @@
goto Exit; goto Exit;
/* parse the private dictionary, if any */ /* parse the private dictionary, if any */
if ( top->private_offset && top->private_size) if ( top->private_offset && top->private_size )
{ {
/* set defaults */ /* set defaults */
MEM_Set( priv, 0, sizeof(*priv) ); MEM_Set( priv, 0, sizeof ( *priv ) );
priv->blue_shift = 7; priv->blue_shift = 7;
priv->blue_fuzz = 1; priv->blue_fuzz = 1;
priv->lenIV = -1; priv->lenIV = -1;
@ -508,7 +514,7 @@
T2_Parser_Init( &parser, T2CODE_PRIVATE, priv ); T2_Parser_Init( &parser, T2CODE_PRIVATE, priv );
if ( FILE_Seek( base_offset + font->font_dict.private_offset ) || if ( FILE_Seek( base_offset + font->font_dict.private_offset ) ||
ACCESS_Frame( font->font_dict.private_size ) ) ACCESS_Frame( font->font_dict.private_size ) )
goto Exit; goto Exit;
error = T2_Parser_Run( &parser, error = T2_Parser_Run( &parser,
@ -529,7 +535,7 @@
error = t2_new_cff_index( &font->local_subrs_index, stream, 1 ); error = t2_new_cff_index( &font->local_subrs_index, stream, 1 );
if ( error ) if ( error )
goto Exit; goto Exit;
font->num_local_subrs = font->local_subrs_index.count; font->num_local_subrs = font->local_subrs_index.count;
error = t2_explicit_cff_index( &font->local_subrs_index, error = t2_explicit_cff_index( &font->local_subrs_index,
&font->local_subrs ); &font->local_subrs );
@ -544,13 +550,12 @@
void CFF_Done_SubFont( FT_Memory memory, void CFF_Done_SubFont( FT_Memory memory,
CFF_SubFont* subfont ) CFF_SubFont* subfont )
{ {
if (subfont) if ( subfont )
{ {
t2_done_cff_index( &subfont->local_subrs_index ); t2_done_cff_index( &subfont->local_subrs_index );
FREE( subfont->local_subrs ); FREE( subfont->local_subrs );
} }
} }
LOCAL_FUNC LOCAL_FUNC
@ -599,7 +604,7 @@
/* read the name, top dict, string and global subrs index */ /* read the name, top dict, string and global subrs index */
error = t2_new_cff_index( &font->name_index, stream, 0 ) || error = t2_new_cff_index( &font->name_index, stream, 0 ) ||
t2_new_cff_index( &font->font_dict_index, stream, 0 ) || t2_new_cff_index( &font->font_dict_index, stream, 0 ) ||
t2_new_cff_index( &font->string_index, stream, 0 ) || t2_new_cff_index( &font->string_index, stream, 0 ) ||
t2_new_cff_index( &font->global_subrs_index, stream, 1 ); t2_new_cff_index( &font->global_subrs_index, stream, 1 );
if ( error ) if ( error )
@ -615,16 +620,16 @@
} }
/* in case of a font format check, simply exit now */ /* in case of a font format check, simply exit now */
if (face_index < 0) if ( face_index < 0 )
goto Exit; goto Exit;
/* now, parse the top-level font dictionary */ /* now, parse the top-level font dictionary */
error = CFF_Load_SubFont( &font->top_font, error = CFF_Load_SubFont( &font->top_font,
&font->font_dict_index, &font->font_dict_index,
face_index, face_index,
stream, stream,
base_offset ); base_offset );
if (error) if ( error )
goto Exit; goto Exit;
/* now, check for a CID font */ /* now, check for a CID font */
@ -634,20 +639,22 @@
CFF_SubFont* sub; CFF_SubFont* sub;
FT_UInt index; FT_UInt index;
/* this is a CID-keyed font, we must now allocate a table of */ /* this is a CID-keyed font, we must now allocate a table of */
/* sub-fonts, then load each of them separately.. */ /* sub-fonts, then load each of them separately */
if ( FILE_Seek( base_offset + dict->cid_fd_array_offset ) ) if ( FILE_Seek( base_offset + dict->cid_fd_array_offset ) )
goto Exit; goto Exit;
error = t2_new_cff_index( &fd_index, stream, 0 ); error = t2_new_cff_index( &fd_index, stream, 0 );
if (error) goto Exit; if ( error )
goto Exit;
if (fd_index.count > CFF_MAX_CID_FONTS)
if ( fd_index.count > CFF_MAX_CID_FONTS )
{ {
FT_ERROR(( "T2_Load_CFF_Font: FD array too large in CID font\n" )); FT_ERROR(( "T2_Load_CFF_Font: FD array too large in CID font\n" ));
goto Fail_CID; goto Fail_CID;
} }
/* allocate & read each font dict independently */ /* allocate & read each font dict independently */
font->num_subfonts = fd_index.count; font->num_subfonts = fd_index.count;
if ( ALLOC_ARRAY( sub, fd_index.count, CFF_SubFont ) ) if ( ALLOC_ARRAY( sub, fd_index.count, CFF_SubFont ) )
@ -656,13 +663,15 @@
/* setup pointer table */ /* setup pointer table */
for ( index = 0; index < fd_index.count; index++ ) for ( index = 0; index < fd_index.count; index++ )
font->subfonts[index] = sub + index; font->subfonts[index] = sub + index;
/* now load each sub font independently */ /* now load each sub font independently */
for ( index = 0; index < fd_index.count; index++ ) for ( index = 0; index < fd_index.count; index++ )
{ {
sub = font->subfonts[index]; sub = font->subfonts[index];
error = CFF_Load_SubFont( sub, &fd_index, index, stream, base_offset ); error = CFF_Load_SubFont( sub, &fd_index, index,
if (error) goto Fail_CID; stream, base_offset );
if ( error )
goto Fail_CID;
} }
/* now load the FD Select array */ /* now load the FD Select array */
@ -673,8 +682,8 @@
Fail_CID: Fail_CID:
t2_done_cff_index( &fd_index ); t2_done_cff_index( &fd_index );
if (error) if ( error )
goto Exit; goto Exit;
} }
else else
@ -713,28 +722,27 @@
} }
LOCAL_FUNC LOCAL_FUNC
void T2_Done_CFF_Font( CFF_Font* font ) void T2_Done_CFF_Font( CFF_Font* font )
{ {
FT_Memory memory = font->memory; FT_Memory memory = font->memory;
FT_UInt index; FT_UInt index;
t2_done_cff_index( &font->global_subrs_index ); t2_done_cff_index( &font->global_subrs_index );
t2_done_cff_index( &font->string_index ); t2_done_cff_index( &font->string_index );
t2_done_cff_index( &font->font_dict_index ); t2_done_cff_index( &font->font_dict_index );
t2_done_cff_index( &font->name_index ); t2_done_cff_index( &font->name_index );
t2_done_cff_index( &font->charstrings_index ); t2_done_cff_index( &font->charstrings_index );
/* release font dictionaries */ /* release font dictionaries */
for ( index = 0; index < font->num_subfonts; index++ ) for ( index = 0; index < font->num_subfonts; index++ )
CFF_Done_SubFont( memory, font->subfonts[index] ); CFF_Done_SubFont( memory, font->subfonts[index] );
CFF_Done_SubFont( memory, &font->top_font ); CFF_Done_SubFont( memory, &font->top_font );
CFF_Done_FD_Select( &font->fd_select, font->stream ); CFF_Done_FD_Select( &font->fd_select, font->stream );
FREE( font->global_subrs ); FREE( font->global_subrs );
FREE( font->font_name ); FREE( font->font_name );
} }

View File

@ -198,7 +198,7 @@
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
return TT_Init_Extensions( driver ); return TT_Init_Extensions( driver );
#else #else
UNUSED(driver); UNUSED( driver );
return T2_Err_Ok; return T2_Err_Ok;
#endif #endif
} }
@ -222,7 +222,7 @@
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
TT_Done_Extensions( driver ); TT_Done_Extensions( driver );
#else #else
UNUSED(driver); UNUSED( driver );
#endif #endif
} }

View File

@ -280,9 +280,9 @@
FT_Error parse_font_matrix( T2_Parser* parser ) FT_Error parse_font_matrix( T2_Parser* parser )
{ {
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_Matrix* matrix = &dict->font_matrix; FT_Matrix* matrix = &dict->font_matrix;
FT_Byte** data = parser->stack; FT_Byte** data = parser->stack;
FT_Error error; FT_Error error;
error = T2_Err_Stack_Underflow; error = T2_Err_Stack_Underflow;
@ -304,9 +304,9 @@
FT_Error parse_font_bbox( T2_Parser* parser ) FT_Error parse_font_bbox( T2_Parser* parser )
{ {
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_BBox* bbox = &dict->font_bbox; FT_BBox* bbox = &dict->font_bbox;
FT_Byte** data = parser->stack; FT_Byte** data = parser->stack;
FT_Error error; FT_Error error;
error = T2_Err_Stack_Underflow; error = T2_Err_Stack_Underflow;
@ -328,8 +328,8 @@
FT_Error parse_private_dict( T2_Parser* parser ) FT_Error parse_private_dict( T2_Parser* parser )
{ {
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_Byte** data = parser->stack; FT_Byte** data = parser->stack;
FT_Error error; FT_Error error;
error = T2_Err_Stack_Underflow; error = T2_Err_Stack_Underflow;
@ -349,8 +349,8 @@
FT_Error parse_cid_ros( T2_Parser* parser ) FT_Error parse_cid_ros( T2_Parser* parser )
{ {
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_Byte** data = parser->stack; FT_Byte** data = parser->stack;
FT_Error error; FT_Error error;
error = T2_Err_Stack_Underflow; error = T2_Err_Stack_Underflow;
@ -395,7 +395,7 @@
code | T2CODE, \ code | T2CODE, \
(FT_UInt)(char*)&T2_REF( T2TYPE, name ), \ (FT_UInt)(char*)&T2_REF( T2TYPE, name ), \
sizeof( T2_REF( T2TYPE, name ) ), \ sizeof( T2_REF( T2TYPE, name ) ), \
0, 0, 0 \ 0, 0, 0 \
}, },
#undef T2_FIELD_DELTA #undef T2_FIELD_DELTA
@ -478,7 +478,8 @@
/* and look for it in our current list. */ /* and look for it in our current list. */
FT_UInt code; FT_UInt code;
FT_UInt num_args = (FT_UInt)(parser->top - parser->stack); FT_UInt num_args = (FT_UInt)
( parser->top - parser->stack );
const T2_Field_Handler* field; const T2_Field_Handler* field;
@ -516,28 +517,35 @@
case t2_kind_fixed: case t2_kind_fixed:
val = t2_parse_fixed( parser->stack ); val = t2_parse_fixed( parser->stack );
/* A slight note regarding the following: */ /* SIZEOF_INT is defined in <freetype/config/ftconfig.h> */
/* */ /* and gives the size in bytes of the `int' type on the */
/* SIZEOF_INT is defined in <freetype/config/ftconfig.h> */ /* current platform. */
/* and gives the size in bytes of the "int" type on the */ /* */
/* current platform.. */ /* Only on 16-bit systems the value of SIZEOF_INT can be */
/* */ /* less than 4. In this case SIZEOF_LONG is always 4. */
/* Only on 16-bit systems can the value of SIZEOF_INT be */ /* */
/* less than 4. In this case SIZEOF_LONG is always 4 */ /* On a 64-bit system, SIZEOF_LONG can be 8, which is */
/* */ /* handled by the default case. */
/* On a 64-bit system, SIZEOF_LONG can be 8, which is */ /* */
/* handled by the default case.. */
/* */
Store_Number: Store_Number:
switch ( field->size ) switch ( field->size )
{ {
case 1: *(FT_Byte*)q = (FT_Byte)val; break; case 1:
case 2: *(FT_Short*)q = (FT_Short)val; break; *(FT_Byte*)q = (FT_Byte)val;
break;
case 2:
*(FT_Short*)q = (FT_Short)val;
break;
#if SIZEOF_INT == 4 #if SIZEOF_INT == 4
case 4: *(FT_Int*)q = (FT_Int)val; break; case 4:
*(FT_Int*)q = (FT_Int)val;
break;
#endif #endif
default: *(FT_Long*)q = val;
default:
*(FT_Long*)q = val;
} }
break; break;

View File

@ -40,7 +40,7 @@
LOCAL_FUNC LOCAL_FUNC
void CID_Done_AFM( FT_Memory memory, void CID_Done_AFM( FT_Memory memory,
CID_AFM* afm ) CID_AFM* afm )
{ {
FREE( afm->kern_pairs ); FREE( afm->kern_pairs );
afm->num_pairs = 0; afm->num_pairs = 0;
@ -162,15 +162,15 @@
FT_Error CID_Read_AFM( FT_Face cid_face, FT_Error CID_Read_AFM( FT_Face cid_face,
FT_Stream stream ) FT_Stream stream )
{ {
FT_Error error; FT_Error error;
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
FT_Byte* start; FT_Byte* start;
FT_Byte* limit; FT_Byte* limit;
FT_Byte* p; FT_Byte* p;
FT_Int count = 0; FT_Int count = 0;
CID_Kern_Pair* pair; CID_Kern_Pair* pair;
T1_Font* type1 = &((T1_Face)t1_face)->type1; T1_Font* type1 = &((T1_Face)t1_face)->type1;
CID_AFM* afm = 0; CID_AFM* afm = 0;
if ( ACCESS_Frame( stream->size ) ) if ( ACCESS_Frame( stream->size ) )
@ -194,7 +194,7 @@
goto Exit; goto Exit;
/* allocate the pairs */ /* allocate the pairs */
if ( ALLOC( afm, sizeof ( *afm ) ) || if ( ALLOC( afm, sizeof ( *afm ) ) ||
ALLOC_ARRAY( afm->kern_pairs, count, CID_Kern_Pair ) ) ALLOC_ARRAY( afm->kern_pairs, count, CID_Kern_Pair ) )
goto Exit; goto Exit;
@ -245,7 +245,7 @@
/* find the kerning for a given glyph pair */ /* find the kerning for a given glyph pair */
LOCAL_FUNC LOCAL_FUNC
void CID_Get_Kerning( CID_AFM* afm, void CID_Get_Kerning( CID_AFM* afm,
FT_UInt glyph1, FT_UInt glyph1,
FT_UInt glyph2, FT_UInt glyph2,
FT_Vector* kerning ) FT_Vector* kerning )

View File

@ -143,8 +143,8 @@
/* glyph :: The current glyph object. */ /* glyph :: The current glyph object. */
/* */ /* */
LOCAL_FUNC LOCAL_FUNC
void CID_Init_Builder( CID_Builder* builder, void CID_Init_Builder( CID_Builder* builder,
CID_Face face, CID_Face face,
CID_Size size, CID_Size size,
CID_GlyphSlot glyph ) CID_GlyphSlot glyph )
{ {
@ -159,11 +159,11 @@
{ {
FT_GlyphLoader* loader = glyph->root.loader; FT_GlyphLoader* loader = glyph->root.loader;
builder->loader = loader; builder->loader = loader;
builder->base = &loader->base.outline; builder->base = &loader->base.outline;
builder->current = &loader->current.outline; builder->current = &loader->current.outline;
FT_GlyphLoader_Rewind( loader ); FT_GlyphLoader_Rewind( loader );
} }
@ -202,6 +202,7 @@
{ {
CID_GlyphSlot glyph = builder->glyph; CID_GlyphSlot glyph = builder->glyph;
if ( glyph ) if ( glyph )
glyph->root.outline = *builder->base; glyph->root.outline = *builder->base;
} }
@ -299,7 +300,7 @@
{ {
if ( outline->n_contours > 0 ) if ( outline->n_contours > 0 )
outline->contours[outline->n_contours - 1] = outline->n_points - 1; outline->contours[outline->n_contours - 1] = outline->n_points - 1;
outline->n_contours++; outline->n_contours++;
} }
return error; return error;
@ -454,7 +455,7 @@
error = FT_GlyphLoader_Check_Subglyphs( loader, 2 ); error = FT_GlyphLoader_Check_Subglyphs( loader, 2 );
if ( error ) if ( error )
goto Exit; goto Exit;
subg = loader->current.subglyphs; subg = loader->current.subglyphs;
/* subglyph 0 = base character */ /* subglyph 0 = base character */
@ -474,13 +475,13 @@
/* set up remaining glyph fields */ /* set up remaining glyph fields */
glyph->num_subglyphs = 2; glyph->num_subglyphs = 2;
glyph->format = ft_glyph_format_composite; glyph->format = ft_glyph_format_composite;
loader->current.num_subglyphs = 2; loader->current.num_subglyphs = 2;
} }
/* First load `bchar' in builder */ /* First load `bchar' in builder */
/* now load the unscaled outline */ /* now load the unscaled outline */
if ( decoder->builder.loader ) if ( decoder->builder.loader )
FT_GlyphLoader_Prepare( decoder->builder.loader ); FT_GlyphLoader_Prepare( decoder->builder.loader );
error = cid_load_glyph( decoder, bchar_index ); /* load one glyph */ error = cid_load_glyph( decoder, bchar_index ); /* load one glyph */
@ -516,7 +517,7 @@
{ {
FT_Outline dummy; FT_Outline dummy;
dummy.n_points = base->n_points - n_base_points; dummy.n_points = base->n_points - n_base_points;
dummy.points = base->points + n_base_points; dummy.points = base->points + n_base_points;
FT_Outline_Translate( &dummy, adx - asb, ady ); FT_Outline_Translate( &dummy, adx - asb, ady );
@ -585,9 +586,9 @@
/* now, execute loop */ /* now, execute loop */
while ( ip < limit ) while ( ip < limit )
{ {
FT_Int* top = decoder->top; FT_Int* top = decoder->top;
CID_Operator op = op_none; CID_Operator op = op_none;
FT_Long value = 0; FT_Long value = 0;
/********************************************************************/ /********************************************************************/
@ -1376,8 +1377,8 @@
LOCAL_FUNC LOCAL_FUNC
FT_Error CID_Load_Glyph( CID_GlyphSlot glyph, FT_Error CID_Load_Glyph( CID_GlyphSlot glyph,
CID_Size size, CID_Size size,
FT_Int glyph_index, FT_Int glyph_index,
FT_Int load_flags ) FT_Int load_flags )
{ {
FT_Error error; FT_Error error;
CID_Decoder decoder; CID_Decoder decoder;

View File

@ -82,7 +82,7 @@
{ {
FT_Memory memory; FT_Memory memory;
CID_Face face; CID_Face face;
CID_GlyphSlot glyph; CID_GlyphSlot glyph;
FT_GlyphLoader* loader; FT_GlyphLoader* loader;
FT_Outline* base; FT_Outline* base;
FT_Outline* current; FT_Outline* current;
@ -142,8 +142,8 @@
LOCAL_DEF LOCAL_DEF
void CID_Init_Builder( CID_Builder* builder, void CID_Init_Builder( CID_Builder* builder,
CID_Face face, CID_Face face,
CID_Size size, CID_Size size,
CID_GlyphSlot glyph ); CID_GlyphSlot glyph );
@ -173,8 +173,8 @@
LOCAL_DEF LOCAL_DEF
FT_Error CID_Load_Glyph( CID_GlyphSlot glyph, FT_Error CID_Load_Glyph( CID_GlyphSlot glyph,
CID_Size size, CID_Size size,
FT_Int glyph_index, FT_Int glyph_index,
FT_Int load_flags ); FT_Int load_flags );
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -83,8 +83,8 @@
static static
FT_Error cid_load_keyword( CID_Face face, FT_Error cid_load_keyword( CID_Face face,
CID_Loader* loader, CID_Loader* loader,
const CID_Field_Rec* keyword ) const CID_Field_Rec* keyword )
{ {
FT_Error error; FT_Error error;

View File

@ -38,7 +38,7 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Type> */ /* <Type> */
/* CID_Driver */ /* CID_Driver */
/* */ /* */
/* <Description> */ /* <Description> */
/* A handle to a Type 1 driver object. */ /* A handle to a Type 1 driver object. */
@ -49,7 +49,7 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Type> */ /* <Type> */
/* CID_Size */ /* CID_Size */
/* */ /* */
/* <Description> */ /* <Description> */
/* A handle to a Type 1 size object. */ /* A handle to a Type 1 size object. */
@ -60,7 +60,7 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Type> */ /* <Type> */
/* CID_GlyphSlot */ /* CID_GlyphSlot */
/* */ /* */
/* <Description> */ /* <Description> */
/* A handle to a Type 1 glyph slot object. */ /* A handle to a Type 1 glyph slot object. */
@ -71,7 +71,7 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Type> */ /* <Type> */
/* CID_CharMap */ /* CID_CharMap */
/* */ /* */
/* <Description> */ /* <Description> */
/* A handle to a Type 1 character mapping object. */ /* A handle to a Type 1 character mapping object. */
@ -81,7 +81,7 @@
/* The driver is responsible for making up charmap objects */ /* The driver is responsible for making up charmap objects */
/* corresponding to these tables. */ /* corresponding to these tables. */
/* */ /* */
typedef struct CID_CharMapRec_* CID_CharMap; typedef struct CID_CharMapRec_* CID_CharMap;
/*************************************************************************/ /*************************************************************************/
@ -99,7 +99,7 @@
} CID_SizeRec; } CID_SizeRec;
typedef struct CID_GlyphSlotRec_ typedef struct CID_GlyphSlotRec_
{ {
FT_GlyphSlotRec root; FT_GlyphSlotRec root;

View File

@ -42,7 +42,7 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/***** *****/ /***** *****/
/***** IMPLEMENTATION OF CID_TABLE OBJECT *****/ /***** IMPLEMENTATION OF CID_TABLE OBJECT *****/
/***** *****/ /***** *****/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -52,10 +52,10 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* CID_New_Table */ /* CID_New_Table */
/* */ /* */
/* <Description> */ /* <Description> */
/* Initializes a CID_Table. */ /* Initializes a CID_Table. */
/* */ /* */
/* <InOut> */ /* <InOut> */
/* table :: The address of the target table. */ /* table :: The address of the target table. */
@ -71,8 +71,8 @@
/* */ /* */
LOCAL_FUNC LOCAL_FUNC
FT_Error CID_New_Table( CID_Table* table, FT_Error CID_New_Table( CID_Table* table,
FT_Int count, FT_Int count,
FT_Memory memory ) FT_Memory memory )
{ {
FT_Error error; FT_Error error;
@ -99,7 +99,7 @@
static static
void shift_elements( CID_Table* table, void shift_elements( CID_Table* table,
FT_Byte* old_base ) FT_Byte* old_base )
{ {
FT_Long delta = table->block - old_base; FT_Long delta = table->block - old_base;
FT_Byte** offset = table->elements; FT_Byte** offset = table->elements;
@ -117,7 +117,7 @@
static static
FT_Error reallocate_t1_table( CID_Table* table, FT_Error reallocate_t1_table( CID_Table* table,
FT_Int new_size ) FT_Int new_size )
{ {
FT_Memory memory = table->memory; FT_Memory memory = table->memory;
FT_Byte* old_base = table->block; FT_Byte* old_base = table->block;
@ -141,10 +141,10 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* CID_Add_Table */ /* CID_Add_Table */
/* */ /* */
/* <Description> */ /* <Description> */
/* Adds an object to a CID_Table, possibly growing its memory block. */ /* Adds an object to a CID_Table, possibly growing its memory block. */
/* */ /* */
/* <InOut> */ /* <InOut> */
/* table :: The target table. */ /* table :: The target table. */
@ -162,9 +162,9 @@
/* */ /* */
LOCAL_FUNC LOCAL_FUNC
FT_Error CID_Add_Table( CID_Table* table, FT_Error CID_Add_Table( CID_Table* table,
FT_Int index, FT_Int index,
void* object, void* object,
FT_Int length ) FT_Int length )
{ {
if ( index < 0 || index > table->max_elems ) if ( index < 0 || index > table->max_elems )
{ {
@ -202,10 +202,10 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* CID_Done_Table */ /* CID_Done_Table */
/* */ /* */
/* <Description> */ /* <Description> */
/* Finalizes a CID_Table (reallocate it to its current cursor). */ /* Finalizes a CID_Table (reallocate it to its current cursor). */
/* */ /* */
/* <InOut> */ /* <InOut> */
/* table :: The target table. */ /* table :: The target table. */
@ -292,7 +292,7 @@
LOCAL_FUNC LOCAL_FUNC
void CID_ToToken( CID_Parser* parser, void CID_ToToken( CID_Parser* parser,
CID_Token_Rec* token ) CID_Token_Rec* token )
{ {
FT_Byte* cur; FT_Byte* cur;
@ -376,10 +376,10 @@
LOCAL_FUNC LOCAL_FUNC
void CID_ToTokenArray( CID_Parser* parser, void CID_ToTokenArray( CID_Parser* parser,
CID_Token_Rec* tokens, CID_Token_Rec* tokens,
FT_UInt max_tokens, FT_UInt max_tokens,
FT_Int* pnum_tokens ) FT_Int* pnum_tokens )
{ {
CID_Token_Rec master; CID_Token_Rec master;
@ -390,8 +390,8 @@
if ( master.type == t1_token_array ) if ( master.type == t1_token_array )
{ {
FT_Byte* old_cursor = parser->cursor; FT_Byte* old_cursor = parser->cursor;
FT_Byte* old_limit = parser->limit; FT_Byte* old_limit = parser->limit;
CID_Token_Rec* cur = tokens; CID_Token_Rec* cur = tokens;
CID_Token_Rec* limit = cur + max_tokens; CID_Token_Rec* limit = cur + max_tokens;
@ -710,9 +710,9 @@
/* Loads a simple field (i.e. non-table) into the current */ /* Loads a simple field (i.e. non-table) into the current */
/* list of objects */ /* list of objects */
LOCAL_FUNC LOCAL_FUNC
FT_Error CID_Load_Field( CID_Parser* parser, FT_Error CID_Load_Field( CID_Parser* parser,
const CID_Field_Rec* field, const CID_Field_Rec* field,
void* object ) void* object )
{ {
CID_Token_Rec token; CID_Token_Rec token;
FT_Byte* cur; FT_Byte* cur;
@ -803,16 +803,16 @@
LOCAL_FUNC LOCAL_FUNC
FT_Error CID_Load_Field_Table( CID_Parser* parser, FT_Error CID_Load_Field_Table( CID_Parser* parser,
const CID_Field_Rec* field, const CID_Field_Rec* field,
void* object ) void* object )
{ {
CID_Token_Rec elements[T1_MAX_TABLE_ELEMENTS]; CID_Token_Rec elements[T1_MAX_TABLE_ELEMENTS];
CID_Token_Rec* token; CID_Token_Rec* token;
FT_Int num_elements; FT_Int num_elements;
FT_Error error = 0; FT_Error error = 0;
FT_Byte* old_cursor; FT_Byte* old_cursor;
FT_Byte* old_limit; FT_Byte* old_limit;
CID_Field_Rec fieldrec = *(CID_Field_Rec*)field; CID_Field_Rec fieldrec = *(CID_Field_Rec*)field;

View File

@ -32,10 +32,10 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Struct> */ /* <Struct> */
/* CID_Table */ /* CID_Table */
/* */ /* */
/* <Description> */ /* <Description> */
/* A CID_Table is a simple object used to store an array of objects */ /* A CID_Table is a simple object used to store an array of objects */
/* in a single memory block. */ /* in a single memory block. */
/* */ /* */
/* <Fields> */ /* <Fields> */
@ -62,7 +62,7 @@
/* memory :: The memory object used for memory operations */ /* memory :: The memory object used for memory operations */
/* (allocation resp. reallocation). */ /* (allocation resp. reallocation). */
/* */ /* */
typedef struct CID_Table_ typedef struct CID_Table_
{ {
FT_Byte* block; /* current memory block */ FT_Byte* block; /* current memory block */
FT_Int cursor; /* current cursor in memory block */ FT_Int cursor; /* current cursor in memory block */
@ -81,14 +81,14 @@
LOCAL_DEF LOCAL_DEF
FT_Error CID_New_Table( CID_Table* table, FT_Error CID_New_Table( CID_Table* table,
FT_Int count, FT_Int count,
CID_Memory memory ); CID_Memory memory );
LOCAL_DEF LOCAL_DEF
FT_Error CID_Add_Table( CID_Table* table, FT_Error CID_Add_Table( CID_Table* table,
FT_Int index, FT_Int index,
void* object, void* object,
FT_Int length ); FT_Int length );
LOCAL_DEF LOCAL_DEF
void CID_Release_Table( CID_Table* table ); void CID_Release_Table( CID_Table* table );
@ -183,7 +183,7 @@
/* simple enumeration type used to identify token types */ /* simple enumeration type used to identify token types */
typedef enum CID_Token_Type_ typedef enum CID_Token_Type_
{ {
t1_token_none = 0, t1_token_none = 0,
t1_token_any, t1_token_any,
@ -199,9 +199,9 @@
/* a simple structure used to identify tokens */ /* a simple structure used to identify tokens */
typedef struct CID_Token_Rec_ typedef struct CID_Token_Rec_
{ {
FT_Byte* start; /* first character of token in input stream */ FT_Byte* start; /* first character of token in input stream */
FT_Byte* limit; /* first character after the token */ FT_Byte* limit; /* first character after the token */
CID_Token_Type type; /* type of token.. */ CID_Token_Type type; /* type of token */
} CID_Token_Rec; } CID_Token_Rec;
@ -212,7 +212,7 @@
/* enumeration type used to identify object fields */ /* enumeration type used to identify object fields */
typedef enum CID_Field_Type_ typedef enum CID_Field_Type_
{ {
t1_field_none = 0, t1_field_none = 0,
t1_field_bool, t1_field_bool,
@ -228,7 +228,7 @@
} CID_Field_Type; } CID_Field_Type;
typedef enum CID_Field_Location_ typedef enum CID_Field_Location_
{ {
t1_field_cid_info, t1_field_cid_info,
t1_field_font_dict, t1_field_font_dict,
@ -245,17 +245,17 @@
CID_Parser* parser ); CID_Parser* parser );
/* structure type used to model object fields */ /* structure type used to model object fields */
typedef struct CID_Field_Rec_ typedef struct CID_Field_Rec_
{ {
const char* ident; /* field identifier */ const char* ident; /* field identifier */
CID_Field_Location location; CID_Field_Location location;
CID_Field_Type type; /* type of field */ CID_Field_Type type; /* type of field */
CID_Field_Parser reader; CID_Field_Parser reader;
FT_UInt offset; /* offset of field in object */ FT_UInt offset; /* offset of field in object */
FT_UInt size; /* size of field in bytes */ FT_UInt size; /* size of field in bytes */
FT_UInt array_max; /* maximal number of elements for */ FT_UInt array_max; /* maximal number of elements for */
/* array */ /* array */
FT_UInt count_offset; /* offset of element count for */ FT_UInt count_offset; /* offset of element count for */
/* arrays */ /* arrays */
} CID_Field_Rec; } CID_Field_Rec;
@ -263,83 +263,83 @@
#define CID_FIELD_REF( s, f ) ( ((s*)0)->f ) #define CID_FIELD_REF( s, f ) ( ((s*)0)->f )
#define CID_NEW_SIMPLE_FIELD( _ident, _type, _fname ) \ #define CID_NEW_SIMPLE_FIELD( _ident, _type, _fname ) \
{ \ { \
_ident, T1CODE, _type, \ _ident, T1CODE, _type, \
0, \ 0, \
(FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, _fname ), \ (FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, _fname ), \
sizeof ( CID_FIELD_REF( T1TYPE, _fname ) ), \ sizeof ( CID_FIELD_REF( T1TYPE, _fname ) ), \
0, 0 \ 0, 0 \
}, },
#define CID_NEW_CALLBACK_FIELD( _ident, _reader ) \ #define CID_NEW_CALLBACK_FIELD( _ident, _reader ) \
{ \ { \
_ident, T1CODE, t1_field_callback, \ _ident, T1CODE, t1_field_callback, \
_reader, \ _reader, \
0, 0, \ 0, 0, \
0, 0 \ 0, 0 \
}, },
#define CID_NEW_TABLE_FIELD( _ident, _type, _fname, _max ) \ #define CID_NEW_TABLE_FIELD( _ident, _type, _fname, _max ) \
{ \ { \
_ident, T1CODE, _type, \ _ident, T1CODE, _type, \
0, \ 0, \
(FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, _fname ), \ (FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, _fname ), \
sizeof ( CID_FIELD_REF( T1TYPE, _fname )[0] ), \ sizeof ( CID_FIELD_REF( T1TYPE, _fname )[0] ), \
_max, \ _max, \
(FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, num_ ## _fname ) \ (FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, num_ ## _fname ) \
}, },
#define CID_NEW_TABLE_FIELD2( _ident, _type, _fname, _max ) \ #define CID_NEW_TABLE_FIELD2( _ident, _type, _fname, _max ) \
{ \ { \
_ident, T1CODE, _type, \ _ident, T1CODE, _type, \
0, \ 0, \
(FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, _fname ), \ (FT_UInt)(char*)&CID_FIELD_REF( T1TYPE, _fname ), \
sizeof ( CID_FIELD_REF( T1TYPE, _fname )[0] ), \ sizeof ( CID_FIELD_REF( T1TYPE, _fname )[0] ), \
_max, 0 \ _max, 0 \
}, },
#define CID_FIELD_BOOL( _ident, _fname ) \ #define CID_FIELD_BOOL( _ident, _fname ) \
CID_NEW_SIMPLE_FIELD( _ident, t1_field_bool, _fname ) CID_NEW_SIMPLE_FIELD( _ident, t1_field_bool, _fname )
#define CID_FIELD_NUM( _ident, _fname ) \ #define CID_FIELD_NUM( _ident, _fname ) \
CID_NEW_SIMPLE_FIELD( _ident, t1_field_integer, _fname ) CID_NEW_SIMPLE_FIELD( _ident, t1_field_integer, _fname )
#define CID_FIELD_FIXED( _ident, _fname ) \ #define CID_FIELD_FIXED( _ident, _fname ) \
CID_NEW_SIMPLE_FIELD( _ident, t1_field_fixed, _fname ) CID_NEW_SIMPLE_FIELD( _ident, t1_field_fixed, _fname )
#define CID_FIELD_STRING( _ident, _fname ) \ #define CID_FIELD_STRING( _ident, _fname ) \
CID_NEW_SIMPLE_FIELD( _ident, t1_field_string, _fname ) CID_NEW_SIMPLE_FIELD( _ident, t1_field_string, _fname )
#define CID_FIELD_NUM_TABLE( _ident, _fname, _fmax ) \ #define CID_FIELD_NUM_TABLE( _ident, _fname, _fmax ) \
CID_NEW_TABLE_FIELD( _ident, t1_field_integer_array, \ CID_NEW_TABLE_FIELD( _ident, t1_field_integer_array, \
_fname, _fmax ) _fname, _fmax )
#define CID_FIELD_FIXED_TABLE( _ident, _fname, _fmax ) \ #define CID_FIELD_FIXED_TABLE( _ident, _fname, _fmax ) \
CID_NEW_TABLE_FIELD( _ident, t1_field_fixed_array, \ CID_NEW_TABLE_FIELD( _ident, t1_field_fixed_array, \
_fname, _fmax ) _fname, _fmax )
#define CID_FIELD_NUM_TABLE2( _ident, _fname, _fmax ) \ #define CID_FIELD_NUM_TABLE2( _ident, _fname, _fmax ) \
CID_NEW_TABLE_FIELD2( _ident, t1_field_integer_array, \ CID_NEW_TABLE_FIELD2( _ident, t1_field_integer_array, \
_fname, _fmax ) _fname, _fmax )
#define CID_FIELD_FIXED_TABLE2( _ident, _fname, _fmax ) \ #define CID_FIELD_FIXED_TABLE2( _ident, _fname, _fmax ) \
CID_NEW_TABLE_FIELD2( _ident, t1_field_fixed_array, \ CID_NEW_TABLE_FIELD2( _ident, t1_field_fixed_array, \
_fname, _fmax ) _fname, _fmax )
#define CID_FIELD_CALLBACK( _ident, _name ) \ #define CID_FIELD_CALLBACK( _ident, _name ) \
CID_NEW_CALLBACK_FIELD( _ident, parse_ ## _name ) CID_NEW_CALLBACK_FIELD( _ident, parse_ ## _name )
LOCAL_DEF LOCAL_DEF
FT_Error CID_Load_Field( CID_Parser* parser, FT_Error CID_Load_Field( CID_Parser* parser,
const CID_Field_Rec* field, const CID_Field_Rec* field,
void* object ); void* object );
LOCAL_DEF LOCAL_DEF
FT_Error CID_Load_Field_Table( CID_Parser* parser, FT_Error CID_Load_Field_Table( CID_Parser* parser,
const CID_Field_Rec* field, const CID_Field_Rec* field,
void* object ); void* object );
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -181,9 +181,9 @@
"t1cid", /* module name */ "t1cid", /* module name */
0x10000L, /* version 1.0 of driver */ 0x10000L, /* version 1.0 of driver */
0x20000L, /* requires FreeType 2.0 */ 0x20000L, /* requires FreeType 2.0 */
0, 0,
(FT_Module_Constructor)CID_Init_Driver, (FT_Module_Constructor)CID_Init_Driver,
(FT_Module_Destructor) CID_Done_Driver, (FT_Module_Destructor) CID_Done_Driver,
(FT_Module_Requester) CID_Get_Interface (FT_Module_Requester) CID_Get_Interface

View File

@ -427,7 +427,7 @@ error:
return FT_Err_Out_Of_Memory; return FT_Err_Out_Of_Memory;
} }
#if 0 #if 0
{ {
FILE* f; FILE* f;
char * path; char * path;

View File

@ -244,9 +244,10 @@
FT_Error error; FT_Error error;
SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt;
UNUSED(face_index); UNUSED( face_index );
UNUSED(num_params); UNUSED( num_params );
UNUSED(params); UNUSED( params );
/* Load tables */ /* Load tables */
if ( LOAD_( header ) || if ( LOAD_( header ) ||

View File

@ -42,8 +42,8 @@
FT_EXPORT_VAR(FT_Raster_Funcs) ft_grays_raster; FT_EXPORT_VAR(FT_Raster_Funcs) ft_grays_raster;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif

View File

@ -920,6 +920,7 @@
FT_Vector* p1; FT_Vector* p1;
FT_Vector* p2; FT_Vector* p2;
if ( start_point + k >= (FT_UInt)num_base_points || if ( start_point + k >= (FT_UInt)num_base_points ||
l >= (FT_UInt)num_new_points ) l >= (FT_UInt)num_new_points )
{ {
@ -1023,8 +1024,8 @@
pp1[0] = loader->pp1; pp1[0] = loader->pp1;
pp1[1] = loader->pp2; pp1[1] = loader->pp2;
pts->tags[num_points ] = 0;
pts->tags[num_points + 1] = 0; pts->tags[num_points + 1] = 0;
pts->tags[num_points + 2] = 0;
/* if hinting, round the phantom points */ /* if hinting, round the phantom points */
if ( IS_HINTED( loader->load_flags ) ) if ( IS_HINTED( loader->load_flags ) )

View File

@ -244,10 +244,10 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
#define IS_Z1_WHITESPACE(c) ( (c) == ' ' || (c) == '\t' ) #define IS_Z1_WHITESPACE(c) ( (c) == ' ' || (c) == '\t' )
#define IS_Z1_LINESPACE(c) ( (c) == '\r' || (c) == '\n' ) #define IS_Z1_LINESPACE(c) ( (c) == '\r' || (c) == '\n' )
#define IS_Z1_SPACE(c) ( IS_Z1_WHITESPACE(c) || IS_Z1_LINESPACE(c) ) #define IS_Z1_SPACE(c) ( IS_Z1_WHITESPACE(c) || IS_Z1_LINESPACE(c) )
LOCAL_FUNC LOCAL_FUNC
void Z1_Skip_Spaces( Z1_Parser* parser ) void Z1_Skip_Spaces( Z1_Parser* parser )