minor updates to the "psaux" module.

Werner, please do not start re-formatting my experimental
code until I declare it "finished", because I still make big
changes to it that create lots of CVS conflicts..

thanks for your work, anyway :-)
This commit is contained in:
David Turner 2000-08-21 04:58:49 +00:00
parent c38ddff8ac
commit f95a603117
6 changed files with 137 additions and 78 deletions

View File

@ -18,7 +18,7 @@
# It works as follows: # It works as follows:
# #
# - When invoked for the first time, this Makefile will include the rules # - When invoked for the first time, this Makefile will include the rules
# found in `freetype/config/detect.mk'. They are in charge of detecting # found in `freetype/builds/detect.mk'. They are in charge of detecting
# the current platform. # the current platform.
# #
# A summary of the detection will be displayed, and the file `config.mk' # A summary of the detection will be displayed, and the file `config.mk'
@ -27,7 +27,7 @@
# - When invoked later, this Makefile will include the rules found in # - When invoked later, this Makefile will include the rules found in
# `config.mk'. This sub-Makefile will define some system-specific # `config.mk'. This sub-Makefile will define some system-specific
# variables (like compiler, compilation flags, object suffix, etc.), then # variables (like compiler, compilation flags, object suffix, etc.), then
# include the rules found in `freetype/config/freetype.mk', used to build # include the rules found in `freetype/builds/freetype.mk', used to build
# the library. # the library.
# #
# See the comments in `config/detect.mk' and `config/freetype.mk' for more # See the comments in `config/detect.mk' and `config/freetype.mk' for more

View File

@ -1,6 +1,7 @@
FT_USE_MODULE(autohint_module_class) FT_USE_MODULE(autohint_module_class)
FT_USE_MODULE(cff_driver_class) FT_USE_MODULE(cff_driver_class)
FT_USE_MODULE(t1cid_driver_class) FT_USE_MODULE(t1cid_driver_class)
FT_USE_MODULE(psaux_module_class)
FT_USE_MODULE(psnames_module_class) FT_USE_MODULE(psnames_module_class)
FT_USE_MODULE(ft_raster1_renderer_class) FT_USE_MODULE(ft_raster1_renderer_class)
FT_USE_MODULE(sfnt_module_class) FT_USE_MODULE(sfnt_module_class)

View File

@ -218,9 +218,10 @@
enum enum
{ {
ft_glyph_bbox_pixels = 0, ft_glyph_bbox_subpixels = 0, /* return unfitted coordinates in 26.6 pixels */
ft_glyph_bbox_subpixels = 1, ft_glyph_bbox_gridfit = 1, /* return grid-fitted coordinates */
ft_glyph_bbox_gridfit = 2 ft_glyph_bbox_truncate = 2, /* return coordinates in integer pixels */
ft_glyph_bbox_pixels = 3 /* return grid-fitted pixel coordinates */
}; };

View File

@ -41,10 +41,10 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Struct> */ /* <Struct> */
/* T1_Table */ /* PS_Table */
/* */ /* */
/* <Description> */ /* <Description> */
/* A T1_Table is a simple object used to store an array of objects in */ /* A PS_Table is a simple object used to store an array of objects in */
/* a single memory block. */ /* a single memory block. */
/* */ /* */
/* <Fields> */ /* <Fields> */
@ -68,7 +68,7 @@
/* memory :: The object used for memory operations */ /* memory :: The object used for memory operations */
/* (alloc/realloc). */ /* (alloc/realloc). */
/* */ /* */
typedef struct T1_Table_ typedef struct PS_Table_
{ {
FT_Byte* block; /* current memory block */ FT_Byte* block; /* current memory block */
FT_Int cursor; /* current cursor in memory block */ FT_Int cursor; /* current cursor in memory block */
@ -82,17 +82,17 @@
FT_Memory memory; FT_Memory memory;
} T1_Table; } PS_Table;
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Struct> */ /* <Struct> */
/* T1_Table_Funcs */ /* PS_Table_Funcs */
/* */ /* */
/* <Description> */ /* <Description> */
/* A set of function pointers used to manage T1_Table objects.. */ /* A set of function pointers used to manage PS_Table objects.. */
/* */ /* */
/* <Fields> */ /* <Fields> */
/* table_init :: used to initialise a a table */ /* table_init :: used to initialise a a table */
@ -100,22 +100,22 @@
/* table_add :: add one new object to a table */ /* table_add :: add one new object to a table */
/* table_release :: release table data, then finalize it */ /* table_release :: release table data, then finalize it */
/* */ /* */
typedef struct T1_Table_Funcs_ typedef struct PS_Table_Funcs_
{ {
FT_Error (*init) ( T1_Table* table, FT_Error (*init) ( PS_Table* table,
FT_Int count, FT_Int count,
FT_Memory memory ); FT_Memory memory );
void (*done) ( T1_Table* table ); void (*done) ( PS_Table* table );
FT_Error (*add) ( T1_Table* table, FT_Error (*add) ( PS_Table* table,
FT_Int index, FT_Int index,
void* object, void* object,
FT_Int length ); FT_Int length );
void (*release)( T1_Table* table ); void (*release)( PS_Table* table );
} T1_Table_Funcs; } PS_Table_Funcs;
/*************************************************************************/ /*************************************************************************/
@ -395,7 +395,7 @@
/* the metrics of a given glyph, not load all of its */ /* the metrics of a given glyph, not load all of its */
/* points. */ /* points. */
/* */ /* */
typedef struct T2_Builder_ typedef struct T1_Builder_
{ {
FT_Memory memory; FT_Memory memory;
FT_Face face; FT_Face face;
@ -426,30 +426,30 @@
} T1_Builder; } T1_Builder;
typedef FT_Error (*T1_Builder_Check_Points_Func)( T1_Builder* builder, typedef FT_Error (*T1_Builder_Check_Points_Func) ( T1_Builder* builder,
FT_Int count ); FT_Int count );
typedef void (*T1_Builder_Add_Point_Func)( T1_Builder* builder, typedef void (*T1_Builder_Add_Point_Func) ( T1_Builder* builder,
FT_Pos x, FT_Pos x,
FT_Pos y, FT_Pos y,
FT_Byte flag ); FT_Byte flag );
typedef void (*T1_Builder_Add_Point1_Func)( T1_Builder* builder, typedef void (*T1_Builder_Add_Point1_Func) ( T1_Builder* builder,
FT_Pos x, FT_Pos x,
FT_Pos y ); FT_Pos y );
typedef FT_Error (*T1_Builder_Add_Contour_Func)( T1_Builder* builder ); typedef FT_Error (*T1_Builder_Add_Contour_Func) ( T1_Builder* builder );
typedef FT_Error (*T1_Builder_Start_Point_Func)( T1_Builder* builder, typedef FT_Error (*T1_Builder_Start_Point_Func) ( T1_Builder* builder,
FT_Pos x, FT_Pos x,
FT_Pos y ); FT_Pos y );
typedef void (*T1_Builder_Close_Contour_Func)( T1_Builder* builder ); typedef void (*T1_Builder_Close_Contour_Func)( T1_Builder* builder );
typedef struct T1_Builder_Funcs_ typedef struct T1_Builder_Funcs_
{ {
FT_Error (*init)( T1_Builder* builder, void (*init)( T1_Builder* builder,
FT_Face face, FT_Face face,
FT_Size size, FT_Size size,
FT_GlyphSlot slot ); FT_GlyphSlot slot );
@ -457,7 +457,7 @@
void (*done)( T1_Builder* builder ); void (*done)( T1_Builder* builder );
T1_Builder_Check_Points_Func check_points; T1_Builder_Check_Points_Func check_points;
T1_Builder_Add_Points_Func add_point; T1_Builder_Add_Point_Func add_point;
T1_Builder_Add_Point1_Func add_point1; T1_Builder_Add_Point1_Func add_point1;
T1_Builder_Add_Contour_Func add_contour; T1_Builder_Add_Contour_Func add_contour;
T1_Builder_Start_Point_Func start_point; T1_Builder_Start_Point_Func start_point;
@ -465,7 +465,6 @@
} T1_Builder_Funcs; } T1_Builder_Funcs;
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/***** *****/ /***** *****/
@ -476,10 +475,13 @@
typedef struct PSAux_Interface_ typedef struct PSAux_Interface_
{ {
const T1_Table_Funcs* t1_table_funcs; const PS_Table_Funcs* t1_table_funcs;
const T1_Parser_Funcs* t1_parser_funcs; const T1_Parser_Funcs* t1_parser_funcs;
const T1_Builder_Funcs* t1_builder_funcs; const T1_Builder_Funcs* t1_builder_funcs;
void (*t1_decrypt)( FT_Byte* buffer,
FT_Int length,
FT_UShort seed );
} PSAux_Interface; } PSAux_Interface;

View File

@ -18,6 +18,7 @@
#include <freetype/internal/psaux.h> #include <freetype/internal/psaux.h>
#include <freetype/fterrors.h> #include <freetype/fterrors.h>
#include <freetype/internal/ftdebug.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
@ -33,7 +34,7 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/***** *****/ /***** *****/
/***** T1_TABLE *****/ /***** PS_TABLE *****/
/***** *****/ /***** *****/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -41,10 +42,10 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* T1_New_Table */ /* PS_Table_New */
/* */ /* */
/* <Description> */ /* <Description> */
/* Initializes a T1_Table. */ /* Initialises a PS_Table. */
/* */ /* */
/* <InOut> */ /* <InOut> */
/* table :: The address of the target table. */ /* table :: The address of the target table. */
@ -59,7 +60,7 @@
/* FreeType error code. 0 means success. */ /* FreeType error code. 0 means success. */
/* */ /* */
LOCAL_FUNC LOCAL_FUNC
FT_Error T1_New_Table( T1_Table* table, FT_Error PS_Table_New( PS_Table* table,
FT_Int count, FT_Int count,
FT_Memory memory ) FT_Memory memory )
{ {
@ -87,7 +88,7 @@
static static
void shift_elements( T1_Table* table, void shift_elements( PS_Table* table,
FT_Byte* old_base ) FT_Byte* old_base )
{ {
FT_Long delta = table->block - old_base; FT_Long delta = table->block - old_base;
@ -105,7 +106,7 @@
static static
FT_Error reallocate_t1_table( T1_Table* table, FT_Error reallocate_t1_table( PS_Table* table,
FT_Int new_size ) FT_Int new_size )
{ {
FT_Memory memory = table->memory; FT_Memory memory = table->memory;
@ -130,10 +131,10 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* T1_Add_Table */ /* PS_Table_Add */
/* */ /* */
/* <Description> */ /* <Description> */
/* Adds an object to a T1_Table, possibly growing its memory block. */ /* Adds an object to a PS_Table, possibly growing its memory block. */
/* */ /* */
/* <InOut> */ /* <InOut> */
/* table :: The target table. */ /* table :: The target table. */
@ -150,14 +151,14 @@
/* reallocation fails. */ /* reallocation fails. */
/* */ /* */
LOCAL_DEF LOCAL_DEF
FT_Error T1_Add_Table( T1_Table* table, FT_Error PS_Table_Add( PS_Table* table,
FT_Int index, FT_Int index,
void* object, void* object,
FT_Int length ) FT_Int length )
{ {
if ( index < 0 || index > table->max_elems ) if ( index < 0 || index > table->max_elems )
{ {
FT_ERROR(( "T1_Add_Table: invalid index\n" )); FT_ERROR(( "PS_Table_Add: invalid index\n" ));
return FT_Err_Invalid_Argument; return FT_Err_Invalid_Argument;
} }
@ -189,10 +190,10 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* T1_Done_Table */ /* PS_Table_Done */
/* */ /* */
/* <Description> */ /* <Description> */
/* Finalizes a T1_Table (i.e., reallocate it to its current cursor). */ /* Finalizes a PS_Table (i.e., reallocate it to its current cursor). */
/* */ /* */
/* <InOut> */ /* <InOut> */
/* table :: The target table. */ /* table :: The target table. */
@ -202,7 +203,7 @@
/* to the caller to clean it, or reference it in its own structures. */ /* to the caller to clean it, or reference it in its own structures. */
/* */ /* */
LOCAL_FUNC LOCAL_FUNC
void T1_Done_Table( T1_Table* table ) void PS_Table_Done( PS_Table* table )
{ {
FT_Memory memory = table->memory; FT_Memory memory = table->memory;
FT_Error error; FT_Error error;
@ -223,7 +224,7 @@
LOCAL_FUNC LOCAL_FUNC
void T1_Release_Table( T1_Table* table ) void PS_Table_Release( PS_Table* table )
{ {
FT_Memory memory = table->memory; FT_Memory memory = table->memory;
@ -1005,7 +1006,7 @@
{ {
parser->error = 0; parser->error = 0;
parser->base = base; parser->base = base;
parser->limit = base; parser->limit = limit;
parser->cursor = base; parser->cursor = base;
parser->memory = memory; parser->memory = memory;
} }
@ -1029,7 +1030,7 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* T1_Init_Builder */ /* T1_Builder_Init */
/* */ /* */
/* <Description> */ /* <Description> */
/* Initializes a given glyph builder. */ /* Initializes a given glyph builder. */
@ -1044,8 +1045,8 @@
/* */ /* */
/* glyph :: The current glyph object. */ /* glyph :: The current glyph object. */
/* */ /* */
LOCALFUNC LOCAL_FUNC
void T1_Init_Builder( T1_Builder* builder, void T1_Builder_Init( T1_Builder* builder,
FT_Face face, FT_Face face,
FT_Size size, FT_Size size,
FT_GlyphSlot glyph ) FT_GlyphSlot glyph )
@ -1055,11 +1056,11 @@
builder->face = face; builder->face = face;
builder->glyph = glyph; builder->glyph = glyph;
builder->memory = face->root.memory; builder->memory = face->memory;
if ( glyph ) if ( glyph )
{ {
FT_GlyphLoader* loader = glyph->root.loader; FT_GlyphLoader* loader = glyph->loader;
builder->loader = loader; builder->loader = loader;
@ -1087,7 +1088,7 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* T1_Done_Builder */ /* T1_Builder_Done */
/* */ /* */
/* <Description> */ /* <Description> */
/* Finalizes a given glyph builder. Its contents can still be used */ /* Finalizes a given glyph builder. Its contents can still be used */
@ -1097,14 +1098,14 @@
/* <Input> */ /* <Input> */
/* builder :: A pointer to the glyph builder to finalize. */ /* builder :: A pointer to the glyph builder to finalize. */
/* */ /* */
LOCALFUNC LOCAL_FUNC
void T1_Done_Builder( T1_Builder* builder ) void T1_Builder_Done( T1_Builder* builder )
{ {
T1_GlyphSlot glyph = builder->glyph; FT_GlyphSlot glyph = builder->glyph;
if ( glyph ) if ( glyph )
glyph->root.outline = *builder->base; glyph->outline = *builder->base;
} }
@ -1152,9 +1153,9 @@
FT_Error error; FT_Error error;
error = check_points( builder, 1 ); error = T1_Builder_Check_Points( builder, 1 );
if ( !error ) if ( !error )
add_point( builder, x, y, 1 ); T1_Builder_Add_Point( builder, x, y, 1 );
return error; return error;
} }
@ -1171,7 +1172,7 @@
if ( !builder->load_points ) if ( !builder->load_points )
{ {
outline->n_contours++; outline->n_contours++;
return T1_Err_Ok; return FT_Err_Ok;
} }
error = FT_GlyphLoader_Check_Points( builder->loader, 0, 1 ); error = FT_GlyphLoader_Check_Points( builder->loader, 0, 1 );
@ -1200,9 +1201,9 @@
if ( !builder->path_begun ) if ( !builder->path_begun )
{ {
builder->path_begun = 1; builder->path_begun = 1;
error = add_contour( builder ); error = T1_Builder_Add_Contour( builder );
if ( !error ) if ( !error )
error = add_point1( builder, x, y ); error = T1_Builder_Add_Point1( builder, x, y );
} }
return error; return error;
} }
@ -1246,7 +1247,6 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
LOCAL_FUNC LOCAL_FUNC
void T1_Decrypt( FT_Byte* buffer, void T1_Decrypt( FT_Byte* buffer,
FT_Int length, FT_Int length,

View File

@ -37,21 +37,22 @@
LOCAL_DEF LOCAL_DEF
FT_Error T1_New_Table( T1_Table* table, FT_Error PS_Table_New( PS_Table* table,
FT_Int count, FT_Int count,
FT_Memory memory ); FT_Memory memory );
LOCAL_DEF LOCAL_DEF
FT_Error T1_Add_Table( T1_Table* table, FT_Error PS_Table_Add( PS_Table* table,
FT_Int index, FT_Int index,
void* object, void* object,
FT_Int length ); FT_Int length );
LOCAL_DEF LOCAL_DEF
void T1_Done_Table( T1_Table* table ); void PS_Table_Done( PS_Table* table );
LOCAL_DEF LOCAL_DEF
void T1_Release_Table( T1_Table* table ); void PS_Table_Release( PS_Table* table );
/*************************************************************************/ /*************************************************************************/
@ -115,15 +116,69 @@
LOCAL_DEF LOCAL_DEF
void T1_Init_Parser( T1_Parser* parser, void T1_Init_Parser( T1_Parser* parser,
FT_Byte* base, FT_Byte* base,
FT_Byte* limit, FT_Byte* limit,
FT_Memory memory ); FT_Memory memory );
LOCAL_DEF LOCAL_DEF
void T1_Done_Parser( T1_Parser* parser ) void T1_Done_Parser( T1_Parser* parser );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** T1 BUILDER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
LOCAL_DEF
void T1_Builder_Init( T1_Builder* builder,
FT_Face face,
FT_Size size,
FT_GlyphSlot glyph );
LOCAL_DEF
void T1_Builder_Done( T1_Builder* builder );
LOCAL_DEF
FT_Error T1_Builder_Check_Points( T1_Builder* builder,
FT_Int count );
LOCAL_DEF
void T1_Builder_Add_Point( T1_Builder* builder,
FT_Pos x,
FT_Pos y,
FT_Byte flag );
LOCAL_DEF
FT_Error T1_Builder_Add_Point1( T1_Builder* builder,
FT_Pos x,
FT_Pos y );
LOCAL_DEF
FT_Error T1_Builder_Add_Contour( T1_Builder* builder );
LOCAL_DEF
FT_Error T1_Builder_Start_Point( T1_Builder* builder,
FT_Pos x,
FT_Pos y );
LOCAL_DEF
void T1_Builder_Close_Contour( T1_Builder* builder );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** OTHER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
LOCAL_DEF LOCAL_DEF
void T1_Decrypt( FT_Byte* buffer, void T1_Decrypt( FT_Byte* buffer,
FT_Int length, FT_Int length,