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:
parent
c38ddff8ac
commit
f95a603117
4
Makefile
4
Makefile
@ -18,7 +18,7 @@
|
||||
# It works as follows:
|
||||
#
|
||||
# - 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.
|
||||
#
|
||||
# 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
|
||||
# `config.mk'. This sub-Makefile will define some system-specific
|
||||
# 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.
|
||||
#
|
||||
# See the comments in `config/detect.mk' and `config/freetype.mk' for more
|
||||
|
@ -1,6 +1,7 @@
|
||||
FT_USE_MODULE(autohint_module_class)
|
||||
FT_USE_MODULE(cff_driver_class)
|
||||
FT_USE_MODULE(t1cid_driver_class)
|
||||
FT_USE_MODULE(psaux_module_class)
|
||||
FT_USE_MODULE(psnames_module_class)
|
||||
FT_USE_MODULE(ft_raster1_renderer_class)
|
||||
FT_USE_MODULE(sfnt_module_class)
|
||||
|
@ -218,9 +218,10 @@
|
||||
|
||||
enum
|
||||
{
|
||||
ft_glyph_bbox_pixels = 0,
|
||||
ft_glyph_bbox_subpixels = 1,
|
||||
ft_glyph_bbox_gridfit = 2
|
||||
ft_glyph_bbox_subpixels = 0, /* return unfitted coordinates in 26.6 pixels */
|
||||
ft_glyph_bbox_gridfit = 1, /* return grid-fitted coordinates */
|
||||
ft_glyph_bbox_truncate = 2, /* return coordinates in integer pixels */
|
||||
ft_glyph_bbox_pixels = 3 /* return grid-fitted pixel coordinates */
|
||||
};
|
||||
|
||||
|
||||
|
@ -41,10 +41,10 @@
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Struct> */
|
||||
/* T1_Table */
|
||||
/* PS_Table */
|
||||
/* */
|
||||
/* <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. */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
@ -68,7 +68,7 @@
|
||||
/* memory :: The object used for memory operations */
|
||||
/* (alloc/realloc). */
|
||||
/* */
|
||||
typedef struct T1_Table_
|
||||
typedef struct PS_Table_
|
||||
{
|
||||
FT_Byte* block; /* current memory block */
|
||||
FT_Int cursor; /* current cursor in memory block */
|
||||
@ -82,17 +82,17 @@
|
||||
|
||||
FT_Memory memory;
|
||||
|
||||
} T1_Table;
|
||||
} PS_Table;
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Struct> */
|
||||
/* T1_Table_Funcs */
|
||||
/* PS_Table_Funcs */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A set of function pointers used to manage T1_Table objects.. */
|
||||
/* A set of function pointers used to manage PS_Table objects.. */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* table_init :: used to initialise a a table */
|
||||
@ -100,22 +100,22 @@
|
||||
/* table_add :: add one new object to a table */
|
||||
/* 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_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,
|
||||
void* object,
|
||||
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 */
|
||||
/* points. */
|
||||
/* */
|
||||
typedef struct T2_Builder_
|
||||
typedef struct T1_Builder_
|
||||
{
|
||||
FT_Memory memory;
|
||||
FT_Face face;
|
||||
@ -426,30 +426,30 @@
|
||||
} T1_Builder;
|
||||
|
||||
|
||||
typedef FT_Error (*T1_Builder_Check_Points_Func)( T1_Builder* builder,
|
||||
FT_Int count );
|
||||
typedef FT_Error (*T1_Builder_Check_Points_Func) ( T1_Builder* builder,
|
||||
FT_Int count );
|
||||
|
||||
typedef void (*T1_Builder_Add_Point_Func)( T1_Builder* builder,
|
||||
FT_Pos x,
|
||||
FT_Pos y,
|
||||
FT_Byte flag );
|
||||
typedef void (*T1_Builder_Add_Point_Func) ( T1_Builder* builder,
|
||||
FT_Pos x,
|
||||
FT_Pos y,
|
||||
FT_Byte flag );
|
||||
|
||||
typedef void (*T1_Builder_Add_Point1_Func)( T1_Builder* builder,
|
||||
FT_Pos x,
|
||||
FT_Pos y );
|
||||
typedef void (*T1_Builder_Add_Point1_Func) ( T1_Builder* builder,
|
||||
FT_Pos x,
|
||||
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,
|
||||
FT_Pos x,
|
||||
FT_Pos y );
|
||||
typedef FT_Error (*T1_Builder_Start_Point_Func) ( T1_Builder* builder,
|
||||
FT_Pos x,
|
||||
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_
|
||||
{
|
||||
FT_Error (*init)( T1_Builder* builder,
|
||||
void (*init)( T1_Builder* builder,
|
||||
FT_Face face,
|
||||
FT_Size size,
|
||||
FT_GlyphSlot slot );
|
||||
@ -457,7 +457,7 @@
|
||||
void (*done)( T1_Builder* builder );
|
||||
|
||||
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_Contour_Func add_contour;
|
||||
T1_Builder_Start_Point_Func start_point;
|
||||
@ -465,7 +465,6 @@
|
||||
|
||||
} T1_Builder_Funcs;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
@ -476,10 +475,13 @@
|
||||
|
||||
typedef struct PSAux_Interface_
|
||||
{
|
||||
const T1_Table_Funcs* t1_table_funcs;
|
||||
const T1_Parser_Funcs* t1_parser_funcs;
|
||||
const T1_Builder_Funcs* t1_builder_funcs;
|
||||
const PS_Table_Funcs* t1_table_funcs;
|
||||
const T1_Parser_Funcs* t1_parser_funcs;
|
||||
const T1_Builder_Funcs* t1_builder_funcs;
|
||||
|
||||
void (*t1_decrypt)( FT_Byte* buffer,
|
||||
FT_Int length,
|
||||
FT_UShort seed );
|
||||
} PSAux_Interface;
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <freetype/internal/psaux.h>
|
||||
#include <freetype/fterrors.h>
|
||||
#include <freetype/internal/ftdebug.h>
|
||||
|
||||
#ifdef FT_FLAT_COMPILE
|
||||
|
||||
@ -33,7 +34,7 @@
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** T1_TABLE *****/
|
||||
/***** PS_TABLE *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
@ -41,10 +42,10 @@
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* T1_New_Table */
|
||||
/* PS_Table_New */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Initializes a T1_Table. */
|
||||
/* Initialises a PS_Table. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* table :: The address of the target table. */
|
||||
@ -59,7 +60,7 @@
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error T1_New_Table( T1_Table* table,
|
||||
FT_Error PS_Table_New( PS_Table* table,
|
||||
FT_Int count,
|
||||
FT_Memory memory )
|
||||
{
|
||||
@ -87,7 +88,7 @@
|
||||
|
||||
|
||||
static
|
||||
void shift_elements( T1_Table* table,
|
||||
void shift_elements( PS_Table* table,
|
||||
FT_Byte* old_base )
|
||||
{
|
||||
FT_Long delta = table->block - old_base;
|
||||
@ -105,7 +106,7 @@
|
||||
|
||||
|
||||
static
|
||||
FT_Error reallocate_t1_table( T1_Table* table,
|
||||
FT_Error reallocate_t1_table( PS_Table* table,
|
||||
FT_Int new_size )
|
||||
{
|
||||
FT_Memory memory = table->memory;
|
||||
@ -130,10 +131,10 @@
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* T1_Add_Table */
|
||||
/* PS_Table_Add */
|
||||
/* */
|
||||
/* <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> */
|
||||
/* table :: The target table. */
|
||||
@ -150,14 +151,14 @@
|
||||
/* reallocation fails. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
FT_Error T1_Add_Table( T1_Table* table,
|
||||
FT_Error PS_Table_Add( PS_Table* table,
|
||||
FT_Int index,
|
||||
void* object,
|
||||
FT_Int length )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -189,10 +190,10 @@
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* T1_Done_Table */
|
||||
/* PS_Table_Done */
|
||||
/* */
|
||||
/* <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> */
|
||||
/* table :: The target table. */
|
||||
@ -202,7 +203,7 @@
|
||||
/* to the caller to clean it, or reference it in its own structures. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
void T1_Done_Table( T1_Table* table )
|
||||
void PS_Table_Done( PS_Table* table )
|
||||
{
|
||||
FT_Memory memory = table->memory;
|
||||
FT_Error error;
|
||||
@ -223,7 +224,7 @@
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
void T1_Release_Table( T1_Table* table )
|
||||
void PS_Table_Release( PS_Table* table )
|
||||
{
|
||||
FT_Memory memory = table->memory;
|
||||
|
||||
@ -1005,7 +1006,7 @@
|
||||
{
|
||||
parser->error = 0;
|
||||
parser->base = base;
|
||||
parser->limit = base;
|
||||
parser->limit = limit;
|
||||
parser->cursor = base;
|
||||
parser->memory = memory;
|
||||
}
|
||||
@ -1029,7 +1030,7 @@
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* T1_Init_Builder */
|
||||
/* T1_Builder_Init */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Initializes a given glyph builder. */
|
||||
@ -1044,8 +1045,8 @@
|
||||
/* */
|
||||
/* glyph :: The current glyph object. */
|
||||
/* */
|
||||
LOCALFUNC
|
||||
void T1_Init_Builder( T1_Builder* builder,
|
||||
LOCAL_FUNC
|
||||
void T1_Builder_Init( T1_Builder* builder,
|
||||
FT_Face face,
|
||||
FT_Size size,
|
||||
FT_GlyphSlot glyph )
|
||||
@ -1055,11 +1056,11 @@
|
||||
|
||||
builder->face = face;
|
||||
builder->glyph = glyph;
|
||||
builder->memory = face->root.memory;
|
||||
builder->memory = face->memory;
|
||||
|
||||
if ( glyph )
|
||||
{
|
||||
FT_GlyphLoader* loader = glyph->root.loader;
|
||||
FT_GlyphLoader* loader = glyph->loader;
|
||||
|
||||
|
||||
builder->loader = loader;
|
||||
@ -1087,7 +1088,7 @@
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* T1_Done_Builder */
|
||||
/* T1_Builder_Done */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Finalizes a given glyph builder. Its contents can still be used */
|
||||
@ -1097,14 +1098,14 @@
|
||||
/* <Input> */
|
||||
/* builder :: A pointer to the glyph builder to finalize. */
|
||||
/* */
|
||||
LOCALFUNC
|
||||
void T1_Done_Builder( T1_Builder* builder )
|
||||
LOCAL_FUNC
|
||||
void T1_Builder_Done( T1_Builder* builder )
|
||||
{
|
||||
T1_GlyphSlot glyph = builder->glyph;
|
||||
FT_GlyphSlot glyph = builder->glyph;
|
||||
|
||||
|
||||
if ( glyph )
|
||||
glyph->root.outline = *builder->base;
|
||||
glyph->outline = *builder->base;
|
||||
}
|
||||
|
||||
|
||||
@ -1152,9 +1153,9 @@
|
||||
FT_Error error;
|
||||
|
||||
|
||||
error = check_points( builder, 1 );
|
||||
error = T1_Builder_Check_Points( builder, 1 );
|
||||
if ( !error )
|
||||
add_point( builder, x, y, 1 );
|
||||
T1_Builder_Add_Point( builder, x, y, 1 );
|
||||
|
||||
return error;
|
||||
}
|
||||
@ -1171,7 +1172,7 @@
|
||||
if ( !builder->load_points )
|
||||
{
|
||||
outline->n_contours++;
|
||||
return T1_Err_Ok;
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
error = FT_GlyphLoader_Check_Points( builder->loader, 0, 1 );
|
||||
@ -1200,9 +1201,9 @@
|
||||
if ( !builder->path_begun )
|
||||
{
|
||||
builder->path_begun = 1;
|
||||
error = add_contour( builder );
|
||||
error = T1_Builder_Add_Contour( builder );
|
||||
if ( !error )
|
||||
error = add_point1( builder, x, y );
|
||||
error = T1_Builder_Add_Point1( builder, x, y );
|
||||
}
|
||||
return error;
|
||||
}
|
||||
@ -1246,7 +1247,6 @@
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
void T1_Decrypt( FT_Byte* buffer,
|
||||
FT_Int length,
|
||||
|
@ -37,21 +37,22 @@
|
||||
|
||||
|
||||
LOCAL_DEF
|
||||
FT_Error T1_New_Table( T1_Table* table,
|
||||
FT_Error PS_Table_New( PS_Table* table,
|
||||
FT_Int count,
|
||||
FT_Memory memory );
|
||||
|
||||
LOCAL_DEF
|
||||
FT_Error T1_Add_Table( T1_Table* table,
|
||||
FT_Error PS_Table_Add( PS_Table* table,
|
||||
FT_Int index,
|
||||
void* object,
|
||||
FT_Int length );
|
||||
|
||||
LOCAL_DEF
|
||||
void T1_Done_Table( T1_Table* table );
|
||||
void PS_Table_Done( PS_Table* table );
|
||||
|
||||
|
||||
LOCAL_DEF
|
||||
void T1_Release_Table( T1_Table* table );
|
||||
void PS_Table_Release( PS_Table* table );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@ -115,15 +116,69 @@
|
||||
|
||||
|
||||
LOCAL_DEF
|
||||
void T1_Init_Parser( T1_Parser* parser,
|
||||
FT_Byte* base,
|
||||
FT_Byte* limit,
|
||||
FT_Memory memory );
|
||||
void T1_Init_Parser( T1_Parser* parser,
|
||||
FT_Byte* base,
|
||||
FT_Byte* limit,
|
||||
FT_Memory memory );
|
||||
|
||||
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
|
||||
void T1_Decrypt( FT_Byte* buffer,
|
||||
FT_Int length,
|
||||
|
Loading…
Reference in New Issue
Block a user