* src/tools/ftrandom.c (font_size): New global variable.

(TestFace): Use it.
(main): Handle new option `--size' to set `font_size'.
(Usage): Updated.

Formatting.
This commit is contained in:
Werner Lemberg 2007-06-17 05:31:23 +00:00
parent 815911ae2a
commit e12ed563d6
5 changed files with 56 additions and 30 deletions

View File

@ -1,14 +1,24 @@
2006-06-17 Werner Lemberg <wl@gnu.org>
* src/tools/ftrandom.c (font_size): New global variable.
(TestFace): Use it.
(main): Handle new option `--size' to set `font_size'.
(Usage): Updated.
2006-06-16 David Turner <david@freetype.org>
* src/smooth/ftgrays.c (gray_hline): prevent integer overflows
when rendering *very* large outlines
* src/smooth/ftgrays.c (gray_find_cell, gray_set_cell, gray_hline):
Prevent integer overflows when rendering very large outlines.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): check the well-formedness
of the contours array when loading a glyph
* src/truetype/ttinterp.c (Ins_IP): check argument ranges to reject
bogus operations properly
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check the
well-formedness of the contours array when loading a glyph.
* src/truetype/ttinterp.c (TT_Load_Context): Initialize `zp0', `zp1',
and `zp2'.
(Ins_IP): Check argument ranges to reject bogus operations properly.
(IUP_WorkerRec): Add `max_points' member.
(_iup_worker_interpolate): Check argument ranges.
(Ins_IUP): Ignore empty outlines.
2006-06-16 Dmitry Timoshkov <dmitry@codeweavers.com>

View File

@ -197,7 +197,7 @@
#define ONE_PIXEL ( 1L << PIXEL_BITS )
#define PIXEL_MASK ( -1L << PIXEL_BITS )
#define TRUNC( x ) ( (TCoord)((x) >> PIXEL_BITS) )
#define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) )
#define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS )
#define FLOOR( x ) ( (x) & -ONE_PIXEL )
#define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )
@ -397,7 +397,8 @@
PCell *pcell, cell;
int x = ras.ex;
if (x > ras.max_ex)
if ( x > ras.max_ex )
x = ras.max_ex;
pcell = &ras.ycells[ras.ey];
@ -465,7 +466,7 @@
/* min_ex - 1 horizontal position. */
ey -= ras.min_ey;
if (ex > ras.max_ex)
if ( ex > ras.max_ex )
ex = ras.max_ex;
ex -= ras.min_ex;
@ -1206,7 +1207,7 @@
x += (TCoord)ras.min_ex;
/* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
if (x >= 32768)
if ( x >= 32768 )
x = 32767;
if ( coverage )

View File

@ -84,6 +84,8 @@
static int error_count = 1;
static int error_fraction = 0;
static FT_F26Dot6 font_size = 12 * 64;
static struct fontlist
{
char* name;
@ -156,7 +158,7 @@
if ( nohints )
load_flags |= FT_LOAD_NO_HINTING;
FT_Set_Char_Size( face, 0, (int)( 12 * 64 ), 72, 72 );
FT_Set_Char_Size( face, 0, font_size, 72, 72 );
for ( gid = 0; gid < face->num_glyphs; ++gid )
{
@ -543,6 +545,7 @@
fprintf( out, " --nohints Turn off hinting.\n" );
fprintf( out, " --rasterize Attempt to rasterize each glyph.\n" );
fprintf( out, " --results <dir> Directory in which to place the test fonts.\n" );
fprintf( out, " --size <float> Use the given font size for the tests.\n" );
fprintf( out, " --test <file> Run a single test on an already existing file.\n" );
}
@ -611,6 +614,15 @@
rasterize = true;
else if ( strcmp( pt, "-results" ) == 0 )
results_dir = argv[++i];
else if ( strcmp( pt, "-size" ) == 0 )
{
font_size = (FT_F26Dot6)( strtod( argv[++i], &end ) * 64 );
if ( *end != '\0' || font_size < 64 )
{
fprintf( stderr, "Bad value for size: %s\n", argv[i] );
exit( 1 );
}
}
else if ( strcmp( pt, "-test" ) == 0 )
testfile = argv[++i];
else

View File

@ -264,16 +264,16 @@
cont_limit = cont + n_contours;
/* check space for contours array + instructions count */
if ( n_contours >= 0xFFF || p + (n_contours + 1) * 2 > limit )
if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit )
goto Invalid_Outline;
cont[0] = prev_cont = FT_NEXT_USHORT( p );
for ( cont++; cont < cont_limit; cont++ )
{
cont[0] = FT_NEXT_USHORT( p );
if (cont[0] > prev_cont)
if ( cont[0] > prev_cont )
{
/* unordered contours, this is invalid */
/* unordered contours: this is invalid */
error = FT_Err_Invalid_Table;
goto Fail;
}
@ -591,13 +591,14 @@
FT_UInt start_point,
FT_UInt start_contour )
{
zone->n_points = (FT_UShort)( load->outline.n_points - start_point );
zone->n_contours = (FT_Short) ( load->outline.n_contours - start_contour );
zone->org = load->extra_points + start_point;
zone->cur = load->outline.points + start_point;
zone->orus = load->extra_points2 + start_point;
zone->tags = (FT_Byte*)load->outline.tags + start_point;
zone->contours = (FT_UShort*)load->outline.contours + start_contour;
zone->n_points = (FT_UShort)( load->outline.n_points - start_point );
zone->n_contours = (FT_Short) ( load->outline.n_contours -
start_contour );
zone->org = load->extra_points + start_point;
zone->cur = load->outline.points + start_point;
zone->orus = load->extra_points2 + start_point;
zone->tags = (FT_Byte*)load->outline.tags + start_point;
zone->contours = (FT_UShort*)load->outline.contours + start_contour;
zone->first_point = (FT_UShort)start_point;
}
@ -1336,11 +1337,11 @@
/* this provides additional offsets */
/* for each component's translation */
if ( (error = TT_Vary_Get_Glyph_Deltas(
face,
glyph_index,
&deltas,
gloader->current.num_subglyphs + 4 )) != 0 )
if ( ( error = TT_Vary_Get_Glyph_Deltas(
face,
glyph_index,
&deltas,
gloader->current.num_subglyphs + 4 )) != 0 )
goto Exit;
subglyph = gloader->current.subglyphs + gloader->base.num_subglyphs;

View File

@ -620,6 +620,7 @@
exec->pts.n_points = 0;
exec->pts.n_contours = 0;
exec->zp1 = exec->pts;
exec->zp2 = exec->pts;
exec->zp0 = exec->pts;
@ -6151,7 +6152,7 @@
*/
twilight = CUR.GS.gep0 == 0 || CUR.GS.gep1 == 0 || CUR.GS.gep2 == 0;
if ( BOUNDS(CUR.GS.rp1, CUR.zp0.n_points) )
if ( BOUNDS( CUR.GS.rp1, CUR.zp0.n_points ) )
{
if ( CUR.pedantic_hinting )
CUR.error = TT_Err_Invalid_Reference;
@ -6302,8 +6303,8 @@
if ( p1 > p2 )
return;
if ( BOUNDS(ref1, worker->max_points) ||
BOUNDS(ref2, worker->max_points) )
if ( BOUNDS( ref1, worker->max_points ) ||
BOUNDS( ref2, worker->max_points ) )
return;
orus1 = worker->orus[ref1].x;
@ -6404,6 +6405,7 @@
FT_UNUSED_ARG;
/* ignore empty outlines */
if ( CUR.pts.n_contours == 0 )
return;