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;
/* typecast an object to a FT_Module */
#define FT_MODULE(x) ((FT_Module)(x))
#define FT_MODULE_CLASS(x) FT_MODULE(x)->clazz
#define FT_MODULE_LIBRARY(x) FT_MODULE(x)->library
#define FT_MODULE_MEMORY(x) FT_MODULE(x)->memory
#define FT_MODULE(x) ((FT_Module)(x))
#define FT_MODULE_CLASS(x) FT_MODULE(x)->clazz
#define FT_MODULE_LIBRARY(x) FT_MODULE(x)->library
#define FT_MODULE_MEMORY(x) FT_MODULE(x)->memory
#define FT_MODULE_IS_DRIVER(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_font_driver )
#define FT_MODULE_IS_DRIVER(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_font_driver )
#define FT_MODULE_IS_DRIVER(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_font_driver )
#define FT_MODULE_IS_DRIVER(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_font_driver )
#define FT_MODULE_IS_RENDERER(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_renderer )
#define FT_MODULE_IS_RENDERER(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_renderer )
#define FT_DRIVER_IS_SCALABLE(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_driver_scalable )
#define FT_DRIVER_IS_SCALABLE(x) (FT_MODULE_CLASS(x)->module_flags & \
ft_module_driver_scalable )
#define FT_DRIVER_USES_OUTLINES(x) !(FT_MODULE_CLASS(x)->module_flags & \
ft_module_driver_no_outlines )
#define FT_DRIVER_USES_OUTLINES(x) !(FT_MODULE_CLASS(x)->module_flags & \
ft_module_driver_no_outlines )
/*************************************************************************/
@ -141,19 +141,19 @@
/* a few macros used to perform easy typecasts with minimal brain damage */
#define FT_FACE(x) ((FT_Face)x)
#define FT_SIZE(x) ((FT_Size)x)
#define FT_SLOT(x) ((FT_GlyphSlot)x)
#define FT_FACE(x) ((FT_Face)x)
#define FT_SIZE(x) ((FT_Size)x)
#define FT_SLOT(x) ((FT_GlyphSlot)x)
#define FT_FACE_DRIVER(x) FT_FACE(x)->driver
#define FT_FACE_LIBRARY(x) FT_FACE_DRIVER(x)->root.library
#define FT_FACE_MEMORY(x) FT_FACE(x)->memory
#define FT_FACE_DRIVER(x) FT_FACE(x)->driver
#define FT_FACE_LIBRARY(x) FT_FACE_DRIVER(x)->root.library
#define FT_FACE_MEMORY(x) FT_FACE(x)->memory
#define FT_SIZE_FACE(x) FT_SIZE(x)->face
#define FT_SLOT_FACE(x) FT_SLOT(x)->face
#define FT_SIZE_FACE(x) FT_SIZE(x)->face
#define FT_SLOT_FACE(x) FT_SLOT(x)->face
#define FT_FACE_SLOT(x) FT_FACE(x)->glyph
#define FT_FACE_SIZE(x) FT_FACE(x)->size
#define FT_FACE_SLOT(x) FT_FACE(x)->glyph
#define FT_FACE_SIZE(x) FT_FACE(x)->size
/* 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_
{
@ -275,10 +275,10 @@
/*************************************************************************/
/* 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 */
#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;
/* maximum number of sub-fonts in a CID-keyed file */
#define CFF_MAX_CID_FONTS 16
/* maximum number of sub-fonts in a CID-keyed file */
#define CFF_MAX_CID_FONTS 16
typedef struct CFF_Font_
{

View File

@ -140,13 +140,13 @@
} T1_Blend_Flags;
/* 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 */
#define T1_MAX_MM_AXIS 4
#define T1_MAX_MM_AXIS 4
/* 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 */
typedef struct T1_DesignMap_

View File

@ -50,19 +50,19 @@
static const FT_Long ft_square_roots[63] =
{
1, 1, 2, 3, 4, 5, 8, 11,
16, 22, 32, 45, 64, 90, 128, 181,
256, 362, 512, 724, 1024, 1448, 2048, 2896,
4096, 5892, 8192, 11585, 16384, 23170, 32768, 46340,
1L, 1L, 2L, 3L, 4L, 5L, 8L, 11L,
16L, 22L, 32L, 45L, 64L, 90L, 128L, 181L,
256L, 362L, 512L, 724L, 1024L, 1448L, 2048L, 2896L,
4096L, 5892L, 8192L, 11585L, 16384L, 23170L, 32768L, 46340L,
65536, 92681, 131072, 185363, 262144, 370727,
524288, 741455, 1048576, 1482910, 2097152, 2965820,
4194304, 5931641, 8388608, 11863283, 16777216, 23726566,
65536L, 92681L, 131072L, 185363L, 262144L, 370727L,
524288L, 741455L, 1048576L, 1482910L, 2097152L, 2965820L,
4194304L, 5931641L, 8388608L, 11863283L, 16777216L, 23726566L,
33554432, 47453132, 67108864, 94906265,
134217728, 189812531, 268435456, 379625062,
536870912, 759250125, 1073741824, 1518500250,
2147483647
33554432L, 47453132L, 67108864L, 94906265L,
134217728L, 189812531L, 268435456L, 379625062L,
536870912L, 759250125L, 1073741824L, 1518500250L,
2147483647L
};
#else
@ -102,8 +102,8 @@
root >>= 1;
mask >>= 2;
}
while ( mask != 0 );
} while ( mask != 0 );
return root;
}
@ -289,8 +289,8 @@
{
s = r;
r = ( r + l / r ) >> 1;
}
while ( r > s || r * r > l );
} while ( r > s || r * r > l );
return r;
}
@ -487,14 +487,14 @@
}
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;
q = ( a / b ) << 16;
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 */
while ( c >> 16 )
{
@ -601,7 +601,7 @@
if ( s < 0 )
{
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 )
{
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 );
@ -759,8 +759,8 @@
r = ( r + FT_Div64by32( l, r ) ) >> 1;
FT_MulTo64( r, r, &l2 );
FT_Sub64 ( l, &l2, &l2 );
}
while ( r > s || (FT_Int32)l2.hi < 0 );
} while ( r > s || (FT_Int32)l2.hi < 0 );
return r;
}

View File

@ -103,7 +103,7 @@
if ( component >= trace_max )
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 )
{
int n;

View File

@ -152,7 +152,8 @@
cur->offset = registry->cur_offset;
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",
cur->id ));
@ -180,12 +181,12 @@
/* extension interface. */
/* */
/* <Return> */
/* A pointer to the extension block. */
/* A generic pointer to the extension block. */
/* */
FT_EXPORT_FUNC( void* ) FT_Get_Extension(
FT_Face face,
const char* extension_id,
void* *extension_interface )
void** extension_interface )
{
FT_Extension_Registry* registry;
@ -296,7 +297,7 @@
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;
if ( !registry )

View File

@ -42,6 +42,7 @@
#define FT_COMPONENT trace_glyph
/* a helper function to avoid duplication of code */
static
void ft_prepare_glyph( FT_Glyph glyph,
FT_Face face,
@ -122,13 +123,13 @@
FT_Vector* origin,
FT_BitmapGlyph* abitglyph )
{
FT_Error error;
FT_Memory memory;
FT_Error error;
FT_Memory memory;
FT_BitmapGlyph bitglyph;
FT_Glyph glyph;
FT_Pos origin_x = 0;
FT_Pos origin_y = 0;
FT_BitmapGlyph bitglyph;
FT_Glyph glyph;
FT_Pos origin_x = 0;
FT_Pos origin_y = 0;
if ( !face )
@ -171,6 +172,7 @@
/* now, handle bitmap and outline glyph images */
memory = face->memory;
switch ( face->glyph->format )
{
case ft_glyph_format_bitmap:
@ -230,7 +232,7 @@
else
pitch = ( width + 7 ) >> 3;
size = pitch * height;
size = pitch * height;
if ( ALLOC( bitglyph, sizeof ( *bitglyph ) ) )
goto Exit;
@ -318,7 +320,7 @@
FT_OutlineGlyph glyph;
/* test for valid face delayed to FT_Load_Glyph() */
/* test for valid `face' delayed to FT_Load_Glyph() */
if ( !vecglyph )
return FT_Err_Invalid_Argument;
@ -529,7 +531,7 @@
v = d;
}
/* check that we're not trying to normalize zero! */
/* check that we are not trying to normalize zero! */
if ( u == 0 )
return 0;
@ -630,8 +632,8 @@
/* Compute the orientation of path filling. It differs between TrueType */
/* 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 */
/* isn't correctly set for some weird composite glyphs for now). */
/* but it is better to re-compute it directly (it seems that this flag */
/* isn't correctly set for some weird composite glyphs currently). */
/* */
/* We do this by computing bounding box points, and computing their */
/* curvature. */
@ -645,6 +647,7 @@
FT_BBox indices;
int n, last;
indices.xMin = -1;
indices.yMin = -1;
indices.xMax = -1;
@ -756,7 +759,7 @@
d = distance;
if ( (outline->flags[n] & FT_Curve_Tag_On) == 0 )
if ( ( outline->flags[n] & FT_Curve_Tag_On ) == 0 )
d *= 2;
/* Check discriminant for parallel vectors */
@ -781,6 +784,7 @@
/* Vectors are nearly parallel */
FT_Pos x, y;
x = distance + cur.x + FT_MulFix( d, u.x + v.x ) / 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;
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;
while ( *cur )
@ -114,7 +115,7 @@ const FT_Module_Class* ft_default_modules[] =
/* library :: A handle to a new library object. */
/* */
/* <Return> */
/* FreeTyoe error code. 0 means success. */
/* FreeType error code. 0 means success. */
/* */
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();
if ( !memory )
{
FT_ERROR(( "FT_Init_FreeType:" ));
FT_ERROR(( " cannot find memory manager\n" ));
FT_ERROR(( "FT_Init_FreeType: cannot find memory manager\n" ));
return FT_Err_Unimplemented_Feature;
}
/* builds a library out of it, then fill it with the set of */
/* default drivers. */
/* build a library out of it, then fill it with the set of */
/* default drivers. */
error = FT_New_Library( memory, library );
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 */
v_control.x = SCALED( point->x );
v_control.y = SCALED( point->y );
Do_Conic:
if ( point < limit )
{
v_control.x = SCALED( point->x );
v_control.y = SCALED( point->y );
FT_Vector vec;
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;
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 );
error = interface->conic_to( &v_control, &vec, user );
if ( error )
goto Exit;
v_control = vec;
goto Do_Conic;
continue;
}
error = interface->conic_to( &v_control, &v_start, user );
goto Close;
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 )
goto Exit;
v_control = vec;
goto Do_Conic;
}
error = interface->conic_to( &v_control, &v_start, user );
goto Close;
default: /* FT_Curve_Tag_Cubic */
{
FT_Vector vec1, vec2;
@ -256,7 +254,7 @@
/* close the contour with a line segment */
error = interface->line_to( &v_start, user );
Close:
Close:
if ( error )
goto Exit;
@ -549,6 +547,7 @@
char* q = outline->tags + last;
char swap;
while ( p < q )
{
swap = *p;
@ -604,34 +603,46 @@
FT_Outline* outline,
FT_Raster_Params* params )
{
FT_Error error;
FT_Bool update = 0;
FT_Renderer renderer = library->cur_renderer;
FT_ListNode node = library->renderers.head;
FT_Error error;
FT_Bool update = 0;
FT_Renderer renderer;
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;
error = FT_Err_Cannot_Render_Glyph;
while (renderer)
while ( renderer )
{
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 */
/* is unsupported by the current renderer for this glyph image */
/* format.. */
/* now, look for another renderer that supports the same */
/* format.. */
renderer = FT_Lookup_Renderer( library, ft_glyph_format_outline, &node );
/* format */
/* now, look for another renderer that supports the same */
/* format */
renderer = FT_Lookup_Renderer( library, ft_glyph_format_outline,
&node );
update = 1;
}
/* if we changed the current renderer for the glyph image format */
/* we need to select it as the next current one.. */
if (!error && update && renderer)
/* we need to select it as the next current one */
if ( !error && update && renderer )
FT_Set_Renderer( library, renderer, 0, 0 );
return error;
}
@ -675,7 +686,7 @@
if ( !bitmap )
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.flags = 0;
@ -713,6 +724,9 @@
FT_Pos xz, yz;
if ( !vector || !matrix )
return;
xz = FT_MulFix( vector->x, matrix->xx ) +
FT_MulFix( vector->y, matrix->xy );
@ -750,7 +764,7 @@
{
FT_Vector* vec = outline->points;
FT_Vector* limit = vec + outline->n_points;
for ( ; vec < limit; vec++ )
FT_Vector_Transform( vec, matrix );

View File

@ -374,9 +374,9 @@
BASE_FUNC( FT_Short ) FT_Read_Short( FT_Stream stream,
FT_Error* error )
{
char reads[2];
char* p = 0;
FT_Short result = 0;
char reads[2];
char* p = 0;
FT_Short result = 0;
FT_Assert( stream );
@ -645,27 +645,24 @@
*(FT_UShort*)p = (FT_UShort)value;
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 */
/* current platform.. */
/* */
/* 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.. */
/* */
/* SIZEOF_INT is defined in <freetype/config/ftconfig.h> */
/* 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. */
/* */
/* On a 64-bit system, SIZEOF_LONG can be 8, which is */
/* handled by the default case. */
/* */
#if SIZEOF_INT == 4
case 4:
*(FT_UInt*)p = (FT_UInt)value;
break;
*(FT_UInt*)p = (FT_UInt)value;
break;
#endif
default:
*(FT_ULong*)p = (FT_ULong)value;
*(FT_ULong*)p = (FT_ULong)value;
}
/* go to next field */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -280,9 +280,9 @@
FT_Error parse_font_matrix( T2_Parser* parser )
{
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_Matrix* matrix = &dict->font_matrix;
FT_Byte** data = parser->stack;
FT_Error error;
FT_Matrix* matrix = &dict->font_matrix;
FT_Byte** data = parser->stack;
FT_Error error;
error = T2_Err_Stack_Underflow;
@ -304,9 +304,9 @@
FT_Error parse_font_bbox( T2_Parser* parser )
{
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_BBox* bbox = &dict->font_bbox;
FT_Byte** data = parser->stack;
FT_Error error;
FT_BBox* bbox = &dict->font_bbox;
FT_Byte** data = parser->stack;
FT_Error error;
error = T2_Err_Stack_Underflow;
@ -328,8 +328,8 @@
FT_Error parse_private_dict( T2_Parser* parser )
{
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_Byte** data = parser->stack;
FT_Error error;
FT_Byte** data = parser->stack;
FT_Error error;
error = T2_Err_Stack_Underflow;
@ -349,8 +349,8 @@
FT_Error parse_cid_ros( T2_Parser* parser )
{
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_Byte** data = parser->stack;
FT_Error error;
FT_Byte** data = parser->stack;
FT_Error error;
error = T2_Err_Stack_Underflow;
@ -395,7 +395,7 @@
code | T2CODE, \
(FT_UInt)(char*)&T2_REF( T2TYPE, name ), \
sizeof( T2_REF( T2TYPE, name ) ), \
0, 0, 0 \
0, 0, 0 \
},
#undef T2_FIELD_DELTA
@ -478,7 +478,8 @@
/* and look for it in our current list. */
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;
@ -516,28 +517,35 @@
case t2_kind_fixed:
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 */
/* current platform.. */
/* */
/* 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.. */
/* */
/* SIZEOF_INT is defined in <freetype/config/ftconfig.h> */
/* 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. */
/* */
/* On a 64-bit system, SIZEOF_LONG can be 8, which is */
/* handled by the default case. */
/* */
Store_Number:
switch ( field->size )
{
case 1: *(FT_Byte*)q = (FT_Byte)val; break;
case 2: *(FT_Short*)q = (FT_Short)val; break;
case 1:
*(FT_Byte*)q = (FT_Byte)val;
break;
case 2:
*(FT_Short*)q = (FT_Short)val;
break;
#if SIZEOF_INT == 4
case 4: *(FT_Int*)q = (FT_Int)val; break;
case 4:
*(FT_Int*)q = (FT_Int)val;
break;
#endif
default: *(FT_Long*)q = val;
default:
*(FT_Long*)q = val;
}
break;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -244,10 +244,10 @@
/*************************************************************************/
/*************************************************************************/
#define IS_Z1_WHITESPACE(c) ( (c) == ' ' || (c) == '\t' )
#define IS_Z1_LINESPACE(c) ( (c) == '\r' || (c) == '\n' )
#define IS_Z1_WHITESPACE(c) ( (c) == ' ' || (c) == '\t' )
#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
void Z1_Skip_Spaces( Z1_Parser* parser )