Formatting.

Adding copyright notices.

Removing an unnecessary file (smooth.h).
This commit is contained in:
Werner Lemberg 2000-07-02 00:27:53 +00:00
parent e0bba32291
commit fbeb41d93d
23 changed files with 290 additions and 206 deletions

View File

@ -1538,7 +1538,7 @@ def dump_glyph_list( file, glyph_list, adobe_extra ):
for name in glyph_list:
write( ' "' + name + '",\n' )
name_list.append(name)
name_list.append( name )
write( "\n" )
write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" )
@ -1546,7 +1546,7 @@ def dump_glyph_list( file, glyph_list, adobe_extra ):
for name in adobe_extra:
write( ' "' + name + '",\n' )
name_list.append(name)
name_list.append( name )
write( "\n" )
write( "#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\n" )

View File

@ -666,7 +666,7 @@
slot->library = driver->root.library;
if ( FT_DRIVER_USES_OUTLINES( driver ) )
error = FT_GlyphLoader_New( memory, &slot->loader );
@ -689,7 +689,7 @@
FREE( slot->bitmap.buffer );
slot->flags &= ~ft_glyph_own_bitmap;
}
/* clear all public fields in the glyph slot */
MEM_Set( &slot->metrics, 0, sizeof ( slot->metrics ) );
MEM_Set( &slot->outline, 0, sizeof ( slot->outline ) );
@ -973,11 +973,11 @@
!( load_flags & FT_LOAD_FORCE_AUTOHINT ) )
autohint = 0;
}
if ( autohint )
{
FT_AutoHinter_Interface* hinting;
hinting = (FT_AutoHinter_Interface*)hinter->clazz->module_interface;
error = hinting->load_glyph( (FT_AutoHinter)hinter, slot, face->size,
@ -1028,7 +1028,7 @@
( load_flags & FT_LOAD_MONOCHROME )
? ft_render_mode_mono
: ft_render_mode_normal );
}
}
Exit:
return error;
@ -2092,7 +2092,7 @@
{
kerning->x = FT_MulFix( kerning->x, face->size->metrics.x_scale );
kerning->y = FT_MulFix( kerning->y, face->size->metrics.y_scale );
if ( kern_mode != ft_kerning_unfitted )
{
kerning->x = ( kerning->x + 32 ) & -64;
@ -2354,7 +2354,7 @@
if ( !result || result->glyph_format != slot->format )
result = FT_Lookup_Renderer( library, slot->format, 0 );
return result;
}
@ -2791,7 +2791,7 @@
/* is the module a auto-hinter? */
if ( FT_MODULE_IS_HINTER( module ) )
library->auto_hinter = module;
/* if the module is a font driver */
if ( FT_MODULE_IS_DRIVER( module ) )
{

View File

@ -493,13 +493,13 @@
FT_Int first = 0;
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1;
if ( outline->n_contours > 1 )
{
first = outline->contours[outline->n_contours - 2] + 1;
p1 = outline->points + first;
}
if ( p1->x == p2->x && p1->y == p2->y )
outline->n_points--;
}
@ -1118,16 +1118,16 @@
FT_TRACE4(( " rlinecurve" ));
if ( num_args < 8 || ( num_args - 6 ) & 1 )
goto Stack_Underflow;
if ( start_point( builder, x, y ) ||
check_points( builder, num_lines + 3 ) )
goto Memory_Error;
args = stack;
/* first, add the line segments */
while ( num_lines > 0 )
{
@ -1137,7 +1137,7 @@
args += 2;
num_lines--;
}
/* then the curve */
x += args[0];
y += args[1];
@ -1148,10 +1148,10 @@
x += args[4];
y += args[5];
add_point( builder, x, y, 1 );
args = stack;
args = stack;
}
break;
case t2_op_rcurveline:
{
FT_Int num_curves = ( num_args - 2 ) / 6;

View File

@ -358,7 +358,7 @@
/* read format */
if ( FILE_Seek( offset ) || READ_Byte( format ) )
goto Exit;
select->format = format;
select->cache_count = 0; /* clear cache */

View File

@ -346,14 +346,14 @@
FT_Int first = 0;
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1;
if ( outline->n_contours > 1 )
{
first = outline->contours[outline->n_contours - 2] + 1;
p1 = outline->points + first;
}
if ( p1->x == p2->x && p1->y == p2->y )
outline->n_points--;
}

View File

@ -516,9 +516,9 @@ error:
"fond", /* driver name */
0x10000L, /* driver version == 1.0 */
0x20000L, /* driver requires FreeType 2.0 or above */
(void*)0,
(FT_Module_Constructor) init_driver,
(FT_Module_Destructor) done_driver,
(FT_Module_Requester) 0

View File

@ -300,7 +300,7 @@
#else
(void*)&psnames_interface, /* module specific interface */
#endif
(FT_Module_Constructor)0,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0

View File

@ -3133,7 +3133,7 @@
raster->gray_width = RASTER_GRAY_LINES / 2;
#endif
#endif
}
@ -3221,7 +3221,7 @@
unsigned long mode,
const char* palette )
{
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
#ifdef FT_RASTER_OPTION_ANTI_ALIASING
if ( mode == FT_MAKE_TAG( 'p', 'a', 'l', '5' ) )
{
@ -3237,9 +3237,9 @@
UNUSED( raster );
UNUSED( mode );
UNUSED( palette );
UNUSED( palette );
#endif
#endif
}

View File

@ -27,7 +27,7 @@
FT_Error ft_raster1_init( FT_Renderer render )
{
FT_Library library = FT_MODULE_LIBRARY( render );
render->clazz->raster_class->raster_reset( render->raster,
library->raster_pool,
@ -35,7 +35,7 @@
return FT_Err_Ok;
}
/* set render-specific mode */
static
@ -47,7 +47,7 @@
return render->clazz->raster_class->raster_set_mode( render->raster,
mode_tag,
data );
}
}
/* transform a given glyph image */
@ -58,20 +58,20 @@
FT_Vector* delta )
{
FT_Error error = FT_Err_Ok;
if ( slot->format != render->glyph_format )
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
if ( matrix )
FT_Outline_Transform( &slot->outline, matrix );
if ( delta )
FT_Outline_Translate( &slot->outline, delta->x, delta->y );
Exit:
return error;
}
@ -87,8 +87,8 @@
if ( slot->format == render->glyph_format )
FT_Outline_Get_CBox( &slot->outline, cbox );
}
}
/* convert a slot's glyph image into a bitmap */
static
@ -103,9 +103,9 @@
FT_UInt width, height, pitch;
FT_Bitmap* bitmap;
FT_Memory memory;
FT_Raster_Params params;
/* check glyph image format */
if ( slot->format != render->glyph_format )
@ -127,16 +127,16 @@
if ( render->clazz == &ft_raster5_renderer_class )
return FT_Err_Cannot_Render_Glyph;
}
outline = &slot->outline;
/* translate the outline to the new origin if needed */
if ( origin )
FT_Outline_Translate( outline, origin->x, origin->y );
/* compute the control box, and grid fit it */
FT_Outline_Get_CBox( outline, &cbox );
cbox.xMin &= -64;
cbox.yMin &= -64;
cbox.xMax = ( cbox.xMax + 63 ) & -64;
@ -146,14 +146,14 @@
height = ( cbox.yMax - cbox.yMin ) >> 6;
bitmap = &slot->bitmap;
memory = render->root.memory;
/* release old bitmap buffer */
if ( slot->flags & ft_glyph_own_bitmap )
{
FREE( bitmap->buffer );
slot->flags &= ~ft_glyph_own_bitmap;
}
/* allocate new one, depends on pixel format */
if ( !( mode & ft_render_mode_mono ) )
{
@ -171,12 +171,12 @@
bitmap->width = width;
bitmap->rows = height;
bitmap->pitch = pitch;
if ( ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
goto Exit;
slot->flags |= ft_glyph_own_bitmap;
/* translate outline to render it into the bitmap */
FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin );
@ -192,7 +192,7 @@
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
slot->format = ft_glyph_format_bitmap;
slot->bitmap_left = cbox.xMin >> 6;
slot->bitmap_top = cbox.yMax >> 6;
@ -207,28 +207,28 @@
{
ft_module_renderer,
sizeof( FT_RendererRec ),
"raster1",
0x10000L,
0x20000L,
0, /* module specific interface */
(FT_Module_Constructor)ft_raster1_init,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0
},
ft_glyph_format_outline,
(FTRenderer_render) ft_raster1_render,
(FTRenderer_transform)ft_raster1_transform,
(FTRenderer_getCBox) ft_raster1_get_cbox,
(FTRenderer_setMode) ft_raster1_set_mode,
(FT_Raster_Funcs*) &ft_standard_raster
};
/* this renderer is _NOT_ part of the default modules, you'll need */
/* to register it by hand in your application. It should only be */
@ -238,20 +238,20 @@
{
ft_module_renderer,
sizeof( FT_RendererRec ),
"raster5",
0x10000L,
0x20000L,
0, /* module specific interface */
(FT_Module_Constructor)ft_raster1_init,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0
},
ft_glyph_format_outline,
(FTRenderer_render) ft_raster1_render,
(FTRenderer_transform)ft_raster1_transform,
(FTRenderer_getCBox) ft_raster1_get_cbox,

View File

@ -48,19 +48,19 @@ RAS1_DRV_H := $(RAS1_DRV_SRC:%.c=%.h)
RAS1_DRV_OBJ_M := $(RAS1_DRV_SRC:$(RAS1_DIR_)%.c=$(OBJ_)%.$O)
RAS1_DRV_OBJ_S := $(OBJ_)raster1.$O
# RASTER1 driver source file for single build
# raster1 driver source file for single build
#
RAS1_DRV_SRC_S := $(RAS1_DIR_)raster1.c
# RASTER1 driver - single object
# raster1 driver - single object
#
$(RAS1_DRV_OBJ_S): $(RAS1_DRV_SRC_S) $(RAS1_DRV_SRC) \
$(FREETYPE_H) $(RAS1_DRV_H)
$(RAS1_COMPILE) $T$@ $(RAS1_DRV_SRC_S)
# RASTER1 driver - multiple objects
# raster1 driver - multiple objects
#
$(OBJ_)%.$O: $(RAS1_DIR_)%.c $(FREETYPE_H) $(RAS1_DRV_H)
$(RAS1_COMPILE) $T$@ $<

View File

@ -156,17 +156,17 @@
{
0, /* not a font driver or renderer */
sizeof( FT_ModuleRec ),
"sfnt", /* driver name */
0x10000L, /* driver version 1.0 */
0x20000L, /* driver requires FreeType 2.0 or higher */
(const void*)&sfnt_interface, /* module specific interface */
(FT_Module_Constructor)0,
(FT_Module_Destructor) 0,
(FT_Module_Requester) SFNT_Get_Interface
};
/* END */

View File

@ -346,8 +346,8 @@
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
/* */
static
FT_UInt code_to_index0( TT_CMapTable* cmap,
FT_ULong charCode )
FT_UInt code_to_index0( TT_CMapTable* cmap,
FT_ULong charCode )
{
TT_CMap0* cmap0 = &cmap->c.cmap0;
@ -389,8 +389,8 @@
if ( char_hi == 0 )
{
/* an 8-bit character code - we use the subHeader 0 in this case */
/* to test whether the character code is in the charmap */
/* an 8-bit character code -- we use the subHeader 0 in this case */
/* to test whether the character code is in the charmap */
if ( cmap2->subHeaderKeys[char_lo] == 0 )
result = cmap2->glyphIdArray[char_lo];
}
@ -452,7 +452,7 @@
/* check against the last segment */
seg4 = cmap4->last_segment;
/* the following is equivalent to performing two tests, as in */
/* */
/* if ( charCode >= seg4->startCount && charCode <= seg4->endCount ) */

View File

@ -63,7 +63,7 @@
(FT_Char)( tag >> 24 ),
(FT_Char)( tag >> 16 ),
(FT_Char)( tag >> 8 ),
(FT_Char)( tag ) ));
(FT_Char)( tag ) ));
entry = face->dir_tables;
limit = entry + face->num_tables;
@ -188,9 +188,9 @@
face->num_tables = 0;
/* first of all, read the first 4 bytes. If it's `ttcf', then the */
/* file is a TrueType collection, otherwise it can be any other */
/* kind of font. */
/* first of all, read the first 4 bytes. If it is `ttcf', then the */
/* file is a TrueType collection, otherwise it can be any other */
/* kind of font. */
if ( READ_ULong( format_tag ) )
goto Exit;
@ -238,8 +238,8 @@
/* now, check the values of `num_tables', `seach_range', etc. */
{
FT_UInt num_tables = sfnt->num_tables;
FT_ULong entry_selector = 1L << sfnt->entry_selector;
FT_UInt num_tables = sfnt->num_tables;
FT_ULong entry_selector = 1L << sfnt->entry_selector;
/* IMPORTANT: Many fonts have an incorrect `search_range' value, so */
@ -547,7 +547,7 @@
goto Exit;
/* XXX: an adjustment that is necessary to load certain */
/* broken fonts like `Keystrokes MT' :-( */
/* broken fonts like `Keystrokes MT' :-( */
/* */
/* We allocate 64 function entries by default when */
/* the maxFunctionDefs field is null. */
@ -613,8 +613,10 @@
TT_LongMetrics** longs;
TT_ShortMetrics** shorts;
FT_TRACE2(( "TT_Load_%s_Metrics: %08p\n",
vertical ? "Vertical" : "Horizontal", face ));
FT_TRACE2(( "TT_Load_%s_Metrics: %08p\n", vertical ? "Vertical"
: "Horizontal",
face ));
if ( vertical )
{
@ -661,7 +663,9 @@
if ( num_shorts < 0 )
{
FT_ERROR(( "!! more metrics than glyphs!\n" ));
FT_ERROR(( "TT_Load_%s_Metrics: more metrics than glyphs!\n",
vertical ? "Vertical"
: "Horizontal" ));
error = vertical ? TT_Err_Invalid_Vert_Metrics
: TT_Err_Invalid_Horiz_Metrics;
@ -787,7 +791,7 @@
}
else
{
/* The horizontal header is mandatory, return an error if we */
/* The horizontal header is mandatory; return an error if we */
/* don't find it. */
error = face->goto_table( face, TTAG_hhea, stream, 0 );
if ( error )
@ -956,7 +960,7 @@
if ( cur->string )
for ( j = 0; j < cur->stringLength; j++ )
{
FT_Char c = *(cur->string + j);
FT_Char c = *( cur->string + j );
if ( (FT_Byte)c < 128 )
@ -1063,7 +1067,7 @@
if ( READ_Fields( cmap_fields, &cmap_dir ) )
goto Exit;
/* save space in face table for cmap tables */
/* reserve space in face table for cmap tables */
if ( ALLOC_ARRAY( face->charmaps,
cmap_dir.numCMaps,
TT_CharMapRec ) )
@ -1215,7 +1219,7 @@
error = face->goto_table( face, TTAG_OS2, stream, 0 );
if ( error )
{
FT_TRACE2(( "is missing\n!" ));
FT_TRACE2(( "is missing!\n" ));
face->os2.version = 0xFFFF;
error = TT_Err_Ok;
goto Exit;
@ -1382,7 +1386,7 @@
/* TT_Load_Gasp */
/* */
/* <Description> */
/* Loads the `GASP' table into a face object. */
/* Loads the `gasp' table into a face object. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
@ -1473,7 +1477,7 @@
FT_UInt n, num_tables, version;
/* the kern table is optional. exit silently if it is missing */
/* the kern table is optional; exit silently if it is missing */
error = face->goto_table( face, TTAG_kern, stream, 0 );
if ( error )
return TT_Err_Ok;

View File

@ -3,7 +3,7 @@
/* ttload.h */
/* */
/* Load the basic TrueType tables, i.e., tables that can be either in */
/* TTF or OTF font (specification). */
/* TTF or OTF fonts (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@ -24,9 +24,6 @@
#include <freetype/internal/ftstream.h>
#include <freetype/internal/tttypes.h>
#if 0
#include <ttobjs.h>
#endif
#ifdef __cplusplus
extern "C" {

View File

@ -43,18 +43,21 @@
#define FT_COMPONENT trace_ttpost
/* If this configuration macro is defined, we rely on the `psnames' */
/* If this configuration macro is defined, we rely on the `PSNames' */
/* module to grab the glyph names. */
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
#include <freetype/internal/psnames.h>
#define MAC_NAME( x ) ( (FT_String*)psnames->macintosh_name( x ) )
#else /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
/* Otherwise, we ignore the `psnames' module, and provide our own */
/* Otherwise, we ignore the `PSNames' module, and provide our own */
/* table of Mac names. Thus, it is possible to build a version of */
/* FreeType without the Type 1 driver & PSNames module. */
@ -144,6 +147,7 @@
"Ccaron", "ccaron", "dmacron",
};
#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
@ -226,9 +230,9 @@
FT_UInt len;
if ( READ_Byte ( len ) ||
ALLOC_ARRAY( name_strings[n], len+1, FT_Char ) ||
FILE_Read ( name_strings[n], len ) )
if ( READ_Byte ( len ) ||
ALLOC_ARRAY( name_strings[n], len + 1, FT_Char ) ||
FILE_Read ( name_strings[n], len ) )
goto Fail1;
name_strings[n][len] = '\0';

View File

@ -139,8 +139,8 @@
acc <<= 8; /* remove bits from accumulator */
loaded -= 8;
count -= 8;
}
while ( count >= 0 );
} while ( count >= 0 );
}
/* restore `count' to correct value */
@ -748,7 +748,7 @@
TT_SBit_Strike** astrike,
FT_ULong* aglyph_offset )
{
TT_SBit_Strike* strike = face->sbit_strikes;
TT_SBit_Strike* strike = face->sbit_strikes;
TT_SBit_Strike* strike_limit = strike + face->num_sbit_strikes;
@ -878,7 +878,6 @@
}
/*************************************************************************/
/* */
/* <Function> */
@ -921,7 +920,7 @@
/***********************************************************************/
/* */
/* first of all, checks the top-most lines of the bitmap, and removes */
/* first of all, check the top-most lines of the bitmap, and remove */
/* them if they're empty. */
/* */
{
@ -954,7 +953,8 @@
{
line = (FT_Byte*)map->buffer;
MEM_Move( line, line + count * line_len, (rows - count) * line_len );
MEM_Move( line, line + count * line_len,
( rows - count ) * line_len );
metrics->height -= count;
metrics->horiBearingY -= count;
@ -970,7 +970,7 @@
/* second, crop the lower lines */
/* */
{
line = (FT_Byte*)map->buffer + (rows - 1) * line_len;
line = (FT_Byte*)map->buffer + ( rows - 1 ) * line_len;
for ( count = 0; count < rows; count++ )
{
@ -1040,6 +1040,7 @@
metrics->horiBearingX++;
metrics->vertBearingX++;
metrics->width--;
} while ( map->width > 0 );
Found_Left:
@ -1067,6 +1068,7 @@
/* crop the whole glyph to the right */
map->width--;
metrics->width--;
} while ( map->width > 0 );
Found_Right:
@ -1253,8 +1255,8 @@
return TT_Err_Invalid_File_Format;
}
/* All right, we're in a compound format. First of all, read */
/* the array of elements */
/* All right, we have a compound format. First of all, read */
/* the array of elements. */
{
TT_SBit_Component* components;
TT_SBit_Component* comp;
@ -1414,6 +1416,8 @@
advance = strike->hori.ascender - strike->hori.descender;
top = advance / 10;
/* some heuristic values */
metrics->vertBearingX = -metrics->width / 2;
metrics->vertBearingY = advance / 10;
metrics->vertAdvance = advance * 12 / 10;

View File

@ -54,9 +54,9 @@
/* understand how it works). */
/* */
/* Note, however, that this is a _very_ different implementation */
/* compared Raph's. Coverage information is stored in a very different */
/* way, and I don't use sorted vector paths. Also, it doesn't use */
/* floating point values. */
/* compared to Raph's. Coverage information is stored in a very */
/* different way, and I don't use sorted vector paths. Also, it */
/* doesn't use floating point values. */
/* */
/* This renderer has the following advantages: */
/* */
@ -94,6 +94,7 @@
#define FT_COMPONENT trace_aaraster
/* XXX: Adapt error code to FreeType conventions */
#define ErrRaster_Invalid_Outline -1
#ifdef _STANDALONE_
@ -227,7 +228,7 @@
#endif /* GRAYS_COMPACT */
typedef struct TRaster_
typedef struct TRaster_
{
PCell cells;
int max_cells;
@ -370,7 +371,7 @@
/* flag to indicate that the cell isn't part of those we're interested */
/* in during the render phase. This means that: */
/* */
/* . the new vertical position must be within min_ey..max_ey - 1. */
/* . the new vertical position must be within min_ey..max_ey-1. */
/* . the new horizontal position must be strictly less than max_ex */
/* */
/* Note that if a cell is to the left of the clipping region, it is */
@ -567,8 +568,8 @@
dx = to_x - ras.x;
dy = to_y - ras.y;
/* we should do something about the trivial case where dx == 0, */
/* as it happens very often! XXXXX */
/* XXX: we should do something about the trivial case where dx == 0, */
/* as it happens very often! */
/* perform vertical clipping */
{
@ -594,7 +595,7 @@
goto End;
}
/* ok, we'll have to render several scanlines */
/* ok, we have to render several scanlines */
p = ( ONE_PIXEL - fy1 ) * dx;
first = ONE_PIXEL;
incr = 1;
@ -928,7 +929,7 @@
Draw:
{
TPos to_x, to_y, mid_x, mid_y;
TPos to_x, to_y, mid_x, mid_y;
to_x = arc[0].x;
@ -949,11 +950,15 @@
/* a macro comparing two cell pointers. Returns true if a <= b. */
#if 1
#define PACK( a ) ( ( (long)(a)->y << 16 ) + (a)->x )
#define LESS_THAN( a, b ) ( PACK( a ) < PACK( b ) )
#else /* 1 */
#define LESS_THAN( a, b ) ( (a)->y < (b)->y || \
( (a)->y == (b)->y && (a)->x < (b)->x ) )
#endif /* 1 */
#define SWAP_CELLS( a, b, temp ) do \
@ -967,8 +972,8 @@
#ifdef SHELL_SORT
/* A simple shell sort algorithm that works directly on our */
/* cells table.. */
/* a simple shell sort algorithm that works directly on our */
/* cells table */
static
void shell_sort ( PCell cells,
int count )
@ -1013,7 +1018,7 @@
/* can even tailor our insertion threshold... */
#define QSORT_THRESHOLD 9 /* below this size, a sub-array will be sorted */
/* through a normal insertion sort.. */
/* through a normal insertion sort */
static
void quick_sort( PCell cells,
@ -1686,8 +1691,8 @@
static
FT_Outline_Funcs interface =
{
(FT_Outline_MoveTo_Func)Move_To,
(FT_Outline_LineTo_Func)Line_To,
(FT_Outline_MoveTo_Func) Move_To,
(FT_Outline_LineTo_Func) Line_To,
(FT_Outline_ConicTo_Func)Conic_To,
(FT_Outline_CubicTo_Func)Cubic_To,
0,
@ -1713,8 +1718,8 @@
if ( ras.max_ex > ras.target.width ) ras.max_ex = ras.target.width;
if ( ras.max_ey > ras.target.rows ) ras.max_ey = ras.target.rows;
/* simple heuristic used to speed-up the bezier decomposition */
/* see the code in render_conic and render_cubic for more details */
/* simple heuristic used to speed-up the bezier decomposition -- see */
/* the code in render_conic() and render_cubic() for more details */
ras.conic_level = 32;
ras.cubic_level = 16;
@ -1841,7 +1846,7 @@
if ( !target_map || !target_map->buffer )
return -1;
/* XXXX: this version does not support monochrome rendering yet! */
/* XXX: this version does not support monochrome rendering yet! */
if ( !(params->flags & ft_raster_flag_aa) )
return ErrRaster_Invalid_Mode;

View File

@ -7,8 +7,8 @@
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
/* modified and distributed under the terms of the FreeType project */
/* 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 */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@ -31,19 +31,22 @@
/*************************************************************************/
/* */
/* To make ftgrays.h independent from configuration files we check */
/* whether FT_EXPORT_DEF has been defined already. */
/* whether FT_EXPORT_DEF has been defined already. */
/* */
/* On some systems and compilers (Win32 mostly), an extra keyword is */
/* necessary to compile the library as a DLL. */
/* */
#ifndef FT_EXPORT_VAR
#define FT_EXPORT_VAR(x) extern x
#define FT_EXPORT_VAR( x ) extern x
#endif
FT_EXPORT_VAR(FT_Raster_Funcs) ft_grays_raster;
FT_EXPORT_VAR( FT_Raster_Funcs ) ft_grays_raster;
#ifdef __cplusplus
}
#endif
#endif
#endif /* FTGRAYS_H */
/* END */

View File

@ -1,72 +1,100 @@
/***************************************************************************/
/* */
/* ftsmooth.c */
/* */
/* Anti-aliasing renderer interface (body). */
/* */
/* Copyright 2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* 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 */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include <freetype/internal/ftobjs.h>
#include <freetype/ftoutln.h>
#include <ftsmooth.h>
#include <ftgrays.h>
/* initialise renderer - init its raster */
static FT_Error ft_smooth_init( FT_Renderer render )
/* initialize renderer -- init its raster */
static
FT_Error ft_smooth_init( FT_Renderer render )
{
FT_Library library = FT_MODULE_LIBRARY(render);
FT_Library library = FT_MODULE_LIBRARY( render );
render->clazz->raster_class->raster_reset( render->raster,
library->raster_pool, library->raster_pool_size );
library->raster_pool,
library->raster_pool_size );
return 0;
}
/* sets render-specific mode */
static FT_Error ft_smooth_set_mode( FT_Renderer render,
FT_ULong mode_tag,
FT_Pointer data )
/* sets render-specific mode */
static
FT_Error ft_smooth_set_mode( FT_Renderer render,
FT_ULong mode_tag,
FT_Pointer data )
{
/* we simply pass it to the raster */
return render->clazz->raster_class->raster_set_mode(
render->raster, mode_tag, data );
return render->clazz->raster_class->raster_set_mode( render->raster,
mode_tag,
data );
}
/* transform a given glyph image */
static FT_Error ft_smooth_transform( FT_Renderer render,
FT_GlyphSlot slot,
FT_Matrix* matrix,
FT_Vector* delta )
/* transform a given glyph image */
static
FT_Error ft_smooth_transform( FT_Renderer render,
FT_GlyphSlot slot,
FT_Matrix* matrix,
FT_Vector* delta )
{
FT_Error error = FT_Err_Ok;
FT_Error error = FT_Err_Ok;
if (slot->format != render->glyph_format)
if ( slot->format != render->glyph_format )
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
if (matrix)
if ( matrix )
FT_Outline_Transform( &slot->outline, matrix );
if (delta)
if ( delta )
FT_Outline_Translate( &slot->outline, delta->x, delta->y );
Exit:
return error;
}
/* return the glyph's control box */
static void ft_smooth_get_cbox( FT_Renderer render,
FT_GlyphSlot slot,
FT_BBox *cbox )
{
MEM_Set( cbox, 0, sizeof(*cbox) );
if (slot->format == render->glyph_format)
/* return the glyph's control box */
static
void ft_smooth_get_cbox( FT_Renderer render,
FT_GlyphSlot slot,
FT_BBox* cbox )
{
MEM_Set( cbox, 0, sizeof ( *cbox ) );
if ( slot->format == render->glyph_format )
FT_Outline_Get_CBox( &slot->outline, cbox );
}
/* convert a slot's glyph image into a bitmap */
static FT_Error ft_smooth_render( FT_Renderer render,
FT_GlyphSlot slot,
FT_UInt mode,
FT_Vector* origin )
/* convert a slot's glyph image into a bitmap */
static
FT_Error ft_smooth_render( FT_Renderer render,
FT_GlyphSlot slot,
FT_UInt mode,
FT_Vector* origin )
{
FT_Error error;
FT_Outline* outline;
@ -77,8 +105,9 @@
FT_Raster_Params params;
/* check glyph image format */
if (slot->format != render->glyph_format)
if ( slot->format != render->glyph_format )
{
error = FT_Err_Invalid_Argument;
goto Exit;
@ -91,7 +120,7 @@
outline = &slot->outline;
/* translate the outline to the new origin if needed */
if (origin)
if ( origin )
FT_Outline_Translate( outline, origin->x, origin->y );
/* compute the control box, and grid fit it */
@ -99,18 +128,18 @@
cbox.xMin &= -64;
cbox.yMin &= -64;
cbox.xMax = (cbox.xMax+63) & -64;
cbox.yMax = (cbox.yMax+63) & -64;
cbox.xMax = ( cbox.xMax + 63 ) & -64;
cbox.yMax = ( cbox.yMax + 63 ) & -64;
width = (cbox.xMax - cbox.xMin) >> 6;
height = (cbox.yMax - cbox.yMin) >> 6;
width = ( cbox.xMax - cbox.xMin ) >> 6;
height = ( cbox.yMax - cbox.yMin ) >> 6;
bitmap = &slot->bitmap;
memory = render->root.memory;
/* release old bitmap buffer */
if ((slot->flags & ft_glyph_own_bitmap))
if ( slot->flags & ft_glyph_own_bitmap )
{
FREE(bitmap->buffer);
FREE( bitmap->buffer );
slot->flags &= ~ft_glyph_own_bitmap;
}
@ -122,7 +151,7 @@
bitmap->rows = height;
bitmap->pitch = pitch;
if (ALLOC( bitmap->buffer, (FT_ULong)pitch * height ))
if ( ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
goto Exit;
slot->flags |= ft_glyph_own_bitmap;
@ -137,7 +166,8 @@
/* render outline into the bitmap */
error = render->raster_render( render->raster, &params );
if (error) goto Exit;
if ( error )
goto Exit;
slot->format = ft_glyph_format_bitmap;
slot->bitmap_left = cbox.xMin >> 6;
@ -155,23 +185,25 @@
sizeof( FT_RendererRec ),
"smooth",
0x10000,
0x20000,
0x10000L,
0x20000L,
0, /* module specific interface */
(FT_Module_Constructor) ft_smooth_init,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0
(FT_Module_Constructor)ft_smooth_init,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0
},
ft_glyph_format_outline,
(FTRenderer_render) ft_smooth_render,
(FTRenderer_transform) ft_smooth_transform,
(FTRenderer_getCBox) ft_smooth_get_cbox,
(FTRenderer_setMode) ft_smooth_set_mode,
(FTRenderer_render) ft_smooth_render,
(FTRenderer_transform)ft_smooth_transform,
(FTRenderer_getCBox) ft_smooth_get_cbox,
(FTRenderer_setMode) ft_smooth_set_mode,
(FT_Raster_Funcs*) &ft_grays_raster
(FT_Raster_Funcs*) &ft_grays_raster
};
/* END */

View File

@ -1,8 +1,35 @@
/***************************************************************************/
/* */
/* ftsmooth.h */
/* */
/* Anti-aliasing renderer interface (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* 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 */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTSMOOTH_H
#define FTSMOOTH_H
#include <freetype/ftrender.h>
FT_EXPORT_VAR(const FT_Renderer_Class) ft_smooth_renderer_class;
#ifndef FT_CONFIG_OPTION_NO_STD_RASTER
FT_EXPORT_VAR( const FT_Renderer_Class ) ft_std_renderer_class;
#endif
#ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER
FT_EXPORT_VAR( const FT_Renderer_Class ) ft_smooth_renderer_class;
#endif
#endif /* FTSMOOTH_H */
/* END */

View File

@ -13,33 +13,34 @@
# fully.
# renderer driver directory
# smooth driver directory
#
SMOOTH_DIR := $(SRC_)smooth
SMOOTH_DIR_ := $(SMOOTH_DIR)$(SEP)
# additional include flags used when compiling the driver
#
SMOOTH_INCLUDE := $(SMOOTH_DIR)
# compilation flags for the driver
#
SMOOTH_CFLAGS := $(SMOOTH_INCLUDE:%=$I%)
SMOOTH_COMPILE := $(FT_COMPILE) $(SMOOTH_CFLAGS)
# SMOOTH driver sources (i.e., C files)
# smooth driver sources (i.e., C files)
#
SMOOTH_DRV_SRC := $(SMOOTH_DIR_)ftgrays.c \
SMOOTH_DRV_SRC := $(SMOOTH_DIR_)ftgrays.c \
$(SMOOTH_DIR_)ftsmooth.c
# SMOOTH driver headers
# smooth driver headers
#
SMOOTH_DRV_H := $(SMOOTH_DRV_SRC:%c=%h)
# SMOOTH driver object(s)
# smooth driver object(s)
#
# SMOOTH_DRV_OBJ_M is used during `multi' builds.
# SMOOTH_DRV_OBJ_S is used during `single' builds.
@ -47,19 +48,19 @@ SMOOTH_DRV_H := $(SMOOTH_DRV_SRC:%c=%h)
SMOOTH_DRV_OBJ_M := $(SMOOTH_DRV_SRC:$(SMOOTH_DIR_)%.c=$(OBJ_)%.$O)
SMOOTH_DRV_OBJ_S := $(OBJ_)smooth.$O
# SMOOTH driver source file for single build
# smooth driver source file for single build
#
SMOOTH_DRV_SRC_S := $(SMOOTH_DIR_)smooth.c
# SMOOTH driver - single object
# smooth driver - single object
#
$(SMOOTH_DRV_OBJ_S): $(SMOOTH_DRV_SRC_S) $(SMOOTH_DRV_SRC) \
$(FREETYPE_H) $(SMOOTH_DRV_H)
$(SMOOTH_COMPILE) $T$@ $(SMOOTH_DRV_SRC_S)
# SMOOTH driver - multiple objects
# smooth driver - multiple objects
#
$(OBJ_)%.$O: $(SMOOTH_DIR_)%.c $(FREETYPE_H) $(SMOOTH_DRV_H)
$(SMOOTH_COMPILE) $T$@ $<

View File

@ -1,4 +1,25 @@
/***************************************************************************/
/* */
/* smooth.c */
/* */
/* FreeType anti-aliasing rasterer module component (body only). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* 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 */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <ftgrays.c>
#include <ftsmooth.c>
/* END */

View File

@ -1,14 +0,0 @@
#ifndef RENDERER_H
#define RENDERER_H
#include <freetype/ftrender.h>
#ifndef FT_CONFIG_OPTION_NO_STD_RASTER
FT_EXPORT_VAR(const FT_Renderer_Class) ft_std_renderer_class;
#endif
#ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER
FT_EXPORT_VAR(const FT_Renderer_Class) ft_smooth_renderer_class;
#endif
#endif /* RENDERER_H */