formatting - removed trailing spaces
diff --git a/src/type1z/t1afm.c b/src/type1z/t1afm.c
index b9f8d83..56eb84a 100644
--- a/src/type1z/t1afm.c
+++ b/src/type1z/t1afm.c
@@ -34,27 +34,27 @@
FT_UInt result = 0;
char temp[64];
- /* skip whitespace */
+ /* skip whitespace */
while ( (*p == ' ' || *p == '\t' || *p == ':' || *p == ';') && p < limit )
p++;
*start = p;
-
+
/* now, read glyph name */
while ( IS_ALPHANUM(*p) && p < limit ) p++;
len = p - *start;
if (len > 0 && len < 64)
{
FT_Int n;
-
+
/* copy glyph name to intermediate array */
MEM_Copy( temp, *start, len );
temp[len] = 0;
-
+
/* lookup glyph name in face array */
for ( n = 0; n < type1->num_glyphs; n++ )
{
char* gname = (char*)type1->glyph_names[n];
-
+
if ( gname && gname[0] == temp[0] && strcmp(gname,temp) == 0 )
{
result = n;
@@ -74,17 +74,17 @@
FT_Byte* p = *start;
int sum = 0;
int sign = 1;
-
+
/* skip everything that is not a number */
while ( p < limit && (*p < '0' || *p > '9') )
{
sign = 1;
if (*p == '-')
sign = -1;
-
+
p++;
}
-
+
while ( p < limit && (*p >= '0' && *p < '9') )
{
sum = sum*10 + (*p - '0');
@@ -104,10 +104,10 @@
{
T1_Kern_Pair* pair1 = (T1_Kern_Pair*)a;
T1_Kern_Pair* pair2 = (T1_Kern_Pair*)b;
-
+
T1_ULong index1 = KERN_INDEX(pair1->glyph1,pair1->glyph2);
T1_ULong index2 = KERN_INDEX(pair2->glyph1,pair2->glyph2);
-
+
return ( index1 < index2 ? -1 :
( index1 > index2 ? 1 : 0 ));
}
@@ -127,14 +127,14 @@
T1_Kern_Pair* pair;
T1_Font* type1 = &((T1_Face)t1_face)->type1;
T1_AFM* afm = 0;
-
+
if ( ACCESS_Frame(stream->size) )
return error;
-
+
start = (FT_Byte*)stream->cursor;
limit = (FT_Byte*)stream->limit;
p = start;
-
+
/* we are now going to count the occurences of "KP" or "KPX" in */
/* the AFM file.. */
count = 0;
@@ -147,16 +147,16 @@
/* Actually, kerning pairs are simply optional !! */
if (count == 0)
goto Exit;
-
+
/* allocate the pairs */
if ( ALLOC( afm, sizeof(*afm ) ) ||
ALLOC_ARRAY( afm->kern_pairs, count, T1_Kern_Pair ) )
goto Exit;
-
+
/* now, read each kern pair */
pair = afm->kern_pairs;
afm->num_pairs = count;
-
+
/* save in face object */
((T1_Face)t1_face)->afm_data = afm;
@@ -165,26 +165,26 @@
if ( IS_KERN_PAIR(p) )
{
FT_Byte* q;
-
+
/* skip keyword (KP or KPX) */
q = p+2;
if (*q == 'X') q++;
-
+
pair->glyph1 = afm_atoindex( &q, limit, type1 );
pair->glyph2 = afm_atoindex( &q, limit, type1 );
pair->kerning.x = afm_atoi( &q, limit );
-
+
pair->kerning.y = 0;
if ( p[2] != 'X' )
pair->kerning.y = afm_atoi( &q, limit );
-
+
pair++;
}
}
-
+
/* now, sort the kern pairs according to their glyph indices */
qsort( afm->kern_pairs, count, sizeof(T1_Kern_Pair), compare_kern_pairs );
-
+
Exit:
if (error)
FREE( afm );
@@ -194,7 +194,7 @@
}
- /* find the kerning for a given glyph pair */
+ /* find the kerning for a given glyph pair */
LOCAL_FUNC
void T1_Get_Kerning( T1_AFM* afm,
FT_UInt glyph1,
@@ -203,23 +203,23 @@
{
T1_Kern_Pair *min, *mid, *max;
T1_ULong index = KERN_INDEX(glyph1,glyph2);
-
+
/* simple binary search */
min = afm->kern_pairs;
max = min + afm->num_pairs-1;
-
+
while (min <= max)
{
T1_ULong midi;
-
+
mid = min + (max-min)/2;
- midi = KERN_INDEX(mid->glyph1,mid->glyph2);
+ midi = KERN_INDEX(mid->glyph1,mid->glyph2);
if ( midi == index )
{
*kerning = mid->kerning;
return;
}
-
+
if ( midi < index ) min = mid+1;
else max = mid-1;
}
diff --git a/src/type1z/t1afm.h b/src/type1z/t1afm.h
index 61e18b8..984ae94 100644
--- a/src/type1z/t1afm.h
+++ b/src/type1z/t1afm.h
@@ -18,7 +18,7 @@
FT_UInt glyph1;
FT_UInt glyph2;
FT_Vector kerning;
-
+
} T1_Kern_Pair;
diff --git a/src/type1z/t1driver.c b/src/type1z/t1driver.c
index 7479fab..c6dba1a 100644
--- a/src/type1z/t1driver.c
+++ b/src/type1z/t1driver.c
@@ -9,7 +9,7 @@
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
- * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
@@ -59,10 +59,10 @@
const FT_String* interface )
{
UNUSED(driver);
-
+
if ( strcmp( (const char*)interface, "attach_file" ) == 0 )
return (FTDriver_Interface)T1_Read_AFM;
-
+
return 0;
}
@@ -107,7 +107,7 @@
T1_Vector* kerning )
{
T1_AFM* afm;
-
+
kerning->x = 0;
kerning->y = 0;
@@ -185,7 +185,7 @@
UNUSED(pixel_width);
UNUSED(pixel_height);
- size->valid = FALSE;
+ size->valid = FALSE;
return T1_Reset_Size(size);
}
@@ -214,7 +214,7 @@
face = (T1_Face)charmap->face;
psnames = (PSNames_Interface*)face->psnames;
- if (psnames)
+ if (psnames)
switch (charmap->encoding)
{
/********************************************************************/
@@ -233,7 +233,7 @@
result = 0;
goto Exit;
}
-
+
/********************************************************************/
/* */
/* Custom Type 1 encoding */
@@ -248,7 +248,7 @@
}
goto Exit;
}
-
+
/********************************************************************/
/* */
/* Adobe Standard & Expert encoding support */
@@ -259,18 +259,18 @@
FT_UInt code;
FT_Int n;
const char* glyph_name;
-
+
code = psnames->adobe_std_encoding[charcode];
if (charmap->encoding == ft_encoding_adobe_expert)
code = psnames->adobe_expert_encoding[charcode];
-
+
glyph_name = psnames->adobe_std_strings(code);
if (!glyph_name) break;
-
+
for ( n = 0; n < face->type1.num_glyphs; n++ )
{
const char* gname = face->type1.glyph_names[n];
-
+
if ( gname && gname[0] == glyph_name[0] &&
strcmp( gname, glyph_name ) == 0 )
{
@@ -280,7 +280,7 @@
}
}
}
- Exit:
+ Exit:
return result;
}
@@ -365,7 +365,7 @@
sizeof( T1_FaceRec ),
sizeof( T1_SizeRec ),
sizeof( T1_GlyphSlotRec ),
-
+
"type1",
100,
200,
@@ -384,7 +384,7 @@
(FTDriver_initFace) T1_Init_Face,
(FTDriver_doneFace) T1_Done_Face,
-#ifdef T1_CONFIG_OPTION_NO_AFM
+#ifdef T1_CONFIG_OPTION_NO_AFM
(FTDriver_getKerning) 0,
#else
(FTDriver_getKerning) Get_Kerning,
@@ -424,12 +424,12 @@
/* */
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
-
+
EXPORT_FUNC(FT_DriverInterface*) getDriverInterface( void )
{
return &t1_driver_interface;
}
-
+
#endif /* FT_CONFIG_OPTION_DYNAMIC_DRIVERS */
diff --git a/src/type1z/t1driver.h b/src/type1z/t1driver.h
index ec43946..76f244a 100644
--- a/src/type1z/t1driver.h
+++ b/src/type1z/t1driver.h
@@ -9,7 +9,7 @@
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
- * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
diff --git a/src/type1z/t1errors.h b/src/type1z/t1errors.h
index 93731c1..a799115 100644
--- a/src/type1z/t1errors.h
+++ b/src/type1z/t1errors.h
@@ -32,7 +32,7 @@
#define T1_Err_Ok FT_Err_Ok
/* ----------- high level API errors -------- */
-
+
#define T1_Err_Invalid_File_Format FT_Err_Invalid_File_Format
#define T1_Err_Invalid_Argument FT_Err_Invalid_Argument
#define T1_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle
@@ -51,7 +51,7 @@
#define T1_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle
/* ------------- internal errors ------------ */
-
+
#define T1_Err_Out_Of_Memory FT_Err_Out_Of_Memory
#define T1_Err_Unlisted_Object FT_Err_Unlisted_Object
diff --git a/src/type1z/t1gload.c b/src/type1z/t1gload.c
index 51d3f44..71a7173 100644
--- a/src/type1z/t1gload.c
+++ b/src/type1z/t1gload.c
@@ -55,7 +55,7 @@
} T1_Operator;
- static const T1_Int t1_args_count[ op_max ] =
+ static const T1_Int t1_args_count[ op_max ] =
{
0, /* none */
0, /* endchar */
@@ -223,7 +223,7 @@
return T1_Err_Ok;
count += base->n_points + outline->n_points;
-
+
/* realloc points table if necessary */
if ( count >= builder->max_points )
{
@@ -237,14 +237,14 @@
if ( REALLOC_ARRAY( base->points, current,
builder->max_points, T1_Vector ) ||
-
+
REALLOC_ARRAY( base->tags, current,
builder->max_points, T1_Byte ) )
{
builder->error = error;
return error;
}
-
+
outline->points = base->points + increment;
outline->tags = base->tags + increment;
}
@@ -265,17 +265,17 @@
{
FT_Vector* point = outline->points + outline->n_points;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
-
+
point->x = x;
point->y = y;
*control = ( flag ? FT_Curve_Tag_On : FT_Curve_Tag_Cubic );
-
+
builder->last = *point;
}
-
+
outline->n_points++;
}
-
+
/* check room for a new on-curve point, then add it */
static
@@ -284,7 +284,7 @@
FT_Pos y )
{
T1_Error error;
-
+
error = check_points(builder,1);
if (!error)
add_point( builder, x, y, 1 );
@@ -305,7 +305,7 @@
outline->n_contours++;
return T1_Err_Ok;
}
-
+
/* realloc contours array if necessary */
if ( base->n_contours + outline->n_contours >= builder->max_contours &&
builder->load_points )
@@ -323,7 +323,7 @@
builder->error = error;
return error;
}
-
+
outline->contours = base->contours + increment;
}
@@ -344,7 +344,7 @@
if (!builder->path_begun)
{
T1_Error error;
-
+
builder->path_begun = 1;
error = add_contour( builder );
if (error) return error;
@@ -374,7 +374,7 @@
* to implement the SEAC Type 1 operator.
*
* <Input>
- * face :: current face object
+ * face :: current face object
* charcode :: charcode to look for
*
* <Return>
@@ -390,18 +390,18 @@
T1_Int n;
const T1_String* glyph_name;
PSNames_Interface* psnames = (PSNames_Interface*)face->psnames;
-
+
/* check range of standard char code */
if (charcode < 0 || charcode > 255)
return -1;
-
+
glyph_name = psnames->adobe_std_strings(
psnames->adobe_std_encoding[charcode]);
-
+
for ( n = 0; n < face->type1.num_glyphs; n++ )
{
T1_String* name = (T1_String*)face->type1.glyph_names[n];
-
+
if ( name && strcmp(name,glyph_name) == 0 )
return n;
}
@@ -428,7 +428,7 @@
* achar :: accent character's StandardEncoding charcode
*
* <Return>
- * Error code. 0 means success.
+ * Error code. 0 means success.
*
*********************************************************************/
@@ -447,10 +447,10 @@
FT_Outline* base = &decoder->builder.base;
T1_Vector left_bearing, advance;
T1_Font* type1 = &face->type1;
-
+
bchar_index = lookup_glyph_by_stdcharcode( face, bchar );
achar_index = lookup_glyph_by_stdcharcode( face, achar );
-
+
if (bchar_index < 0 || achar_index < 0)
{
FT_ERROR(( "T1.Parse_Seac : invalid seac character code arguments\n" ));
@@ -482,20 +482,20 @@
FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
FT_SubGlyph* subg;
- /* reallocate subglyph array if necessary */
+ /* reallocate subglyph array if necessary */
if (glyph->max_subglyphs < 2)
{
FT_Memory memory = decoder->builder.face->root.memory;
-
+
if ( REALLOC_ARRAY( glyph->subglyphs, glyph->max_subglyphs,
2, FT_SubGlyph ) )
return error;
-
+
glyph->max_subglyphs = 2;
}
subg = glyph->subglyphs;
-
+
/* subglyph 0 = base character */
subg->index = bchar_index;
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
@@ -503,7 +503,7 @@
subg->arg1 = 0;
subg->arg2 = 0;
subg++;
-
+
/* subglyph 1 = accent character */
subg->index = achar_index;
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
@@ -520,19 +520,19 @@
/* as they will be erase by the next load.. */
left_bearing = decoder->builder.left_bearing;
advance = decoder->builder.advance;
-
+
decoder->builder.left_bearing.x = 0;
- decoder->builder.left_bearing.y = 0;
-
+ decoder->builder.left_bearing.y = 0;
+
/* Now load "achar" on top of */
/* the base outline */
- /* */
+ /* */
cur->n_points = 0;
cur->n_contours = 0;
cur->points = base->points + base->n_points;
cur->tags = base->tags + base->n_points;
cur->contours = base->contours + base->n_contours;
-
+
error = T1_Parse_CharStrings( decoder,
type1->charstrings [achar_index],
type1->charstrings_len[achar_index],
@@ -540,21 +540,21 @@
type1->subrs,
type1->subrs_len );
if (error) return error;
-
+
/* adjust contours in accented character outline */
if (decoder->builder.load_points)
{
T1_Int n;
-
+
for ( n = 0; n < cur->n_contours; n++ )
cur->contours[n] += n_base_points;
}
-
+
/* restore the left side bearing and */
/* advance width of the base character */
decoder->builder.left_bearing = left_bearing;
decoder->builder.advance = advance;
-
+
/* Finally, move the accent */
if (decoder->builder.load_points)
FT_Outline_Translate( cur, adx - asb, ady );
@@ -580,7 +580,7 @@
* subrs_len :: array of sub-routines lengths
*
* <Return>
- * Error code. 0 means success.
+ * Error code. 0 means success.
*
*********************************************************************/
@@ -615,7 +615,7 @@
error = T1_Err_Ok;
outline = &builder->current;
-
+
x = builder->pos_x;
y = builder->pos_y;
@@ -749,27 +749,27 @@
FT_TRACE4(( " callothersubr" ));
if ( top - decoder->stack < 2 )
goto Stack_Underflow;
-
+
top -= 2;
switch ( top[1] )
{
case 1: /* start flex feature ---------------------- */
{
if ( top[0] != 0 ) goto Unexpected_OtherSubr;
-
+
decoder->flex_state = 1;
decoder->num_flex_vectors = 0;
if ( start_point(builder, x, y) ||
check_points(builder,6) ) goto Memory_Error;
}
break;
-
+
case 2: /* add flex vectors ------------------------ */
{
T1_Int index;
-
+
if ( top[0] != 0 ) goto Unexpected_OtherSubr;
-
+
/* note that we should not add a point for index 0 */
/* this will move our current position to the flex */
/* point without adding any point to the outline */
@@ -781,18 +781,18 @@
(T1_Byte)( index==3 || index==6 ) );
}
break;
-
+
case 0: /* end flex feature ------------------------- */
{
if ( top[0] != 3 ) goto Unexpected_OtherSubr;
-
+
if ( decoder->flex_state == 0 ||
decoder->num_flex_vectors != 7 )
{
FT_ERROR(( "T1.Parse_CharStrings: unexpected flex end\n" ));
goto Syntax_Error;
}
-
+
/* now consume the remaining "pop pop setcurpoint" */
if ( ip+6 > limit ||
ip[0] != 12 || ip[1] != 17 || /* pop */
@@ -802,16 +802,16 @@
FT_ERROR(( "T1.Parse_CharStrings: invalid flex charstring\n" ));
goto Syntax_Error;
}
-
+
ip += 6;
decoder->flex_state = 0;
break;
}
-
+
case 3: /* change hints ---------------------------- */
{
if ( top[0] != 1 ) goto Unexpected_OtherSubr;
-
+
/* eat the following "pop" */
if (ip+2 > limit)
{
@@ -819,7 +819,7 @@
ip[-1] ));
goto Syntax_Error;
}
-
+
if (ip[0] != 12 || ip[1] != 17)
{
FT_ERROR(( "T1.Parse_CharStrings: 'pop' expected, found (%d %d)\n",
@@ -829,7 +829,7 @@
ip += 2;
break;;
}
-
+
default:
Unexpected_OtherSubr:
FT_ERROR(( "T1.Parse_CharStrings: invalid othersubr [%d %d]!!\n",
@@ -852,12 +852,12 @@
case op_endchar: /*************************************************/
{
FT_TRACE4(( " endchar" ));
- close_contour( builder );
+ close_contour( builder );
/* add current outline to the glyph slot */
builder->base.n_points += builder->current.n_points;
builder->base.n_contours += builder->current.n_contours;
-
+
/* return now !! */
FT_TRACE4(( "\n\n" ));
return T1_Err_Ok;
@@ -870,16 +870,16 @@
builder->left_bearing.x += top[0];
builder->advance.x = top[1];
builder->advance.y = 0;
-
+
builder->last.x = x = top[0];
builder->last.y = y = 0;
-
+
/* the "metrics_only" indicates that we only want to compute */
/* the glyph's metrics (lsb + advance width), not load the */
/* rest of it.. so exit immediately */
if (builder->metrics_only)
return T1_Err_Ok;
-
+
break;
}
@@ -896,16 +896,16 @@
builder->left_bearing.y += top[1];
builder->advance.x = top[2];
builder->advance.y = top[3];
-
+
builder->last.x = x = top[0];
builder->last.y = y = top[1];
-
+
/* the "metrics_only" indicates that we only want to compute */
/* the glyph's metrics (lsb + advance width), not load the */
/* rest of it.. so exit immediately */
if (builder->metrics_only)
return T1_Err_Ok;
-
+
break;
}
@@ -942,7 +942,7 @@
FT_TRACE4(( " hvcurveto" ));
if ( start_point( builder, x, y ) ||
check_points( builder, 3 ) ) goto Memory_Error;
-
+
x += top[0];
add_point( builder, x, y, 0 );
x += top[1];
@@ -958,7 +958,7 @@
{
FT_TRACE4(( " rlineto" ));
if ( start_point( builder, x, y ) ) goto Memory_Error;
-
+
x += top[0];
y += top[1];
Add_Line:
@@ -980,11 +980,11 @@
FT_TRACE4(( " rcurveto" ));
if ( start_point( builder, x, y ) ||
check_points( builder, 3 ) ) goto Memory_Error;
-
+
x += top[0];
y += top[1];
add_point( builder, x, y, 0 );
-
+
x += top[2];
y += top[3];
add_point( builder, x, y, 0 );
@@ -993,7 +993,7 @@
y += top[5];
add_point( builder, x, y, 1 );
break;
- }
+ }
case op_vhcurveto: /**********************************************/
@@ -1001,7 +1001,7 @@
FT_TRACE4(( " vhcurveto" ));
if ( start_point( builder, x, y ) ||
check_points( builder, 3 ) ) goto Memory_Error;
-
+
y += top[0];
add_point( builder, x, y, 0 );
x += top[1];
@@ -1017,7 +1017,7 @@
{
FT_TRACE4(( " vlineto" ));
if ( start_point( builder, x, y ) ) goto Memory_Error;
-
+
y += top[0];
goto Add_Line;
}
@@ -1150,10 +1150,10 @@
}
decoder->top = top;
-
+
} /* general operator processing */
-
+
} /* while ip < limit */
FT_TRACE4(( "..end..\n\n" ));
return error;
@@ -1163,7 +1163,7 @@
Stack_Underflow:
return T1_Err_Stack_Underflow;
-
+
Memory_Error:
return builder->error;
}
@@ -1269,9 +1269,9 @@
{
T1_Init_Decoder( &decoder );
T1_Init_Builder( &decoder.builder, face, size, glyph );
-
+
decoder.builder.no_recurse = (FT_Bool)!!(load_flags & FT_LOAD_NO_RECURSE);
-
+
/* now load the unscaled outline */
error = T1_Parse_CharStrings( &decoder,
type1->charstrings [glyph_index],
@@ -1279,7 +1279,7 @@
type1->num_subrs,
type1->subrs,
type1->subrs_len );
-
+
/* save new glyph tables */
T1_Done_Builder( &decoder.builder );
}
@@ -1300,29 +1300,29 @@
{
FT_BBox cbox;
FT_Glyph_Metrics* metrics = &glyph->root.metrics;
-
+
/* copy the _unscaled_ advance width */
metrics->horiAdvance = decoder.builder.advance.x;
-
+
/* make up vertical metrics */
metrics->vertBearingX = 0;
metrics->vertBearingY = 0;
metrics->vertAdvance = 0;
-
+
glyph->root.format = ft_glyph_format_outline;
-
+
glyph->root.outline.flags &= ft_outline_owner;
if ( size && size->root.metrics.y_ppem < 24 )
glyph->root.outline.flags |= ft_outline_high_precision;
glyph->root.outline.flags |= ft_outline_reverse_fill;
-
+
/*
glyph->root.outline.second_pass = TRUE;
glyph->root.outline.high_precision = ( size->root.metrics.y_ppem < 24 );
glyph->root.outline.dropout_mode = 2;
*/
-
+
if ( (load_flags & FT_LOAD_NO_SCALE) == 0 )
{
/* scale the outline and the metrics */
@@ -1331,7 +1331,7 @@
T1_Vector* vec = cur->points;
T1_Fixed x_scale = glyph->x_scale;
T1_Fixed y_scale = glyph->y_scale;
-
+
/* First of all, scale the points */
for ( n = cur->n_points; n > 0; n--, vec++ )
{
@@ -1340,10 +1340,10 @@
}
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
-
+
/* Then scale the metrics */
metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
-
+
metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale );
metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale );
metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, x_scale );
@@ -1351,7 +1351,7 @@
/* compute the other metrics */
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
-
+
/* grid fit the bounding box if necessary */
if (hinting)
{
diff --git a/src/type1z/t1gload.h b/src/type1z/t1gload.h
index 3c2de5e..0ac000a 100644
--- a/src/type1z/t1gload.h
+++ b/src/type1z/t1gload.h
@@ -108,10 +108,10 @@
T1_Bool path_begun;
T1_Bool load_points;
T1_Bool no_recurse;
-
+
T1_Error error; /* only used for memory errors */
T1_Bool metrics_only;
-
+
} T1_Builder;
diff --git a/src/type1z/t1load.c b/src/type1z/t1load.c
index b2589c2..e53e914 100644
--- a/src/type1z/t1load.c
+++ b/src/type1z/t1load.c
@@ -2,7 +2,7 @@
*
* t1load.h 2.0
*
- * Type1 Loader.
+ * Type1 Loader.
*
* Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
@@ -32,7 +32,7 @@
*
* ..... /Field <data> ....
*
- * where <data> can be a number, a boolean, a string, or an
+ * where <data> can be a number, a boolean, a string, or an
* array of numbers. There are a few exceptions, namely the
* encoding, font name, charstrings and subrs and they are
* handled with a special pattern-matching routine.
@@ -72,17 +72,17 @@
typedef void (*T1_Parse_Func)( T1_Face face, T1_Loader* loader );
- typedef struct T1_KeyWord_
+ typedef struct T1_KeyWord_
{
const char* name;
T1_Parse_Func parsing;
-
+
} T1_KeyWord;
/* some handy macros used to easily define parsing callback functions */
/* each callback is in charge of loading a value and storing it in a */
/* given field of the Type 1 face.. */
-
+
#define PARSE_(x) static void FT_XCAT(parse_,x) ( T1_Face face, T1_Loader* loader )
#define FIELD FACE.x
@@ -98,7 +98,7 @@
FACE.x = (t)T1_ToInt(&loader->parser); \
FT_TRACE2(( "type1.parse_%s: \"%d\"\n", #x, FACE.x )); \
}
-
+
#define PARSE_INT(s,x) PARSE_(x) \
{ \
FACE.x = T1_ToInt(&loader->parser); \
@@ -111,19 +111,19 @@
FT_TRACE2(( "type1.parse_%s : \"%s\"\n", \
#x, FACE.x ? "true" : "false" )); \
}
-
+
#define PARSE_FIXED(s,x) PARSE_(x) \
{ \
FACE.x = T1_ToFixed(&loader->parser,3); \
FT_TRACE2(( "type1.parse_%s: \"%f\"\n", #x, FACE.x/65536.0 )); \
}
-
+
#define PARSE_COORDS(s,c,m,x) PARSE_(x) \
{ \
FACE.c = T1_ToCoordArray(&loader->parser, m, (T1_Short*)FACE.x ); \
FT_TRACE2(( "type1.parse_%s\n", #x )); \
}
-
+
#define PARSE_FIXEDS(s,c,m,x) PARSE_(x) \
{ \
FACE.c = T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)FACE.x, 3 ); \
@@ -168,49 +168,49 @@
void skip_whitespace( T1_Parser* parser )
{
T1_Byte* cur = parser->cursor;
-
+
while ( cur < parser->limit && is_space(*cur) )
cur++;
-
+
parser->cursor = cur;
}
-
+
static
void skip_blackspace( T1_Parser* parser )
{
T1_Byte* cur = parser->cursor;
-
+
while ( cur < parser->limit && !is_space(*cur) )
cur++;
-
+
parser->cursor = cur;
}
-
+
static
int read_binary_data( T1_Parser* parser, T1_Int *size, T1_Byte* *base )
{
T1_Byte* cur;
T1_Byte* limit = parser->limit;
-
+
/* the binary data has the following format */
/* */
/* "size" [white*] RD white ....... ND */
/* */
-
+
skip_whitespace(parser);
cur = parser->cursor;
-
+
if ( cur < limit && (T1_Byte)(*cur-'0') < 10 )
{
*size = T1_ToInt(parser);
-
+
skip_whitespace(parser);
skip_blackspace(parser); /* "RD" or "-|" or something else */
-
+
/* there is only one whitespace char after the */
/* "RD" or "-|" token */
*base = parser->cursor + 1;
-
+
parser->cursor += *size+1;
return 1;
}
@@ -235,12 +235,12 @@
T1_Byte* cur;
T1_Byte* cur2;
T1_Byte* limit;
-
+
skip_whitespace(parser);
cur = parser->cursor;
limit = parser->limit;
if ( cur >= limit-1 || *cur != '/' ) return;
-
+
cur++;
cur2 = cur;
while (cur2 < limit && is_alpha(*cur2)) cur2++;
@@ -252,7 +252,7 @@
parser->error = error;
return;
}
-
+
MEM_Copy( face->type1.font_name, cur, len );
face->type1.font_name[len] = '\0';
}
@@ -265,7 +265,7 @@
T1_Parser* parser = &loader->parser;
T1_Short temp[4];
T1_BBox* bbox = &face->type1.font_bbox;
-
+
(void)T1_ToCoordArray( parser, 4, temp );
bbox->xMin = temp[0];
bbox->yMin = temp[1];
@@ -279,7 +279,7 @@
T1_Parser* parser = &loader->parser;
T1_Byte* cur = parser->cursor;
T1_Byte* limit = parser->limit;
-
+
/* skip whitespace */
while (is_space(*cur))
{
@@ -291,7 +291,7 @@
return;
}
}
-
+
/* if we have a number, then the encoding is an array, */
/* and we must load it now */
if ((T1_Byte)(*cur - '0') < 10)
@@ -301,7 +301,7 @@
T1_Table* char_table = &loader->encoding_table;
FT_Memory memory = parser->memory;
FT_Error error;
-
+
/* read the number of entries in the encoding, should be 256 */
count = T1_ToInt( parser );
if (parser->error) return;
@@ -315,7 +315,7 @@
parser->error = error;
return;
}
-
+
/* now, we will need to read a record of the form */
/* ... charcode /charname ... for each entry in our table */
/* */
@@ -337,9 +337,9 @@
for ( ; cur < limit; )
{
T1_Byte c;
-
+
c = *cur;
-
+
/* we stop when we encounter a 'def' */
if ( c == 'd' && cur+3 < limit )
{
@@ -352,39 +352,39 @@
break;
}
}
-
+
/* otherwise, we must find a number before anything else */
if ( (T1_Byte)(c-'0') < 10 )
{
T1_Int charcode;
-
+
parser->cursor = cur;
charcode = T1_ToInt(parser);
cur = parser->cursor;
-
+
/* skip whitespace */
while (cur < limit && is_space(*cur)) cur++;
-
+
if (cur < limit && *cur == '/')
{
/* bingo, we have an immediate name - it must be a */
/* character name */
FT_Byte* cur2 = cur+1;
T1_Int len;
-
+
while (cur2 < limit && is_alpha(*cur2)) cur2++;
len = cur2-cur-1;
parser->error = T1_Add_Table( char_table, charcode, cur+1, len+1 );
char_table->elements[charcode][len] = '\0';
if (parser->error) return;
-
+
cur = cur2;
}
}
else
cur++;
}
-
+
face->type1.encoding_type = t1_encoding_array;
parser->cursor = cur;
}
@@ -395,7 +395,7 @@
if ( cur+17 < limit &&
strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 )
face->type1.encoding_type = t1_encoding_standard;
-
+
else if ( cur+15 < limit &&
strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 )
face->type1.encoding_type = t1_encoding_expert;
@@ -404,7 +404,7 @@
{
FT_ERROR(( "type1.parse_encoding: invalid token !!\n" ));
parser->error = FT_Err_Invalid_File_Format;
- }
+ }
}
}
@@ -417,10 +417,10 @@
FT_Memory memory = parser->memory;
FT_Error error;
T1_Int n;
-
- loader->num_subrs = T1_ToInt( parser );
+
+ loader->num_subrs = T1_ToInt( parser );
if (parser->error) return;
-
+
/* initialise subrs array */
error = T1_New_Table( table, loader->num_subrs, memory );
if (error) goto Fail;
@@ -429,16 +429,16 @@
/* */
/* "index" + binary data */
/* */
-
+
for ( n = 0; n < loader->num_subrs; n++ )
{
T1_Int index, size;
T1_Byte* base;
-
+
index = T1_ToInt(parser);
if (!read_binary_data(parser,&size,&base)) return;
-
- T1_Decrypt( base, size, 4330 );
+
+ T1_Decrypt( base, size, 4330 );
size -= face->type1.private_dict.lenIV;
base += face->type1.private_dict.lenIV;
@@ -466,21 +466,21 @@
T1_Byte* cur;
T1_Byte* limit = parser->limit;
T1_Int n;
-
- loader->num_glyphs = T1_ToInt( parser );
+
+ loader->num_glyphs = T1_ToInt( parser );
if (parser->error) return;
-
+
/* initialise tables */
error = T1_New_Table( code_table, loader->num_glyphs, memory ) ||
T1_New_Table( name_table, loader->num_glyphs, memory );
if (error) goto Fail;
-
+
n = 0;
for ( ;; )
{
T1_Int size;
T1_Byte* base;
-
+
/* the format is simple : */
/* "/glyphname" + binary data */
/* */
@@ -491,7 +491,7 @@
if (cur >= limit) break;
/* we stop when we find a "def" or "end" keyword */
- if (*cur == 'd' &&
+ if (*cur == 'd' &&
cur+3 < limit &&
cur[1] == 'e' &&
cur[2] == 'f' )
@@ -509,26 +509,26 @@
{
T1_Byte* cur2 = cur+1;
T1_Int len;
-
+
while (cur2 < limit && is_alpha(*cur2)) cur2++;
len = cur2-cur-1;
-
+
error = T1_Add_Table( name_table, n, cur+1, len+1 );
if (error) goto Fail;
-
+
/* add a trailing zero to the name table */
name_table->elements[n][len] = '\0';
-
- parser->cursor = cur2;
+
+ parser->cursor = cur2;
if (!read_binary_data(parser,&size,&base)) return;
- T1_Decrypt( base, size, 4330 );
+ T1_Decrypt( base, size, 4330 );
size -= face->type1.private_dict.lenIV;
base += face->type1.private_dict.lenIV;
error = T1_Add_Table( code_table, n, base, size );
if (error) goto Fail;
-
+
n++;
if (n >= loader->num_glyphs)
break;
@@ -536,7 +536,7 @@
}
loader->num_glyphs = n;
return;
-
+
Fail:
parser->error = error;
}
@@ -586,15 +586,15 @@
T1_Long size )
{
T1_Parser* parser = &loader->parser;
-
+
parser->cursor = base;
parser->limit = base + size;
parser->error = 0;
-
+
{
T1_Byte* cur = base;
T1_Byte* limit = cur + size;
-
+
for ( ;cur < limit; cur++ )
{
/* look for immediates */
@@ -602,21 +602,21 @@
{
T1_Byte* cur2;
T1_Int len;
-
+
cur ++;
cur2 = cur;
while (cur2 < limit && is_alpha(*cur2)) cur2++;
len = cur2-cur;
-
+
if (len > 0 && len < 20)
{
/* now, compare the immediate name to the keyword table */
T1_KeyWord* keyword = (T1_KeyWord*)t1_keywords;
-
+
for (;;)
{
T1_Byte* name;
-
+
name = (T1_Byte*)keyword->name;
if (!name) break;
@@ -627,7 +627,7 @@
for ( n = 1; n < len; n++ )
if (cur[n] != name[n])
break;
-
+
if (n >= len)
{
/* we found it - run the parsing callback !! */
@@ -654,29 +654,29 @@
void t1_init_loader( T1_Loader* loader, T1_Face face )
{
UNUSED(face);
-
+
MEM_Set( loader, 0, sizeof(*loader) );
loader->num_glyphs = 0;
loader->num_chars = 0;
- /* initialize the tables - simply set their 'init' field to 0 */
+ /* initialize the tables - simply set their 'init' field to 0 */
loader->encoding_table.init = 0;
loader->charstrings.init = 0;
loader->glyph_names.init = 0;
loader->subrs.init = 0;
}
-
+
static
void t1_done_loader( T1_Loader* loader )
{
T1_Parser* parser = &loader->parser;
-
+
/* finalize tables */
T1_Release_Table( &loader->encoding_table );
T1_Release_Table( &loader->charstrings );
T1_Release_Table( &loader->glyph_names );
T1_Release_Table( &loader->subrs );
-
+
/* finalize parser */
T1_Done_Parser( parser );
}
@@ -693,47 +693,47 @@
/* default lenIV */
type1->private_dict.lenIV = 4;
-
+
parser = &loader.parser;
error = T1_New_Parser( parser, face->root.stream, face->root.memory );
if (error) goto Exit;
error = parse_dict( face, &loader, parser->base_dict, parser->base_len );
if (error) goto Exit;
-
+
error = T1_Get_Private_Dict( parser );
if (error) goto Exit;
-
+
error = parse_dict( face, &loader, parser->private_dict, parser->private_len );
- if (error) goto Exit;
+ if (error) goto Exit;
/* now, propagate the subrs, charstrings and glyphnames tables */
/* to the Type1 data */
type1->num_glyphs = loader.num_glyphs;
-
+
if ( !loader.subrs.init )
{
FT_ERROR(( "T1.Open_Face: no subrs array in face !!\n" ));
error = FT_Err_Invalid_File_Format;
}
-
+
if ( !loader.charstrings.init )
{
FT_ERROR(( "T1.Open_Face: no charstrings array in face !!\n" ));
error = FT_Err_Invalid_File_Format;
}
-
+
loader.subrs.init = 0;
type1->num_subrs = loader.num_subrs;
type1->subrs_block = loader.subrs.block;
type1->subrs = loader.subrs.elements;
type1->subrs_len = loader.subrs.lengths;
-
+
loader.charstrings.init = 0;
type1->charstrings_block = loader.charstrings.block;
type1->charstrings = loader.charstrings.elements;
type1->charstrings_len = loader.charstrings.lengths;
-
+
/* we copy the glyph names "block" and "elements" fields */
/* but the "lengths" field must be released later.. */
type1->glyph_names_block = loader.glyph_names.block;
@@ -753,16 +753,16 @@
/* table, lookup the index of the glyph having the same name */
/* the index is then stored in type1.encoding.char_index, and */
/* a the name to type1.encoding.char_name */
-
+
min_char = +32000;
max_char = -32000;
-
+
charcode = 0;
for ( ; charcode < loader.encoding_table.num_elems; charcode++ )
{
type1->encoding.char_index[charcode] = 0;
type1->encoding.char_name [charcode] = ".notdef";
-
+
char_name = loader.encoding_table.elements[charcode];
if (char_name)
for ( index = 0; index < type1->num_glyphs; index++ )
@@ -773,7 +773,7 @@
{
type1->encoding.char_index[charcode] = index;
type1->encoding.char_name [charcode] = (char*)glyph_name;
-
+
if (charcode < min_char) min_char = charcode;
if (charcode > max_char) max_char = charcode;
break;
@@ -784,8 +784,8 @@
type1->encoding.code_last = max_char;
type1->encoding.num_chars = loader.num_chars;
}
-
+
Exit:
t1_done_loader( &loader );
return error;
- }
+ }
diff --git a/src/type1z/t1load.h b/src/type1z/t1load.h
index 093096c..629e943 100644
--- a/src/type1z/t1load.h
+++ b/src/type1z/t1load.h
@@ -2,7 +2,7 @@
*
* t1load.h 2.0
*
- * Type1 Loader.
+ * Type1 Loader.
*
* Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
@@ -32,14 +32,14 @@
T1_Int num_chars; /* number of characters in encoding */
T1_Table encoding_table; /* T1_Table used to store the */
/* encoding character names */
-
- T1_Int num_glyphs;
+
+ T1_Int num_glyphs;
T1_Table glyph_names;
T1_Table charstrings;
-
+
T1_Int num_subrs;
T1_Table subrs;
-
+
} T1_Loader;
LOCAL_DEF
diff --git a/src/type1z/t1objs.c b/src/type1z/t1objs.c
index 2d25408..3a5c053 100644
--- a/src/type1z/t1objs.c
+++ b/src/type1z/t1objs.c
@@ -2,7 +2,7 @@
*
* t1objs.c 1.0
*
- * Type1 Objects manager.
+ * Type1 Objects manager.
*
* Copyright 1996-1998 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
@@ -97,7 +97,7 @@
* Error code.
*
******************************************************************/
-
+
LOCAL_FUNC
T1_Error T1_Reset_Size( T1_Size size )
{
@@ -124,7 +124,7 @@
* face :: typeless pointer to the face object to destroy
*
* <Return>
- * Error code.
+ * Error code.
*
******************************************************************/
@@ -138,10 +138,10 @@
{
memory = face->root.memory;
- /* release font info strings */
+ /* release font info strings */
{
T1_FontInfo* info = &type1->font_info;
-
+
FREE( info->version );
FREE( info->notice );
FREE( info->full_name );
@@ -149,21 +149,21 @@
FREE( info->weight );
}
- /* release top dictionary */
+ /* release top dictionary */
FREE( type1->charstrings_len );
FREE( type1->charstrings );
FREE( type1->glyph_names );
FREE( type1->subrs );
FREE( type1->subrs_len );
-
+
FREE( type1->subrs_block );
FREE( type1->charstrings_block );
FREE( type1->glyph_names_block );
FREE( type1->encoding.char_index );
FREE( type1->font_name );
-
+
#ifndef T1_CONFIG_OPTION_NO_AFM
/* release afm data if present */
if ( face->afm_data)
@@ -217,7 +217,7 @@
{
/* look-up the PSNames driver */
FT_Driver psnames_driver;
-
+
psnames_driver = FT_Get_Driver( face->root.driver->library, "psnames" );
if (psnames_driver)
face->psnames = (PSNames_Interface*)
@@ -246,15 +246,15 @@
/* Now set up root face fields */
{
FT_Face root = (FT_Face)&face->root;
-
+
root->num_glyphs = face->type1.num_glyphs;
root->num_charmaps = 1;
-
+
root->face_index = face_index;
root->face_flags = FT_FACE_FLAG_SCALABLE;
-
+
root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
-
+
if ( face->type1.font_info.is_fixed_pitch )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
@@ -267,13 +267,13 @@
{
char* full = face->type1.font_info.full_name;
char* family = root->family_name;
-
+
while ( *family && *full == *family )
{
family++;
full++;
}
-
+
root->style_name = ( *full == ' ' ? full+1 : "Regular" );
}
else
@@ -285,17 +285,17 @@
root->style_name = "Regular";
}
}
-
+
/* no embedded bitmap support */
root->num_fixed_sizes = 0;
root->available_sizes = 0;
-
+
root->bbox = face->type1.font_bbox;
root->units_per_EM = 1000;
root->ascender = (T1_Short)face->type1.font_bbox.yMax;
root->descender = -(T1_Short)face->type1.font_bbox.yMin;
root->height = ((root->ascender + root->descender)*12)/10;
-
+
/* now compute the maximum advance width */
root->max_advance_width = face->type1.private_dict.standard_width;
@@ -315,10 +315,10 @@
}
root->max_advance_height = root->height;
-
+
root->underline_position = face->type1.font_info.underline_position;
root->underline_thickness = face->type1.font_info.underline_thickness;
-
+
root->max_points = 0;
root->max_contours = 0;
}
@@ -349,7 +349,7 @@
charmap->encoding_id = 1;
charmap++;
}
-
+
/* simply clear the error in case of failure (which really) */
/* means that out of memory or no unicode glyph names */
error = 0;
@@ -359,25 +359,25 @@
/* now, support either the standard, expert, or custom encodings */
charmap->face = (FT_Face)face;
charmap->platform_id = 7; /* a new platform id for Adobe fonts ?? */
-
+
switch (face->type1.encoding_type)
{
case t1_encoding_standard:
charmap->encoding = ft_encoding_adobe_standard;
charmap->encoding_id = 0;
break;
-
+
case t1_encoding_expert:
charmap->encoding = ft_encoding_adobe_expert;
charmap->encoding_id = 1;
break;
-
+
default:
charmap->encoding = ft_encoding_adobe_custom;
charmap->encoding_id = 2;
break;
}
-
+
root->charmaps = face->charmaps;
root->num_charmaps = charmap - face->charmaprecs + 1;
face->charmaps[0] = &face->charmaprecs[0];
@@ -396,7 +396,7 @@
*
* Input : _glyph typeless pointer to the glyph record to destroy
*
- * Output : Error code.
+ * Output : Error code.
*
******************************************************************/
@@ -420,7 +420,7 @@
* Description : The glyph object constructor.
*
* Input : glyph glyph record to build.
- * face the glyph's parent face.
+ * face the glyph's parent face.
*
* Output : Error code.
*
diff --git a/src/type1z/t1objs.h b/src/type1z/t1objs.h
index 15f1e99..7da6713 100644
--- a/src/type1z/t1objs.h
+++ b/src/type1z/t1objs.h
@@ -2,7 +2,7 @@
*
* t1objs.h 1.0
*
- * Type1 objects definition.
+ * Type1 objects definition.
*
* Copyright 1996-1999 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
@@ -82,7 +82,7 @@
/* NOW BEGINS THE TYPE1 SPECIFIC STUFF .............................. */
/* */
/**************************************************************************/
-
+
/***************************************************/
/* */
@@ -90,7 +90,7 @@
/* */
/* Type 1 size record.. */
/* */
-
+
typedef struct T1_SizeRec_
{
FT_SizeRec root;
@@ -109,14 +109,14 @@
/* */
/* TrueDoc glyph record.. */
/* */
-
+
typedef struct T1_GlyphSlotRec_
{
FT_GlyphSlotRec root;
T1_Bool hint;
T1_Bool scaled;
-
+
T1_Int max_points;
T1_Int max_contours;
@@ -250,7 +250,7 @@
*
* <Input> glyph :: handle to glyph slot object
*
- * <Output> Error code.
+ * <Output> Error code.
*
******************************************************************/
diff --git a/src/type1z/t1parse.c b/src/type1z/t1parse.c
index 42743c3..b7d9506 100644
--- a/src/type1z/t1parse.c
+++ b/src/type1z/t1parse.c
@@ -27,7 +27,7 @@
* See "t1load.c" to see how data is loaded from the font file
*
******************************************************************/
-
+
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftobjs.h>
@@ -75,7 +75,7 @@
Exit:
if (error) FREE(table->elements);
-
+
return error;
}
@@ -105,7 +105,7 @@
T1_Long delta = table->block - old_base;
T1_Byte** offset = table->elements;
T1_Byte** limit = offset + table->max_elems;
-
+
if (delta)
for ( ; offset < limit; offset++ )
{
@@ -113,7 +113,7 @@
offset[0] += delta;
}
}
-
+
static
T1_Error reallocate_t1_table( T1_Table* table,
T1_Int new_size )
@@ -121,17 +121,17 @@
FT_Memory memory = table->memory;
T1_Byte* old_base = table->block;
T1_Error error;
-
+
/* realloc the base block */
if ( REALLOC( table->block, table->capacity, new_size ) )
return error;
-
+
table->capacity = new_size;
-
+
/* shift all offsets when needed */
if (old_base)
shift_elements( table, old_base );
-
+
return T1_Err_Ok;
}
@@ -198,10 +198,10 @@
old_base = table->block;
if (!old_base)
return;
-
+
(void)REALLOC( table->block, table->capacity, table->cursor );
table->capacity = table->cursor;
-
+
if (old_base != table->block)
shift_elements( table, old_base );
}
@@ -211,7 +211,7 @@
void T1_Release_Table( T1_Table* table )
{
FT_Memory memory = table->memory;
-
+
if (table->init == (FT_Long)0xdeadbeef)
{
FREE( table->block );
@@ -228,20 +228,20 @@
T1_Long result = 0;
T1_Byte* cur = *cursor;
T1_Byte c, d;
-
+
for (; cur < limit; cur++)
{
c = *cur;
d = (T1_Byte)(c - '0');
if (d < 10) break;
-
+
if ( c=='-' )
{
cur++;
break;
}
}
-
+
if (cur < limit)
{
do
@@ -249,16 +249,16 @@
d = (T1_Byte)(cur[0] - '0');
if (d >= 10)
break;
-
+
result = result*10 + d;
cur++;
-
+
} while (cur < limit);
-
+
if (c == '-')
result = -result;
}
-
+
*cursor = cur;
return result;
}
@@ -273,26 +273,26 @@
T1_Long num, divider, result;
T1_Int sign = 0;
T1_Byte d;
-
+
if (cur >= limit) return 0;
-
+
/* first of all, read the integer part */
result = t1_toint( &cur, limit ) << 16;
num = 0;
divider = 1;
-
+
if (result < 0)
{
sign = 1;
result = -result;
}
if (cur >= limit) goto Exit;
-
+
/* read decimal part, if any */
if (*cur == '.' && cur+1 < limit)
{
cur++;
-
+
for (;;)
{
d = (T1_Byte)(*cur - '0');
@@ -307,14 +307,14 @@
if (cur >= limit) break;
}
}
-
+
/* read exponent, if any */
if ( cur+1 < limit && (*cur == 'e' || *cur == 'E'))
{
cur++;
power_ten += t1_toint( &cur, limit );
}
-
+
Exit:
/* raise to power of ten if needed */
while (power_ten > 0)
@@ -323,7 +323,7 @@
num = num*10;
power_ten--;
}
-
+
while (power_ten < 0)
{
result = result/10;
@@ -336,7 +336,7 @@
if (sign)
result = -result;
-
+
*cursor = cur;
return result;
}
@@ -351,19 +351,19 @@
T1_Byte* cur = *cursor;
T1_Int count = 0;
T1_Byte c, ender;
-
+
if (cur >= limit) goto Exit;
-
+
/* check for the beginning of an array. If not, only one number will be read */
c = *cur;
ender = 0;
-
+
if (c == '[')
ender = ']';
-
+
if (c == '{')
ender = '}';
-
+
if (ender)
cur++;
@@ -375,21 +375,21 @@
{
c = *cur;
if ( c != ' ' && c != '\t' ) break;
-
+
cur++;
if (cur >= limit) goto Exit;
}
-
+
if (count >= max_coords || c == ender)
break;
-
+
coords[count] = (T1_Short)(t1_tofixed(&cur,limit,0) >> 16);
count++;
-
+
if (!ender)
break;
}
-
+
Exit:
*cursor = cur;
return count;
@@ -399,7 +399,7 @@
static
T1_Int t1_tofixedarray( T1_Byte* *cursor,
- T1_Byte* limit,
+ T1_Byte* limit,
T1_Int max_values,
T1_Fixed* values,
T1_Int power_ten )
@@ -407,19 +407,19 @@
T1_Byte* cur = *cursor;
T1_Int count = 0;
T1_Byte c, ender;
-
+
if (cur >= limit) goto Exit;
-
+
/* check for the beginning of an array. If not, only one number will be read */
c = *cur;
ender = 0;
-
+
if (c == '[')
ender = ']';
-
+
if (c == '{')
ender = '}';
-
+
if (ender)
cur++;
@@ -431,21 +431,21 @@
{
c = *cur;
if ( c != ' ' && c != '\t' ) break;
-
+
cur++;
if (cur >= limit) goto Exit;
}
if (count >= max_values || c == ender)
break;
-
+
values[count] = t1_tofixed(&cur,limit,power_ten);
count++;
-
+
if (!ender)
break;
}
-
+
Exit:
*cursor = cur;
return count;
@@ -472,18 +472,18 @@
while ( cur < limit && (*cur == ' ' || *cur == '\t')) cur++;
if (cur+1 >= limit) return 0;
-
+
if (*cur == '(') cur++; /* skip the opening parenthesis, if there is one */
-
+
*cursor = cur;
count = 0;
-
+
/* then, count its length */
for ( ; cur < limit; cur++ )
{
if (*cur == '(')
count++;
-
+
else if (*cur == ')')
{
count--;
@@ -492,14 +492,14 @@
}
}
- len = cur - *cursor;
+ len = cur - *cursor;
if (cur >= limit || ALLOC(result,len+1)) return 0;
-
+
/* now copy the string */
MEM_Copy( result, *cursor, len );
result[len] = '\0';
*cursor = cur;
- return result;
+ return result;
}
static
@@ -507,7 +507,7 @@
{
T1_Byte* cur = *cursor;
T1_Bool result = 0;
-
+
/* return 1 if we find a "true", 0 otherwise */
if ( cur+3 < limit &&
cur[0] == 't' &&
@@ -583,21 +583,21 @@
FT_Error read_pfb_tag( FT_Stream stream, T1_UShort *tag, T1_Long* size )
{
FT_Error error;
-
+
if (READ_UShort(*tag)) goto Exit;
if (*tag == 0x8001 || *tag == 0x8002)
{
FT_Long asize;
-
+
if (READ_ULong(asize)) goto Exit;
-
+
/* swap between big and little endianness */
*size = ((asize & 0xFF000000) >> 24) |
((asize & 0x00FF0000) >> 8 ) |
((asize & 0x0000FF00) << 8 ) |
((asize & 0x000000FF) << 24);
}
-
+
Exit:
return error;
}
@@ -612,7 +612,7 @@
FT_Error error;
T1_UShort tag;
T1_Long size;
-
+
parser->stream = stream;
parser->memory = memory;
parser->base_len = 0;
@@ -622,10 +622,10 @@
parser->in_pfb = 0;
parser->in_memory = 0;
parser->single_block = 0;
-
+
parser->cursor = 0;
parser->limit = 0;
-
+
/******************************************************************/
/* */
/* Here's a short summary of what is going on : */
@@ -641,12 +641,12 @@
/* parser->in_pfb is set when we are in a binary (".pfb") font */
/* parser->in_memory is set when we have a memory stream. */
/* */
-
+
/* try to compute the size of the base dictionary */
/* look for a Postscript binary file tag, i.e 0x8001 */
if ( FILE_Seek(0L) )
goto Exit;
-
+
error = read_pfb_tag( stream, &tag, &size );
if (error) goto Exit;
@@ -662,14 +662,14 @@
/* now, try to load the "size" bytes of the "base" dictionary we */
/* found previously */
-
+
/* if it's a memory-based resource, set up pointers */
if ( !stream->read )
{
parser->base_dict = (T1_Byte*)stream->base + stream->pos;
parser->base_len = size;
parser->in_memory = 1;
-
+
/* check that the "size" field is valid */
if ( FILE_Skip(size) ) goto Exit;
}
@@ -681,7 +681,7 @@
goto Exit;
parser->base_len = size;
}
-
+
/* Now check font format, we must see a '%!PS-AdobeFont-1' */
/* or a '%!FontType' */
{
@@ -764,7 +764,7 @@
FT_Memory memory = parser->memory;
FT_Error error = 0;
T1_Long size;
-
+
if (parser->in_pfb)
{
/* in the case of the PFB format, the private dictionary can be */
@@ -775,15 +775,15 @@
T1_UShort tag;
T1_Long size;
- parser->private_len = 0;
+ parser->private_len = 0;
for (;;)
{
error = read_pfb_tag(stream, &tag, &size);
if (error) goto Fail;
-
+
if (tag != 0x8002)
break;
-
+
parser->private_len += size;
if ( FILE_Skip(size) )
@@ -824,9 +824,9 @@
/* first of all, look at the "eexec" keyword */
FT_Byte* cur = parser->base_dict;
- FT_Byte* limit = cur + parser->base_len;
+ FT_Byte* limit = cur + parser->base_len;
FT_Byte c;
-
+
for (;;)
{
c = cur[0];
@@ -836,12 +836,12 @@
cur[3] == 'e' && cur[4] == 'c' )
{
cur += 6; /* we skip the newling after the "eexec" */
-
+
/* XXX: Some fonts use DOS-linefeeds, i.e. \r\n, we need to skip */
/* the extra \n when we find it.. */
if (cur[0] == '\n')
cur++;
-
+
break;
}
}
@@ -853,13 +853,13 @@
goto Exit;
}
}
-
+
/* now determine wether where to write the _encrypted_ binary private */
/* dictionary. We overwrite the base dictionary for disk-based resources */
/* and allocate a new block otherwise */
-
- size = parser->base_len - (cur-parser->base_dict);
-
+
+ size = parser->base_len - (cur-parser->base_dict);
+
if ( parser->in_memory )
{
/* note that we allocate one more byte to put a terminating '0' */
@@ -868,13 +868,13 @@
}
else
{
- parser->single_block = 1;
+ parser->single_block = 1;
parser->private_dict = parser->base_dict;
parser->private_len = size;
parser->base_dict = 0;
parser->base_len = 0;
}
-
+
/* now determine wether the private dictionary is encoded in binary */
/* or hexadecimal ASCII format.. */
/* and decode it accordingly */
@@ -890,40 +890,40 @@
MEM_Copy( parser->private_dict, cur, size );
}
else
- {
+ {
/* ASCII hexadecimal encoding.. This blows goats !!.. */
-
+
T1_Byte* write;
T1_Int count;
write = parser->private_dict;
count = 0;
-
+
for ( ;cur < limit; cur++)
{
int hex1;
-
+
/* check for newline */
if (cur[0] == '\r' || cur[0] == '\n')
continue;
-
+
/* exit if we have a non-hexadecimal digit that isn't a newline */
hex1 = hexa_value(cur[0]);
if (hex1 < 0 || cur+1 >= limit)
break;
-
+
/* otherwise, store byte */
*write++ = (hex1 << 4) | hexa_value(cur[1]);
count++;
cur++;
}
-
+
/* put a safeguard */
parser->private_len = write - parser->private_dict;
*write++ = 0;
}
}
-
+
/* we now decrypt the encoded binary private dictionary */
T1_Decrypt( parser->private_dict, parser->private_len, 55665 );
parser->cursor = parser->private_dict;
@@ -933,4 +933,4 @@
Exit:
return error;
}
-
+
diff --git a/src/type1z/t1parse.h b/src/type1z/t1parse.h
index 6866918..6482d52 100644
--- a/src/type1z/t1parse.h
+++ b/src/type1z/t1parse.h
@@ -116,13 +116,13 @@
{
FT_Stream stream;
FT_Memory memory;
-
+
T1_Byte* base_dict;
T1_Int base_len;
-
+
T1_Byte* private_dict;
T1_Int private_len;
-
+
T1_Byte in_pfb;
T1_Byte in_memory;
T1_Byte single_block;
@@ -130,7 +130,7 @@
T1_Byte* cursor;
T1_Byte* limit;
T1_Error error;
-
+
} T1_Parser;
diff --git a/src/type1z/t1tokens.h b/src/type1z/t1tokens.h
index 0de85be..2ef03b4 100644
--- a/src/type1z/t1tokens.h
+++ b/src/type1z/t1tokens.h
@@ -26,37 +26,37 @@
PARSE_STRING("FullName",full_name)
PARSE_STRING("FamilyName",family_name)
PARSE_STRING("Weight",weight)
-
+
PARSE_INT("ItalicAngle",italic_angle)
PARSE_BOOL("isFixedPitch",is_fixed_pitch)
PARSE_NUM("UnderlinePosition",underline_position,T1_Short)
PARSE_NUM("UnderlineThickness",underline_thickness,T1_UShort)
- /* define the private dict parsing callbacks */
-
+ /* define the private dict parsing callbacks */
+
#undef FACE
#define FACE (face->type1.private_dict)
PARSE_INT("UniqueID",unique_id)
PARSE_INT("lenIV",lenIV)
-
+
PARSE_COORDS( "BlueValues", num_blues, 14, blue_values)
PARSE_COORDS( "OtherBlues", num_other_blues, 10, other_blues)
-
+
PARSE_COORDS( "FamilyBlues", num_family_blues, 14, family_blues)
PARSE_COORDS( "FamilyOtherBlues", num_family_other_blues, 10, family_other_blues)
-
+
PARSE_FIXED( "BlueScale", blue_scale)
PARSE_INT( "BlueShift", blue_shift)
-
+
PARSE_INT( "BlueFuzz", blue_fuzz)
PARSE_COORDS2( "StdHW", 1, standard_width )
PARSE_COORDS2( "StdVW", 1, standard_height )
-
+
PARSE_COORDS( "StemSnapH", num_snap_widths, 12, stem_snap_widths )
PARSE_COORDS( "StemSnapV", num_snap_heights, 12, stem_snap_heights )
-
+
PARSE_INT( "LanguageGroup", language_group )
PARSE_INT( "password", password )
PARSE_COORDS2( "MinFeature", 2, min_feature )
@@ -66,7 +66,7 @@
#undef FACE
#define FACE (face->type1)
-
+
/* PARSE_STRING( "FontName", font_name ) -- handled by special routine */
PARSE_NUM( "PaintType", paint_type, T1_Byte )
PARSE_NUM( "FontType", font_type, T1_Byte )