shithub: freetype+ttf2subf

Download patch

ref: db8df797d088e2e861bafb81dedb4106f15523be
parent: 16217e5f22127cbe3aed6375b446629228098b90
author: Werner Lemberg <[email protected]>
date: Wed Apr 1 09:30:55 EDT 2015

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2015-04-01  Werner Lemberg  <[email protected]>
 
+	[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  <[email protected]>
+
 	* src/autofit/afhints.c (af_glyph_hints_done): Fix minor thinko.
 
 2015-03-29  Werner Lemberg  <[email protected]>
--- 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
   }
 
 
--- 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 */
   }