shithub: freetype+ttf2subf

Download patch

ref: 4937a3ebd2c77ece7796b312eb3814ce1b18b03b
parent: c40a7e2d50fa71ca337fba3b58f424b67550e689
author: David Turner <[email protected]>
date: Wed Dec 19 16:09:16 EST 2001

* 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

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2001-12-19  David Turner  <[email protected]>
 
+        * 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
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -2068,6 +2068,9 @@
   /*                                                                       */
 #define FT_LOAD_LINEAR_DESIGN  8192
 
+  /* temporary hack !! */
+#define FT_LOAD_SBITS_ONLY     16384
+
 
   /*************************************************************************/
   /*                                                                       */
--- 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 )
     {
--- 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...                                                           */