* src/truetype/ttinterp.c, src/truetype/ttinterp.h: Remove original

TT_Done_Context and rename TT_Destroy_Context to TT_Done_Context with
slight changes.

* src/truetype/ttobjs.h (tt_slot_init): New function.

* src/truetype/ttobjs.c (tt_driver_init): Initialize execution context
here.
(tt_slot_init): New function to create extra points for the internal
glyph loader. We then use it directly, instead of face's glyph loader,
when loading glyph.

* src/truetype/ttdriver.c: Use tt_slot_init for glyph slot
initialization.
(TT_Load_Glyph): Load flag dependencies are handled here.
Return error if size is NULL.

* src/truetype/ttgload.c: Heavy cleanup and refactor.
(TT_Hint_Glyph): New funcion to hint a zone, prepared by caller.
(TT_Process_Simple_Glyph): Use loader->pp's instead of recalculating.
Use TT_Hint_Glyph.
No need to save/restore loader->stream before/after
TT_Vary_Get_Glyph_Deltas now.
(TT_LOADER_SET_PP): New macro to calculate and set the four phantom points.
(TT_Process_Composite_Component, TT_Process_Composite_Glyph,
load_truetype_glyph): Refactor load_truetype_glyph into these three functions.
Never set exec->glyphSize to 0. (close #13107)
Forget glyph frame before calling TT_Process_Simple_Glyph.
(TT_Load_Glyph, load_sbit_image, tt_loader_init): Refactor TT_Load_Glyph into
these three functions.
Set various fields of `glyph' here, instead of in load_truetype_glyph
and compute_glyph_metrics.
This commit is contained in:
Wu, Chia-I (吳佳一) 2005-08-16 01:54:59 +00:00
parent f20a4d3527
commit 0142e6aff1
7 changed files with 764 additions and 792 deletions

View File

@ -1,3 +1,38 @@
2005-08-16 Chia I Wu <b90201047@ntu.edu.tw>
* src/truetype/ttinterp.c, src/truetype/ttinterp.h: Remove original
TT_Done_Context and rename TT_Destroy_Context to TT_Done_Context with
slight changes.
* src/truetype/ttobjs.h (tt_slot_init): New function.
* src/truetype/ttobjs.c (tt_driver_init): Initialize execution context
here.
(tt_slot_init): New function to create extra points for the internal
glyph loader. We then use it directly, instead of face's glyph loader,
when loading glyph.
* src/truetype/ttdriver.c: Use tt_slot_init for glyph slot
initialization.
(TT_Load_Glyph): Load flag dependencies are handled here.
Return error if size is NULL.
* src/truetype/ttgload.c: Heavy cleanup and refactor.
(TT_Hint_Glyph): New funcion to hint a zone, prepared by caller.
(TT_Process_Simple_Glyph): Use loader->pp's instead of recalculating.
Use TT_Hint_Glyph.
No need to save/restore loader->stream before/after
TT_Vary_Get_Glyph_Deltas now.
(TT_LOADER_SET_PP): New macro to calculate and set the four phantom points.
(TT_Process_Composite_Component, TT_Process_Composite_Glyph,
load_truetype_glyph): Refactor load_truetype_glyph into these three functions.
Never set exec->glyphSize to 0. (close #13107)
Forget glyph frame before calling TT_Process_Simple_Glyph.
(TT_Load_Glyph, load_sbit_image, tt_loader_init): Refactor TT_Load_Glyph into
these three functions.
Set various fields of `glyph' here, instead of in load_truetype_glyph
and compute_glyph_metrics.
2005-08-08 Werner Lemberg <wl@gnu.org>
* docs/INSTALL.ANY: Updated.

View File

@ -283,25 +283,14 @@
if ( !slot )
return TT_Err_Invalid_Slot_Handle;
/* check whether we want a scaled outline or bitmap */
if ( !size )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
if ( !size || !size->ttmetrics.valid )
return TT_Err_Invalid_Size_Handle;
if ( load_flags & FT_LOAD_NO_SCALE )
size = NULL;
/* reset the size object if necessary */
if ( size )
if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
{
/* these two object must have the same parent */
if ( size->root.face != slot->face )
return TT_Err_Invalid_Face_Handle;
if ( !size->ttmetrics.valid )
{
if ( FT_SET_ERROR( tt_size_reset( size ) ) )
return error;
}
load_flags |= FT_LOAD_NO_HINTING |
FT_LOAD_NO_BITMAP |
FT_LOAD_NO_SCALE;
}
/* now load the glyph outline if necessary */
@ -409,8 +398,8 @@
tt_face_done,
tt_size_init,
tt_size_done,
0, /* FT_Slot_InitFunc */
0, /* FT_Slot_DoneFunc */
tt_slot_init,
0, /* FT_Slot_DoneFunc */
Set_Char_Sizes,
Set_Pixel_Sizes,

File diff suppressed because it is too large Load Diff

View File

@ -371,7 +371,7 @@
/*************************************************************************/
/* */
/* <Function> */
/* TT_Destroy_Context */
/* TT_Done_Context */
/* */
/* <Description> */
/* Destroys a given context. */
@ -388,9 +388,11 @@
/* Only the glyph loader and debugger should call this function. */
/* */
FT_LOCAL_DEF( FT_Error )
TT_Destroy_Context( TT_ExecContext exec,
FT_Memory memory )
TT_Done_Context( TT_ExecContext exec )
{
FT_Memory memory = exec->memory;
/* free composite load stack */
FT_FREE( exec->loadStack );
exec->loadSize = 0;
@ -416,6 +418,7 @@
exec->face = NULL;
FT_FREE( exec );
return TT_Err_Ok;
}
@ -431,8 +434,6 @@
/* <Input> */
/* memory :: A handle to the parent memory object. */
/* */
/* face :: A handle to the source TrueType face object. */
/* */
/* <InOut> */
/* exec :: A handle to the target execution context. */
/* */
@ -441,14 +442,12 @@
/* */
static FT_Error
Init_Context( TT_ExecContext exec,
TT_Face face,
FT_Memory memory )
{
FT_Error error;
FT_TRACE1(( "Init_Context: new object at 0x%08p, parent = 0x%08p\n",
exec, face ));
FT_TRACE1(( "Init_Context: new object at 0x%08p\n", exec ));
exec->memory = memory;
exec->callSize = 32;
@ -469,7 +468,7 @@
exec->loadStack = NULL;
exec->glyphIns = NULL;
exec->face = face;
exec->face = NULL;
exec->size = NULL;
return TT_Err_Ok;
@ -477,7 +476,7 @@
Fail_Memory:
FT_ERROR(( "Init_Context: not enough memory for 0x%08lx\n",
(FT_Long)exec ));
TT_Destroy_Context( exec, memory );
TT_Done_Context( exec );
return error;
}
@ -770,18 +769,12 @@
/* documentation is in ttinterp.h */
FT_EXPORT_DEF( TT_ExecContext )
TT_New_Context( TT_Face face )
TT_New_Context( TT_Driver driver )
{
TT_Driver driver;
TT_ExecContext exec;
FT_Memory memory;
if ( !face )
return 0;
driver = (TT_Driver)face->root.driver;
memory = driver->root.root.memory;
exec = driver->context;
@ -795,7 +788,7 @@
goto Exit;
/* initialize it */
error = Init_Context( exec, face, memory );
error = Init_Context( exec, memory );
if ( error )
goto Fail;
@ -813,34 +806,6 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* TT_Done_Context */
/* */
/* <Description> */
/* Discards an execution context. */
/* */
/* <Input> */
/* exec :: A handle to the target execution context. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* Only the glyph loader and debugger should call this function. */
/* */
FT_LOCAL_DEF( FT_Error )
TT_Done_Context( TT_ExecContext exec )
{
/* Nothing at all for now */
FT_UNUSED( exec );
return TT_Err_Ok;
}
/*************************************************************************/
/* */
/* Before an opcode is executed, the interpreter verifies that there are */

View File

@ -263,16 +263,11 @@ FT_BEGIN_HEADER
/* Only the glyph loader and debugger should call this function. */
/* */
FT_EXPORT( TT_ExecContext )
TT_New_Context( TT_Face face );
TT_New_Context( TT_Driver driver );
FT_LOCAL( FT_Error )
TT_Done_Context( TT_ExecContext exec );
FT_LOCAL( FT_Error )
TT_Destroy_Context( TT_ExecContext exec,
FT_Memory memory );
FT_LOCAL( FT_Error )
TT_Load_Context( TT_ExecContext exec,
TT_Face face,

View File

@ -348,7 +348,7 @@
if ( size->debug )
exec = size->context;
else
exec = TT_New_Context( face );
exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
if ( !exec )
return TT_Err_Could_Not_Find_Context;
@ -403,9 +403,6 @@
if ( !error )
TT_Save_Context( exec, size );
if ( !size->debug )
TT_Done_Context( exec );
return error;
}
@ -436,7 +433,7 @@
if ( size->debug )
exec = size->context;
else
exec = TT_New_Context( face );
exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
if ( !exec )
return TT_Err_Could_Not_Find_Context;
@ -470,9 +467,6 @@
TT_Save_Context( exec, size );
if ( !size->debug )
TT_Done_Context( exec );
return error;
}
@ -917,15 +911,24 @@
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF( FT_Error )
tt_driver_init( FT_Module driver ) /* TT_Driver */
tt_driver_init( FT_Module ttdriver ) /* TT_Driver */
{
FT_Error error;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
TT_Driver driver = (TT_Driver)ttdriver;
/* set `extra' in glyph loader */
error = FT_GlyphLoader_CreateExtra( FT_DRIVER( driver )->glyph_loader );
if ( !TT_New_Context( driver ) )
return TT_Err_Could_Not_Find_Context;
return error;
#else
FT_UNUSED( ttdriver );
#endif
return TT_Err_Ok;
}
@ -950,7 +953,7 @@
/* destroy the execution context */
if ( driver->context )
{
TT_Destroy_Context( driver->context, driver->root.root.memory );
TT_Done_Context( driver->context );
driver->context = NULL;
}
#else
@ -960,4 +963,25 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* tt_slot_init */
/* */
/* <Description> */
/* Initializes a new slot object. */
/* */
/* <InOut> */
/* slot :: A handle to the slot object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF( FT_Error )
tt_slot_init( FT_GlyphSlot slot )
{
return FT_GlyphLoader_CreateExtra( slot->internal->loader );
}
/* END */

View File

@ -442,6 +442,14 @@ FT_BEGIN_HEADER
tt_driver_done( FT_Module ttdriver ); /* TT_Driver */
/*************************************************************************/
/* */
/* Slot functions */
/* */
FT_LOCAL( FT_Error )
tt_slot_init( FT_GlyphSlot slot );
FT_END_HEADER
#endif /* __TTOBJS_H__ */