forked from minhngoc25a/freetype2
[cff] Signedness fixes for basic infrastructure and old engine.
* include/internal/pshints.h, src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffgload.h, src/cff/cffload.c, src/cff/cffobjs.c, src/cff/cffparse.c, src/pshinter/pshrec.c: Apply.
This commit is contained in:
parent
d7db7fb54f
commit
3a8d0537b5
@ -1,3 +1,11 @@
|
||||
2015-02-20 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[cff] Signedness fixes for basic infrastructure and old engine.
|
||||
|
||||
* include/internal/pshints.h, src/cff/cffdrivr.c,
|
||||
src/cff/cffgload.c, src/cff/cffgload.h, src/cff/cffload.c,
|
||||
src/cff/cffobjs.c, src/cff/cffparse.c, src/pshinter/pshrec.c: Apply.
|
||||
|
||||
2015-02-19 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Ignore `countSizePairs'.
|
||||
|
@ -465,7 +465,7 @@ FT_BEGIN_HEADER
|
||||
typedef void
|
||||
(*T2_Hints_StemsFunc)( T2_Hints hints,
|
||||
FT_UInt dimension,
|
||||
FT_UInt count,
|
||||
FT_Int count,
|
||||
FT_Fixed* coordinates );
|
||||
|
||||
|
||||
|
@ -352,7 +352,7 @@
|
||||
font_info->italic_angle = dict->italic_angle;
|
||||
font_info->is_fixed_pitch = dict->is_fixed_pitch;
|
||||
font_info->underline_position = (FT_Short)dict->underline_position;
|
||||
font_info->underline_thickness = (FT_Short)dict->underline_thickness;
|
||||
font_info->underline_thickness = (FT_UShort)dict->underline_thickness;
|
||||
|
||||
cff->font_info = font_info;
|
||||
}
|
||||
|
@ -337,11 +337,11 @@
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The bias value. */
|
||||
static FT_Int
|
||||
static FT_UInt
|
||||
cff_compute_bias( FT_Int in_charstring_type,
|
||||
FT_UInt num_subrs )
|
||||
{
|
||||
FT_Int result;
|
||||
FT_UInt result;
|
||||
|
||||
|
||||
if ( in_charstring_type == 1 )
|
||||
@ -646,7 +646,7 @@
|
||||
for ( n = 0; n < cff->num_glyphs; n++ )
|
||||
{
|
||||
if ( cff->charset.sids[n] == glyph_sid )
|
||||
return n;
|
||||
return (FT_Int)n;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -672,7 +672,7 @@
|
||||
|
||||
|
||||
*pointer = (FT_Byte*)data.pointer;
|
||||
*length = data.length;
|
||||
*length = (FT_ULong)data.length;
|
||||
|
||||
return error;
|
||||
}
|
||||
@ -707,7 +707,7 @@
|
||||
|
||||
|
||||
data.pointer = *pointer;
|
||||
data.length = length;
|
||||
data.length = (FT_Int)length;
|
||||
|
||||
face->root.internal->incremental_interface->funcs->free_glyph_data(
|
||||
face->root.internal->incremental_interface->object, &data );
|
||||
@ -819,7 +819,7 @@
|
||||
FT_GlyphLoader_Prepare( builder->loader );
|
||||
|
||||
/* First load `bchar' in builder */
|
||||
error = cff_get_glyph_data( face, bchar_index,
|
||||
error = cff_get_glyph_data( face, (FT_UInt)bchar_index,
|
||||
&charstring, &charstring_len );
|
||||
if ( !error )
|
||||
{
|
||||
@ -849,7 +849,7 @@
|
||||
builder->pos_y = ady;
|
||||
|
||||
/* Now load `achar' on top of the base outline. */
|
||||
error = cff_get_glyph_data( face, achar_index,
|
||||
error = cff_get_glyph_data( face, (FT_UInt)achar_index,
|
||||
&charstring, &charstring_len );
|
||||
if ( !error )
|
||||
{
|
||||
@ -922,10 +922,10 @@
|
||||
decoder->read_width = 1;
|
||||
|
||||
/* compute random seed from stack address of parameter */
|
||||
seed = (FT_Fixed)( ( (FT_PtrDist)(char*)&seed ^
|
||||
(FT_PtrDist)(char*)&decoder ^
|
||||
(FT_PtrDist)(char*)&charstring_base ) &
|
||||
FT_ULONG_MAX ) ;
|
||||
seed = (FT_Fixed)( ( (FT_Offset)(char*)&seed ^
|
||||
(FT_Offset)(char*)&decoder ^
|
||||
(FT_Offset)(char*)&charstring_base ) &
|
||||
FT_ULONG_MAX );
|
||||
seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
|
||||
if ( seed == 0 )
|
||||
seed = 0x7384;
|
||||
@ -1373,12 +1373,12 @@
|
||||
{
|
||||
if ( op == cff_op_hintmask )
|
||||
hinter->hintmask( hinter->hints,
|
||||
builder->current->n_points,
|
||||
decoder->num_hints,
|
||||
(FT_UInt)builder->current->n_points,
|
||||
(FT_UInt)decoder->num_hints,
|
||||
ip );
|
||||
else
|
||||
hinter->counter( hinter->hints,
|
||||
decoder->num_hints,
|
||||
(FT_UInt)decoder->num_hints,
|
||||
ip );
|
||||
}
|
||||
|
||||
@ -1995,7 +1995,7 @@
|
||||
if ( hinter )
|
||||
{
|
||||
if ( hinter->close( hinter->hints,
|
||||
builder->current->n_points ) )
|
||||
(FT_UInt)builder->current->n_points ) )
|
||||
goto Syntax_Error;
|
||||
|
||||
/* apply hints to the loaded glyph outline now */
|
||||
@ -2385,8 +2385,7 @@
|
||||
|
||||
case cff_op_callsubr:
|
||||
{
|
||||
FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) +
|
||||
decoder->locals_bias );
|
||||
FT_UInt idx = ( (FT_UInt)args[0] >> 16 ) + decoder->locals_bias;
|
||||
|
||||
|
||||
FT_TRACE4(( " callsubr(%d)\n", idx ));
|
||||
@ -2427,8 +2426,7 @@
|
||||
|
||||
case cff_op_callgsubr:
|
||||
{
|
||||
FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) +
|
||||
decoder->globals_bias );
|
||||
FT_UInt idx = ( (FT_UInt)args[0] >> 16 ) + decoder->globals_bias;
|
||||
|
||||
|
||||
FT_TRACE4(( " callgsubr(%d)\n", idx ));
|
||||
@ -2669,7 +2667,7 @@
|
||||
error = sfnt->load_sbit_image( face,
|
||||
size->strike_index,
|
||||
glyph_index,
|
||||
(FT_Int)load_flags,
|
||||
(FT_UInt)load_flags,
|
||||
stream,
|
||||
&glyph->root.bitmap,
|
||||
&metrics );
|
||||
@ -2757,16 +2755,16 @@
|
||||
/* this scaling is only relevant if the PS hinter isn't active */
|
||||
if ( cff->num_subfonts )
|
||||
{
|
||||
FT_ULong top_upm, sub_upm;
|
||||
FT_Byte fd_index = cff_fd_select_get( &cff->fd_select,
|
||||
glyph_index );
|
||||
FT_Long top_upm, sub_upm;
|
||||
FT_Byte fd_index = cff_fd_select_get( &cff->fd_select,
|
||||
glyph_index );
|
||||
|
||||
|
||||
if ( fd_index >= cff->num_subfonts )
|
||||
fd_index = (FT_Byte)( cff->num_subfonts - 1 );
|
||||
|
||||
top_upm = cff->top_font.font_dict.units_per_em;
|
||||
sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em;
|
||||
top_upm = (FT_Long)cff->top_font.font_dict.units_per_em;
|
||||
sub_upm = (FT_Long)cff->subfonts[fd_index]->font_dict.units_per_em;
|
||||
|
||||
|
||||
font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;
|
||||
@ -2884,7 +2882,7 @@
|
||||
{
|
||||
glyph->root.control_data = csindex->bytes +
|
||||
csindex->offsets[glyph_index] - 1;
|
||||
glyph->root.control_len = charstring_len;
|
||||
glyph->root.control_len = (FT_Long)charstring_len;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,8 +178,8 @@ FT_BEGIN_HEADER
|
||||
FT_UInt num_locals;
|
||||
FT_UInt num_globals;
|
||||
|
||||
FT_Int locals_bias;
|
||||
FT_Int globals_bias;
|
||||
FT_UInt locals_bias;
|
||||
FT_UInt globals_bias;
|
||||
|
||||
FT_Byte** locals;
|
||||
FT_Byte** globals;
|
||||
|
@ -357,7 +357,7 @@
|
||||
|
||||
case 3:
|
||||
for ( ; p < p_end; p += 3, poff++ )
|
||||
poff[0] = FT_PEEK_OFF3( p );
|
||||
poff[0] = FT_PEEK_UOFF3( p );
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -809,7 +809,7 @@
|
||||
/* When multiple GIDs map to the same CID, we choose the lowest */
|
||||
/* GID. This is not described in any spec, but it matches the */
|
||||
/* behaviour of recent Acroread versions. */
|
||||
for ( j = num_glyphs - 1; j >= 0 ; j-- )
|
||||
for ( j = (FT_Long)num_glyphs - 1; j >= 0 ; j-- )
|
||||
charset->cids[charset->sids[j]] = (FT_UShort)j;
|
||||
|
||||
charset->max_cid = max_cid;
|
||||
@ -1447,7 +1447,7 @@
|
||||
FT_ULong base_offset;
|
||||
CFF_FontRecDict dict;
|
||||
CFF_IndexRec string_index;
|
||||
FT_Int subfont_index;
|
||||
FT_UInt subfont_index;
|
||||
|
||||
|
||||
FT_ZERO( font );
|
||||
@ -1495,9 +1495,9 @@
|
||||
if ( pure_cff )
|
||||
{
|
||||
/* well, we don't really forget the `disabled' fonts... */
|
||||
subfont_index = face_index;
|
||||
subfont_index = (FT_UInt)face_index;
|
||||
|
||||
if ( subfont_index >= (FT_Int)font->name_index.count )
|
||||
if ( subfont_index >= font->name_index.count )
|
||||
{
|
||||
FT_ERROR(( "cff_font_load:"
|
||||
" invalid subfont index for pure CFF font (%d)\n",
|
||||
|
@ -226,8 +226,8 @@
|
||||
CFF_Font font = (CFF_Font)face->extra.data;
|
||||
CFF_Internal internal = (CFF_Internal)size->internal;
|
||||
|
||||
FT_ULong top_upm = font->top_font.font_dict.units_per_em;
|
||||
FT_UInt i;
|
||||
FT_Long top_upm = (FT_Long)font->top_font.font_dict.units_per_em;
|
||||
FT_UInt i;
|
||||
|
||||
|
||||
funcs->set_scale( internal->topfont,
|
||||
@ -237,7 +237,7 @@
|
||||
for ( i = font->num_subfonts; i > 0; i-- )
|
||||
{
|
||||
CFF_SubFont sub = font->subfonts[i - 1];
|
||||
FT_ULong sub_upm = sub->font_dict.units_per_em;
|
||||
FT_Long sub_upm = (FT_Long)sub->font_dict.units_per_em;
|
||||
FT_Pos x_scale, y_scale;
|
||||
|
||||
|
||||
@ -298,8 +298,8 @@
|
||||
CFF_Font font = (CFF_Font)cffface->extra.data;
|
||||
CFF_Internal internal = (CFF_Internal)size->internal;
|
||||
|
||||
FT_ULong top_upm = font->top_font.font_dict.units_per_em;
|
||||
FT_UInt i;
|
||||
FT_Long top_upm = (FT_Long)font->top_font.font_dict.units_per_em;
|
||||
FT_UInt i;
|
||||
|
||||
|
||||
funcs->set_scale( internal->topfont,
|
||||
@ -309,7 +309,7 @@
|
||||
for ( i = font->num_subfonts; i > 0; i-- )
|
||||
{
|
||||
CFF_SubFont sub = font->subfonts[i - 1];
|
||||
FT_ULong sub_upm = sub->font_dict.units_per_em;
|
||||
FT_Long sub_upm = (FT_Long)sub->font_dict.units_per_em;
|
||||
FT_Pos x_scale, y_scale;
|
||||
|
||||
|
||||
@ -592,7 +592,7 @@
|
||||
/* Note that this is only necessary for pure CFF and CEF fonts; */
|
||||
/* SFNT based fonts use the `name' table instead. */
|
||||
|
||||
cffface->num_glyphs = cff->num_glyphs;
|
||||
cffface->num_glyphs = (FT_Long)cff->num_glyphs;
|
||||
|
||||
dict = &cff->top_font.font_dict;
|
||||
|
||||
@ -646,7 +646,7 @@
|
||||
|
||||
if ( temp != 0x10000L )
|
||||
{
|
||||
*upm = FT_DivFix( *upm, temp );
|
||||
*upm = (FT_ULong)FT_DivFix( (FT_Long)*upm, temp );
|
||||
|
||||
matrix->xx = FT_DivFix( matrix->xx, temp );
|
||||
matrix->yx = FT_DivFix( matrix->yx, temp );
|
||||
@ -682,7 +682,8 @@
|
||||
if ( top->has_font_matrix )
|
||||
{
|
||||
if ( top->units_per_em > 1 && sub->units_per_em > 1 )
|
||||
scaling = FT_MIN( top->units_per_em, sub->units_per_em );
|
||||
scaling = (FT_Long)FT_MIN( top->units_per_em,
|
||||
sub->units_per_em );
|
||||
else
|
||||
scaling = 1;
|
||||
|
||||
@ -693,9 +694,10 @@
|
||||
&top->font_matrix,
|
||||
scaling );
|
||||
|
||||
sub->units_per_em = FT_MulDiv( sub->units_per_em,
|
||||
top->units_per_em,
|
||||
scaling );
|
||||
sub->units_per_em = (FT_ULong)
|
||||
FT_MulDiv( (FT_Long)sub->units_per_em,
|
||||
(FT_Long)top->units_per_em,
|
||||
scaling );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -713,7 +715,7 @@
|
||||
|
||||
if ( temp != 0x10000L )
|
||||
{
|
||||
*upm = FT_DivFix( *upm, temp );
|
||||
*upm = (FT_ULong)FT_DivFix( (FT_Long)*upm, temp );
|
||||
|
||||
matrix->xx = FT_DivFix( matrix->xx, temp );
|
||||
matrix->yx = FT_DivFix( matrix->yx, temp );
|
||||
@ -733,13 +735,13 @@
|
||||
|
||||
|
||||
/* set up num_faces */
|
||||
cffface->num_faces = cff->num_faces;
|
||||
cffface->num_faces = (FT_Long)cff->num_faces;
|
||||
|
||||
/* compute number of glyphs */
|
||||
if ( dict->cid_registry != 0xFFFFU )
|
||||
cffface->num_glyphs = cff->charset.max_cid + 1;
|
||||
cffface->num_glyphs = (FT_Long)( cff->charset.max_cid + 1 );
|
||||
else
|
||||
cffface->num_glyphs = cff->charstrings_index.count;
|
||||
cffface->num_glyphs = (FT_Long)cff->charstrings_index.count;
|
||||
|
||||
/* set global bbox, as well as EM size */
|
||||
cffface->bbox.xMin = dict->font_bbox.xMin >> 16;
|
||||
@ -763,7 +765,8 @@
|
||||
(FT_Short)( dict->underline_thickness >> 16 );
|
||||
|
||||
/* retrieve font family & style name */
|
||||
cffface->family_name = cff_index_get_name( cff, face_index );
|
||||
cffface->family_name = cff_index_get_name( cff,
|
||||
(FT_UInt)face_index );
|
||||
if ( cffface->family_name )
|
||||
{
|
||||
char* full = cff_index_get_sid_string( cff,
|
||||
|
@ -129,7 +129,7 @@
|
||||
FT_Long* scaling )
|
||||
{
|
||||
FT_Byte* p = start;
|
||||
FT_UInt nib;
|
||||
FT_Int nib;
|
||||
FT_UInt phase;
|
||||
|
||||
FT_Long result, number, exponent;
|
||||
@ -166,7 +166,7 @@
|
||||
}
|
||||
|
||||
/* Get the nibble. */
|
||||
nib = ( p[0] >> phase ) & 0xF;
|
||||
nib = (FT_Int)( p[0] >> phase ) & 0xF;
|
||||
phase = 4 - phase;
|
||||
|
||||
if ( nib == 0xE )
|
||||
@ -559,7 +559,7 @@
|
||||
offset->x = cff_parse_fixed_scaled( data++, scaling );
|
||||
offset->y = cff_parse_fixed_scaled( data, scaling );
|
||||
|
||||
*upm = power_tens[scaling];
|
||||
*upm = (FT_ULong)power_tens[scaling];
|
||||
|
||||
FT_TRACE4(( " [%f %f %f %f %f %f]\n",
|
||||
(double)matrix->xx / *upm / 65536,
|
||||
|
@ -835,14 +835,14 @@
|
||||
/* add one or more stems to the current hints table */
|
||||
static void
|
||||
ps_hints_stem( PS_Hints hints,
|
||||
FT_Int dimension,
|
||||
FT_UInt count,
|
||||
FT_UInt dimension,
|
||||
FT_Int count,
|
||||
FT_Long* stems )
|
||||
{
|
||||
if ( !hints->error )
|
||||
{
|
||||
/* limit "dimension" to 0..1 */
|
||||
if ( dimension < 0 || dimension > 1 )
|
||||
if ( dimension > 1 )
|
||||
{
|
||||
FT_TRACE0(( "ps_hints_stem: invalid dimension (%d) used\n",
|
||||
dimension ));
|
||||
@ -891,7 +891,7 @@
|
||||
/* add one Type1 counter stem to the current hints table */
|
||||
static void
|
||||
ps_hints_t1stem3( PS_Hints hints,
|
||||
FT_Int dimension,
|
||||
FT_UInt dimension,
|
||||
FT_Fixed* stems )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
@ -906,7 +906,7 @@
|
||||
|
||||
|
||||
/* limit "dimension" to 0..1 */
|
||||
if ( dimension < 0 || dimension > 1 )
|
||||
if ( dimension > 1 )
|
||||
{
|
||||
FT_TRACE0(( "ps_hints_t1stem3: invalid dimension (%d) used\n",
|
||||
dimension ));
|
||||
@ -1128,7 +1128,7 @@
|
||||
|
||||
static void
|
||||
t1_hints_stem( T1_Hints hints,
|
||||
FT_Int dimension,
|
||||
FT_UInt dimension,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Pos stems[2];
|
||||
@ -1172,12 +1172,12 @@
|
||||
|
||||
static void
|
||||
t2_hints_stems( T2_Hints hints,
|
||||
FT_Int dimension,
|
||||
FT_UInt dimension,
|
||||
FT_Int count,
|
||||
FT_Fixed* coords )
|
||||
{
|
||||
FT_Pos stems[32], y, n;
|
||||
FT_Int total = count;
|
||||
FT_Pos stems[32], y;
|
||||
FT_Int total = count, n;
|
||||
|
||||
|
||||
y = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user