From db8df797d088e2e861bafb81dedb4106f15523be Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 1 Apr 2015 13:30:55 +0200 Subject: [PATCH] [autofit] Make debugging stuff work again. The interface to ftgrid was broken in the series of commits starting with [autofit] Allocate AF_Loader on the stack instead of AF_Module. from 2015-01-14. * src/autofit/afmodule.c (_af_debug_hints_rec) [FT_DEBUG_AUTOFIT]: Use a global AF_GlyphHintsRec object for debugging. (af_autofitter_done, af_autofitter_load_glyph): Updated. * src/autofit/afloader.c (af_loader_init, af_loader_done): Updated. --- ChangeLog | 17 ++++++++++++++++ src/autofit/afloader.c | 7 ------- src/autofit/afmodule.c | 44 ++++++++++++++++++++++++++++++++++++++---- 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97bf29368..66939434f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2015-04-01 Werner Lemberg + + [autofit] Make debugging stuff work again. + + The interface to ftgrid was broken in the series of commits starting + with + + [autofit] Allocate AF_Loader on the stack instead of AF_Module. + + from 2015-01-14. + + * src/autofit/afmodule.c (_af_debug_hints_rec) [FT_DEBUG_AUTOFIT]: + Use a global AF_GlyphHintsRec object for debugging. + (af_autofitter_done, af_autofitter_load_glyph): Updated. + + * src/autofit/afloader.c (af_loader_init, af_loader_done): Updated. + 2015-04-01 Werner Lemberg * src/autofit/afhints.c (af_glyph_hints_done): Fix minor thinko. diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index 5f68c8c14..7c2fa7cff 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -33,9 +33,6 @@ FT_ZERO( loader ); loader->hints = hints; -#ifdef FT_DEBUG_AUTOFIT - _af_debug_hints = loader->hints; -#endif } @@ -76,10 +73,6 @@ loader->face = NULL; loader->globals = NULL; loader->hints = NULL; - -#ifdef FT_DEBUG_AUTOFIT - _af_debug_hints = NULL; -#endif } diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c index 35ce6ad4e..4968e0197 100644 --- a/src/autofit/afmodule.c +++ b/src/autofit/afmodule.c @@ -23,10 +23,14 @@ #include "afpic.h" #ifdef FT_DEBUG_AUTOFIT - int _af_debug_disable_horz_hints; - int _af_debug_disable_vert_hints; - int _af_debug_disable_blue_hints; - void* _af_debug_hints; + int _af_debug_disable_horz_hints; + int _af_debug_disable_vert_hints; + int _af_debug_disable_blue_hints; + + /* we use a global object instead of a local one for debugging */ + AF_GlyphHintsRec _af_debug_hints_rec[1]; + + void* _af_debug_hints = _af_debug_hints_rec; #endif #include FT_INTERNAL_OBJECTS_H @@ -261,6 +265,11 @@ af_autofitter_done( FT_Module ft_module ) /* AF_Module */ { FT_UNUSED( ft_module ); + +#ifdef FT_DEBUG_AUTOFIT + if ( _af_debug_hints_rec->memory ) + af_glyph_hints_done( _af_debug_hints_rec ); +#endif } @@ -274,6 +283,31 @@ FT_Error error = FT_Err_Ok; FT_Memory memory = module->root.library->memory; +#ifdef FT_DEBUG_AUTOFIT + + /* in debug mode, we use a global object that survives this routine */ + + AF_GlyphHints hints = _af_debug_hints_rec; + AF_LoaderRec loader[1]; + + FT_UNUSED( size ); + + + if ( hints->memory ) + af_glyph_hints_done( hints ); + + af_glyph_hints_init( hints, memory ); + af_loader_init( loader, hints ); + + error = af_loader_load_glyph( loader, module, slot->face, + glyph_index, load_flags ); + + af_loader_done( loader ); + + return error; + +#else /* !FT_DEBUG_AUTOFIT */ + AF_GlyphHintsRec hints[1]; AF_LoaderRec loader[1]; @@ -290,6 +324,8 @@ af_glyph_hints_done( hints ); return error; + +#endif /* !FT_DEBUG_AUTOFIT */ }