From 76c7bd0d40e85d1956572411e9ec3096809ac2ca Mon Sep 17 00:00:00 2001 From: David Turner Date: Sun, 24 Feb 2002 02:59:24 +0000 Subject: [PATCH] * moving all code related to glyph loaders to "internal/ftgloadr.h" and "src/base/ftgloadr.c". Note also that the type "FT_GlyphLoader" is now a pointer to the structure "FT_GlyphLoaderRec".. --- ChangeLog | 7 +++ include/freetype/internal/ftgloadr.h | 4 +- include/freetype/internal/ftobjs.h | 26 +++-------- include/freetype/internal/internal.h | 2 +- include/freetype/internal/psaux.h | 4 +- include/freetype/internal/tttypes.h | 2 +- src/autohint/ahglyph.c | 2 +- src/autohint/ahglyph.h | 2 +- src/autohint/ahhint.c | 4 +- src/autohint/ahloader.h | 69 +--------------------------- src/autohint/ahtypes.h | 2 +- src/base/Jamfile | 2 +- src/base/ftbase.c | 5 +- src/base/ftgloadr.c | 19 ++++---- src/base/ftobjs.c | 3 ++ src/base/rules.mk | 1 + src/cff/cffgload.c | 10 ++-- src/cff/cffgload.h | 2 +- src/psaux/psobjs.c | 8 ++-- src/psaux/t1decode.c | 22 ++++----- src/truetype/ttgload.c | 12 ++--- 21 files changed, 69 insertions(+), 139 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0fbf788b2..0f31ff426 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2002-02-24 David Turner + * moving all code related to glyph loaders to "internal/ftgloadr.h" + and "src/base/ftgloadr.c". + + Note also that the type "FT_GlyphLoader" is now a pointer to the + structure "FT_GlyphLoaderRec".. + + * renaming "ft_glyph_own_bitmap" into "FT_GLYPH_OWN_BITMAP" 2002-02-22 Werner Lemberg diff --git a/include/freetype/internal/ftgloadr.h b/include/freetype/internal/ftgloadr.h index 73479ca7d..ac3dcfb4e 100644 --- a/include/freetype/internal/ftgloadr.h +++ b/include/freetype/internal/ftgloadr.h @@ -32,7 +32,7 @@ FT_BEGIN_HEADER /* The glyph loader implementation is not part of the high-level API, */ /* hence the forward structure declaration. */ /* */ - typedef struct FT_GlyphLoader_ FT_GlyphLoader ; + typedef struct FT_GlyphLoaderRec_* FT_GlyphLoader ; #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1 @@ -89,7 +89,7 @@ FT_BEGIN_HEADER /* create new empty glyph loader */ FT_BASE( FT_Error ) FT_GlyphLoader_New( FT_Memory memory, - FT_GlyphLoader *aloader ); + FT_GlyphLoader *aloader ); /* add an extra points table to a glyph loader */ FT_BASE( FT_Error ) diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index e934cfff0..a6bd132f2 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -31,6 +31,7 @@ #include FT_RENDER_H #include FT_SIZES_H #include FT_INTERNAL_MEMORY_H +#include FT_INTERNAL_GLYPH_LOADER_H #include FT_INTERNAL_DRIVER_H #include FT_INTERNAL_AUTOHINT_H @@ -73,22 +74,6 @@ FT_BEGIN_HEADER #endif - /*************************************************************************/ - /* */ - /* */ - /* FT_GlyphLoader */ - /* */ - /* */ - /* The glyph loader is an internal object used to load several glyphs */ - /* together (for example, in the case of composites). */ - /* */ - /* */ - /* The glyph loader implementation is not part of the high-level API, */ - /* hence the forward structure declaration. */ - /* */ - typedef struct FT_GlyphLoader_ FT_GlyphLoader; - - /*************************************************************************/ /* */ /* */ @@ -171,12 +156,12 @@ FT_BEGIN_HEADER /* */ typedef struct FT_Slot_InternalRec_ { - FT_GlyphLoader* loader; + FT_GlyphLoader loader; FT_Bool glyph_transformed; FT_Matrix glyph_matrix; FT_Vector glyph_delta; void* glyph_hints; - + } FT_GlyphSlot_InternalRec; @@ -345,6 +330,8 @@ FT_BEGIN_HEADER FT_Done_GlyphSlot( FT_GlyphSlot slot ); +#if 0 + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -444,6 +431,7 @@ FT_BEGIN_HEADER FT_GlyphLoader_Copy_Points( FT_GlyphLoader* target, FT_GlyphLoader* source ); +#endif /*************************************************************************/ /*************************************************************************/ @@ -533,7 +521,7 @@ FT_BEGIN_HEADER FT_ListRec faces_list; void* extensions; - FT_GlyphLoader* glyph_loader; + FT_GlyphLoader glyph_loader; } FT_DriverRec; diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h index 32a06f9d1..054413c97 100644 --- a/include/freetype/internal/internal.h +++ b/include/freetype/internal/internal.h @@ -33,7 +33,7 @@ #define FT_INTERNAL_DRIVER_H #define FT_INTERNAL_EXTEND_H #define FT_INTERNAL_TRACE_H - +#define FT_INTERNAL_GLYPH_LOADER_H #define FT_INTERNAL_SFNT_H #define FT_INTERNAL_TRUETYPE_TYPES_H diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 38816090f..57265b7f0 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -508,7 +508,7 @@ FT_BEGIN_HEADER FT_Memory memory; FT_Face face; FT_GlyphSlot glyph; - FT_GlyphLoader* loader; + FT_GlyphLoader loader; FT_Outline* base; FT_Outline* current; @@ -535,7 +535,7 @@ FT_BEGIN_HEADER void* hints_funcs; /* hinter-specific */ void* hints_globals; /* hinter-specific */ - T1_Builder_Funcs funcs; + T1_Builder_Funcs funcs; }; diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 4177d1e38..0b1efa894 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1615,7 +1615,7 @@ FT_BEGIN_HEADER FT_Face face; FT_Size size; FT_GlyphSlot glyph; - FT_GlyphLoader* gloader; + FT_GlyphLoader gloader; FT_ULong load_flags; FT_UInt glyph_index; diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c index 49da90142..94afa0d95 100644 --- a/src/autohint/ahglyph.c +++ b/src/autohint/ahglyph.c @@ -351,7 +351,7 @@ /* */ FT_LOCAL_DEF void ah_outline_save( AH_Outline* outline, - AH_Loader* gloader ) + AH_Loader gloader ) { AH_Point* point = outline->points; AH_Point* point_limit = point + outline->num_points; diff --git a/src/autohint/ahglyph.h b/src/autohint/ahglyph.h index 3c50ee733..8a85e7737 100644 --- a/src/autohint/ahglyph.h +++ b/src/autohint/ahglyph.h @@ -79,7 +79,7 @@ FT_BEGIN_HEADER FT_LOCAL void ah_outline_save( AH_Outline* outline, - AH_Loader* loader ); + AH_Loader loader ); FT_LOCAL void ah_outline_done( AH_Outline* outline ); diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c index 5c02589cd..7e0e2865c 100644 --- a/src/autohint/ahhint.c +++ b/src/autohint/ahhint.c @@ -388,7 +388,7 @@ ah_debug_disable_vert = no_vert_edges; #else FT_UNUSED( no_horz_edges ); - FT_UNUSED( no_vert_edges ); + FT_UNUSED( no_vert_edges ); #endif /* AH_Interpolate_Blue_Edges( hinter ); -- doesn't seem to help */ /* reduce the problem of the disappearing eye in the `e' of Times... */ @@ -1011,7 +1011,7 @@ FT_Fixed y_scale = face->size->metrics.y_scale; FT_Error error; AH_Outline* outline = hinter->glyph; - AH_Loader* gloader = hinter->loader; + AH_Loader gloader = hinter->loader; FT_Bool no_horz_hints = FT_BOOL( ( load_flags & AH_HINT_NO_HORZ_EDGES ) != 0 ); FT_Bool no_vert_hints = FT_BOOL( diff --git a/src/autohint/ahloader.h b/src/autohint/ahloader.h index 1f9b3a5ca..b5c1ba8d8 100644 --- a/src/autohint/ahloader.h +++ b/src/autohint/ahloader.h @@ -41,72 +41,7 @@ FT_BEGIN_HEADER - -#ifdef _STANDALONE_ - - typedef struct AH_GlyphLoad_ - { - FT_Outline outline; /* outline */ - FT_UInt num_subglyphs; /* number of subglyphs */ - FT_SubGlyph* subglyphs; /* subglyphs */ - FT_Vector* extra_points; /* extra points table */ - - } AH_GlyphLoad; - - - struct AH_GlyphLoader_ - { - FT_Memory memory; - FT_UInt max_points; - FT_UInt max_contours; - FT_UInt max_subglyphs; - FT_Bool use_extra; - - AH_GlyphLoad base; - AH_GlyphLoad current; - - void* other; /* for possible future extensions */ - }; - - - FT_LOCAL FT_Error - AH_GlyphLoader_New( FT_Memory memory, - AH_GlyphLoader** aloader ); - - FT_LOCAL FT_Error - AH_GlyphLoader_Create_Extra( AH_GlyphLoader* loader ); - - FT_LOCAL void - AH_GlyphLoader_Done( AH_GlyphLoader* loader ); - - FT_LOCAL void - AH_GlyphLoader_Reset( AH_GlyphLoader* loader ); - - FT_LOCAL void - AH_GlyphLoader_Rewind( AH_GlyphLoader* loader ); - - FT_LOCAL FT_Error - AH_GlyphLoader_Check_Points( AH_GlyphLoader* loader, - FT_UInt n_points, - FT_UInt n_contours ); - - FT_LOCAL FT_Error - AH_GlyphLoader_Check_Subglyphs( AH_GlyphLoader* loader, - FT_UInt n_subs ); - - FT_LOCAL void - AH_GlyphLoader_Prepare( AH_GlyphLoader* loader ); - - FT_LOCAL void - AH_GlyphLoader_Add( AH_GlyphLoader* loader ); - - FT_LOCAL FT_Error - AH_GlyphLoader_Copy_Points( AH_GlyphLoader* target, - FT_GlyphLoader* source ); - -#else /* _STANDALONE */ - -#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_GLYPH_LOADER_H #define AH_Load FT_GlyphLoad #define AH_Loader FT_GlyphLoader @@ -122,8 +57,6 @@ FT_BEGIN_HEADER #define ah_loader_add FT_GlyphLoader_Add #define ah_loader_copy_points FT_GlyphLoader_Copy_Points -#endif /* _STANDALONE_ */ - FT_END_HEADER diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h index 83b499582..c05de7fdb 100644 --- a/src/autohint/ahtypes.h +++ b/src/autohint/ahtypes.h @@ -477,7 +477,7 @@ FT_BEGIN_HEADER AH_Outline* glyph; - AH_Loader* loader; + AH_Loader loader; FT_Vector pp1; FT_Vector pp2; diff --git a/src/base/Jamfile b/src/base/Jamfile index 5c2f5a6ad..3e2ff7e09 100644 --- a/src/base/Jamfile +++ b/src/base/Jamfile @@ -10,7 +10,7 @@ SubDirHdrs [ FT2_SubDir src base ] ; if $(FT2_MULTI) { - _sources = ftcalc ftlist ftobjs ftstream ftoutln ftnames fttrigon + _sources = ftcalc ftgloadr ftlist ftobjs ftstream ftoutln ftnames fttrigon ftdbgmem ; } else diff --git a/src/base/ftbase.c b/src/base/ftbase.c index b49096bcf..83e0ad01f 100644 --- a/src/base/ftbase.c +++ b/src/base/ftbase.c @@ -22,6 +22,7 @@ #include "ftcalc.c" #include "fttrigon.c" +#include "ftgloadr.c" #include "ftobjs.c" #include "ftstream.c" #include "ftlist.c" @@ -29,8 +30,4 @@ #include "ftnames.c" #include "ftdbgmem.c" -#if 0 -#include "ftextend.c" -#endif - /* END */ diff --git a/src/base/ftgloadr.c b/src/base/ftgloadr.c index e8a1556e6..5d3e07510 100644 --- a/src/base/ftgloadr.c +++ b/src/base/ftgloadr.c @@ -1,5 +1,6 @@ #include #include FT_INTERNAL_GLYPH_LOADER_H +#include FT_INTERNAL_MEMORY_H #undef FT_COMPONENT #define FT_COMPONENT trace_gloader @@ -65,8 +66,8 @@ FT_BASE_DEF( void ) FT_GlyphLoader_Rewind( FT_GlyphLoader loader ) { - FT_GlyphLoad* base = &loader->base; - FT_GlyphLoad* current = &loader->current; + FT_GlyphLoad base = &loader->base; + FT_GlyphLoad current = &loader->current; base->outline.n_points = 0; @@ -154,8 +155,8 @@ static void FT_GlyphLoader_Adjust_Subglyphs( FT_GlyphLoader loader ) { - FT_GlyphLoad* base = &loader->base; - FT_GlyphLoad* current = &loader->current; + FT_GlyphLoad base = &loader->base; + FT_GlyphLoad current = &loader->current; current->subglyphs = base->subglyphs + base->num_subglyphs; @@ -235,8 +236,8 @@ FT_Error error = FT_Err_Ok; FT_UInt new_max, old_max; - FT_GlyphLoad* base = &loader->base; - FT_GlyphLoad* current = &loader->current; + FT_GlyphLoad base = &loader->base; + FT_GlyphLoad current = &loader->current; new_max = base->num_subglyphs + current->num_subglyphs + n_subs; @@ -261,7 +262,7 @@ FT_BASE_DEF( void ) FT_GlyphLoader_Prepare( FT_GlyphLoader loader ) { - FT_GlyphLoad* current = &loader->current; + FT_GlyphLoad current = &loader->current; current->outline.n_points = 0; @@ -277,8 +278,8 @@ FT_BASE_DEF( void ) FT_GlyphLoader_Add( FT_GlyphLoader loader ) { - FT_GlyphLoad* base = &loader->base; - FT_GlyphLoad* current = &loader->current; + FT_GlyphLoad base = &loader->base; + FT_GlyphLoad current = &loader->current; FT_UInt n_curr_contours = current->outline.n_contours; FT_UInt n_base_points = base->outline.n_points; diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 3b6b92dc2..3a7e2b32b 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -262,6 +262,8 @@ #define FT_COMPONENT trace_objs +#if 0 + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -598,6 +600,7 @@ return error; } +#endif /*************************************************************************/ /*************************************************************************/ diff --git a/src/base/rules.mk b/src/base/rules.mk index 2c6df87b0..2da51b318 100644 --- a/src/base/rules.mk +++ b/src/base/rules.mk @@ -34,6 +34,7 @@ BASE_COMPILE := $(FT_COMPILE) $I$(SRC_)base # BASE_SRC := $(BASE_)ftcalc.c \ $(BASE_)fttrigon.c \ + $(BASE_)ftgloadr.c \ $(BASE_)ftlist.c \ $(BASE_)ftobjs.c \ $(BASE_)ftstream.c \ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index ab907955d..7c3c340ad 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -238,7 +238,7 @@ if ( glyph ) { - FT_GlyphLoader* loader = glyph->root.internal->loader; + FT_GlyphLoader loader = glyph->root.internal->loader; builder->loader = loader; @@ -248,7 +248,7 @@ builder->hints_globals = 0; builder->hints_funcs = 0; - + if ( hinting && size ) { builder->hints_globals = size->internal; @@ -588,7 +588,7 @@ if ( decoder->builder.no_recurse ) { FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph; - FT_GlyphLoader* loader = glyph->internal->loader; + FT_GlyphLoader loader = glyph->internal->loader; FT_SubGlyph* subg; @@ -1091,7 +1091,7 @@ case cff_op_hintmask: case cff_op_cntrmask: FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" )); - + /* implement vstem when needed -- */ /* the specification doesn't say it, but this also works */ /* with the 'cntrmask' operator */ @@ -1103,7 +1103,7 @@ 0, num_args / 2, args ); - + decoder->num_hints += num_args / 2; } diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h index 55af7c4d4..c542adf70 100644 --- a/src/cff/cffgload.h +++ b/src/cff/cffgload.h @@ -89,7 +89,7 @@ FT_BEGIN_HEADER FT_Memory memory; TT_Face face; CFF_GlyphSlot glyph; - FT_GlyphLoader* loader; + FT_GlyphLoader loader; FT_Outline* base; FT_Outline* current; diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index c497190b0..4856b217d 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -166,7 +166,7 @@ FT_Error error; FT_Offset new_size = table->capacity; FT_Long in_offset; - + in_offset = (FT_Long)((FT_Byte*)object - table->block); if ( (FT_ULong)in_offset >= table->capacity ) @@ -178,7 +178,7 @@ error = reallocate_t1_table( table, new_size ); if ( error ) return error; - + if ( in_offset >= 0 ) object = table->block + in_offset; } @@ -1085,7 +1085,7 @@ if ( glyph ) { - FT_GlyphLoader* loader = glyph->internal->loader; + FT_GlyphLoader loader = glyph->internal->loader; builder->loader = loader; @@ -1095,7 +1095,7 @@ builder->hints_globals = size->internal; builder->hints_funcs = 0; - + if ( hinting ) builder->hints_funcs = glyph->internal->glyph_hints; } diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 0a90394ed..fcd5cc93e 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -218,7 +218,7 @@ if ( decoder->builder.no_recurse ) { FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph; - FT_GlyphLoader* loader = glyph->internal->loader; + FT_GlyphLoader loader = glyph->internal->loader; FT_SubGlyph* subg; @@ -290,7 +290,7 @@ decoder->builder.advance = advance; /* XXX: old code doesn't work with postscript hinter */ -#if 0 +#if 0 /* Finally, move the accent */ if ( decoder->builder.load_points ) { @@ -302,7 +302,7 @@ FT_Outline_Translate( &dummy, adx - asb, ady ); } -#else +#else decoder->builder.pos_x = 0; decoder->builder.pos_y = 0; #endif @@ -638,10 +638,10 @@ goto Syntax_Error; } ip += 2; - + if ( hinter ) hinter->reset( hinter->hints, builder->current->n_points ); - + break; case 12: @@ -736,19 +736,19 @@ FT_TRACE4(( " endchar" )); close_contour( builder ); - + /* close hints recording session */ if ( hinter ) { if (hinter->close( hinter->hints, builder->current->n_points )) goto Syntax_Error; - + /* apply hints to the loaded glyph outline now */ hinter->apply( hinter->hints, builder->current, (PSH_Globals)builder->hints_globals ); } - + /* add current outline to the glyph slot */ FT_GlyphLoader_Add( builder->loader ); @@ -1016,7 +1016,7 @@ case op_hstem: FT_TRACE4(( " hstem" )); - + /* record horizontal hint */ if ( hinter ) { @@ -1032,7 +1032,7 @@ /* record horizontal counter-controlled hints */ if ( hinter ) hinter->stem3( hinter->hints, 1, top ); - + break; case op_vstem: @@ -1054,7 +1054,7 @@ if ( hinter ) { FT_Pos dx = orig_x; - + top[0] += dx; top[2] += dx; top[4] += dx; diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index d7104d789..7053caa5f 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -176,7 +176,7 @@ static void tt_prepare_zone( TT_GlyphZone* zone, - FT_GlyphLoad* load, + FT_GlyphLoad load, FT_UInt start_point, FT_UInt start_contour ) { @@ -267,7 +267,7 @@ { FT_Error error; FT_Stream stream = load->stream; - FT_GlyphLoader* gloader = load->gloader; + FT_GlyphLoader gloader = load->gloader; FT_Int n_contours = load->n_contours; FT_Outline* outline; TT_Face face = (TT_Face)load->face; @@ -470,7 +470,7 @@ { FT_Error error; FT_Stream stream = loader->stream; - FT_GlyphLoader* gloader = loader->gloader; + FT_GlyphLoader gloader = loader->gloader; FT_SubGlyph* subglyph; FT_UInt num_subglyphs; FT_Int byte_len = loader->byte_len; @@ -606,7 +606,7 @@ TT_Process_Simple_Glyph( TT_Loader* load, FT_Bool debug ) { - FT_GlyphLoader* gloader = load->gloader; + FT_GlyphLoader gloader = load->gloader; FT_Outline* outline = &gloader->current.outline; FT_UInt n_points = outline->n_points; #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER @@ -751,7 +751,7 @@ FT_Int contours_count; FT_UInt index, num_points, count; FT_Fixed x_scale, y_scale; - FT_GlyphLoader* gloader = loader->gloader; + FT_GlyphLoader gloader = loader->gloader; FT_Bool opened_frame = 0; @@ -1519,7 +1519,7 @@ /* update the glyph zone bounds */ { - FT_GlyphLoader* gloader = FT_FACE_DRIVER(face)->glyph_loader; + FT_GlyphLoader gloader = FT_FACE_DRIVER(face)->glyph_loader; loader.gloader = gloader;