various updates to reduce the compilation warnings

This commit is contained in:
David Turner 2000-05-02 17:41:41 +00:00
parent d89489210a
commit d186a361a1
14 changed files with 621 additions and 419 deletions

View File

@ -187,6 +187,9 @@ else
$(OBJ_)ftgrays2.$O: $(SRC_DIR_)ftgrays2.c
$(COMPILE) $T$@ $<
$(OBJ_)ftrast.$O: $(SRC_DIR_)ftrast.c
$(COMPILE) $T$@ $<
$(OBJ_)fttry.$O: $(SRC_DIR_)fttry.c
$(COMPILE) $T$@ $<
@ -261,7 +264,7 @@ else
$(LINK)
$(BIN_)ftview$E: $(OBJ_)ftview.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)
$(BIN_)ftview$E: $(OBJ_)ftview.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ) $(OBJ_)ftrast.$O
$(GRAPH_LINK)
$(BIN_)ftstring$E: $(OBJ_)ftstring.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)

View File

@ -20,7 +20,7 @@
*
******************************************************************/
#include "frast.h"
#include "ftrast.h"
#include <ftcalc.h> /* for FT_MulDiv only */
/****************************************************************/
@ -44,17 +44,20 @@
/* The default render pool size */
#define RASTER_RENDER_POOL 8192
/* XXXXX */
#define FT_CONFIG_OPTION_GRAY_SCALING
/* The size of the two-lines intermediate bitmap used */
/* for anti-aliasing */
#define RASTER_GRAY_LINES 1024
#define Raster_Err_None TT_Err_Ok
#define Raster_Err_Not_Ini TT_Err_Raster_Not_Initialized
#define Raster_Err_Overflow TT_Err_Raster_Pool_Overflow
#define Raster_Err_Neg_Height TT_Err_Raster_Negative_Height
#define Raster_Err_Invalid TT_Err_Raster_Invalid_Value
#define Raster_Err_Gray_Unsupported TT_Err_Raster_Gray_Unsupported
#define Raster_Err_None 0
#define Raster_Err_Not_Ini -1
#define Raster_Err_Overflow -2
#define Raster_Err_Neg_Height -3
#define Raster_Err_Invalid -4
#define Raster_Err_Gray_Unsupported -5
#define Raster_Err_Unsupported -6
/* FMulDiv means "Fast MulDiv", it is uses in case where 'b' is typically */
/* a small value and the result of (a*b) is known to fit in 32 bits. */
@ -86,7 +89,13 @@
#define NULL (void*)0
#endif
#ifndef SUCCESS
#define SUCCESS 0
#endif
#ifndef FAILURE
#define FAILURE 1
#endif
#define MaxBezier 32 /* The maximum number of stacked Bezier curves. */
@ -148,7 +157,7 @@
{
FT_F26Dot6 X; /* current coordinate during sweep */
PProfile link; /* link to next profile - various purpose */
PStorage offset; /* start of profile's data in render pool */
PLong offset; /* start of profile's data in render pool */
Int flow; /* Profile orientation: Asc/Descending */
Long height; /* profile's height in scanlines */
Long start; /* profile's starting scanline */
@ -274,11 +283,6 @@
FT_Error error;
PByte flags; /* current flags table */
PUShort outs; /* current outlines table */
UShort nPoints; /* number of points in current glyph */
Short nContours; /* number of contours in current glyph */
Int numTurns; /* number of Y-turns in outline */
TPoint* arc; /* current Bezier arc pointer */
@ -302,7 +306,8 @@
/* of impact */
TStates state; /* rendering state */
FT_Bitmap target; /* description of target bit/pixmap */
FT_Bitmap target; /* description of target bit/pixmap */
FT_Outline outline;
Long traceOfs; /* current offset in target bitmap */
Long traceG; /* current offset in target pixmap */
@ -319,8 +324,6 @@
Function_Sweep_Span* Proc_Sweep_Drop;
Function_Sweep_Step* Proc_Sweep_Step;
FT_Vector* coords;
Byte dropOutControl; /* current drop_out control method */
Byte grays[5]; /* Palette of gray levels used for render */
@ -348,6 +351,19 @@
Int count_table[256]; /* Look-up table used to quickly count */
/* set bits in a gray 2x2 cell */
void* memory;
#if 0
PByte flags; /* current flags table */
PUShort outs; /* current outlines table */
FT_Vector* coords;
UShort nPoints; /* number of points in current glyph */
Short nContours; /* number of contours in current glyph */
#endif
};
@ -437,12 +453,12 @@
switch ( aState )
{
case Ascending:
ras.cProfile->flow = FT_Flow_Up;
ras.cProfile->flow = Flow_Up;
FT_TRACE7(( "New ascending profile = %lx\n", (long)ras.cProfile ));
break;
case Descending:
ras.cProfile->flow = FT_Flow_Down;
ras.cProfile->flow = Flow_Down;
FT_TRACE7(( "New descending profile = %lx\n", (long)ras.cProfile ));
break;
@ -541,7 +557,7 @@
static
Bool Insert_Y_Turn( RAS_ARGS Int y )
{
PStorage y_turns;
PLong y_turns;
Int y2, n;
n = ras.numTurns-1;
@ -611,14 +627,14 @@
switch ( p->flow )
{
case FT_Flow_Down:
case Flow_Down:
bottom = p->start - p->height+1;
top = p->start;
p->start = bottom;
p->offset += p->height-1;
break;
case FT_Flow_Up:
case Flow_Up:
default:
bottom = p->start;
top = p->start + p->height-1;
@ -720,35 +736,6 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* Push_Cubic */
/* */
/* <Description> */
/* Clears the Bezier stack and pushes a new third-order Bezier arc on */
/* top of it. */
/* */
/* <Input> */
/* p2 :: A pointer to the second (control) point. */
/* p3 :: A pointer to the third (control) point. */
/* p4 :: A pointer to the fourth (end) point. */
/* */
/* <Note> */
/* The first point is taken as `raster->last', so it doesn't appear */
/* in the signature. */
/* */
/* This is the same as Push_Conic(), except that it deals with */
/* third-order Beziers. */
/* */
static
static void Push_Cubic( RAS_ARGS Long x1, Long y1,
Long x2, Long y2,
Long x3, Long y3,
Long x4, Long y4 )
{
}
/****************************************************************************/
/* */
@ -772,7 +759,7 @@
Int e1, e2, f1, f2, size; /* XXX: is `Short' sufficient? */
Long Ix, Rx, Ax;
PStorage top;
PLong top;
Dx = x2 - x1;
@ -913,7 +900,7 @@
TPoint* arc;
TPoint* start_arc;
PStorage top;
PLong top;
arc = ras.arc;
@ -1138,7 +1125,7 @@
Long cx,
Long cy )
{
Long y1, y2, y3, x3;
Long y1, y2, y3, x3, ymin, ymax;
TStates state_bez;
@ -1192,18 +1179,18 @@
goto Fail;
/* create a new profile */
if ( New_Profile( RAS_VAR_ state_bez ) )
if ( New_Profile( RAS_VARS state_bez ) )
goto Fail;
}
/* now call the appropriate routine */
if ( state_bez == Ascending )
{
if ( Bezier_Up( RAS_VAR_ 2, Split_Conic, ras.minY, ras.maxY ) )
if ( Bezier_Up( RAS_VARS 2, Split_Conic, ras.minY, ras.maxY ) )
goto Fail;
}
else
if ( Bezier_Down( RAS_VAR_ 2, Split_Conic, ras.minY, ras.maxY ) )
if ( Bezier_Down( RAS_VARS 2, Split_Conic, ras.minY, ras.maxY ) )
goto Fail;
}
@ -1213,6 +1200,8 @@
ras.lastY = y3;
return SUCCESS;
Fail:
return FAILURE;
}
/****************************************************************************/
@ -1226,11 +1215,10 @@
Long y,
Long cx1,
Long cy1,
Lonc cx2,
Long cx2,
Long cy2 )
{
TPos y1, y2, y3, y4, x4, ymin1, ymax1, ymin2, ymax2;
Long y0, y1, y2, y3, x3;
Long y1, y2, y3, y4, x4, ymin1, ymax1, ymin2, ymax2;
TStates state_bez;
@ -1295,25 +1283,25 @@
End_Profile( RAS_VAR ) )
goto Fail;
if ( New_Profile( RAS_VAR_ state_bez ) )
if ( New_Profile( RAS_VARS state_bez ) )
goto Fail;
}
/* compute intersections */
if ( state_bez == Ascending )
{
if ( Bezier_Up ( RAS_VAR_ 3, Split_Cubic, ras.minY, ras.maxY ) )
if ( Bezier_Up ( RAS_VARS 3, Split_Cubic, ras.minY, ras.maxY ) )
goto Fail;
}
else
if ( Bezier_Down ( RAS_VAR_ 3, Split_Cubic, ras.minY, ras.maxY ) )
if ( Bezier_Down ( RAS_VARS 3, Split_Cubic, ras.minY, ras.maxY ) )
goto Fail;
}
} while ( ras.arc >= ras.arcs );
ras.lastX = x4
ras.lastY = y4
ras.lastX = x4;
ras.lastY = y4;
return SUCCESS;
Fail:
@ -1356,9 +1344,6 @@
FT_Vector* limit;
char* tags;
int n; /* index of contour in outline */
int first; /* index of first point in contour */
int error;
char tag; /* current point's state */
points = ras.outline.points;
@ -1377,7 +1362,7 @@
v_control = v_start;
point = points + first;
tags = ras.outline->tags + first;
tags = ras.outline.tags + first;
tag = FT_CURVE_TAG( tags[0] );
/* A contour cannot start with a cubic control point! */
@ -1388,7 +1373,7 @@
if ( tag == FT_Curve_Tag_Conic )
{
/* first point is conic control. Yes, this happens. */
if ( FT_CURVE_TAG( ras.outline->tags[last] ) == FT_Curve_Tag_On )
if ( FT_CURVE_TAG( ras.outline.tags[last] ) == FT_Curve_Tag_On )
{
/* start at last point if it is on the curve */
v_start = v_last;
@ -1515,17 +1500,16 @@
/* close the contour with a line segment */
if (Line_To( RAS_VARS v_start.x, v_start.y ))
goto Fail;
}
Close:
return SUCCESS;
Close:
return SUCCESS;
Invalid_Outline:
ras.error = Raster_Err_Invalid;
Invalid_Outline:
ras.error = Raster_Err_Invalid;
Fail:
return FAILURE;
}
Fail:
return FAILURE;
}
/****************************************************************************/
/* */
@ -1565,15 +1549,15 @@ Fail:
start = 0;
for ( i = 0; i < ras.nContours; i++ )
for ( i = 0; i < ras.outline.n_contours; i++ )
{
ras.state = Unknown;
ras.gProfile = NULL;
if ( Decompose_Curve( RAS_VARS start, ras.outs[i], flipped ) )
if ( Decompose_Curve( RAS_VARS start, ras.outline.contours[i], flipped ) )
return FAILURE;
start = ras.outs[i] + 1;
start = ras.outline.contours[i] + 1;
/* We must now see if the extreme arcs join or not */
if ( ( FRAC( ras.lastY ) == 0 &&
@ -1775,18 +1759,15 @@ Fail:
static void Vertical_Sweep_Init( RAS_ARGS Short* min, Short* max )
{
switch ( ras.target.flow )
{
case FT_Flow_Up:
ras.traceOfs = *min * ras.target.cols;
ras.traceIncr = ras.target.cols;
break;
default:
ras.traceOfs = ( ras.target.rows - 1 - *min ) * ras.target.cols;
ras.traceIncr = -ras.target.cols;
}
Long pitch = ras.target.pitch;
(void)max;
ras.traceIncr = - pitch;
ras.traceOfs = - *min * pitch;
if (ras.traceIncr > 0)
ras.traceOfs += (ras.target.rows-1)*pitch;
ras.gray_min_x = 0;
ras.gray_max_x = 0;
}
@ -1800,9 +1781,12 @@ Fail:
{
Long e1, e2;
Short c1, c2;
Short f1, f2;
Byte f1, f2;
Byte* target;
(void)y;
(void)left;
(void)right;
/* Drop-out control */
@ -1821,25 +1805,32 @@ Fail:
c1 = (Short)(e1 >> 3);
c2 = (Short)(e2 >> 3);
f1 = e1 & 7;
f2 = e2 & 7;
f1 = ((unsigned char)0xFF >> (e1 & 7));
f2 = ~((unsigned char)0x7F >> (e2 & 7));
if ( ras.gray_min_x > c1 ) ras.gray_min_x = c1;
if ( ras.gray_max_x < c2 ) ras.gray_max_x = c2;
target = ras.bTarget + ras.traceOfs + c1;
c2 -= c1;
if ( c1 != c2 )
if ( c2 > 0 )
{
*target |= LMask[f1];
target[0] |= f1;
if ( c2 > c1 + 1 )
MEM_Set( target + 1, 0xFF, c2 - c1 - 1 );
target[c2 - c1] |= RMask[f2];
/* memset() is slower than the following code on many platforms. */
/* This is due to the fact that, in the vast majority of cases, */
/* the span length in bytes is relatively small. */
c2--;
while ( c2 > 0 )
{
*(++target) = 0xFF;
c2--;
}
target[1] |= f2;
}
else
*target |= ( LMask[f1] & RMask[f2] );
*target |= ( f1 & f2 );
}
}
@ -1947,7 +1938,7 @@ Fail:
if ( ras.gray_min_x > c1 ) ras.gray_min_x = c1;
if ( ras.gray_max_x < c1 ) ras.gray_max_x = c1;
ras.bTarget[ras.traceOfs + c1] |= (Char)(0x80 >> f1);
ras.bTarget[ras.traceOfs + c1] |= (char)(0x80 >> f1);
}
}
@ -1970,6 +1961,9 @@ Fail:
static void Horizontal_Sweep_Init( RAS_ARGS Short* min, Short* max )
{
/* nothing, really */
(void)raster;
(void)min;
(void)max;
}
@ -1983,7 +1977,9 @@ Fail:
PByte bits;
Byte f1;
(void)left;
(void)right;
if ( x2-x1 < ras.precision )
{
e1 = CEILING( x1 );
@ -1998,10 +1994,13 @@ Fail:
if ( e1 >= 0 && e1 < ras.target.rows )
{
if ( ras.target.flow == FT_Flow_Down )
bits[(ras.target.rows-1 - e1) * ras.target.cols] |= f1;
else
bits[e1 * ras.target.cols] |= f1;
PByte p;
p = bits - e1*ras.target.pitch;
if (ras.target.pitch > 0)
p += (ras.target.rows-1)*ras.target.pitch;
p[0] |= f1;
}
}
}
@ -2009,10 +2008,15 @@ Fail:
e2 = TRUNC( e2 );
if ( e2 >= 0 && e2 < ras.target.rows )
if ( ras.target.flow == FT_Flow_Down )
bits[(ras.target.rows-1-e2) * ras.target.cols] |= f1;
else
bits[e2 * ras.target.cols] |= f1;
{
PByte p;
p = bits - e2*ras.target.pitch;
if (ras.target.pitch > 0)
p += (ras.target.rows-1)*ras.target.pitch;
p[0] |= f1;
}
#endif
}
@ -2072,10 +2076,9 @@ Fail:
bits = ras.bTarget + (y >> 3);
f1 = (Byte)(0x80 >> (y & 7));
if ( ras.target.flow == FT_Flow_Down )
bits += (ras.target.rows-1-e1) * ras.target.cols;
else
bits += e1 * ras.target.cols;
bits -= e1*ras.target.pitch;
if (ras.target.pitch > 0)
bits += (ras.target.rows-1)*ras.target.pitch;
if ( e1 >= 0 &&
e1 < ras.target.rows &&
@ -2104,10 +2107,11 @@ Fail:
if ( e1 >= 0 && e1 < ras.target.rows )
{
if (ras.target.flow==FT_Flow_Down)
bits[(ras.target.rows-1-e1) * ras.target.cols] |= f1;
else
bits[e1 * ras.target.cols] |= f1;
bits -= e1*ras.target.pitch;
if (ras.target.pitch > 0)
bits += (ras.target.rows-1)*ras.target.pitch;
bits[0] |= f1;
}
}
@ -2115,6 +2119,7 @@ Fail:
static void Horizontal_Sweep_Step( RAS_ARG )
{
/* Nothing, really */
(void)raster;
}
@ -2139,25 +2144,24 @@ Fail:
static void Vertical_Gray_Sweep_Init( RAS_ARGS Short* min, Short* max )
{
Long pitch, byte_len;
*min = *min & -2;
*max = ( *max + 3 ) & -2;
ras.traceOfs = 0;
switch ( ras.target.flow )
ras.traceOfs = 0;
pitch = ras.target.pitch;
byte_len = -pitch;
ras.traceIncr = byte_len;
ras.traceG = (*min/2)*byte_len;
if (pitch > 0)
{
case FT_Flow_Up:
ras.traceG = (*min / 2) * ras.target.cols;
ras.traceIncr = ras.target.cols;
break;
default:
ras.traceG = (ras.target.rows-1 - *min/2) * ras.target.cols;
ras.traceIncr = -ras.target.cols;
ras.traceG += (ras.target.rows-1)*pitch;
byte_len = -byte_len;
}
ras.gray_min_x = ras.target.cols;
ras.gray_max_x = -ras.target.cols;
ras.gray_min_x = byte_len;
ras.gray_max_x = -byte_len;
}
@ -2195,10 +2199,10 @@ Fail:
if ( c2 )
{
pix[0] = grays[(c2 & 0xF000) >> 12];
pix[1] = grays[(c2 & 0x0F00) >> 8];
pix[2] = grays[(c2 & 0x00F0) >> 4];
pix[3] = grays[(c2 & 0x000F) ];
pix[0] = grays[(c2 >> 12) & 0x000F];
pix[1] = grays[(c2 >> 8 ) & 0x000F];
pix[2] = grays[(c2 >> 4 ) & 0x000F];
pix[3] = grays[ c2 & 0x000F];
*bit = 0;
*bit2 = 0;
@ -2214,8 +2218,8 @@ Fail:
ras.traceOfs = 0;
ras.traceG += ras.traceIncr;
ras.gray_min_x = ras.target.cols;
ras.gray_max_x = -ras.target.cols;
ras.gray_min_x = 32000;
ras.gray_max_x = -32000;
}
}
@ -2227,6 +2231,12 @@ Fail:
PProfile right )
{
/* nothing, really */
(void)raster;
(void)y;
(void)x1;
(void)x2;
(void)left;
(void)right;
}
static void Horizontal_Gray_Sweep_Drop( RAS_ARGS Short y,
@ -2299,12 +2309,9 @@ Fail:
e1 = TRUNC( e1 ) / 2;
if ( e1 < ras.target.rows )
{
if ( ras.target.flow == FT_Flow_Down )
pixel = ras.gTarget +
(ras.target.rows - 1 - e1) * ras.target.cols + y / 2;
else
pixel = ras.gTarget +
e1 * ras.target.cols + y / 2;
pixel = ras.gTarget - e1*ras.target.pitch + y/2;
if (ras.target.pitch > 0)
pixel += (ras.target.rows-1)*ras.target.pitch;
if (pixel[0] == ras.grays[0])
pixel[0] = color;
@ -2410,8 +2417,8 @@ Fail:
switch ( P->flow )
{
case FT_Flow_Up: InsNew( &draw_left, P ); break;
case FT_Flow_Down: InsNew( &draw_right, P ); break;
case Flow_Up: InsNew( &draw_left, P ); break;
case Flow_Down: InsNew( &draw_right, P ); break;
}
}
@ -2642,40 +2649,14 @@ Scan_DropOuts :
/****************************************************************************/
LOCAL_FUNC
FT_Error Render_Glyph( RAS_ARGS FT_Outline* glyph,
FT_Raster_Map* target_map )
FT_Error Render_Glyph( RAS_ARG )
{
FT_Error error;
if ( glyph->n_points == 0 || glyph->n_contours <= 0 )
return FT_Err_Ok;
if ( !ras.buff )
{
ras.error = Raster_Err_Not_Ini;
return ras.error;
}
if ( glyph->n_points < glyph->contours[glyph->n_contours - 1] )
{
ras.error = FT_Err_Too_Many_Points;
return ras.error;
}
if ( target_map )
ras.target = *target_map;
ras.outs = glyph->contours;
ras.flags = glyph->flags;
ras.nPoints = glyph->n_points;
ras.nContours = glyph->n_contours;
ras.coords = glyph->points;
Set_High_Precision( RAS_VARS glyph->high_precision );
Set_High_Precision( RAS_VARS ras.outline.flags & ft_outline_high_precision );
ras.scale_shift = ras.precision_shift;
ras.dropOutControl = glyph->dropout_mode;
ras.second_pass = glyph->second_pass;
ras.dropOutControl = 2;
ras.second_pass = !(ras.outline.flags & ft_outline_single_pass);
/* Vertical Sweep */
@ -2689,7 +2670,7 @@ Scan_DropOuts :
ras.band_stack[0].y_max = ras.target.rows - 1;
ras.bWidth = ras.target.width;
ras.bTarget = (Byte*)ras.target.bitmap;
ras.bTarget = (Byte*)ras.target.buffer;
if ( (error = Render_Single_Pass( RAS_VARS 0 )) != 0 )
return error;
@ -2715,8 +2696,6 @@ Scan_DropOuts :
}
#ifdef FT_CONFIG_OPTION_GRAY_SCALING
/****************************************************************************/
/* */
/* Function: Render_Gray_Glyph */
@ -2731,28 +2710,12 @@ Scan_DropOuts :
/****************************************************************************/
LOCAL_FUNC
FT_Error Render_Gray_Glyph( RAS_ARGS FT_Outline* glyph,
FT_Raster_Map* target_map,
Byte* palette )
FT_Error Render_Gray_Glyph( RAS_ARG )
{
Int i;
Long byte_len;
FT_Error error;
if ( !ras.buff )
{
ras.error = Raster_Err_Not_Ini;
return ras.error;
}
if ( glyph->n_points == 0 || glyph->n_contours <= 0 )
return FT_Err_Ok;
if ( glyph->n_points < glyph->contours[glyph->n_contours - 1] )
{
ras.error = FT_Err_Too_Many_Points;
return ras.error;
}
#if 0
if ( palette )
{
for ( i = 0; i < 5; i++ )
@ -2761,17 +2724,12 @@ Scan_DropOuts :
if ( target_map )
ras.target = *target_map;
#endif
ras.outs = glyph->contours;
ras.flags = glyph->flags;
ras.nPoints = glyph->n_points;
ras.nContours = glyph->n_contours;
ras.coords = glyph->points;
Set_High_Precision( RAS_VARS glyph->high_precision );
Set_High_Precision( RAS_VARS ras.outline.flags & ft_outline_high_precision );
ras.scale_shift = ras.precision_shift+1;
ras.dropOutControl = glyph->dropout_mode;
ras.second_pass = glyph->second_pass;
ras.dropOutControl = 2;
ras.second_pass = !(ras.outline.flags & ft_outline_single_pass);
/* Vertical Sweep */
@ -2781,12 +2739,17 @@ Scan_DropOuts :
ras.band_stack[0].y_max = 2 * ras.target.rows - 1;
ras.bWidth = ras.gray_width;
if ( ras.bWidth > ras.target.cols/4 )
ras.bWidth = ras.target.cols/4;
byte_len = ras.target.pitch;
if (byte_len < 0)
byte_len = -byte_len;
if ( ras.bWidth > byte_len/4 )
ras.bWidth = byte_len/4;
ras.bWidth = ras.bWidth * 8;
ras.bTarget = (Byte*)ras.gray_lines;
ras.gTarget = (Byte*)ras.target.bitmap;
ras.gTarget = (Byte*)ras.target.buffer;
ras.Proc_Sweep_Init = Vertical_Gray_Sweep_Init;
ras.Proc_Sweep_Span = Vertical_Sweep_Span;
@ -2818,9 +2781,9 @@ Scan_DropOuts :
return FT_Err_Ok;
}
#endif /* FT_CONFIG_OPTION_GRAY_SCALING */
#if 0
/************************************************/
/* */
/* InitRasterizer */
@ -2900,6 +2863,131 @@ Scan_DropOuts :
return FT_Err_Ok;
}
#endif
/**** RASTER OBJECT CREATION : in standalone mode, we simply use *****/
/**** a static object .. *****/
#ifdef _STANDALONE_
static
int ft_black_new( void* memory, FT_Raster *araster )
{
static FT_RasterRec_ the_raster;
*araster = &the_raster;
memset( &the_raster, sizeof(the_raster), 0 );
return 0;
}
static
void ft_black_done( FT_Raster raster )
{
/* nothing */
raster->init = 0;
}
#else
#include <ftobjs.h>
static
int ft_black_new( FT_Memory memory, TRaster_Instance* *araster )
{
FT_Error error;
TRaster_Instance* raster;
*araster = 0;
if ( !ALLOC( raster, sizeof(*raster) ))
{
raster->memory = memory;
*araster = raster;
}
return error;
}
static
void ft_black_done( TRaster_Instance* raster )
{
FT_Memory memory = (FT_Memory)raster->memory;
FREE( raster );
}
#endif
static void ft_black_reset( TRaster_Instance* raster,
const char* pool_base,
long pool_size )
{
if ( raster && pool_base && pool_size >= 4096 )
{
/* save the pool */
raster->buff = (PLong)pool_base;
raster->sizeBuff = raster->buff + pool_size / sizeof (Long);
}
}
static
int ft_black_render( TRaster_Instance* raster,
FT_Raster_Params* params )
{
FT_Outline* outline = (FT_Outline*)params->source;
FT_Bitmap* target_map = params->target;
if ( !raster || !raster->buff || !raster->sizeBuff )
return Raster_Err_Not_Ini;
if ( !outline || !outline->contours || !outline->points )
return Raster_Err_Invalid;
/* return immediately if the outline is empty */
if ( outline->n_points == 0 || outline->n_contours <= 0 )
return Raster_Err_None;
if ( outline->n_points != outline->contours[outline->n_contours - 1] + 1 )
return Raster_Err_Invalid;
if ( !target_map || !target_map->buffer )
return Raster_Err_Invalid;
/* this version of the raster does not support direct rendering, sorry */
if ( params->flags & ft_raster_flag_direct )
return Raster_Err_Unsupported;
ras.outline = *outline;
ras.target = *target_map;
return ( params->flags & ft_raster_flag_aa
? Render_Glyph( raster )
: Render_Gray_Glyph( raster ) );
#if 0
/* Note that we always use drop-out mode 2, because it seems that */
/* it's the only way to do to get results consistent with Windows */
/* rendering.. */
ras.dropout_mode = 2;
ras.second_pass = (outline->flags & ft_outline_single_pass) == 0;
SET_High_Precision( (char)((outline->flags & ft_outline_high_precision)!= 0) );
return ( params->flags & ft_raster_flag_aa
? Raster_Render8( raster )
: Raster_Render1( raster ) );
#endif
}
FT_Raster_Funcs ft_black_raster =
{
ft_glyph_format_outline,
(FT_Raster_New_Func) ft_black_new,
(FT_Raster_Reset_Func) ft_black_reset,
(FT_Raster_Set_Mode_Func) 0,
(FT_Raster_Render_Func) ft_black_render,
(FT_Raster_Done_Func) ft_black_done
};
/* END */

View File

@ -267,7 +267,11 @@ $\243^\250*\265\371%!\247:/;.,?<>";
i = first_glyph;
#if 0
while ( i < first_glyph+1 )
#else
while ( i < num_glyphs )
#endif
{
if ( !(error = LoadChar( i, hinted )) )
{

View File

@ -1151,6 +1151,8 @@ int check_sort( PCell cells, int count )
TScan x, y, cover, area;
PCell start, cur, limit;
(void)target;
cur = ras.cells;
limit = cur + ras.num_cells;

View File

@ -52,10 +52,19 @@
/* */
/*************************************************************************/
#define OLD
#define xxxDEBUG_RAS
#ifdef DEBUG_RAS
#include <stdio.h>
#endif
#include <ftraster.h>
#ifndef _STANDALONE_
#include <ftconfig.h>
#include <ftdebug.h>
#endif
#ifndef EXPORT_FUNC
@ -115,41 +124,6 @@
#define FT_RASTER_CUBIC_BEZIERS
/*************************************************************************/
/* */
/* FT_RASTER_ANTI_ALIAS_5 */
/* */
/* Define this configuration macro if you want to enable the 5-grays */
/* anti-aliasing mode. Ignored if FT_RASTER_OPTION_ANTI_ALIAS isn't */
/* defined. */
/* */
#define FT_RASTER_ANTI_ALIAS_5
/*************************************************************************/
/* */
/* FT_RASTER_ANTI_ALIAS_17 */
/* */
/* Define this configuration macro if you want to enable the 17-grays */
/* anti-aliasing mode. Ignored if FT_RASTER_OPTION_ANTI_ALIAS isn't */
/* defined. */
/* */
/* #define FT_RASTER_ANTI_ALIAS_17 */
/*************************************************************************/
/* */
/* FT_RASTER_LITTLE_ENDIAN */
/* FT_RASTER_BIG_ENDIAN */
/* */
/* The default anti-alias routines are processor-independent, but */
/* slow. Define one of these macros to suit your own system, and */
/* enjoy greatly improved rendering speed. */
/* */
/* #define FT_RASTER_LITTLE_ENDIAN */
/* #define FT_RASTER_BIG_ENDIAN */
/*************************************************************************/
/* */
/* FT_RASTER_CONSTANT_PRECISION */
@ -162,7 +136,7 @@
/* This results in a speed boost, but the macro can be undefined if */
/* it results in rendering errors (mainly changed drop-outs).. */
/* */
#define FT_RASTER_CONSTANT_PRECISION
#undef FT_RASTER_CONSTANT_PRECISION
/*************************************************************************/
@ -188,7 +162,7 @@
/* constant, as it speeds things a bit while keeping a very good */
/* accuracy on the bezier intersections.. */
/* */
#define FT_DYNAMIC_BEZIER_STEPS
#undef FT_DYNAMIC_BEZIER_STEPS
#else /* _STANDALONE_ */
@ -223,16 +197,20 @@
#define FT_RASTER_BIG_ENDIAN
#endif
#define FT_RASTER_CONSTANT_PRECISION
#define FT_DYNAMIC_BEZIER_STEPS
#undef FT_RASTER_CONSTANT_PRECISION
#undef FT_DYNAMIC_BEZIER_STEPS
#define FT_PRECISION_BITS 8
#endif /* _STANDALONE_ */
/* to keep the compiler happy */
#ifndef PTRACE2
#define PTRACE2(x) /*void*/
#ifndef FT_TRACE2
#define FT_TRACE2(x) /*void*/
#endif
#ifndef FT_TRACE4
#define FT_TRACE4(x) /* void */
#endif
/*************************************************************************/
@ -302,6 +280,7 @@
/* `->' */
#define ras (*raster)
#define UNUSED_RASTER (void)raster;
/*************************************************************************/
/* */
@ -706,7 +685,6 @@
long o;
long x;
x = ras.cursor[-1];
switch ( ras.cur_prof->flow )
@ -1001,7 +979,7 @@
int n;
PTRACE2(( "EXTREMA += %d", y ));
FT_TRACE2(( "EXTREMA += %d", y ));
n = ras.n_extrema - 1;
extrema = ras.pool_size - ras.n_extrema;
@ -1069,7 +1047,7 @@
switch ( p->flow )
{
case Flow_Down:
PTRACE2(( "FLOW DOWN (start = %d, height = %d)",
FT_TRACE2(( "FLOW DOWN (start = %d, height = %d)",
p->start, p->height ));
bottom = p->start - p->height+1;
top = p->start;
@ -1079,7 +1057,7 @@
case Flow_Up:
default:
PTRACE2(( "FLOW UP (start = %d, height = %d)",
FT_TRACE2(( "FLOW UP (start = %d, height = %d)",
p->start, p->height ));
bottom = p->start;
top = p->start + p->height-1;
@ -1099,6 +1077,19 @@
return SUCCESS;
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** COMPUTE SCAN-LINE INTERSECTIONS FROM SEGMENTS ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
@ -1154,6 +1145,11 @@
/* clip to lower scanline when necessary */
if ( y1 < miny )
{
#ifdef OLD
x1 += FT_MulDiv( Dx, miny-y1, Dy );
e1 = TRUNC( miny );
f1 = 0;
#else
TPos x, y;
/* we use a binary search to compute the lower
@ -1182,6 +1178,7 @@
e1 = TRUNC( miny );
f1 = 0;
#endif
}
else
{
@ -1223,6 +1220,22 @@
return FAILURE;
}
#ifdef OLD
if ( Dx > 0 )
{
Ix = ( PRECISION*Dx ) / Dy;
Rx = ( PRECISION*Dx ) % Dy;
Dx = 1;
}
else
{
Ix = -( (PRECISION*-Dx) / Dy );
Rx = (PRECISION*-Dx) % Dy;
Dx = -1;
}
Ax = -Dy;
#else
/* compute decision variables and push the intersections on top */
/* of the render pool */
Dx <<= PRECISION_BITS;
@ -1237,6 +1250,7 @@
Ax = -Dy;
Rx <<= 1;
Dy <<= 1;
#endif
top = ras.cursor;
@ -1251,7 +1265,11 @@
if ( Ax >= 0 )
{
Ax -= Dy;
#ifdef OLD
x1 += Dx;
#else
x1 ++;
#endif
}
size--;
}
@ -1416,10 +1434,18 @@
e2 = FLOOR( y2 ); /* integer end y */
#ifdef OLD
if ( e2 > maxy )
e2 = maxy;
e0 = miny;
#else
if ( e2 > maxy )
e2 = FLOOR(maxy);
e0 = CEILING(miny);
#endif
if ( y1 < miny )
{
@ -1466,6 +1492,7 @@
return FAILURE;
}
#ifdef FT_DYNAMIC_BEZIER_STEPS
/* compute dynamic bezier step threshold */
threshold = Dynamic_Bezier_Threshold( RAS_VAR_ degree, arc );
@ -1487,7 +1514,11 @@
{
y1 = arc[degree].y; /* start y of top-most arc */
#ifdef OLD
if ( y2-y1 >= PRECISION_STEP )
#else
if ( y2 >= e + PRECISION || y2 - y1 >= threshold )
#endif
{
/* if the arc's height is too great, split it */
splitter( arc );
@ -1573,6 +1604,19 @@
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** SPLITTING CONIC AND CUBIC BEZIERS IN HALF ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
#ifdef FT_RASTER_CONIC_BEZIERS
/*************************************************************************/
@ -1608,60 +1652,7 @@
base[2].y = ( a + b ) / 2;
}
/*************************************************************************/
/* */
/* <Function> */
/* Push_Conic */
/* */
/* <Description> */
/* Clears the Bezier stack and pushes a new arc on top of it. */
/* */
/* <Input> */
/* p2 :: A pointer to the second (control) point. */
/* p3 :: A pointer to the third (end) point. */
/* */
/* <Note> */
/* The first point is taken as `raster->last', so it doesn't appear */
/* in the signature. */
/* */
static
void Push_Conic( RAS_ARG_ FT_Vector* p2,
FT_Vector* p3 )
{
#undef STORE
#define STORE( _arc, point ) \
{ \
TPos x = SCALED( point->x ); \
TPos y = SCALED( point->y ); \
\
\
if ( ras.flipped ) \
{ \
_arc.x = y; \
_arc.y = x; \
} \
else \
{ \
_arc.x = x; \
_arc.y = y; \
} \
}
TPoint* arc;
ras.arc = arc = ras.arcs;
arc[2] = ras.last;
STORE( arc[1], p2 );
STORE( arc[0], p3 );
#undef STORE
}
#endif /* FT_RASTER_CONIC_BEZIERS */
#endif
#ifdef FT_RASTER_CUBIC_BEZIERS
@ -1705,63 +1696,21 @@
base[3].y = ( a + b + 1 ) >> 1;
}
#endif /* FT_RASTER_CUBIC_BEZIERS */
/*************************************************************************/
/* */
/* <Function> */
/* Push_Cubic */
/* */
/* <Description> */
/* Clears the Bezier stack and pushes a new third-order Bezier arc on */
/* top of it. */
/* */
/* <Input> */
/* p2 :: A pointer to the second (control) point. */
/* p3 :: A pointer to the third (control) point. */
/* p4 :: A pointer to the fourth (end) point. */
/* */
/* <Note> */
/* The first point is taken as `raster->last', so it doesn't appear */
/* in the signature. */
/* */
/* This is the same as Push_Conic(), except that it deals with */
/* third-order Beziers. */
/* */
static
void Push_Cubic( RAS_ARG_ FT_Vector* p2,
FT_Vector* p3,
FT_Vector* p4 )
{
#undef STORE
#define STORE( _arc, point ) \
{ \
TPos x = SCALED( point->x ); \
TPos y = SCALED( point->y ); \
\
if ( ras.flipped ) \
{ \
_arc.x = y; \
_arc.y = x; \
} \
else \
{ \
_arc.x = x; \
_arc.y = y; \
} \
}
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** PROCESSING OUTLINE SEGMENTS ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
TPoint* arc;
ras.arc = arc = ras.arcs;
arc[3] = ras.last;
STORE( arc[2], p2 );
STORE( arc[1], p3 );
STORE( arc[0], p4 );
#undef STORE
}
#endif /* FT_RASTER_CUBIC_BEZIERS */
/*************************************************************************/
@ -1945,6 +1894,56 @@
#ifdef FT_RASTER_CONIC_BEZIERS
/*************************************************************************/
/* */
/* <Function> */
/* Push_Conic */
/* */
/* <Description> */
/* Clears the Bezier stack and pushes a new arc on top of it. */
/* */
/* <Input> */
/* p2 :: A pointer to the second (control) point. */
/* p3 :: A pointer to the third (end) point. */
/* */
/* <Note> */
/* The first point is taken as `raster->last', so it doesn't appear */
/* in the signature. */
/* */
static
void Push_Conic( RAS_ARG_ FT_Vector* p2,
FT_Vector* p3 )
{
#undef STORE
#define STORE( _arc, point ) \
{ \
TPos x = SCALED( point->x ); \
TPos y = SCALED( point->y ); \
\
\
if ( ras.flipped ) \
{ \
_arc.x = y; \
_arc.y = x; \
} \
else \
{ \
_arc.x = x; \
_arc.y = y; \
} \
}
TPoint* arc;
ras.arc = arc = ras.arcs;
arc[2] = ras.last;
STORE( arc[1], p2 );
STORE( arc[0], p3 );
#undef STORE
}
/*************************************************************************/
/* */
@ -2063,12 +2062,66 @@
return ErrRaster_Invalid_Outline;
}
#endif /* FT_RASTER_CONIC_BEZIERS */
#ifdef FT_RASTER_CUBIC_BEZIERS
/*************************************************************************/
/* */
/* <Function> */
/* Push_Cubic */
/* */
/* <Description> */
/* Clears the Bezier stack and pushes a new third-order Bezier arc on */
/* top of it. */
/* */
/* <Input> */
/* p2 :: A pointer to the second (control) point. */
/* p3 :: A pointer to the third (control) point. */
/* p4 :: A pointer to the fourth (end) point. */
/* */
/* <Note> */
/* The first point is taken as `raster->last', so it doesn't appear */
/* in the signature. */
/* */
/* This is the same as Push_Conic(), except that it deals with */
/* third-order Beziers. */
/* */
static
void Push_Cubic( RAS_ARG_ FT_Vector* p2,
FT_Vector* p3,
FT_Vector* p4 )
{
#undef STORE
#define STORE( _arc, point ) \
{ \
TPos x = SCALED( point->x ); \
TPos y = SCALED( point->y ); \
\
if ( ras.flipped ) \
{ \
_arc.x = y; \
_arc.y = x; \
} \
else \
{ \
_arc.x = x; \
_arc.y = y; \
} \
}
TPoint* arc;
ras.arc = arc = ras.arcs;
arc[3] = ras.last;
STORE( arc[2], p2 );
STORE( arc[1], p3 );
STORE( arc[0], p4 );
#undef STORE
}
/*************************************************************************/
/* */
@ -2480,12 +2533,17 @@
/* Drop-out control */
e1 = TRUNC( CEILING( x1 ) );
if ( x2 - x1 - PRECISION <= PRECISION_JITTER )
e2 = e1;
else
e2 = TRUNC( FLOOR( x2 ) );
#ifdef OLD
if ( e2 >= 0 && e1 < ras.bit_width )
#else
if ( e1 <= e2 && e2 >= 0 && e1 < ras.bit_width )
#endif
{
if ( e1 < 0 ) e1 = 0;
if ( e2 >= ras.bit_width ) e2 = ras.bit_width - 1;
@ -2916,6 +2974,7 @@
int Vertical_Gray_Test_Pixel( RAS_ARG_ TScan y,
int x )
{
UNUSED_RASTER
UNUSED( y );
#if 0
@ -3163,6 +3222,7 @@
return ( x >= 0 && x < ras.target.rows &&
*pixel >= 64 );
#else
UNUSED_RASTER
UNUSED(y);
UNUSED(x);
return 0;
@ -3321,6 +3381,9 @@
TProfileList wait;
TProfileList draw;
#ifdef DEBUG_RAS
int y_set = 0;
#endif
/* Init empty linked lists */
Init_Linked( &wait );
@ -3355,9 +3418,9 @@
}
/* Now inits the sweep */
PTRACE2(( "draw_sweep: initialize sweep\n" ));
FT_TRACE2(( "draw_sweep: initialize sweep\n" ));
ras.render.init( RAS_VAR_ &min_Y, &max_Y );
PTRACE2(( " init min_y = %d, max_y = %d\n", min_Y, max_Y ));
FT_TRACE2(( " init min_y = %d, max_y = %d\n", min_Y, max_Y ));
/* Then compute the distance of each profile from min_Y */
P = wait;
@ -3375,7 +3438,7 @@
ras.pool_size[-ras.n_extrema] == min_Y )
ras.n_extrema--;
PTRACE2(( "starting loop with n_extrema = %d", ras.n_extrema ));
FT_TRACE2(( "starting loop with n_extrema = %d", ras.n_extrema ));
while ( ras.n_extrema > 0 )
{
PProfile prof = wait;
@ -3404,7 +3467,7 @@
y_change = ras.pool_size[-ras.n_extrema--];
y_height = y_change - y;
PTRACE2(( ">>> y = %d, y_change = %d, y_height = %d",
FT_TRACE2(( ">>> y = %d, y_change = %d, y_height = %d",
y, y_change, y_height ));
while ( y < y_change )
@ -3423,7 +3486,7 @@
window = left->flow;
prof = left->link;
PTRACE2(( ">>> line y = %d", y ));
FT_TRACE2(( ">>> line y = %d", y ));
while ( prof )
{
@ -3463,7 +3526,15 @@
}
}
PTRACE2(( "drawing span ( y=%d, x1=%d, x2=%d )", y, x1, x2 ));
FT_TRACE2(( "drawing span ( y=%d, x1=%d, x2=%d )", y, x1, x2 ));
#ifdef DEBUG_RAS
if (!y_set)
{
y_set = 1;
fprintf( stderr, "%3d", y );
}
fprintf( stderr, " [%.2f-%.2f]", x1*1.0/PRECISION, x2*1.0/PRECISION );
#endif
ras.render.span( RAS_VAR_ y, x1, x2 );
Skip_To_Next:
@ -3482,16 +3553,23 @@
ras.render.step( RAS_VAR );
y++;
#ifdef DEBUG_RAS
if (y_set)
{
fprintf( stderr, "\n" );
y_set = 0;
}
#endif
if ( y < y_change )
Sort( &draw );
PTRACE2(( "line sorted for next operation" ));
FT_TRACE4(( "line sorted for next operation" ));
}
/* Now finalize the profiles that needs it */
PTRACE2(( "finalizing profiles..." ));
FT_TRACE2(( "finalizing profiles..." ));
{
PProfile prof, next;
@ -3505,7 +3583,7 @@
}
}
PTRACE2(( "profiles finalized for this run" ));
FT_TRACE2(( "profiles finalized for this run" ));
}
/* for gray-scaling, flushes the bitmap scanline cache */
@ -3543,9 +3621,18 @@ Scan_DropOuts :
left = ( ras.flipped ? P_Right : P_Left );
right = ( ras.flipped ? P_Left : P_Right );
PTRACE2(( "performing drop-out control ( x1= %d, x2 = %d )",
FT_TRACE2(( "performing drop-out control ( x1= %d, x2 = %d )",
x1, x2 ));
#ifdef DEBUG_RAS
if (!y_set)
{
y_set = 1;
fprintf( stderr, "%3d", y );
}
fprintf( stderr, " <%.2f-%.2f>", P_Left->X*1.0/PRECISION, P_Right->X*1.0/PRECISION );
#endif
e1 = CEILING( x1 );
e2 = FLOOR ( x2 );
@ -3611,7 +3698,7 @@ Scan_DropOuts :
goto Next_Dropout;
}
PTRACE2(( " -> setting pixel" ));
FT_TRACE2(( " -> setting pixel" ));
ras.render.set_pixel( RAS_VAR_ y,
TRUNC( e1 ),
(x2 - x1) >> ras.scale_shift );
@ -3647,7 +3734,7 @@ Scan_DropOuts :
band = ras.band_stack;
PTRACE2(( "raster: entering render_single_pass (flipped = %d)\n",
FT_TRACE2(( "raster: entering render_single_pass (flipped = %d)\n",
flipped ));
while ( band >= ras.band_stack )
@ -3658,7 +3745,7 @@ Scan_DropOuts :
ras.cursor = ras.pool;
ras.error = 0;
PTRACE2(( "raster: band = [ %d, %d ]\n",
FT_TRACE2(( "raster: band = [ %d, %d ]\n",
band[0].y_min,
band[0].y_max ));
@ -3671,7 +3758,7 @@ Scan_DropOuts :
return FAILURE;
ras.error = ErrRaster_Ok;
PTRACE2(( "conversion failure, performing sub-banding\n" ));
FT_TRACE2(( "conversion failure, performing sub-banding\n" ));
/* sub-banding */
@ -3698,7 +3785,7 @@ Scan_DropOuts :
}
else
{
PTRACE2(( "conversion succeeded, span drawing sweep\n" ));
FT_TRACE2(( "conversion succeeded, span drawing sweep\n" ));
#if 1 /* for debugging */
if ( ras.start_prof )
if ( Draw_Sweep( RAS_VAR ) )
@ -3708,7 +3795,7 @@ Scan_DropOuts :
}
}
PTRACE2(( "raster: exiting render_single_pass\n" ));
FT_TRACE2(( "raster: exiting render_single_pass\n" ));
return SUCCESS; /* success */
}

View File

@ -68,6 +68,9 @@ typedef struct FT_Frame_Field_
#define FT_MAKE_EMPTY_FIELD( frame_op ) { frame_op, 0, 0 }
#define FT_FRAME_START(s) { ft_frame_start, 0, s }
#define FT_FRAME_END { ft_frame_end, 0, 0 }
#define FT_FRAME_LONG(s,f) FT_FRAME_FIELD( ft_frame_long_be, s, f )
#define FT_FRAME_ULONG(s,f) FT_FRAME_FIELD( ft_frame_ulong_be, s, f )
#define FT_FRAME_SHORT(s,f) FT_FRAME_FIELD( ft_frame_short_be, s, f )

View File

@ -151,10 +151,10 @@
#ifdef READ_FIELDS
const FT_Frame_Field ttc_header_fields[] = {
{ ft_frame_start, 0, 8 }, /* frame of 8 bytes */
FT_FRAME_START(8), /* frame of 8 bytes */
FT_FRAME_LONG( TTC_Header, version ),
FT_FRAME_LONG( TTC_Header, DirCount ),
{ ft_frame_end, 0, 0 } };
FT_FRAME_END };
#endif
FT_TRACE2(( "TT_Load_Format_Tag(%08lx, %ld )\n",
@ -256,12 +256,12 @@
FT_Memory memory = stream->memory;
#ifdef READ_FIELDS
const FT_Frame_Field table_dir_fields[] = {
{ ft_frame_start, 0, 8 },
FT_FRAME_START(8),
FT_FRAME_USHORT( TT_TableDir, numTables ),
FT_FRAME_USHORT( TT_TableDir, searchRange ),
FT_FRAME_USHORT( TT_TableDir, entrySelector ),
FT_FRAME_USHORT( TT_TableDir, rangeShift ),
{ ft_frame_end, 0 , 0 } };
FT_FRAME_END };
#endif
TT_TableDir tableDir;
@ -438,8 +438,8 @@
TT_Error error;
TT_Header* header;
#ifdef READ_FIELDS
const FT_Frame_Field header_fields[] = {
{ ft_frame_start, 0, 54 },
static const FT_Frame_Field header_fields[] = {
FT_FRAME_START(54),
FT_FRAME_ULONG( TT_Header, Table_Version ),
FT_FRAME_ULONG( TT_Header, Font_Revision ),
FT_FRAME_LONG( TT_Header, CheckSum_Adjust ),
@ -459,7 +459,7 @@
FT_FRAME_SHORT( TT_Header, Font_Direction ),
FT_FRAME_SHORT( TT_Header, Index_To_Loc_Format ),
FT_FRAME_SHORT( TT_Header, Glyph_Data_Format ),
{ ft_frame_end } };
FT_FRAME_END };
#endif
FT_TRACE2(( "Load_TT_Header( %08lx )\n", (TT_Long)face ));
@ -539,7 +539,7 @@
TT_MaxProfile* maxProfile = &face->max_profile;
#ifdef READ_FIELDS
const FT_Frame_Field maxp_fields[] = {
{ ft_frame_start, 0, 32 },
FT_FRAME_START(32),
FT_FRAME_ULONG( TT_MaxProfile, version ),
FT_FRAME_USHORT( TT_MaxProfile, numGlyphs ),
FT_FRAME_USHORT( TT_MaxProfile, maxPoints ),
@ -555,7 +555,7 @@
FT_FRAME_USHORT( TT_MaxProfile, maxSizeOfInstructions ),
FT_FRAME_USHORT( TT_MaxProfile, maxComponentElements ),
FT_FRAME_USHORT( TT_MaxProfile, maxComponentDepth ),
{ ft_frame_end } };
FT_FRAME_END };
#endif
FT_TRACE2(( "Load_TT_MaxProfile( %08lx )\n", (TT_Long)face ));
@ -785,7 +785,7 @@
TT_HoriHeader* header;
#ifdef READ_FIELDS
const FT_Frame_Field metrics_header_fields[] = {
{ ft_frame_start, 0, 36 },
FT_FRAME_START(36),
FT_FRAME_ULONG( TT_HoriHeader, Version ),
FT_FRAME_SHORT( TT_HoriHeader, Ascender ),
FT_FRAME_SHORT( TT_HoriHeader, Descender ),
@ -803,7 +803,7 @@
FT_FRAME_SHORT( TT_HoriHeader, Reserved[4] ),
FT_FRAME_SHORT( TT_HoriHeader, metric_Data_Format ),
FT_FRAME_USHORT( TT_HoriHeader, number_Of_HMetrics ),
{ ft_frame_end } };
FT_FRAME_END };
#endif
FT_TRACE2(( vertical ? "Vertical header " : "Horizontal header " ));
@ -909,11 +909,11 @@
TT_NameTable* names;
#ifdef READ_FIELDS
const FT_Frame_Field name_table_fields[] = {
{ ft_frame_start, 0, 6 },
FT_FRAME_START(6),
FT_FRAME_USHORT( TT_NameTable, format ),
FT_FRAME_USHORT( TT_NameTable, numNameRecords ),
FT_FRAME_USHORT( TT_NameTable, storageOffset ),
{ ft_frame_end } };
FT_FRAME_END };
const FT_Frame_Field name_record_fields[] = {
FT_FRAME_USHORT( TT_NameRec, platformID ),
@ -922,7 +922,7 @@
FT_FRAME_USHORT( TT_NameRec, nameID ),
FT_FRAME_USHORT( TT_NameRec, stringLength ),
FT_FRAME_USHORT( TT_NameRec, stringOffset ),
{ ft_frame_end } };
FT_FRAME_END };
#endif
@ -1103,17 +1103,17 @@
#ifdef READ_FIELDS
const FT_Frame_Field cmap_fields[] = {
{ ft_frame_start, 0, 4 },
FT_FRAME_START(4),
FT_FRAME_USHORT( TT_CMapDir, tableVersionNumber ),
FT_FRAME_USHORT( TT_CMapDir, numCMaps ),
{ ft_frame_end } };
FT_FRAME_END };
const FT_Frame_Field cmap_rec_fields[] = {
{ ft_frame_start, 0, 6 },
FT_FRAME_START(6),
FT_FRAME_USHORT( TT_CMapTable, format ),
FT_FRAME_USHORT( TT_CMapTable, length ),
FT_FRAME_USHORT( TT_CMapTable, version ),
{ ft_frame_end } };
FT_FRAME_END };
#endif
FT_TRACE2(( "CMaps " ));
@ -1219,7 +1219,7 @@
TT_OS2* os2;
#ifdef READ_FIELDS
const FT_Frame_Field os2_fields[] = {
{ ft_frame_start, 0, 78 },
FT_FRAME_START(78),
FT_FRAME_USHORT( TT_OS2, version ),
FT_FRAME_SHORT( TT_OS2, xAvgCharWidth ),
FT_FRAME_USHORT( TT_OS2, usWeightClass ),
@ -1263,22 +1263,22 @@
FT_FRAME_SHORT( TT_OS2, sTypoLineGap ),
FT_FRAME_USHORT( TT_OS2, usWinAscent ),
FT_FRAME_USHORT( TT_OS2, usWinDescent ),
{ ft_frame_end } };
FT_FRAME_END };
const FT_Frame_Field os2_fields_extra[] = {
{ ft_frame_start, 0, 8 },
FT_FRAME_START(8),
FT_FRAME_ULONG( TT_OS2, ulCodePageRange1 ),
FT_FRAME_ULONG( TT_OS2, ulCodePageRange2 ),
{ ft_frame_end } };
FT_FRAME_END };
const FT_Frame_Field os2_fields_extra2[] = {
{ ft_frame_start, 0, 10 },
FT_FRAME_START(10),
FT_FRAME_SHORT( TT_OS2, sxHeight ),
FT_FRAME_SHORT( TT_OS2, sCapHeight ),
FT_FRAME_USHORT( TT_OS2, usDefaultChar ),
FT_FRAME_USHORT( TT_OS2, usBreakChar ),
FT_FRAME_USHORT( TT_OS2, usMaxContext ),
{ ft_frame_end } };
FT_FRAME_END };
#else
TT_Int j;
#endif
@ -1414,7 +1414,7 @@
TT_Postscript* post = &face->postscript;
#ifdef READ_FIELDS
const FT_Frame_Field post_fields[] = {
{ ft_frame_start, 0, 32 },
FT_FRAME_START(32),
FT_FRAME_ULONG( TT_Postscript, FormatType ),
FT_FRAME_ULONG( TT_Postscript, italicAngle ),
FT_FRAME_SHORT( TT_Postscript, underlinePosition ),
@ -1424,7 +1424,7 @@
FT_FRAME_ULONG( TT_Postscript, maxMemType42 ),
FT_FRAME_ULONG( TT_Postscript, minMemType1 ),
FT_FRAME_ULONG( TT_Postscript, maxMemType1 ),
{ ft_frame_end } };
FT_FRAME_END };
#endif
FT_TRACE2(( "PostScript " ));

View File

@ -621,11 +621,12 @@
switch (tag)
{
case ft_sfnt_head: table = &face->header;
case ft_sfnt_hhea: table = &face->horizontal;
case ft_sfnt_vhea: table = (face->vertical_info ? &face->vertical : 0 );
case ft_sfnt_os2: table = (face->os2.version == 0xFFFF ? 0 : &face->os2 );
case ft_sfnt_post: table = &face->postscript;
case ft_sfnt_head: table = &face->header; break;
case ft_sfnt_hhea: table = &face->horizontal; break;
case ft_sfnt_vhea: table = (face->vertical_info ? &face->vertical : 0 ); break;
case ft_sfnt_os2: table = (face->os2.version == 0xFFFF ? 0 : &face->os2 ); break;
case ft_sfnt_post: table = &face->postscript; break;
case ft_sfnt_maxp: table = &face->max_profile; break;
default:
table = 0;
@ -637,6 +638,8 @@
static
FTDriver_Interface tt_get_interface( TT_Driver driver, const char* interface )
{
(void)driver;
if (strcmp(interface,"get_sfnt")==0)
return (FTDriver_Interface)tt_get_sfnt_table;

View File

@ -718,6 +718,7 @@
exec->callTop = 0;
#if 1
(void)debug;
return exec->face->interpreter( exec );
#else
if ( !debug )
@ -2151,6 +2152,8 @@
TT_F26Dot6 W;
TT_Bool S1, S2;
UNUSED_EXEC;
if ( ABS( Vx ) < 0x10000L && ABS( Vy ) < 0x10000L )
{
Vx *= 0x100;

View File

@ -58,6 +58,8 @@
FTDriver_Interface Get_Interface( FT_Driver driver,
const FT_String* interface )
{
UNUSED(driver);
if ( strcmp( (const char*)interface, "attach_file" ) == 0 )
return (FTDriver_Interface)T1_Read_AFM;
@ -141,6 +143,7 @@
T1_UInt vert_resolution )
{
UNUSED(char_width);
UNUSED(char_height);
UNUSED(horz_resolution);
UNUSED(vert_resolution);

View File

@ -58,6 +58,8 @@
FTDriver_Interface Get_Interface( FT_Driver driver,
const FT_String* interface )
{
UNUSED(driver);
if ( strcmp( (const char*)interface, "attach_file" ) == 0 )
return (FTDriver_Interface)T1_Read_AFM;
@ -141,6 +143,7 @@
T1_UInt vert_resolution )
{
UNUSED(char_width);
UNUSED(char_height);
UNUSED(horz_resolution);
UNUSED(vert_resolution);

View File

@ -651,6 +651,8 @@
static
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;

View File

@ -167,8 +167,9 @@
T1_Error error;
PSNames_Interface* psnames;
(void)face_index;
(void)face;
UNUSED(face_index);
UNUSED(face);
UNUSED(stream);
face->root.num_faces = 1;

View File

@ -212,7 +212,7 @@
{
FT_Memory memory = table->memory;
if (table->init == 0xdeadbeef)
if (table->init == (FT_Long)0xdeadbeef)
{
FREE( table->block );
FREE( table->elements );