Commit 4937a3ebd2c77ece7796b312eb3814ce1b18b03b

David Turner 2001-12-19T21:09:16

* src/truetype/ttgload.c (TT_Load_Glyph), src/base/ftobjs.c (FT_Load_Glyph): "fixed" the bug that prevented embedded bitmaps from begin loaded when the auto-hinter is used.. This actually is a hack but will be enough until the internal re-design scheduled for FreeType 2.1

diff --git a/ChangeLog b/ChangeLog
index 840ace8..ff9a287 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2001-12-19  David Turner  <david@freetype.org>
 
+        * src/truetype/ttgload.c (TT_Load_Glyph), src/base/ftobjs.c
+        (FT_Load_Glyph): "fixed" the bug that prevented embedded bitmaps from
+        begin loaded when the auto-hinter is used.. This actually is a hack
+        but will be enough until the internal re-design scheduled for
+        FreeType 2.1
+
+
         * include/freetype/cache/ftcache.h: added comments to indicate that
         some of the exported functions should only be used by applications
         that need to implement custom cache types
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 81b29e2..2f47ba2 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -2068,6 +2068,9 @@ FT_BEGIN_HEADER
   /*                                                                       */
 #define FT_LOAD_LINEAR_DESIGN  8192
 
+  /* temporary hack !! */
+#define FT_LOAD_SBITS_ONLY     16384
+
 
   /*************************************************************************/
   /*                                                                       */
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 1a10f2a..6189db9 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -883,6 +883,22 @@
       FT_AutoHinter_Interface*  hinting;
 
 
+      /* try to load embedded bitmaps first when available          */
+      
+      /* XXX: this is really a temporary hack that should disappear */
+      /*      promptly with FreeType 2.1 !!                         */
+      /*                                                            */
+      if ( FT_HAS_FIXED_SIZES( face ) )
+      {
+        error = driver->clazz->load_glyph( slot, face->size,
+                                           glyph_index,
+                                           load_flags | FT_LOAD_SBITS_ONLY );
+
+        if ( !error && slot->format == ft_glyph_format_bitmap )
+          goto Load_Ok;
+      }
+
+      /* load auto-hinted outline */
       hinting = (FT_AutoHinter_Interface*)hinter->clazz->module_interface;
 
       error   = hinting->load_glyph( (FT_AutoHinter)hinter,
@@ -897,6 +913,7 @@
     if ( error )
       goto Exit;
 
+  Load_Ok:
     /* compute the advance */
     if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
     {
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 33caaed..6495dcf 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1411,6 +1411,10 @@
 
 #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
 
+    /* return immediately if we only wanted the embedded bitmaps */
+    if ( load_flags & FT_LOAD_SBITS_ONLY )
+      return FT_Err_Invalid_Argument;
+
     /* seek to the beginning of the glyph table.  For Type 42 fonts      */
     /* the table might be accessed from a Postscript stream or something */
     /* else...                                                           */