shithub: freetype+ttf2subf

Download patch

ref: f6aa089f12ce3a7b7ee3d1b548969c2cb879b893
parent: cecf93ef90c660a8b0b45e5adbbfb5ea443fb6b9
author: Werner Lemberg <[email protected]>
date: Fri May 10 03:58:47 EDT 2013

*/* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-05-10  Werner Lemberg  <[email protected]>
+
+	*/* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code.
+
 2013-05-08  Werner Lemberg  <[email protected]>
 
 	* Version 2.4.12 released.
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -774,37 +774,10 @@
 
 
   /*
-   * Define this variable if you want to keep the layout of internal
-   * structures that was used prior to FreeType 2.2.  This also compiles in
-   * a few obsolete functions to avoid linking problems on typical Unix
-   * distributions.
-   *
-   * For embedded systems or building a new distribution from scratch, it
-   * is recommended to disable the macro since it reduces the library's code
-   * size and activates a few memory-saving optimizations as well.
+   *  This macro is obsolete.  Support has been removed in FreeType
+   *  version 2.5.
    */
 /* #define FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
-  /*
-   *  To detect legacy cache-lookup call from a rogue client (<= 2.1.7),
-   *  we restrict the number of charmaps in a font.  The current API of
-   *  FTC_CMapCache_Lookup() takes cmap_index & charcode, but old API
-   *  takes charcode only.  To determine the passed value is for cmap_index
-   *  or charcode, the possible cmap_index is restricted not to exceed
-   *  the minimum possible charcode by a rogue client.  It is also very
-   *  unlikely that a rogue client is interested in Unicode values 0 to 15.
-   *
-   *  NOTE: The original threshold was 4 deduced from popular number of
-   *        cmap subtables in UCS-4 TrueType fonts, but now it is not
-   *        irregular for OpenType fonts to have more than 4 subtables,
-   *        because variation selector subtables are available for Apple
-   *        and Microsoft platforms.
-   */
-
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-#define FT_MAX_CHARMAP_CACHEABLE 15
-#endif
 
 
   /*
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -1,7 +1,16 @@
 
-CHANGES BETWEEN 2.4.11 and 2.4.12
+CHANGES BETWEEN 2.4.12 and 2.5
 
   I. IMPORTANT CHANGES
+
+    - As announced in the previous release,  all code related to macro
+      FT_CONFIG_OPTION_OLD_INTERNALS  has been removed,  thus becoming
+      obsolete.
+
+
+======================================================================
+
+CHANGES BETWEEN 2.4.11 and 2.4.12
 
     - We have another CFF parsing and hinting engine!  Written by Dave
       Arnold <[email protected]>,  this work  has been  contributed by
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -774,37 +774,10 @@
 
 
   /*
-   * Define this variable if you want to keep the layout of internal
-   * structures that was used prior to FreeType 2.2.  This also compiles in
-   * a few obsolete functions to avoid linking problems on typical Unix
-   * distributions.
-   *
-   * For embedded systems or building a new distribution from scratch, it
-   * is recommended to disable the macro since it reduces the library's code
-   * size and activates a few memory-saving optimizations as well.
+   *  This macro is obsolete.  Support has been removed in FreeType
+   *  version 2.5.
    */
 /* #define FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
-  /*
-   *  To detect legacy cache-lookup call from a rogue client (<= 2.1.7),
-   *  we restrict the number of charmaps in a font.  The current API of
-   *  FTC_CMapCache_Lookup() takes cmap_index & charcode, but old API
-   *  takes charcode only.  To determine the passed value is for cmap_index
-   *  or charcode, the possible cmap_index is restricted not to exceed
-   *  the minimum possible charcode by a rogue client.  It is also very
-   *  unlikely that a rogue client is interested in Unicode values 0 to 15.
-   *
-   *  NOTE: The original threshold was 4 deduced from popular number of
-   *        cmap subtables in UCS-4 TrueType fonts, but now it is not
-   *        irregular for OpenType fonts to have more than 4 subtables,
-   *        because variation selector subtables are available for Apple
-   *        and Microsoft platforms.
-   */
-
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-#define FT_MAX_CHARMAP_CACHEABLE 15
-#endif
 
 
   /*
--- a/include/freetype/ftcache.h
+++ b/include/freetype/ftcache.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType Cache subsystem (specification).                            */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */
+/*  Copyright 1996-2008, 2010, 2013 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -214,18 +214,7 @@
 
  /* */
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
 
-  /* these macros are incompatible with LLP64, should not be used */
-
-#define FT_POINTER_TO_ULONG( p )  ( (FT_ULong)(FT_Pointer)(p) )
-
-#define FTC_FACE_ID_HASH( i )                                \
-          ((FT_UInt32)(( FT_POINTER_TO_ULONG( i ) >> 3 ) ^   \
-                       ( FT_POINTER_TO_ULONG( i ) << 7 ) ) )
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
@@ -705,18 +694,7 @@
             (d1)->width   == (d2)->width   && \
             (d1)->flags   == (d2)->flags   )
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
 
-  /* this macro is incompatible with LLP64, should not be used */
-
-#define FTC_IMAGE_TYPE_HASH( d )                          \
-          (FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id )  ^ \
-                      ( (d)->width << 8 ) ^ (d)->height ^ \
-                      ( (d)->flags << 4 )               )
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
   /*************************************************************************/
   /*                                                                       */
   /* <Type>                                                                */
@@ -1067,67 +1045,6 @@
                               FT_UInt        gindex,
                               FTC_SBit      *sbit,
                               FTC_Node      *anode );
-
-
- /* */
-
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  /*@***********************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    FTC_FontRec                                                        */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A simple structure used to describe a given `font' to the cache    */
-  /*    manager.  Note that a `font' is the combination of a given face    */
-  /*    with a given character size.                                       */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    face_id    :: The ID of the face to use.                           */
-  /*                                                                       */
-  /*    pix_width  :: The character width in integer pixels.               */
-  /*                                                                       */
-  /*    pix_height :: The character height in integer pixels.              */
-  /*                                                                       */
-  typedef struct  FTC_FontRec_
-  {
-    FTC_FaceID  face_id;
-    FT_UShort   pix_width;
-    FT_UShort   pix_height;
-
-  } FTC_FontRec;
-
-
-  /* */
-
-
-#define FTC_FONT_COMPARE( f1, f2 )                  \
-          ( (f1)->face_id    == (f2)->face_id    && \
-            (f1)->pix_width  == (f2)->pix_width  && \
-            (f1)->pix_height == (f2)->pix_height )
-
-  /* this macro is incompatible with LLP64, should not be used */
-#define FTC_FONT_HASH( f )                              \
-          (FT_UInt32)( FTC_FACE_ID_HASH((f)->face_id) ^ \
-                       ((f)->pix_width << 8)          ^ \
-                       ((f)->pix_height)              )
-
-  typedef FTC_FontRec*  FTC_Font;
-
-
-  FT_EXPORT( FT_Error )
-  FTC_Manager_Lookup_Face( FTC_Manager  manager,
-                           FTC_FaceID   face_id,
-                           FT_Face     *aface );
-
-  FT_EXPORT( FT_Error )
-  FTC_Manager_Lookup_Size( FTC_Manager  manager,
-                           FTC_Font     font,
-                           FT_Face     *aface,
-                           FT_Size     *asize );
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
  /* */
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -48,29 +48,6 @@
   FT_SqrtFixed( FT_Int32  x );
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Sqrt32                                                          */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Computes the square root of an Int32 integer (which will be        */
-  /*    handled as an unsigned long value).                                */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    x :: The value to compute the root for.                            */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The result of `sqrt(x)'.                                           */
-  /*                                                                       */
-  FT_EXPORT( FT_Int32 )
-  FT_Sqrt32( FT_Int32  x );
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
   /*************************************************************************/
   /*                                                                       */
   /* FT_MulDiv() and FT_MulFix() are declared in freetype.h.               */
--- a/include/freetype/internal/ftdriver.h
+++ b/include/freetype/internal/ftdriver.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType font driver interface (specification).                      */
 /*                                                                         */
-/*  Copyright 1996-2003, 2006, 2008, 2011-2012 by                          */
+/*  Copyright 1996-2003, 2006, 2008, 2011-2013 by                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -60,23 +60,7 @@
   (*FT_Size_SelectFunc)( FT_Size   size,
                          FT_ULong  size_index );
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
   typedef FT_Error
-  (*FT_Size_ResetPointsFunc)( FT_Size     size,
-                              FT_F26Dot6  char_width,
-                              FT_F26Dot6  char_height,
-                              FT_UInt     horz_resolution,
-                              FT_UInt     vert_resolution );
-
-  typedef FT_Error
-  (*FT_Size_ResetPixelsFunc)( FT_Size  size,
-                              FT_UInt  pixel_width,
-                              FT_UInt  pixel_height );
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-  typedef FT_Error
   (*FT_Slot_LoadFunc)( FT_GlyphSlot  slot,
                        FT_Size       size,
                        FT_UInt       glyph_index,
@@ -196,13 +180,6 @@
     FT_Slot_InitFunc         init_slot;
     FT_Slot_DoneFunc         done_slot;
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-    FT_Size_ResetPointsFunc  set_char_sizes;
-    FT_Size_ResetPixelsFunc  set_pixel_sizes;
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
     FT_Slot_LoadFunc         load_glyph;
 
     FT_Face_GetKerningFunc   get_kerning;
@@ -216,30 +193,6 @@
   } FT_Driver_ClassRec, *FT_Driver_Class;
 
 
-  /*
-   *  The following functions are used as stubs for `set_char_sizes' and
-   *  `set_pixel_sizes'; the code uses `request_size' and `select_size'
-   *  functions instead.
-   *
-   *  Implementation is in `src/base/ftobjs.c'.
-   */
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  FT_BASE( FT_Error )
-  ft_stub_set_char_sizes( FT_Size     size,
-                          FT_F26Dot6  width,
-                          FT_F26Dot6  height,
-                          FT_UInt     horz_res,
-                          FT_UInt     vert_res );
-
-  FT_BASE( FT_Error )
-  ft_stub_set_pixel_sizes( FT_Size  size,
-                           FT_UInt  width,
-                           FT_UInt  height );
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
   /*************************************************************************/
   /*                                                                       */
   /* <Macro>                                                               */
@@ -279,94 +232,74 @@
   /*                                                                       */
 #ifndef FT_CONFIG_OPTION_PIC
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) \
-          a_, b_,
-#else
-#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ )  /* empty */
-#endif
-
 #define FT_DECLARE_DRIVER( class_ )  \
-  FT_CALLBACK_TABLE                   \
+  FT_CALLBACK_TABLE                  \
   const FT_Driver_ClassRec  class_;
 
-#define FT_DEFINE_DRIVER(                                    \
-          class_,                                            \
-          flags_,                                            \
-          size_,                                             \
-          name_,                                             \
-          version_,                                          \
-          requires_,                                         \
-          interface_,                                        \
-          init_,                                             \
-          done_,                                             \
-          get_interface_,                                    \
-          face_object_size_,                                 \
-          size_object_size_,                                 \
-          slot_object_size_,                                 \
-          init_face_,                                        \
-          done_face_,                                        \
-          init_size_,                                        \
-          done_size_,                                        \
-          init_slot_,                                        \
-          done_slot_,                                        \
-          old_set_char_sizes_,                               \
-          old_set_pixel_sizes_,                              \
-          load_glyph_,                                       \
-          get_kerning_,                                      \
-          attach_file_,                                      \
-          get_advances_,                                     \
-          request_size_,                                     \
-          select_size_ )                                     \
-  FT_CALLBACK_TABLE_DEF                                      \
-  const FT_Driver_ClassRec  class_ =                         \
-  {                                                          \
-    FT_DEFINE_ROOT_MODULE( flags_,                           \
-                           size_,                            \
-                           name_,                            \
-                           version_,                         \
-                           requires_,                        \
-                           interface_,                       \
-                           init_,                            \
-                           done_,                            \
-                           get_interface_ )                  \
-                                                             \
-    face_object_size_,                                       \
-    size_object_size_,                                       \
-    slot_object_size_,                                       \
-                                                             \
-    init_face_,                                              \
-    done_face_,                                              \
-                                                             \
-    init_size_,                                              \
-    done_size_,                                              \
-                                                             \
-    init_slot_,                                              \
-    done_slot_,                                              \
-                                                             \
-    FT_DEFINE_DRIVERS_OLD_INTERNALS( old_set_char_sizes_,    \
-                                     old_set_pixel_sizes_ )  \
-                                                             \
-    load_glyph_,                                             \
-                                                             \
-    get_kerning_,                                            \
-    attach_file_,                                            \
-    get_advances_,                                           \
-                                                             \
-    request_size_,                                           \
-    select_size_                                             \
+#define FT_DEFINE_DRIVER(                    \
+          class_,                            \
+          flags_,                            \
+          size_,                             \
+          name_,                             \
+          version_,                          \
+          requires_,                         \
+          interface_,                        \
+          init_,                             \
+          done_,                             \
+          get_interface_,                    \
+          face_object_size_,                 \
+          size_object_size_,                 \
+          slot_object_size_,                 \
+          init_face_,                        \
+          done_face_,                        \
+          init_size_,                        \
+          done_size_,                        \
+          init_slot_,                        \
+          done_slot_,                        \
+          load_glyph_,                       \
+          get_kerning_,                      \
+          attach_file_,                      \
+          get_advances_,                     \
+          request_size_,                     \
+          select_size_ )                     \
+  FT_CALLBACK_TABLE_DEF                      \
+  const FT_Driver_ClassRec  class_ =         \
+  {                                          \
+    FT_DEFINE_ROOT_MODULE( flags_,           \
+                           size_,            \
+                           name_,            \
+                           version_,         \
+                           requires_,        \
+                           interface_,       \
+                           init_,            \
+                           done_,            \
+                           get_interface_ )  \
+                                             \
+    face_object_size_,                       \
+    size_object_size_,                       \
+    slot_object_size_,                       \
+                                             \
+    init_face_,                              \
+    done_face_,                              \
+                                             \
+    init_size_,                              \
+    done_size_,                              \
+                                             \
+    init_slot_,                              \
+    done_slot_,                              \
+                                             \
+    load_glyph_,                             \
+                                             \
+    get_kerning_,                            \
+    attach_file_,                            \
+    get_advances_,                           \
+                                             \
+    request_size_,                           \
+    select_size_                             \
   };
 
 #else /* FT_CONFIG_OPTION_PIC */
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ )  \
-          clazz->set_char_sizes  = a_;             \
-          clazz->set_pixel_sizes = b_;
-#else
-#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ )  /* empty */
-#endif
-
 #define FT_DECLARE_DRIVER( class_ )  FT_DECLARE_MODULE( class_ )
 
 #define FT_DEFINE_DRIVER(                                        \
@@ -389,8 +322,6 @@
           done_size_,                                            \
           init_slot_,                                            \
           done_slot_,                                            \
-          old_set_char_sizes_,                                   \
-          old_set_pixel_sizes_,                                  \
           load_glyph_,                                           \
           get_kerning_,                                          \
           attach_file_,                                          \
@@ -452,9 +383,6 @@
                                                                  \
     clazz->init_slot        = init_slot_;                        \
     clazz->done_slot        = done_slot_;                        \
-                                                                 \
-    FT_DEFINE_DRIVERS_OLD_INTERNALS( old_set_char_sizes_,        \
-                                     old_set_pixel_sizes_ )      \
                                                                  \
     clazz->load_glyph       = load_glyph_;                       \
                                                                  \
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType memory management macros (specification).               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2010 by             */
+/*  Copyright 1996-2002, 2004-2007, 2010, 2013 by                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg                       */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -303,37 +303,6 @@
           FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  FT_BASE( FT_Error )
-  FT_Alloc( FT_Memory  memory,
-            FT_Long    size,
-            void*     *P );
-
-  FT_BASE( FT_Error )
-  FT_QAlloc( FT_Memory  memory,
-             FT_Long    size,
-             void*     *p );
-
-  FT_BASE( FT_Error )
-  FT_Realloc( FT_Memory  memory,
-              FT_Long    current,
-              FT_Long    size,
-              void*     *P );
-
-  FT_BASE( FT_Error )
-  FT_QRealloc( FT_Memory  memory,
-               FT_Long    current,
-               FT_Long    size,
-               void*     *p );
-
-  FT_BASE( void )
-  FT_Free( FT_Memory  memory,
-           void*     *P );
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
   FT_BASE( FT_Pointer )
   ft_mem_strdup( FT_Memory    memory,
                  const char*  str,
@@ -344,6 +313,7 @@
               const void*  address,
               FT_ULong     size,
               FT_Error    *p_error );
+
 
 #define FT_MEM_STRDUP( dst, str )                                            \
           (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType private base classes (specification).                   */
 /*                                                                         */
-/*  Copyright 1996-2006, 2008, 2010, 2012 by                               */
+/*  Copyright 1996-2006, 2008, 2010, 2012-2013 by                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -352,10 +352,6 @@
   /*                                                                       */
   typedef struct  FT_Face_InternalRec_
   {
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    FT_UShort           reserved1;
-    FT_Short            reserved2;
-#endif
     FT_Matrix           transform_matrix;
     FT_Vector           transform_delta;
     FT_Int              transform_flags;
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    High-level `sfnt' driver interface (specification).                  */
 /*                                                                         */
-/*  Copyright 1996-2006, 2009, 2012 by                                     */
+/*  Copyright 1996-2006, 2009, 2012-2013 by                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -125,80 +125,9 @@
   (*TT_Done_Face_Func)( TT_Face  face );
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
   /*************************************************************************/
   /*                                                                       */
   /* <FuncType>                                                            */
-  /*    TT_Load_SFNT_HeaderRec_Func                                        */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the header of a SFNT font file.  Supports collections.       */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face       :: A handle to the target face object.                  */
-  /*                                                                       */
-  /*    stream     :: The input stream.                                    */
-  /*                                                                       */
-  /*    face_index :: The index of the TrueType font, if we are opening a  */
-  /*                  collection.                                          */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    sfnt       :: The SFNT header.                                     */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The stream cursor must be at the font file's origin.               */
-  /*                                                                       */
-  /*    This function recognizes fonts embedded in a `TrueType             */
-  /*    collection'.                                                       */
-  /*                                                                       */
-  /*    This function checks that the header is valid by looking at the    */
-  /*    values of `search_range', `entry_selector', and `range_shift'.     */
-  /*                                                                       */
-  typedef FT_Error
-  (*TT_Load_SFNT_HeaderRec_Func)( TT_Face      face,
-                                  FT_Stream    stream,
-                                  FT_Long      face_index,
-                                  SFNT_Header  sfnt );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    TT_Load_Directory_Func                                             */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the table directory into a face object.                      */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the target face object.                      */
-  /*                                                                       */
-  /*    stream :: The input stream.                                        */
-  /*                                                                       */
-  /*    sfnt   :: The SFNT header.                                         */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The stream cursor must be on the first byte after the 4-byte font  */
-  /*    format tag.  This is the case just after a call to                 */
-  /*    TT_Load_Format_Tag().                                              */
-  /*                                                                       */
-  typedef FT_Error
-  (*TT_Load_Directory_Func)( TT_Face      face,
-                             FT_Stream    stream,
-                             SFNT_Header  sfnt );
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
   /*    TT_Load_Any_Func                                                   */
   /*                                                                       */
   /* <Description>                                                         */
@@ -363,91 +292,9 @@
                               TT_SBit_MetricsRec  *ametrics );
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
   /*************************************************************************/
   /*                                                                       */
   /* <FuncType>                                                            */
-  /*    TT_Set_SBit_Strike_OldFunc                                         */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Select an sbit strike for a given size request.                    */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face          :: The target face object.                           */
-  /*                                                                       */
-  /*    req           :: The size request.                                 */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    astrike_index :: The index of the sbit strike.                     */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.  Returns an error if no     */
-  /*    sbit strike exists for the selected ppem values.                   */
-  /*                                                                       */
-  typedef FT_Error
-  (*TT_Set_SBit_Strike_OldFunc)( TT_Face    face,
-                                 FT_UInt    x_ppem,
-                                 FT_UInt    y_ppem,
-                                 FT_ULong*  astrike_index );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    TT_CharMap_Load_Func                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads a given TrueType character map into memory.                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the parent face object.                      */
-  /*                                                                       */
-  /*    stream :: A handle to the current stream object.                   */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    cmap   :: A pointer to a cmap object.                              */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The function assumes that the stream is already in use (i.e.,      */
-  /*    opened).  In case of error, all partially allocated tables are     */
-  /*    released.                                                          */
-  /*                                                                       */
-  typedef FT_Error
-  (*TT_CharMap_Load_Func)( TT_Face    face,
-                           void*      cmap,
-                           FT_Stream  input );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    TT_CharMap_Free_Func                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Destroys a character mapping table.                                */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face :: A handle to the parent face object.                        */
-  /*                                                                       */
-  /*    cmap :: A handle to a cmap object.                                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  typedef FT_Error
-  (*TT_CharMap_Free_Func)( TT_Face       face,
-                           void*         cmap );
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
   /*    TT_Set_SBit_Strike_Func                                            */
   /*                                                                       */
   /* <Description>                                                         */
@@ -657,11 +504,6 @@
 
     TT_Load_Any_Func             load_any;
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    TT_Load_SFNT_HeaderRec_Func  load_sfnt_header;
-    TT_Load_Directory_Func       load_directory;
-#endif
-
     /* these functions are called by `load_face' but they can also  */
     /* be called from external modules, if there is a need to do so */
     TT_Load_Table_Func           load_head;
@@ -674,12 +516,6 @@
     TT_Load_Table_Func           load_name;
     TT_Free_Table_Func           free_name;
 
-    /* optional tables */
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    TT_Load_Table_Func           load_hdmx_stub;
-    TT_Free_Table_Func           free_hdmx_stub;
-#endif
-
     /* this field was called `load_kerning' up to version 2.1.10 */
     TT_Load_Table_Func           load_kern;
 
@@ -690,43 +526,12 @@
     /* version 2.1.10                                                   */
     TT_Load_Table_Func           load_bhed;
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-    /* see `ttsbit.h' */
-    TT_Set_SBit_Strike_OldFunc   set_sbit_strike_stub;
-    TT_Load_Table_Func           load_sbits_stub;
-
-    /*
-     *  The following two fields appeared in version 2.1.8, and were placed
-     *  between `load_sbits' and `load_sbit_image'.  We support them as a
-     *  special exception since they are used by Xfont library within the
-     *  X.Org xserver, and because the probability that other rogue clients
-     *  use the other version 2.1.7 fields below is _extremely_ low.
-     *
-     *  Note that this forces us to disable an interesting memory-saving
-     *  optimization though...
-     */
-
-    TT_Find_SBit_Image_Func      find_sbit_image;
-    TT_Load_SBit_Metrics_Func    load_sbit_metrics;
-
-#endif
-
     TT_Load_SBit_Image_Func      load_sbit_image;
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    TT_Free_Table_Func           free_sbits_stub;
-#endif
-
     /* see `ttpost.h' */
     TT_Get_PS_Name_Func          get_psname;
     TT_Free_Table_Func           free_psnames;
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    TT_CharMap_Load_Func         load_charmap_stub;
-    TT_CharMap_Free_Func         free_charmap_stub;
-#endif
-
     /* starting here, the structure differs from version 2.1.7 */
 
     /* this field was introduced in version 2.1.8, named `get_psname' */
@@ -755,213 +560,141 @@
 
 #ifndef FT_CONFIG_OPTION_PIC
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a )  \
-          a,
-#else
-#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a )  /* empty */
-#endif
-
-#define FT_INTERNAL( a ) \
-          a,
-
-#define FT_DEFINE_SFNT_INTERFACE(                            \
-          class_,                                            \
-          goto_table_,                                       \
-          init_face_,                                        \
-          load_face_,                                        \
-          done_face_,                                        \
-          get_interface_,                                    \
-          load_any_,                                         \
-          load_sfnt_header_,                                 \
-          load_directory_,                                   \
-          load_head_,                                        \
-          load_hhea_,                                        \
-          load_cmap_,                                        \
-          load_maxp_,                                        \
-          load_os2_,                                         \
-          load_post_,                                        \
-          load_name_,                                        \
-          free_name_,                                        \
-          load_hdmx_stub_,                                   \
-          free_hdmx_stub_,                                   \
-          load_kern_,                                        \
-          load_gasp_,                                        \
-          load_pclt_,                                        \
-          load_bhed_,                                        \
-          set_sbit_strike_stub_,                             \
-          load_sbits_stub_,                                  \
-          find_sbit_image_,                                  \
-          load_sbit_metrics_,                                \
-          load_sbit_image_,                                  \
-          free_sbits_stub_,                                  \
-          get_psname_,                                       \
-          free_psnames_,                                     \
-          load_charmap_stub_,                                \
-          free_charmap_stub_,                                \
-          get_kerning_,                                      \
-          load_font_dir_,                                    \
-          load_hmtx_,                                        \
-          load_eblc_,                                        \
-          free_eblc_,                                        \
-          set_sbit_strike_,                                  \
-          load_strike_metrics_,                              \
-          get_metrics_ )                                     \
-  static const SFNT_Interface  class_ =                      \
-  {                                                          \
-    FT_INTERNAL( goto_table_ )                               \
-    FT_INTERNAL( init_face_ )                                \
-    FT_INTERNAL( load_face_ )                                \
-    FT_INTERNAL( done_face_ )                                \
-    FT_INTERNAL( get_interface_ )                            \
-    FT_INTERNAL( load_any_ )                                 \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sfnt_header_ )      \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_directory_ )        \
-    FT_INTERNAL( load_head_ )                                \
-    FT_INTERNAL( load_hhea_ )                                \
-    FT_INTERNAL( load_cmap_ )                                \
-    FT_INTERNAL( load_maxp_ )                                \
-    FT_INTERNAL( load_os2_ )                                 \
-    FT_INTERNAL( load_post_ )                                \
-    FT_INTERNAL( load_name_ )                                \
-    FT_INTERNAL( free_name_ )                                \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_hdmx_stub_ )        \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_hdmx_stub_ )        \
-    FT_INTERNAL( load_kern_ )                                \
-    FT_INTERNAL( load_gasp_ )                                \
-    FT_INTERNAL( load_pclt_ )                                \
-    FT_INTERNAL( load_bhed_ )                                \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( set_sbit_strike_stub_ )  \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbits_stub_ )       \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( find_sbit_image_ )       \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbit_metrics_ )     \
-    FT_INTERNAL( load_sbit_image_ )                          \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_sbits_stub_ )       \
-    FT_INTERNAL( get_psname_ )                               \
-    FT_INTERNAL( free_psnames_ )                             \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_charmap_stub_ )     \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_charmap_stub_ )     \
-    FT_INTERNAL( get_kerning_ )                              \
-    FT_INTERNAL( load_font_dir_ )                            \
-    FT_INTERNAL( load_hmtx_ )                                \
-    FT_INTERNAL( load_eblc_ )                                \
-    FT_INTERNAL( free_eblc_ )                                \
-    FT_INTERNAL( set_sbit_strike_ )                          \
-    FT_INTERNAL( load_strike_metrics_ )                      \
-    FT_INTERNAL( get_metrics_ )                              \
+#define FT_DEFINE_SFNT_INTERFACE(        \
+          class_,                        \
+          goto_table_,                   \
+          init_face_,                    \
+          load_face_,                    \
+          done_face_,                    \
+          get_interface_,                \
+          load_any_,                     \
+          load_head_,                    \
+          load_hhea_,                    \
+          load_cmap_,                    \
+          load_maxp_,                    \
+          load_os2_,                     \
+          load_post_,                    \
+          load_name_,                    \
+          free_name_,                    \
+          load_kern_,                    \
+          load_gasp_,                    \
+          load_pclt_,                    \
+          load_bhed_,                    \
+          load_sbit_image_,              \
+          get_psname_,                   \
+          free_psnames_,                 \
+          get_kerning_,                  \
+          load_font_dir_,                \
+          load_hmtx_,                    \
+          load_eblc_,                    \
+          free_eblc_,                    \
+          set_sbit_strike_,              \
+          load_strike_metrics_,          \
+          get_metrics_ )                 \
+  static const SFNT_Interface  class_ =  \
+  {                                      \
+    goto_table_,                         \
+    init_face_,                          \
+    load_face_,                          \
+    done_face_,                          \
+    get_interface_,                      \
+    load_any_,                           \
+    load_head_,                          \
+    load_hhea_,                          \
+    load_cmap_,                          \
+    load_maxp_,                          \
+    load_os2_,                           \
+    load_post_,                          \
+    load_name_,                          \
+    free_name_,                          \
+    load_kern_,                          \
+    load_gasp_,                          \
+    load_pclt_,                          \
+    load_bhed_,                          \
+    load_sbit_image_,                    \
+    get_psname_,                         \
+    free_psnames_,                       \
+    get_kerning_,                        \
+    load_font_dir_,                      \
+    load_hmtx_,                          \
+    load_eblc_,                          \
+    free_eblc_,                          \
+    set_sbit_strike_,                    \
+    load_strike_metrics_,                \
+    get_metrics_,                        \
   };
 
 #else /* FT_CONFIG_OPTION_PIC */
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a, a_ )  \
-          clazz->a = a_;
-#else
-#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a, a_ )  /* empty */
-#endif
-
 #define FT_INTERNAL( a, a_ )  \
           clazz->a = a_;
 
-#define FT_DEFINE_SFNT_INTERFACE(                             \
-          class_,                                             \
-          goto_table_,                                        \
-          init_face_,                                         \
-          load_face_,                                         \
-          done_face_,                                         \
-          get_interface_,                                     \
-          load_any_,                                          \
-          load_sfnt_header_,                                  \
-          load_directory_,                                    \
-          load_head_,                                         \
-          load_hhea_,                                         \
-          load_cmap_,                                         \
-          load_maxp_,                                         \
-          load_os2_,                                          \
-          load_post_,                                         \
-          load_name_,                                         \
-          free_name_,                                         \
-          load_hdmx_stub_,                                    \
-          free_hdmx_stub_,                                    \
-          load_kern_,                                         \
-          load_gasp_,                                         \
-          load_pclt_,                                         \
-          load_bhed_,                                         \
-          set_sbit_strike_stub_,                              \
-          load_sbits_stub_,                                   \
-          find_sbit_image_,                                   \
-          load_sbit_metrics_,                                 \
-          load_sbit_image_,                                   \
-          free_sbits_stub_,                                   \
-          get_psname_,                                        \
-          free_psnames_,                                      \
-          load_charmap_stub_,                                 \
-          free_charmap_stub_,                                 \
-          get_kerning_,                                       \
-          load_font_dir_,                                     \
-          load_hmtx_,                                         \
-          load_eblc_,                                         \
-          free_eblc_,                                         \
-          set_sbit_strike_,                                   \
-          load_strike_metrics_,                               \
-          get_metrics_ )                                      \
-  void                                                        \
-  FT_Init_Class_ ## class_( FT_Library       library,         \
-                            SFNT_Interface*  clazz )          \
-  {                                                           \
-    FT_UNUSED( library );                                     \
-                                                              \
-    FT_INTERNAL( goto_table, goto_table_ )                    \
-    FT_INTERNAL( init_face, init_face_ )                      \
-    FT_INTERNAL( load_face, load_face_ )                      \
-    FT_INTERNAL( done_face, done_face_ )                      \
-    FT_INTERNAL( get_interface, get_interface_ )              \
-    FT_INTERNAL( load_any, load_any_ )                        \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sfnt_header,         \
-                                    load_sfnt_header_ )       \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_directory,           \
-                                    load_directory_ )         \
-    FT_INTERNAL( load_head, load_head_ )                      \
-    FT_INTERNAL( load_hhea, load_hhea_ )                      \
-    FT_INTERNAL( load_cmap, load_cmap_ )                      \
-    FT_INTERNAL( load_maxp, load_maxp_ )                      \
-    FT_INTERNAL( load_os2, load_os2_ )                        \
-    FT_INTERNAL( load_post, load_post_ )                      \
-    FT_INTERNAL( load_name, load_name_ )                      \
-    FT_INTERNAL( free_name, free_name_ )                      \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_hdmx_stub,           \
-                                    load_hdmx_stub_ )         \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_hdmx_stub,           \
-                                    free_hdmx_stub_ )         \
-    FT_INTERNAL( load_kern, load_kern_ )                      \
-    FT_INTERNAL( load_gasp, load_gasp_ )                      \
-    FT_INTERNAL( load_pclt, load_pclt_ )                      \
-    FT_INTERNAL( load_bhed, load_bhed_ )                      \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( set_sbit_strike_stub,     \
-                                    set_sbit_strike_stub_ )   \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbits_stub,          \
-                                    load_sbits_stub_ )        \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( find_sbit_image,          \
-                                    find_sbit_image_ )        \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbit_metrics,        \
-                                    load_sbit_metrics_ )      \
-    FT_INTERNAL( load_sbit_image, load_sbit_image_ )          \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_sbits_stub,          \
-                                    free_sbits_stub_ )        \
-    FT_INTERNAL( get_psname, get_psname_ )                    \
-    FT_INTERNAL( free_psnames, free_psnames_ )                \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( load_charmap_stub,        \
-                                    load_charmap_stub_ )      \
-    FT_DEFINE_DRIVERS_OLD_INTERNAL( free_charmap_stub,        \
-                                    free_charmap_stub_ )      \
-    FT_INTERNAL( get_kerning, get_kerning_ )                  \
-    FT_INTERNAL( load_font_dir, load_font_dir_ )              \
-    FT_INTERNAL( load_hmtx, load_hmtx_ )                      \
-    FT_INTERNAL( load_eblc, load_eblc_ )                      \
-    FT_INTERNAL( free_eblc, free_eblc_ )                      \
-    FT_INTERNAL( set_sbit_strike, set_sbit_strike_ )          \
-    FT_INTERNAL( load_strike_metrics, load_strike_metrics_ )  \
-    FT_INTERNAL( get_metrics, get_metrics_ )                  \
+#define FT_DEFINE_SFNT_INTERFACE(                       \
+          class_,                                       \
+          goto_table_,                                  \
+          init_face_,                                   \
+          load_face_,                                   \
+          done_face_,                                   \
+          get_interface_,                               \
+          load_any_,                                    \
+          load_head_,                                   \
+          load_hhea_,                                   \
+          load_cmap_,                                   \
+          load_maxp_,                                   \
+          load_os2_,                                    \
+          load_post_,                                   \
+          load_name_,                                   \
+          free_name_,                                   \
+          load_kern_,                                   \
+          load_gasp_,                                   \
+          load_pclt_,                                   \
+          load_bhed_,                                   \
+          load_sbit_image_,                             \
+          get_psname_,                                  \
+          free_psnames_,                                \
+          get_kerning_,                                 \
+          load_font_dir_,                               \
+          load_hmtx_,                                   \
+          load_eblc_,                                   \
+          free_eblc_,                                   \
+          set_sbit_strike_,                             \
+          load_strike_metrics_,                         \
+          get_metrics_ )                                \
+  void                                                  \
+  FT_Init_Class_ ## class_( FT_Library       library,   \
+                            SFNT_Interface*  clazz )    \
+  {                                                     \
+    FT_UNUSED( library );                               \
+                                                        \
+    clazz->goto_table          = goto_table_;           \
+    clazz->init_face           = init_face_;            \
+    clazz->load_face           = load_face_;            \
+    clazz->done_face           = done_face_;            \
+    clazz->get_interface       = get_interface_;        \
+    clazz->load_any            = load_any_;             \
+    clazz->load_head           = load_head_;            \
+    clazz->load_hhea           = load_hhea_;            \
+    clazz->load_cmap           = load_cmap_;            \
+    clazz->load_maxp           = load_maxp_;            \
+    clazz->load_os2            = load_os2_;             \
+    clazz->load_post           = load_post_;            \
+    clazz->load_name           = load_name_;            \
+    clazz->free_name           = free_name_;            \
+    clazz->load_kern           = load_kern_;            \
+    clazz->load_gasp           = load_gasp_;            \
+    clazz->load_pclt           = load_pclt_;            \
+    clazz->load_bhed           = load_bhed_;            \
+    clazz->load_sbit_image     = load_sbit_image_;      \
+    clazz->get_psname          = get_psname_;           \
+    clazz->free_psnames        = free_psnames_;         \
+    clazz->get_kerning         = get_kerning_;          \
+    clazz->load_font_dir       = load_font_dir_;        \
+    clazz->load_hmtx           = load_hmtx_;            \
+    clazz->load_eblc           = load_eblc_;            \
+    clazz->free_eblc           = free_eblc_;            \
+    clazz->set_sbit_strike     = set_sbit_strike_;      \
+    clazz->load_strike_metrics = load_strike_metrics_;  \
+    clazz->get_metrics         = get_metrics_;          \
   }
 
 #endif /* FT_CONFIG_OPTION_PIC */
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -5,7 +5,7 @@
 /*    Basic Type1/Type2 type definitions and interface (specification      */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 1996-2004, 2006, 2008, 2009, 2011 by                         */
+/*  Copyright 1996-2004, 2006, 2008, 2009, 2011, 2013 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -204,10 +204,6 @@
     const void*     afm_data;
     FT_CharMapRec   charmaprecs[2];
     FT_CharMap      charmaps[2];
-
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    PS_Unicodes     unicode_map;
-#endif
 
     /* support for Multiple Masters fonts */
     PS_Blend        blend;
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -311,90 +311,9 @@
   } TT_GaspRec;
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
   /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    TT_HdmxEntryRec                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A small structure used to model the pre-computed widths of a given */
-  /*    size.  They are found in the `hdmx' table.                         */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    ppem      :: The pixels per EM value at which these metrics apply. */
-  /*                                                                       */
-  /*    max_width :: The maximum advance width for this metric.            */
-  /*                                                                       */
-  /*    widths    :: An array of widths.  Note: These are 8-bit bytes.     */
-  /*                                                                       */
-  typedef struct  TT_HdmxEntryRec_
-  {
-    FT_Byte   ppem;
-    FT_Byte   max_width;
-    FT_Byte*  widths;
-
-  } TT_HdmxEntryRec, *TT_HdmxEntry;
-
-
   /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    TT_HdmxRec                                                         */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A structure used to model the `hdmx' table, which contains         */
-  /*    pre-computed widths for a set of given sizes/dimensions.           */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    version     :: The version number.                                 */
-  /*                                                                       */
-  /*    num_records :: The number of hdmx records.                         */
-  /*                                                                       */
-  /*    records     :: An array of hdmx records.                           */
-  /*                                                                       */
-  typedef struct  TT_HdmxRec_
-  {
-    FT_UShort     version;
-    FT_Short      num_records;
-    TT_HdmxEntry  records;
-
-  } TT_HdmxRec, *TT_Hdmx;
-
-
   /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    TT_Kern0_PairRec                                                   */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A structure used to model a kerning pair for the kerning table     */
-  /*    format 0.  The engine now loads this table if it finds one in the  */
-  /*    font file.                                                         */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    left  :: The index of the left glyph in pair.                      */
-  /*                                                                       */
-  /*    right :: The index of the right glyph in pair.                     */
-  /*                                                                       */
-  /*    value :: The kerning distance.  A positive value spaces the        */
-  /*             glyphs, a negative one makes them closer.                 */
-  /*                                                                       */
-  typedef struct  TT_Kern0_PairRec_
-  {
-    FT_UShort  left;   /* index of left  glyph in pair */
-    FT_UShort  right;  /* index of right glyph in pair */
-    FT_FWord   value;  /* kerning value                */
-
-  } TT_Kern0_PairRec, *TT_Kern0_Pair;
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
   /***                                                                   ***/
   /***                                                                   ***/
   /***                    EMBEDDED BITMAPS SUPPORT                       ***/
@@ -1269,9 +1188,6 @@
     TT_HoriHeader         horizontal;   /* TrueType horizontal header     */
 
     TT_MaxProfile         max_profile;
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    FT_ULong              max_components;  /* stubbed to 0 */
-#endif
 
     FT_Bool               vertical_info;
     TT_VertHeader         vertical;     /* TT Vertical header, if present */
@@ -1308,11 +1224,6 @@
     /*                                                                     */
     /***********************************************************************/
 
-    /* horizontal device metrics */
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    TT_HdmxRec            hdmx;
-#endif
-
     /* grid-fitting and scaling table */
     TT_GaspRec            gasp;                 /* the `gasp' table */
 
@@ -1320,11 +1231,6 @@
     TT_PCLT               pclt;
 
     /* embedded bitmaps support */
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    FT_ULong              num_sbit_strikes;
-    TT_SBit_Strike        sbit_strikes;
-#endif
-
     FT_ULong              num_sbit_scales;
     TT_SBit_Scale         sbit_scales;
 
@@ -1338,12 +1244,6 @@
     /*                                                                     */
     /***********************************************************************/
 
-    /* the glyph locations */
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    FT_UShort             num_locations_stub;
-    FT_Long*              glyph_locations_stub;
-#endif
-
     /* the font program, if any */
     FT_ULong              font_program_size;
     FT_Byte*              font_program;
@@ -1356,13 +1256,6 @@
     FT_ULong              cvt_size;
     FT_Short*             cvt;
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    /* the format 0 kerning table, if any */
-    FT_Int                num_kern_pairs;
-    FT_Int                kern_table_index;
-    TT_Kern0_Pair         kern_pairs;
-#endif
-
     /* A pointer to the bytecode interpreter to use.  This is also */
     /* used to hook the debugger for the `ttdebug' utility.        */
     TT_Interpreter        interpreter;
@@ -1383,11 +1276,8 @@
 
     const char*           postscript_name;
 
-    /* since version 2.1.8, but was originally placed after */
-    /* `glyph_locations_stub'                               */
     FT_ULong              glyf_len;
 
-    /* since version 2.1.8, but was originally placed before `extra' */
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
     FT_Bool               doblend;
     GX_Blend              blend;
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -152,40 +152,6 @@
   }
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  /* documentation is in ftcalc.h */
-
-  FT_EXPORT_DEF( FT_Int32 )
-  FT_Sqrt32( FT_Int32  x )
-  {
-    FT_UInt32  val, root, newroot, mask;
-
-
-    root = 0;
-    mask = (FT_UInt32)0x40000000UL;
-    val  = (FT_UInt32)x;
-
-    do
-    {
-      newroot = root + mask;
-      if ( newroot <= val )
-      {
-        val -= newroot;
-        root = newroot + mask;
-      }
-
-      root >>= 1;
-      mask >>= 2;
-
-    } while ( mask != 0 );
-
-    return root;
-  }
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
 #ifdef FT_LONG64
 
 
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4815,70 +4815,6 @@
   }
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  FT_BASE_DEF( FT_Error )
-  ft_stub_set_char_sizes( FT_Size     size,
-                          FT_F26Dot6  width,
-                          FT_F26Dot6  height,
-                          FT_UInt     horz_res,
-                          FT_UInt     vert_res )
-  {
-    FT_Size_RequestRec  req;
-    FT_Driver           driver = size->face->driver;
-
-
-    if ( driver->clazz->request_size )
-    {
-      req.type   = FT_SIZE_REQUEST_TYPE_NOMINAL;
-      req.width  = width;
-      req.height = height;
-
-      if ( horz_res == 0 )
-        horz_res = vert_res;
-
-      if ( vert_res == 0 )
-        vert_res = horz_res;
-
-      if ( horz_res == 0 )
-        horz_res = vert_res = 72;
-
-      req.horiResolution = horz_res;
-      req.vertResolution = vert_res;
-
-      return driver->clazz->request_size( size, &req );
-    }
-
-    return 0;
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  ft_stub_set_pixel_sizes( FT_Size  size,
-                           FT_UInt  width,
-                           FT_UInt  height )
-  {
-    FT_Size_RequestRec  req;
-    FT_Driver           driver = size->face->driver;
-
-
-    if ( driver->clazz->request_size )
-    {
-      req.type           = FT_SIZE_REQUEST_TYPE_NOMINAL;
-      req.width          = width  << 6;
-      req.height         = height << 6;
-      req.horiResolution = 0;
-      req.vertResolution = 0;
-
-      return driver->clazz->request_size( size, &req );
-    }
-
-    return 0;
-  }
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
   /* documentation is in freetype.h */
 
   FT_EXPORT_DEF( FT_Error )
--- a/src/base/ftutil.c
+++ b/src/base/ftutil.c
@@ -433,70 +433,4 @@
   }
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  FT_BASE_DEF( FT_Error )
-  FT_Alloc( FT_Memory  memory,
-            FT_Long    size,
-            void*     *P )
-  {
-    FT_Error  error;
-
-
-    (void)FT_ALLOC( *P, size );
-    return error;
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_QAlloc( FT_Memory  memory,
-             FT_Long    size,
-             void*     *p )
-  {
-    FT_Error  error;
-
-
-    (void)FT_QALLOC( *p, size );
-    return error;
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_Realloc( FT_Memory  memory,
-              FT_Long    current,
-              FT_Long    size,
-              void*     *P )
-  {
-    FT_Error  error;
-
-
-    (void)FT_REALLOC( *P, current, size );
-    return error;
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_QRealloc( FT_Memory  memory,
-               FT_Long    current,
-               FT_Long    size,
-               void*     *p )
-  {
-    FT_Error  error;
-
-
-    (void)FT_QREALLOC( *p, current, size );
-    return error;
-  }
-
-
-  FT_BASE_DEF( void )
-  FT_Free( FT_Memory  memory,
-           void*     *P )
-  {
-    if ( *P )
-      FT_MEM_FREE( *P );
-  }
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
 /* END */
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -864,10 +864,6 @@
     0,                          /* FT_Slot_InitFunc */
     0,                          /* FT_Slot_DoneFunc */
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    ft_stub_set_char_sizes,
-    ft_stub_set_pixel_sizes,
-#endif
     BDF_Glyph_Load,
 
     0,                          /* FT_Face_GetKerningFunc  */
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -30,45 +30,7 @@
 #define FT_COMPONENT  trace_cache
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
   /*
-   *  These structures correspond to the FTC_Font and FTC_ImageDesc types
-   *  that were defined in version 2.1.7.
-   */
-  typedef struct  FTC_OldFontRec_
-  {
-    FTC_FaceID  face_id;
-    FT_UShort   pix_width;
-    FT_UShort   pix_height;
-
-  } FTC_OldFontRec, *FTC_OldFont;
-
-
-  typedef struct  FTC_OldImageDescRec_
-  {
-    FTC_OldFontRec  font;
-    FT_UInt32       flags;
-
-  } FTC_OldImageDescRec, *FTC_OldImageDesc;
-
-
-  /*
-   *  Notice that FTC_OldImageDescRec and FTC_ImageTypeRec are nearly
-   *  identical, bit-wise.  The only difference is that the `width' and
-   *  `height' fields are expressed as 16-bit integers in the old structure,
-   *  and as normal `int' in the new one.
-   *
-   *  We are going to perform a weird hack to detect which structure is
-   *  being passed to the image and sbit caches.  If the new structure's
-   *  `width' is larger than 0x10000, we assume that we are really receiving
-   *  an FTC_OldImageDesc.
-   */
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
-  /*
    *  Basic Families
    *
    */
@@ -336,27 +298,7 @@
     if ( anode )
       *anode  = NULL;
 
-#if defined( FT_CONFIG_OPTION_OLD_INTERNALS ) && ( FT_INT_MAX > 0xFFFFU )
-
-    /*
-     *  This one is a major hack used to detect whether we are passed a
-     *  regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
-     */
-    if ( (FT_ULong)type->width >= 0x10000L )
     {
-      FTC_OldImageDesc  desc = (FTC_OldImageDesc)type;
-
-
-      query.attrs.scaler.face_id = desc->font.face_id;
-      query.attrs.scaler.width   = desc->font.pix_width;
-      query.attrs.scaler.height  = desc->font.pix_height;
-      query.attrs.load_flags     = desc->flags;
-    }
-    else
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-    {
       if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX )
       {
         FT_TRACE1(( "FTC_ImageCache_Lookup: higher bits in load_flags" ));
@@ -467,143 +409,12 @@
   }
 
 
+  /*
+   *
+   * basic small bitmap cache
+   *
+   */
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  /* yet another backwards-legacy structure */
-  typedef struct  FTC_OldImage_Desc_
-  {
-    FTC_FontRec  font;
-    FT_UInt      image_type;
-
-  } FTC_OldImage_Desc;
-
-
-#define FTC_OLD_IMAGE_FORMAT( x )  ( (x) & 7 )
-
-
-#define ftc_old_image_format_bitmap    0x0000
-#define ftc_old_image_format_outline   0x0001
-
-#define ftc_old_image_format_mask      0x000F
-
-#define ftc_old_image_flag_monochrome  0x0010
-#define ftc_old_image_flag_unhinted    0x0020
-#define ftc_old_image_flag_autohinted  0x0040
-#define ftc_old_image_flag_unscaled    0x0080
-#define ftc_old_image_flag_no_sbits    0x0100
-
-  /* monochrome bitmap */
-#define ftc_old_image_mono             ftc_old_image_format_bitmap   | \
-                                       ftc_old_image_flag_monochrome
-
-  /* anti-aliased bitmap */
-#define ftc_old_image_grays            ftc_old_image_format_bitmap
-
-  /* scaled outline */
-#define ftc_old_image_outline          ftc_old_image_format_outline
-
-
-  static void
-  ftc_image_type_from_old_desc( FTC_ImageType       typ,
-                                FTC_OldImage_Desc*  desc )
-  {
-    typ->face_id = desc->font.face_id;
-    typ->width   = desc->font.pix_width;
-    typ->height  = desc->font.pix_height;
-
-    /* convert image type flags to load flags */
-    {
-      FT_UInt  load_flags = FT_LOAD_DEFAULT;
-      FT_UInt  type       = desc->image_type;
-
-
-      /* determine load flags, depending on the font description's */
-      /* image type                                                */
-
-      if ( FTC_OLD_IMAGE_FORMAT( type ) == ftc_old_image_format_bitmap )
-      {
-        if ( type & ftc_old_image_flag_monochrome )
-          load_flags |= FT_LOAD_MONOCHROME;
-
-        /* disable embedded bitmaps loading if necessary */
-        if ( type & ftc_old_image_flag_no_sbits )
-          load_flags |= FT_LOAD_NO_BITMAP;
-      }
-      else
-      {
-        /* we want an outline, don't load embedded bitmaps */
-        load_flags |= FT_LOAD_NO_BITMAP;
-
-        if ( type & ftc_old_image_flag_unscaled )
-          load_flags |= FT_LOAD_NO_SCALE;
-      }
-
-      /* always render glyphs to bitmaps */
-      load_flags |= FT_LOAD_RENDER;
-
-      if ( type & ftc_old_image_flag_unhinted )
-        load_flags |= FT_LOAD_NO_HINTING;
-
-      if ( type & ftc_old_image_flag_autohinted )
-        load_flags |= FT_LOAD_FORCE_AUTOHINT;
-
-      typ->flags = load_flags;
-    }
-  }
-
-
-  FT_EXPORT( FT_Error )
-  FTC_Image_Cache_New( FTC_Manager      manager,
-                       FTC_ImageCache  *acache );
-
-  FT_EXPORT( FT_Error )
-  FTC_Image_Cache_Lookup( FTC_ImageCache      icache,
-                          FTC_OldImage_Desc*  desc,
-                          FT_UInt             gindex,
-                          FT_Glyph           *aglyph );
-
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_Image_Cache_New( FTC_Manager      manager,
-                       FTC_ImageCache  *acache )
-  {
-    return FTC_ImageCache_New( manager, (FTC_ImageCache*)acache );
-  }
-
-
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_Image_Cache_Lookup( FTC_ImageCache      icache,
-                          FTC_OldImage_Desc*  desc,
-                          FT_UInt             gindex,
-                          FT_Glyph           *aglyph )
-  {
-    FTC_ImageTypeRec  type0;
-
-
-    if ( !desc )
-      return FT_THROW( Invalid_Argument );
-
-    ftc_image_type_from_old_desc( &type0, desc );
-
-    return FTC_ImageCache_Lookup( (FTC_ImageCache)icache,
-                                   &type0,
-                                   gindex,
-                                   aglyph,
-                                   NULL );
-  }
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
- /*
-  *
-  * basic small bitmap cache
-  *
-  */
-
-
   FT_CALLBACK_TABLE_DEF
   const FTC_SFamilyClassRec  ftc_basic_sbit_family_class =
   {
@@ -672,26 +483,7 @@
 
     *ansbit = NULL;
 
-#if defined( FT_CONFIG_OPTION_OLD_INTERNALS ) && ( FT_INT_MAX > 0xFFFFU )
-
-    /*  This one is a major hack used to detect whether we are passed a
-     *  regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
-     */
-    if ( (FT_ULong)type->width >= 0x10000L )
     {
-      FTC_OldImageDesc  desc = (FTC_OldImageDesc)type;
-
-
-      query.attrs.scaler.face_id = desc->font.face_id;
-      query.attrs.scaler.width   = desc->font.pix_width;
-      query.attrs.scaler.height  = desc->font.pix_height;
-      query.attrs.load_flags     = desc->flags;
-    }
-    else
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-    {
       if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX )
       {
         FT_TRACE1(( "FTC_ImageCache_Lookup: higher bits in load_flags" ));
@@ -805,51 +597,6 @@
   Exit:
     return error;
   }
-
-
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  FT_EXPORT( FT_Error )
-  FTC_SBit_Cache_New( FTC_Manager     manager,
-                      FTC_SBitCache  *acache );
-
-  FT_EXPORT( FT_Error )
-  FTC_SBit_Cache_Lookup( FTC_SBitCache       cache,
-                         FTC_OldImage_Desc*  desc,
-                         FT_UInt             gindex,
-                         FTC_SBit           *ansbit );
-
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_SBit_Cache_New( FTC_Manager     manager,
-                      FTC_SBitCache  *acache )
-  {
-    return FTC_SBitCache_New( manager, (FTC_SBitCache*)acache );
-  }
-
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_SBit_Cache_Lookup( FTC_SBitCache       cache,
-                         FTC_OldImage_Desc*  desc,
-                         FT_UInt             gindex,
-                         FTC_SBit           *ansbit )
-  {
-    FTC_ImageTypeRec  type0;
-
-
-    if ( !desc )
-      return FT_THROW( Invalid_Argument );
-
-    ftc_image_type_from_old_desc( &type0, desc );
-
-    return FTC_SBitCache_Lookup( (FTC_SBitCache)cache,
-                                  &type0,
-                                  gindex,
-                                  ansbit,
-                                  NULL );
-  }
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
 /* END */
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -269,11 +269,7 @@
 
 
   /* remove a node from the cache manager */
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-  FT_BASE_DEF( void )
-#else
   FT_LOCAL_DEF( void )
-#endif
   ftc_node_destroy( FTC_Node     node,
                     FTC_Manager  manager )
   {
--- a/src/cache/ftccache.h
+++ b/src/cache/ftccache.h
@@ -86,12 +86,6 @@
         ftc_get_top_node_for_hash( ( cache ), ( hash ) )
 #endif
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-  FT_BASE( void )
-  ftc_node_destroy( FTC_Node     node,
-                    FTC_Manager  manager );
-#endif
-
 
   /*************************************************************************/
   /*************************************************************************/
--- a/src/cache/ftccback.h
+++ b/src/cache/ftccback.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Callback functions of the caching sub-system (specification only).   */
 /*                                                                         */
-/*  Copyright 2004, 2005, 2006, 2011 by                                    */
+/*  Copyright 2004-2006, 2011, 2013 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -81,11 +81,10 @@
   FT_LOCAL( void )
   ftc_cache_done( FTC_Cache  cache );
 
-#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
   FT_LOCAL( void )
   ftc_node_destroy( FTC_Node     node,
                     FTC_Manager  manager );
-#endif
+
 
 #endif /* __FTCCBACK_H__ */
 
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType CharMap cache (body)                                        */
 /*                                                                         */
-/*  Copyright 2000-2012 by                                                 */
+/*  Copyright 2000-2013 by                                                 */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -31,43 +31,6 @@
 #define FT_COMPONENT  trace_cache
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  typedef enum  FTC_OldCMapType_
-  {
-    FTC_OLD_CMAP_BY_INDEX    = 0,
-    FTC_OLD_CMAP_BY_ENCODING = 1,
-    FTC_OLD_CMAP_BY_ID       = 2
-
-  } FTC_OldCMapType;
-
-
-  typedef struct  FTC_OldCMapIdRec_
-  {
-    FT_UInt  platform;
-    FT_UInt  encoding;
-
-  } FTC_OldCMapIdRec, *FTC_OldCMapId;
-
-
-  typedef struct  FTC_OldCMapDescRec_
-  {
-    FTC_FaceID       face_id;
-    FTC_OldCMapType  type;
-
-    union
-    {
-      FT_UInt           index;
-      FT_Encoding       encoding;
-      FTC_OldCMapIdRec  id;
-
-    } u;
-
-  } FTC_OldCMapDescRec, *FTC_OldCMapDesc;
-
-#endif /* FT_CONFIG_OLD_INTERNALS */
-
-
   /*************************************************************************/
   /*                                                                       */
   /* Each FTC_CMapNode contains a simple array to map a range of character */
@@ -266,21 +229,6 @@
   }
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  /*
-   *  Unfortunately, it is not possible to support binary backwards
-   *  compatibility in the cmap cache.  The FTC_CMapCache_Lookup signature
-   *  changes were too deep, and there is no clever hackish way to detect
-   *  what kind of structure we are being passed.
-   *
-   *  On the other hand it seems that no production code is using this
-   *  function on Unix distributions.
-   */
-
-#endif
-
-
   /* documentation is in ftcache.h */
 
   FT_EXPORT_DEF( FT_UInt )
@@ -315,57 +263,9 @@
       return 0;
     }
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-    /*
-     * If cmap_index is greater than the maximum number of cachable
-     * charmaps, we assume the request is from a legacy rogue client
-     * using old internal header. See include/config/ftoption.h.
-     */
-    if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE && !no_cmap_change )
-    {
-      FTC_OldCMapDesc  desc = (FTC_OldCMapDesc) face_id;
-
-
-      char_code     = (FT_UInt32)cmap_index;
-      query.face_id = desc->face_id;
-
-
-      switch ( desc->type )
-      {
-      case FTC_OLD_CMAP_BY_INDEX:
-        query.cmap_index = desc->u.index;
-        query.char_code  = (FT_UInt32)cmap_index;
-        break;
-
-      case FTC_OLD_CMAP_BY_ENCODING:
-        {
-          FT_Face  face;
-
-
-          error = FTC_Manager_LookupFace( cache->manager, desc->face_id,
-                                          &face );
-          if ( error )
-            return 0;
-
-          FT_Select_Charmap( face, desc->u.encoding );
-
-          return FT_Get_Char_Index( face, char_code );
-        }
-
-      default:
-        return 0;
-      }
-    }
-    else
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-    {
-      query.face_id    = face_id;
-      query.cmap_index = (FT_UInt)cmap_index;
-      query.char_code  = char_code;
-    }
+    query.face_id    = face_id;
+    query.cmap_index = (FT_UInt)cmap_index;
+    query.char_code  = char_code;
 
     hash = FTC_CMAP_HASH( face_id, cmap_index, char_code );
 
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -689,55 +689,4 @@
   }
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_Manager_Lookup_Face( FTC_Manager  manager,
-                           FTC_FaceID   face_id,
-                           FT_Face     *aface )
-  {
-    return FTC_Manager_LookupFace( manager, face_id, aface );
-  }
-
-
-  FT_EXPORT( FT_Error )
-  FTC_Manager_Lookup_Size( FTC_Manager  manager,
-                           FTC_Font     font,
-                           FT_Face     *aface,
-                           FT_Size     *asize )
-  {
-    FTC_ScalerRec  scaler;
-    FT_Error       error;
-    FT_Size        size;
-    FT_Face        face;
-
-
-    scaler.face_id = font->face_id;
-    scaler.width   = font->pix_width;
-    scaler.height  = font->pix_height;
-    scaler.pixel   = TRUE;
-    scaler.x_res   = 0;
-    scaler.y_res   = 0;
-
-    error = FTC_Manager_LookupSize( manager, &scaler, &size );
-    if ( error )
-    {
-      face = NULL;
-      size = NULL;
-    }
-    else
-      face = size->face;
-
-    if ( aface )
-      *aface = face;
-
-    if ( asize )
-      *asize = size;
-
-    return error;
-  }
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
 /* END */
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -765,9 +765,6 @@
     cff_slot_init,
     cff_slot_done,
 
-    ft_stub_set_char_sizes,  /* FT_CONFIG_OPTION_OLD_INTERNALS */
-    ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
     cff_glyph_load,
 
     cff_get_kerning,
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -2711,16 +2711,9 @@
                                                      &advance );
           glyph->root.linearHoriAdvance = advance;
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
           has_vertical_info = FT_BOOL(
                                 face->vertical_info                   &&
-                                face->vertical.number_Of_VMetrics > 0 &&
-                                face->vertical.long_metrics           );
-#else
-          has_vertical_info = FT_BOOL(
-                                face->vertical_info                   &&
                                 face->vertical.number_Of_VMetrics > 0 );
-#endif
 
           /* get the vertical metrics from the vtmx table if we have one */
           if ( has_vertical_info )
@@ -2936,14 +2929,8 @@
         glyph->root.linearHoriAdvance           = decoder.glyph_width;
         glyph->root.internal->glyph_transformed = 0;
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
         has_vertical_info = FT_BOOL( face->vertical_info                   &&
-                                     face->vertical.number_Of_VMetrics > 0 &&
-                                     face->vertical.long_metrics           );
-#else
-        has_vertical_info = FT_BOOL( face->vertical_info                   &&
                                      face->vertical.number_Of_VMetrics > 0 );
-#endif
 
         /* get the vertical metrics from the vtmx table if we have one */
         if ( has_vertical_info )
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -221,11 +221,6 @@
     cid_slot_init,
     cid_slot_done,
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    ft_stub_set_char_sizes,
-    ft_stub_set_pixel_sizes,
-#endif
-
     cid_slot_load_glyph,
 
     0,                      /* FT_Face_GetKerningFunc  */
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -699,10 +699,6 @@
     0,                      /* FT_Slot_InitFunc */
     0,                      /* FT_Slot_DoneFunc */
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    ft_stub_set_char_sizes,
-    ft_stub_set_pixel_sizes,
-#endif
     PCF_Glyph_Load,
 
     0,                      /* FT_Face_GetKerningFunc  */
--- a/src/pfr/pfrdrivr.c
+++ b/src/pfr/pfrdrivr.c
@@ -197,10 +197,6 @@
     pfr_slot_init,
     pfr_slot_done,
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    ft_stub_set_char_sizes,
-    ft_stub_set_pixel_sizes,
-#endif
     pfr_slot_load,
 
     pfr_get_kerning,
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -445,134 +445,6 @@
   }
 
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-
-  FT_CALLBACK_DEF( FT_Error )
-  tt_face_load_sfnt_header_stub( TT_Face      face,
-                                 FT_Stream    stream,
-                                 FT_Long      face_index,
-                                 SFNT_Header  header )
-  {
-    FT_UNUSED( face );
-    FT_UNUSED( stream );
-    FT_UNUSED( face_index );
-    FT_UNUSED( header );
-
-    return FT_THROW( Unimplemented_Feature );
-  }
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  tt_face_load_directory_stub( TT_Face      face,
-                               FT_Stream    stream,
-                               SFNT_Header  header )
-  {
-    FT_UNUSED( face );
-    FT_UNUSED( stream );
-    FT_UNUSED( header );
-
-    return FT_THROW( Unimplemented_Feature );
-  }
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  tt_face_load_hdmx_stub( TT_Face    face,
-                          FT_Stream  stream )
-  {
-    FT_UNUSED( face );
-    FT_UNUSED( stream );
-
-    return FT_THROW( Unimplemented_Feature );
-  }
-
-
-  FT_CALLBACK_DEF( void )
-  tt_face_free_hdmx_stub( TT_Face  face )
-  {
-    FT_UNUSED( face );
-  }
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  tt_face_set_sbit_strike_stub( TT_Face    face,
-                                FT_UInt    x_ppem,
-                                FT_UInt    y_ppem,
-                                FT_ULong*  astrike_index )
-  {
-    /*
-     * We simply forge a FT_Size_Request and call the real function
-     * that does all the work.
-     *
-     * This stub might be called by libXfont in the X.Org Xserver,
-     * compiled against version 2.1.8 or newer.
-     */
-
-    FT_Size_RequestRec  req;
-
-
-    req.type           = FT_SIZE_REQUEST_TYPE_NOMINAL;
-    req.width          = (FT_F26Dot6)x_ppem;
-    req.height         = (FT_F26Dot6)y_ppem;
-    req.horiResolution = 0;
-    req.vertResolution = 0;
-
-    *astrike_index = 0x7FFFFFFFUL;
-
-    return tt_face_set_sbit_strike( face, &req, astrike_index );
-  }
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  tt_face_load_sbit_stub( TT_Face    face,
-                          FT_Stream  stream )
-  {
-    FT_UNUSED( face );
-    FT_UNUSED( stream );
-
-    /*
-     *  This function was originally implemented to load the sbit table.
-     *  However, it has been replaced by `tt_face_load_eblc', and this stub
-     *  is only there for some rogue clients which would want to call it
-     *  directly (which doesn't make much sense).
-     */
-    return FT_THROW( Unimplemented_Feature );
-  }
-
-
-  FT_CALLBACK_DEF( void )
-  tt_face_free_sbit_stub( TT_Face  face )
-  {
-    /* nothing to do in this stub */
-    FT_UNUSED( face );
-  }
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  tt_face_load_charmap_stub( TT_Face    face,
-                             void*      cmap,
-                             FT_Stream  input )
-  {
-    FT_UNUSED( face );
-    FT_UNUSED( cmap );
-    FT_UNUSED( input );
-
-    return FT_THROW( Unimplemented_Feature );
-  }
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  tt_face_free_charmap_stub( TT_Face  face,
-                             void*    cmap )
-  {
-    FT_UNUSED( face );
-    FT_UNUSED( cmap );
-
-    return FT_Err_Ok;
-  }
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
 #define PUT_EMBEDDED_BITMAPS( a )  a
 #else
@@ -596,9 +468,6 @@
 
     tt_face_load_any,
 
-    tt_face_load_sfnt_header_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
-    tt_face_load_directory_stub,   /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
     tt_face_load_head,
     tt_face_load_hhea,
     tt_face_load_cmap,
@@ -609,9 +478,6 @@
     tt_face_load_name,
     tt_face_free_name,
 
-    tt_face_load_hdmx_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
-    tt_face_free_hdmx_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
     tt_face_load_kern,
     tt_face_load_gasp,
     tt_face_load_pclt,
@@ -619,29 +485,16 @@
     /* see `ttload.h' */
     PUT_EMBEDDED_BITMAPS( tt_face_load_bhed ),
 
-    tt_face_set_sbit_strike_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
-    tt_face_load_sbit_stub,       /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-    tt_find_sbit_image,   /* FT_CONFIG_OPTION_OLD_INTERNALS */
-    tt_load_sbit_metrics, /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
     PUT_EMBEDDED_BITMAPS( tt_face_load_sbit_image ),
 
-    tt_face_free_sbit_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
     /* see `ttpost.h' */
     PUT_PS_NAMES( tt_face_get_ps_name   ),
     PUT_PS_NAMES( tt_face_free_ps_names ),
 
-    tt_face_load_charmap_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
-    tt_face_free_charmap_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
     /* since version 2.1.8 */
-
     tt_face_get_kerning,
 
     /* since version 2.2 */
-
     tt_face_load_font_dir,
     tt_face_load_hmtx,
 
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -919,11 +919,7 @@
         FT_UInt  i, count;
 
 
-#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
         count = face->sbit_num_strikes;
-#else
-        count = (FT_UInt)face->num_sbit_strikes;
-#endif
 
         if ( count > 0 )
         {
@@ -1124,7 +1120,6 @@
     }
 
     /* freeing the horizontal metrics */
-#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
     {
       FT_Stream  stream = FT_FACE_STREAM( face );
 
@@ -1134,10 +1129,6 @@
       face->horz_metrics_size = 0;
       face->vert_metrics_size = 0;
     }
-#else
-    FT_FREE( face->horizontal.long_metrics );
-    FT_FREE( face->horizontal.short_metrics );
-#endif
 
     /* freeing the vertical ones, if any */
     if ( face->vertical_info )
--- a/src/sfnt/ttmtx.c
+++ b/src/sfnt/ttmtx.c
@@ -35,13 +35,6 @@
 #define FT_COMPONENT  trace_ttmtx
 
 
-  /*
-   *  Unfortunately, we can't enable our memory optimizations if
-   *  FT_CONFIG_OPTION_OLD_INTERNALS is defined.  This is because at least
-   *  one rogue client (libXfont in the X.Org XServer) is directly accessing
-   *  the metrics.
-   */
-
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -60,8 +53,6 @@
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
-#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
-
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_hmtx( TT_Face    face,
                      FT_Stream  stream,
@@ -97,143 +88,7 @@
     return error;
   }
 
-#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
 
-  FT_LOCAL_DEF( FT_Error )
-  tt_face_load_hmtx( TT_Face    face,
-                     FT_Stream  stream,
-                     FT_Bool    vertical )
-  {
-    FT_Error   error;
-    FT_Memory  memory = stream->memory;
-
-    FT_ULong   table_len;
-    FT_Long    num_shorts, num_longs, num_shorts_checked;
-
-    TT_LongMetrics*    longs;
-    TT_ShortMetrics**  shorts;
-    FT_Byte*           p;
-
-
-    if ( vertical )
-    {
-      void*   lm = &face->vertical.long_metrics;
-      void**  sm = &face->vertical.short_metrics;
-
-
-      error = face->goto_table( face, TTAG_vmtx, stream, &table_len );
-      if ( error )
-        goto Fail;
-
-      num_longs = face->vertical.number_Of_VMetrics;
-      if ( (FT_ULong)num_longs > table_len / 4 )
-        num_longs = (FT_Long)( table_len / 4 );
-
-      face->vertical.number_Of_VMetrics = 0;
-
-      longs  = (TT_LongMetrics*)lm;
-      shorts = (TT_ShortMetrics**)sm;
-    }
-    else
-    {
-      void*   lm = &face->horizontal.long_metrics;
-      void**  sm = &face->horizontal.short_metrics;
-
-
-      error = face->goto_table( face, TTAG_hmtx, stream, &table_len );
-      if ( error )
-        goto Fail;
-
-      num_longs = face->horizontal.number_Of_HMetrics;
-      if ( (FT_ULong)num_longs > table_len / 4 )
-        num_longs = (FT_Long)( table_len / 4 );
-
-      face->horizontal.number_Of_HMetrics = 0;
-
-      longs  = (TT_LongMetrics*)lm;
-      shorts = (TT_ShortMetrics**)sm;
-    }
-
-    /* never trust derived values */
-
-    num_shorts         = face->max_profile.numGlyphs - num_longs;
-    num_shorts_checked = ( table_len - num_longs * 4L ) / 2;
-
-    if ( num_shorts < 0 )
-    {
-      FT_TRACE0(( "tt_face_load_hmtx:"
-                  " %cmtx has more metrics than glyphs.\n",
-                  vertical ? 'v' : 'h' ));
-
-      /* Adobe simply ignores this problem.  So we shall do the same. */
-#if 0
-      error = vertical ? FT_THROW( Invalid_Vert_Metrics )
-                       : FT_THROW( Invalid_Horiz_Metrics );
-      goto Exit;
-#else
-      num_shorts = 0;
-#endif
-    }
-
-    if ( FT_QNEW_ARRAY( *longs,  num_longs  ) ||
-         FT_QNEW_ARRAY( *shorts, num_shorts ) )
-      goto Fail;
-
-    if ( FT_FRAME_ENTER( table_len ) )
-      goto Fail;
-
-    p = stream->cursor;
-
-    {
-      TT_LongMetrics  cur   = *longs;
-      TT_LongMetrics  limit = cur + num_longs;
-
-
-      for ( ; cur < limit; cur++ )
-      {
-        cur->advance = FT_NEXT_USHORT( p );
-        cur->bearing = FT_NEXT_SHORT( p );
-      }
-    }
-
-    /* do we have an inconsistent number of metric values? */
-    {
-      TT_ShortMetrics*  cur   = *shorts;
-      TT_ShortMetrics*  limit = cur +
-                                FT_MIN( num_shorts, num_shorts_checked );
-
-
-      for ( ; cur < limit; cur++ )
-        *cur = FT_NEXT_SHORT( p );
-
-      /* We fill up the missing left side bearings with the     */
-      /* last valid value.  Since this will occur for buggy CJK */
-      /* fonts usually only, nothing serious will happen.       */
-      if ( num_shorts > num_shorts_checked && num_shorts_checked > 0 )
-      {
-        FT_Short  val = (*shorts)[num_shorts_checked - 1];
-
-
-        limit = *shorts + num_shorts;
-        for ( ; cur < limit; cur++ )
-          *cur = val;
-      }
-    }
-
-    FT_FRAME_EXIT();
-
-    if ( vertical )
-      face->vertical.number_Of_VMetrics = (FT_UShort)num_longs;
-    else
-      face->horizontal.number_Of_HMetrics = (FT_UShort)num_longs;
-
-  Fail:
-    return error;
-  }
-
-#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -343,8 +198,6 @@
   /*                                                                       */
   /*    advance :: The advance width resp. advance height.                 */
   /*                                                                       */
-#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
-
   FT_LOCAL_DEF( FT_Error )
   tt_face_get_metrics( TT_Face     face,
                        FT_Bool     vertical,
@@ -421,48 +274,6 @@
 
     return FT_Err_Ok;
   }
-
-#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */
-
-  FT_LOCAL_DEF( FT_Error )
-  tt_face_get_metrics( TT_Face     face,
-                       FT_Bool     vertical,
-                       FT_UInt     gindex,
-                       FT_Short*   abearing,
-                       FT_UShort*  aadvance )
-  {
-    void*           v = &face->vertical;
-    void*           h = &face->horizontal;
-    TT_HoriHeader*  header = vertical ? (TT_HoriHeader*)v
-                                      : (TT_HoriHeader*)h;
-    TT_LongMetrics  longs_m;
-    FT_UShort       k = header->number_Of_HMetrics;
-
-
-    if ( k == 0                                         ||
-         !header->long_metrics                          ||
-         gindex >= (FT_UInt)face->max_profile.numGlyphs )
-    {
-      *abearing = *aadvance = 0;
-      return FT_Err_Ok;
-    }
-
-    if ( gindex < (FT_UInt)k )
-    {
-      longs_m   = (TT_LongMetrics)header->long_metrics + gindex;
-      *abearing = longs_m->bearing;
-      *aadvance = longs_m->advance;
-    }
-    else
-    {
-      *abearing = ((TT_ShortMetrics*)header->short_metrics)[gindex - k];
-      *aadvance = ((TT_LongMetrics)header->long_metrics)[k - 1].advance;
-    }
-
-    return FT_Err_Ok;
-  }
-
-#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
 /* END */
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -24,1484 +24,7 @@
    *  Alas, the memory-optimized sbit loader can't be used when implementing
    *  the `old internals' hack
    */
-#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
-
 #include "ttsbit0.c"
-
-#else /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include "ttsbit.h"
-
-#include "sferrors.h"
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
-  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
-  /* messages during execution.                                            */
-  /*                                                                       */
-#undef  FT_COMPONENT
-#define FT_COMPONENT  trace_ttsbit
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    blit_sbit                                                          */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Blits a bitmap from an input stream into a given target.  Supports */
-  /*    x and y offsets as well as byte padded lines.                      */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    target      :: The target bitmap/pixmap.                           */
-  /*                                                                       */
-  /*    source      :: The input packed bitmap data.                       */
-  /*                                                                       */
-  /*    line_bits   :: The number of bits per line.                        */
-  /*                                                                       */
-  /*    byte_padded :: A flag which is true if lines are byte-padded.      */
-  /*                                                                       */
-  /*    x_offset    :: The horizontal offset.                              */
-  /*                                                                       */
-  /*    y_offset    :: The vertical offset.                                */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    IMPORTANT: The x and y offsets are relative to the top corner of   */
-  /*               the target bitmap (unlike the normal TrueType           */
-  /*               convention).  A positive y offset indicates a downwards */
-  /*               direction!                                              */
-  /*                                                                       */
-  static void
-  blit_sbit( FT_Bitmap*  target,
-             FT_Byte*    source,
-             FT_Int      line_bits,
-             FT_Bool     byte_padded,
-             FT_Int      x_offset,
-             FT_Int      y_offset,
-             FT_Int      source_height )
-  {
-    FT_Byte*   line_buff;
-    FT_Int     line_incr;
-    FT_Int     height;
-
-    FT_UShort  acc;
-    FT_UInt    loaded;
-
-
-    /* first of all, compute starting write position */
-    line_incr = target->pitch;
-    line_buff = target->buffer;
-
-    if ( line_incr < 0 )
-      line_buff -= line_incr * ( target->rows - 1 );
-
-    line_buff += ( x_offset >> 3 ) + y_offset * line_incr;
-
-    /***********************************************************************/
-    /*                                                                     */
-    /* We use the extra-classic `accumulator' trick to extract the bits    */
-    /* from the source byte stream.                                        */
-    /*                                                                     */
-    /* Namely, the variable `acc' is a 16-bit accumulator containing the   */
-    /* last `loaded' bits from the input stream.  The bits are shifted to  */
-    /* the upmost position in `acc'.                                       */
-    /*                                                                     */
-    /***********************************************************************/
-
-    acc    = 0;  /* clear accumulator   */
-    loaded = 0;  /* no bits were loaded */
-
-    for ( height = source_height; height > 0; height-- )
-    {
-      FT_Byte*  cur   = line_buff;        /* current write cursor          */
-      FT_Int    count = line_bits;        /* # of bits to extract per line */
-      FT_Byte   shift = (FT_Byte)( x_offset & 7 ); /* current write shift  */
-      FT_Byte   space = (FT_Byte)( 8 - shift );
-
-
-      /* first of all, read individual source bytes */
-      if ( count >= 8 )
-      {
-        count -= 8;
-        {
-          do
-          {
-            FT_Byte  val;
-
-
-            /* ensure that there are at least 8 bits in the accumulator */
-            if ( loaded < 8 )
-            {
-              acc    |= (FT_UShort)((FT_UShort)*source++ << ( 8 - loaded ));
-              loaded += 8;
-            }
-
-            /* now write one byte */
-            val = (FT_Byte)( acc >> 8 );
-            if ( shift )
-            {
-              cur[0] |= (FT_Byte)( val >> shift );
-              cur[1] |= (FT_Byte)( val << space );
-            }
-            else
-              cur[0] |= val;
-
-            cur++;
-            acc   <<= 8;  /* remove bits from accumulator */
-            loaded -= 8;
-            count  -= 8;
-
-          } while ( count >= 0 );
-        }
-
-        /* restore `count' to correct value */
-        count += 8;
-      }
-
-      /* now write remaining bits (count < 8) */
-      if ( count > 0 )
-      {
-        FT_Byte  val;
-
-
-        /* ensure that there are at least `count' bits in the accumulator */
-        if ( (FT_Int)loaded < count )
-        {
-          acc    |= (FT_UShort)((FT_UShort)*source++ << ( 8 - loaded ));
-          loaded += 8;
-        }
-
-        /* now write remaining bits */
-        val     = (FT_Byte)( ( (FT_Byte)( acc >> 8 ) ) & ~( 0xFF >> count ) );
-        cur[0] |= (FT_Byte)( val >> shift );
-
-        if ( count > space )
-          cur[1] |= (FT_Byte)( val << space );
-
-        acc   <<= count;
-        loaded -= count;
-      }
-
-      /* now, skip to next line */
-      if ( byte_padded )
-      {
-        acc    = 0;
-        loaded = 0;   /* clear accumulator on byte-padded lines */
-      }
-
-      line_buff += line_incr;
-    }
-  }
-
-
-  static const FT_Frame_Field  sbit_metrics_fields[] =
-  {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  TT_SBit_MetricsRec
-
-    FT_FRAME_START( 8 ),
-      FT_FRAME_BYTE( height ),
-      FT_FRAME_BYTE( width ),
-
-      FT_FRAME_CHAR( horiBearingX ),
-      FT_FRAME_CHAR( horiBearingY ),
-      FT_FRAME_BYTE( horiAdvance ),
-
-      FT_FRAME_CHAR( vertBearingX ),
-      FT_FRAME_CHAR( vertBearingY ),
-      FT_FRAME_BYTE( vertAdvance ),
-    FT_FRAME_END
-  };
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    Load_SBit_Const_Metrics                                            */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the metrics for `EBLC' index tables format 2 and 5.          */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    range  :: The target range.                                        */
-  /*                                                                       */
-  /*    stream :: The input stream.                                        */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  static FT_Error
-  Load_SBit_Const_Metrics( TT_SBit_Range  range,
-                           FT_Stream      stream )
-  {
-    FT_Error  error;
-
-
-    if ( FT_READ_ULONG( range->image_size ) )
-      return error;
-
-    return FT_STREAM_READ_FIELDS( sbit_metrics_fields, &range->metrics );
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    Load_SBit_Range_Codes                                              */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the range codes for `EBLC' index tables format 4 and 5.      */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    range        :: The target range.                                  */
-  /*                                                                       */
-  /*    stream       :: The input stream.                                  */
-  /*                                                                       */
-  /*    load_offsets :: A flag whether to load the glyph offset table.     */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  static FT_Error
-  Load_SBit_Range_Codes( TT_SBit_Range  range,
-                         FT_Stream      stream,
-                         FT_Bool        load_offsets )
-  {
-    FT_Error   error;
-    FT_ULong   count, n, size;
-    FT_Memory  memory = stream->memory;
-
-
-    if ( FT_READ_ULONG( count ) )
-      goto Exit;
-
-    range->num_glyphs = count;
-
-    /* Allocate glyph offsets table if needed */
-    if ( load_offsets )
-    {
-      if ( FT_NEW_ARRAY( range->glyph_offsets, count ) )
-        goto Exit;
-
-      size = count * 4L;
-    }
-    else
-      size = count * 2L;
-
-    /* Allocate glyph codes table and access frame */
-    if ( FT_NEW_ARRAY ( range->glyph_codes, count ) ||
-         FT_FRAME_ENTER( size )                     )
-      goto Exit;
-
-    for ( n = 0; n < count; n++ )
-    {
-      range->glyph_codes[n] = FT_GET_USHORT();
-
-      if ( load_offsets )
-        range->glyph_offsets[n] = (FT_ULong)range->image_offset +
-                                  FT_GET_USHORT();
-    }
-
-    FT_FRAME_EXIT();
-
-  Exit:
-    return error;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    Load_SBit_Range                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads a given `EBLC' index/range table.                            */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    range  :: The target range.                                        */
-  /*                                                                       */
-  /*    stream :: The input stream.                                        */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  static FT_Error
-  Load_SBit_Range( TT_SBit_Range  range,
-                   FT_Stream      stream )
-  {
-    FT_Error   error;
-    FT_Memory  memory = stream->memory;
-
-
-    switch( range->index_format )
-    {
-    case 1:   /* variable metrics with 4-byte offsets */
-    case 3:   /* variable metrics with 2-byte offsets */
-      {
-        FT_ULong  num_glyphs, n;
-        FT_Int    size_elem;
-        FT_Bool   large = FT_BOOL( range->index_format == 1 );
-
-
-
-        if ( range->last_glyph < range->first_glyph )
-        {
-          error = FT_THROW( Invalid_File_Format );
-          goto Exit;
-        }
-
-        num_glyphs        = range->last_glyph - range->first_glyph + 1L;
-        range->num_glyphs = num_glyphs;
-        num_glyphs++;                       /* XXX: BEWARE - see spec */
-
-        size_elem = large ? 4 : 2;
-
-        if ( FT_NEW_ARRAY( range->glyph_offsets, num_glyphs ) ||
-             FT_FRAME_ENTER( num_glyphs * size_elem )         )
-          goto Exit;
-
-        for ( n = 0; n < num_glyphs; n++ )
-          range->glyph_offsets[n] = (FT_ULong)( range->image_offset +
-                                                ( large ? FT_GET_ULONG()
-                                                        : FT_GET_USHORT() ) );
-        FT_FRAME_EXIT();
-      }
-      break;
-
-    case 2:   /* all glyphs have identical metrics */
-      error = Load_SBit_Const_Metrics( range, stream );
-      break;
-
-    case 4:
-      error = Load_SBit_Range_Codes( range, stream, 1 );
-      break;
-
-    case 5:
-      error = Load_SBit_Const_Metrics( range, stream );
-      if ( !error )
-        error = Load_SBit_Range_Codes( range, stream, 0 );
-      break;
-
-    default:
-      error = FT_THROW( Invalid_File_Format );
-    }
-
-  Exit:
-    return error;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_eblc                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the table of embedded bitmap sizes for this face.            */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: The target face object.                                  */
-  /*                                                                       */
-  /*    stream :: The input stream.                                        */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_LOCAL_DEF( FT_Error )
-  tt_face_load_eblc( TT_Face    face,
-                     FT_Stream  stream )
-  {
-    FT_Error   error  = FT_Err_Ok;
-    FT_Memory  memory = stream->memory;
-    FT_Fixed   version;
-    FT_ULong   num_strikes;
-    FT_ULong   table_base;
-
-    static const FT_Frame_Field  sbit_line_metrics_fields[] =
-    {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  TT_SBit_LineMetricsRec
-
-      /* no FT_FRAME_START */
-        FT_FRAME_CHAR( ascender ),
-        FT_FRAME_CHAR( descender ),
-        FT_FRAME_BYTE( max_width ),
-
-        FT_FRAME_CHAR( caret_slope_numerator ),
-        FT_FRAME_CHAR( caret_slope_denominator ),
-        FT_FRAME_CHAR( caret_offset ),
-
-        FT_FRAME_CHAR( min_origin_SB ),
-        FT_FRAME_CHAR( min_advance_SB ),
-        FT_FRAME_CHAR( max_before_BL ),
-        FT_FRAME_CHAR( min_after_BL ),
-        FT_FRAME_CHAR( pads[0] ),
-        FT_FRAME_CHAR( pads[1] ),
-      FT_FRAME_END
-    };
-
-    static const FT_Frame_Field  strike_start_fields[] =
-    {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  TT_SBit_StrikeRec
-
-      /* no FT_FRAME_START */
-        FT_FRAME_ULONG( ranges_offset ),
-        FT_FRAME_SKIP_LONG,
-        FT_FRAME_ULONG( num_ranges ),
-        FT_FRAME_ULONG( color_ref ),
-      FT_FRAME_END
-    };
-
-    static const FT_Frame_Field  strike_end_fields[] =
-    {
-      /* no FT_FRAME_START */
-        FT_FRAME_USHORT( start_glyph ),
-        FT_FRAME_USHORT( end_glyph ),
-        FT_FRAME_BYTE  ( x_ppem ),
-        FT_FRAME_BYTE  ( y_ppem ),
-        FT_FRAME_BYTE  ( bit_depth ),
-        FT_FRAME_CHAR  ( flags ),
-      FT_FRAME_END
-    };
-
-
-    face->num_sbit_strikes = 0;
-
-    /* this table is optional */
-    error = face->goto_table( face, TTAG_EBLC, stream, 0 );
-    if ( error )
-      error = face->goto_table( face, TTAG_bloc, stream, 0 );
-    if ( error )
-      goto Exit;
-
-    table_base = FT_STREAM_POS();
-    if ( FT_FRAME_ENTER( 8L ) )
-      goto Exit;
-
-    version     = FT_GET_LONG();
-    num_strikes = FT_GET_ULONG();
-
-    FT_FRAME_EXIT();
-
-    /* check version number and strike count */
-    if ( version     != 0x00020000L ||
-         num_strikes >= 0x10000L    )
-    {
-      FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version\n" ));
-      error = FT_THROW( Invalid_File_Format );
-
-      goto Exit;
-    }
-
-    /* allocate the strikes table */
-    if ( FT_NEW_ARRAY( face->sbit_strikes, num_strikes ) )
-      goto Exit;
-
-    face->num_sbit_strikes = num_strikes;
-
-    /* now read each strike table separately */
-    {
-      TT_SBit_Strike  strike = face->sbit_strikes;
-      FT_ULong        count  = num_strikes;
-
-
-      if ( FT_FRAME_ENTER( 48L * num_strikes ) )
-        goto Exit;
-
-      while ( count > 0 )
-      {
-        if ( FT_STREAM_READ_FIELDS( strike_start_fields, strike )             ||
-             FT_STREAM_READ_FIELDS( sbit_line_metrics_fields, &strike->hori ) ||
-             FT_STREAM_READ_FIELDS( sbit_line_metrics_fields, &strike->vert ) ||
-             FT_STREAM_READ_FIELDS( strike_end_fields, strike )               )
-          break;
-
-        count--;
-        strike++;
-      }
-
-      FT_FRAME_EXIT();
-    }
-
-    /* allocate the index ranges for each strike table */
-    {
-      TT_SBit_Strike  strike = face->sbit_strikes;
-      FT_ULong        count  = num_strikes;
-
-
-      while ( count > 0 )
-      {
-        TT_SBit_Range  range;
-        FT_ULong       count2 = strike->num_ranges;
-
-
-        /* read each range */
-        if ( FT_STREAM_SEEK( table_base + strike->ranges_offset ) ||
-             FT_FRAME_ENTER( strike->num_ranges * 8L )            )
-          goto Exit;
-
-        if ( FT_NEW_ARRAY( strike->sbit_ranges, strike->num_ranges ) )
-          goto Exit;
-
-        range = strike->sbit_ranges;
-        while ( count2 > 0 )
-        {
-          range->first_glyph  = FT_GET_USHORT();
-          range->last_glyph   = FT_GET_USHORT();
-          range->table_offset = table_base + strike->ranges_offset +
-                                  FT_GET_ULONG();
-          count2--;
-          range++;
-        }
-
-        FT_FRAME_EXIT();
-
-        /* Now, read each index table */
-        count2 = strike->num_ranges;
-        range  = strike->sbit_ranges;
-        while ( count2 > 0 )
-        {
-          /* Read the header */
-          if ( FT_STREAM_SEEK( range->table_offset ) ||
-               FT_FRAME_ENTER( 8L )                  )
-            goto Exit;
-
-          range->index_format = FT_GET_USHORT();
-          range->image_format = FT_GET_USHORT();
-          range->image_offset = FT_GET_ULONG();
-
-          FT_FRAME_EXIT();
-
-          error = Load_SBit_Range( range, stream );
-          if ( error )
-            goto Exit;
-
-          count2--;
-          range++;
-        }
-
-        count--;
-        strike++;
-      }
-    }
-
-  Exit:
-    return error;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_free_eblc                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Releases the embedded bitmap tables.                               */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face :: The target face object.                                    */
-  /*                                                                       */
-  FT_LOCAL_DEF( void )
-  tt_face_free_eblc( TT_Face  face )
-  {
-    FT_Memory       memory       = face->root.memory;
-    TT_SBit_Strike  strike       = face->sbit_strikes;
-    TT_SBit_Strike  strike_limit = strike + face->num_sbit_strikes;
-
-
-    if ( strike )
-    {
-      for ( ; strike < strike_limit; strike++ )
-      {
-        TT_SBit_Range  range       = strike->sbit_ranges;
-        TT_SBit_Range  range_limit = range + strike->num_ranges;
-
-
-        if ( range )
-        {
-          for ( ; range < range_limit; range++ )
-          {
-            /* release the glyph offsets and codes tables */
-            /* where appropriate                          */
-            FT_FREE( range->glyph_offsets );
-            FT_FREE( range->glyph_codes );
-          }
-        }
-        FT_FREE( strike->sbit_ranges );
-        strike->num_ranges = 0;
-      }
-      FT_FREE( face->sbit_strikes );
-    }
-    face->num_sbit_strikes = 0;
-  }
-
-
-  FT_LOCAL_DEF( FT_Error )
-  tt_face_set_sbit_strike( TT_Face          face,
-                           FT_Size_Request  req,
-                           FT_ULong*        astrike_index )
-  {
-    return FT_Match_Size( (FT_Face)face, req, 0, astrike_index );
-  }
-
-
-  FT_LOCAL_DEF( FT_Error )
-  tt_face_load_strike_metrics( TT_Face           face,
-                               FT_ULong          strike_index,
-                               FT_Size_Metrics*  metrics )
-  {
-    TT_SBit_Strike  strike;
-
-
-    if ( strike_index >= face->num_sbit_strikes )
-      return FT_THROW( Invalid_Argument );
-
-    strike = face->sbit_strikes + strike_index;
-
-    metrics->x_ppem = strike->x_ppem;
-    metrics->y_ppem = strike->y_ppem;
-
-    metrics->ascender  = strike->hori.ascender << 6;
-    metrics->descender = strike->hori.descender << 6;
-
-    /* XXX: Is this correct? */
-    metrics->max_advance = ( strike->hori.min_origin_SB  +
-                             strike->hori.max_width      +
-                             strike->hori.min_advance_SB ) << 6;
-
-    metrics->height = metrics->ascender - metrics->descender;
-
-    return FT_Err_Ok;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    find_sbit_range                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Scans a given strike's ranges and return, for a given glyph        */
-  /*    index, the corresponding sbit range, and `EBDT' offset.            */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    glyph_index   :: The glyph index.                                  */
-  /*                                                                       */
-  /*    strike        :: The source/current sbit strike.                   */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    arange        :: The sbit range containing the glyph index.        */
-  /*                                                                       */
-  /*    aglyph_offset :: The offset of the glyph data in `EBDT' table.     */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means the glyph index was found.           */
-  /*                                                                       */
-  static FT_Error
-  find_sbit_range( FT_UInt          glyph_index,
-                   TT_SBit_Strike   strike,
-                   TT_SBit_Range   *arange,
-                   FT_ULong        *aglyph_offset )
-  {
-    TT_SBit_RangeRec  *range, *range_limit;
-
-
-    /* check whether the glyph index is within this strike's */
-    /* glyph range                                           */
-    if ( glyph_index < (FT_UInt)strike->start_glyph ||
-         glyph_index > (FT_UInt)strike->end_glyph   )
-      goto Fail;
-
-    /* scan all ranges in strike */
-    range       = strike->sbit_ranges;
-    range_limit = range + strike->num_ranges;
-    if ( !range )
-      goto Fail;
-
-    for ( ; range < range_limit; range++ )
-    {
-      if ( glyph_index >= (FT_UInt)range->first_glyph &&
-           glyph_index <= (FT_UInt)range->last_glyph  )
-      {
-        FT_UShort  delta = (FT_UShort)( glyph_index - range->first_glyph );
-
-
-        switch ( range->index_format )
-        {
-        case 1:
-        case 3:
-          *aglyph_offset = range->glyph_offsets[delta];
-          break;
-
-        case 2:
-          *aglyph_offset = range->image_offset +
-                           range->image_size * delta;
-          break;
-
-        case 4:
-        case 5:
-          {
-            FT_ULong  n;
-
-
-            for ( n = 0; n < range->num_glyphs; n++ )
-            {
-              if ( (FT_UInt)range->glyph_codes[n] == glyph_index )
-              {
-                if ( range->index_format == 4 )
-                  *aglyph_offset = range->glyph_offsets[n];
-                else
-                  *aglyph_offset = range->image_offset +
-                                   n * range->image_size;
-                goto Found;
-              }
-            }
-          }
-
-        /* fall-through */
-        default:
-          goto Fail;
-        }
-
-      Found:
-        /* return successfully! */
-        *arange  = range;
-        return FT_Err_Ok;
-      }
-    }
-
-  Fail:
-    *arange        = 0;
-    *aglyph_offset = 0;
-
-    return FT_THROW( Invalid_Argument );
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_find_sbit_image                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Checks whether an embedded bitmap (an `sbit') exists for a given   */
-  /*    glyph, at a given strike.                                          */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face          :: The target face object.                           */
-  /*                                                                       */
-  /*    glyph_index   :: The glyph index.                                  */
-  /*                                                                       */
-  /*    strike_index  :: The current strike index.                         */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    arange        :: The SBit range containing the glyph index.        */
-  /*                                                                       */
-  /*    astrike       :: The SBit strike containing the glyph index.       */
-  /*                                                                       */
-  /*    aglyph_offset :: The offset of the glyph data in `EBDT' table.     */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.  Returns                    */
-  /*    SFNT_Err_Invalid_Argument if no sbit exists for the requested      */
-  /*    glyph.                                                             */
-  /*                                                                       */
-  FT_LOCAL( FT_Error )
-  tt_find_sbit_image( TT_Face          face,
-                      FT_UInt          glyph_index,
-                      FT_ULong         strike_index,
-                      TT_SBit_Range   *arange,
-                      TT_SBit_Strike  *astrike,
-                      FT_ULong        *aglyph_offset )
-  {
-    FT_Error        error;
-    TT_SBit_Strike  strike;
-
-
-    if ( !face->sbit_strikes                        ||
-         ( face->num_sbit_strikes <= strike_index ) )
-      goto Fail;
-
-    strike = &face->sbit_strikes[strike_index];
-
-    error = find_sbit_range( glyph_index, strike,
-                             arange, aglyph_offset );
-    if ( error )
-      goto Fail;
-
-    *astrike = strike;
-
-    return FT_Err_Ok;
-
-  Fail:
-    /* no embedded bitmap for this glyph in face */
-    *arange        = 0;
-    *astrike       = 0;
-    *aglyph_offset = 0;
-
-    return FT_THROW( Invalid_Argument );
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_load_sbit_metrics                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Gets the big metrics for a given SBit.                             */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    stream      :: The input stream.                                   */
-  /*                                                                       */
-  /*    range       :: The SBit range containing the glyph.                */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    big_metrics :: A big SBit metrics structure for the glyph.         */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The stream cursor must be positioned at the glyph's offset within  */
-  /*    the `EBDT' table before the call.                                  */
-  /*                                                                       */
-  /*    If the image format uses variable metrics, the stream cursor is    */
-  /*    positioned just after the metrics header in the `EBDT' table on    */
-  /*    function exit.                                                     */
-  /*                                                                       */
-  FT_LOCAL( FT_Error )
-  tt_load_sbit_metrics( FT_Stream        stream,
-                        TT_SBit_Range    range,
-                        TT_SBit_Metrics  metrics )
-  {
-    FT_Error  error = FT_Err_Ok;
-
-
-    switch ( range->image_format )
-    {
-    case 1:
-    case 2:
-    case 8:
-      /* variable small metrics */
-      {
-        TT_SBit_SmallMetricsRec  smetrics;
-
-        static const FT_Frame_Field  sbit_small_metrics_fields[] =
-        {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  TT_SBit_SmallMetricsRec
-
-          FT_FRAME_START( 5 ),
-            FT_FRAME_BYTE( height ),
-            FT_FRAME_BYTE( width ),
-            FT_FRAME_CHAR( bearingX ),
-            FT_FRAME_CHAR( bearingY ),
-            FT_FRAME_BYTE( advance ),
-          FT_FRAME_END
-        };
-
-
-        /* read small metrics */
-        if ( FT_STREAM_READ_FIELDS( sbit_small_metrics_fields, &smetrics ) )
-          goto Exit;
-
-        /* convert it to a big metrics */
-        metrics->height       = smetrics.height;
-        metrics->width        = smetrics.width;
-        metrics->horiBearingX = smetrics.bearingX;
-        metrics->horiBearingY = smetrics.bearingY;
-        metrics->horiAdvance  = smetrics.advance;
-
-        /* these metrics are made up at a higher level when */
-        /* needed.                                          */
-        metrics->vertBearingX = 0;
-        metrics->vertBearingY = 0;
-        metrics->vertAdvance  = 0;
-      }
-      break;
-
-    case 6:
-    case 7:
-    case 9:
-      /* variable big metrics */
-      if ( FT_STREAM_READ_FIELDS( sbit_metrics_fields, metrics ) )
-        goto Exit;
-      break;
-
-    case 5:
-    default:  /* constant metrics */
-      if ( range->index_format == 2 || range->index_format == 5 )
-        *metrics = range->metrics;
-      else
-        return FT_THROW( Invalid_File_Format );
-   }
-
-  Exit:
-    return error;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    crop_bitmap                                                        */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Crops a bitmap to its tightest bounding box, and adjusts its       */
-  /*    metrics.                                                           */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    map     :: The bitmap.                                             */
-  /*                                                                       */
-  /*    metrics :: The corresponding metrics structure.                    */
-  /*                                                                       */
-  static void
-  crop_bitmap( FT_Bitmap*       map,
-               TT_SBit_Metrics  metrics )
-  {
-    /***********************************************************************/
-    /*                                                                     */
-    /* In this situation, some bounding boxes of embedded bitmaps are too  */
-    /* large.  We need to crop it to a reasonable size.                    */
-    /*                                                                     */
-    /*      ---------                                                      */
-    /*      |       |                -----                                 */
-    /*      |  ***  |                |***|                                 */
-    /*      |   *   |                | * |                                 */
-    /*      |   *   |    ------>     | * |                                 */
-    /*      |   *   |                | * |                                 */
-    /*      |   *   |                | * |                                 */
-    /*      |  ***  |                |***|                                 */
-    /*      ---------                -----                                 */
-    /*                                                                     */
-    /***********************************************************************/
-
-    FT_Int    rows, count;
-    FT_Long   line_len;
-    FT_Byte*  line;
-
-
-    /***********************************************************************/
-    /*                                                                     */
-    /* first of all, check the top-most lines of the bitmap, and remove    */
-    /* them if they're empty.                                              */
-    /*                                                                     */
-    {
-      line     = (FT_Byte*)map->buffer;
-      rows     = map->rows;
-      line_len = map->pitch;
-
-
-      for ( count = 0; count < rows; count++ )
-      {
-        FT_Byte*  cur   = line;
-        FT_Byte*  limit = line + line_len;
-
-
-        for ( ; cur < limit; cur++ )
-          if ( cur[0] )
-            goto Found_Top;
-
-        /* the current line was empty - skip to next one */
-        line  = limit;
-      }
-
-    Found_Top:
-      /* check that we have at least one filled line */
-      if ( count >= rows )
-        goto Empty_Bitmap;
-
-      /* now, crop the empty upper lines */
-      if ( count > 0 )
-      {
-        line = (FT_Byte*)map->buffer;
-
-        FT_MEM_MOVE( line, line + count * line_len,
-                     ( rows - count ) * line_len );
-
-        metrics->height       = (FT_Byte)( metrics->height - count );
-        metrics->horiBearingY = (FT_Char)( metrics->horiBearingY - count );
-        metrics->vertBearingY = (FT_Char)( metrics->vertBearingY - count );
-
-        map->rows -= count;
-        rows      -= count;
-      }
-    }
-
-    /***********************************************************************/
-    /*                                                                     */
-    /* second, crop the lower lines                                        */
-    /*                                                                     */
-    {
-      line = (FT_Byte*)map->buffer + ( rows - 1 ) * line_len;
-
-      for ( count = 0; count < rows; count++ )
-      {
-        FT_Byte*  cur   = line;
-        FT_Byte*  limit = line + line_len;
-
-
-        for ( ; cur < limit; cur++ )
-          if ( cur[0] )
-            goto Found_Bottom;
-
-        /* the current line was empty - skip to previous one */
-        line -= line_len;
-      }
-
-    Found_Bottom:
-      if ( count > 0 )
-      {
-        metrics->height  = (FT_Byte)( metrics->height - count );
-        rows            -= count;
-        map->rows       -= count;
-      }
-    }
-
-    /***********************************************************************/
-    /*                                                                     */
-    /* third, get rid of the space on the left side of the glyph           */
-    /*                                                                     */
-    do
-    {
-      FT_Byte*  limit;
-
-
-      line  = (FT_Byte*)map->buffer;
-      limit = line + rows * line_len;
-
-      for ( ; line < limit; line += line_len )
-        if ( line[0] & 0x80 )
-          goto Found_Left;
-
-      /* shift the whole glyph one pixel to the left */
-      line  = (FT_Byte*)map->buffer;
-      limit = line + rows * line_len;
-
-      for ( ; line < limit; line += line_len )
-      {
-        FT_Int    n, width = map->width;
-        FT_Byte   old;
-        FT_Byte*  cur = line;
-
-
-        old = (FT_Byte)(cur[0] << 1);
-        for ( n = 8; n < width; n += 8 )
-        {
-          FT_Byte  val;
-
-
-          val    = cur[1];
-          cur[0] = (FT_Byte)( old | ( val >> 7 ) );
-          old    = (FT_Byte)( val << 1 );
-          cur++;
-        }
-        cur[0] = old;
-      }
-
-      map->width--;
-      metrics->horiBearingX++;
-      metrics->vertBearingX++;
-      metrics->width--;
-
-    } while ( map->width > 0 );
-
-  Found_Left:
-
-    /***********************************************************************/
-    /*                                                                     */
-    /* finally, crop the bitmap width to get rid of the space on the right */
-    /* side of the glyph.                                                  */
-    /*                                                                     */
-    do
-    {
-      FT_Int    right = map->width - 1;
-      FT_Byte*  limit;
-      FT_Byte   mask;
-
-
-      line  = (FT_Byte*)map->buffer + ( right >> 3 );
-      limit = line + rows * line_len;
-      mask  = (FT_Byte)( 0x80 >> ( right & 7 ) );
-
-      for ( ; line < limit; line += line_len )
-        if ( line[0] & mask )
-          goto Found_Right;
-
-      /* crop the whole glyph to the right */
-      map->width--;
-      metrics->width--;
-
-    } while ( map->width > 0 );
-
-  Found_Right:
-    /* all right, the bitmap was cropped */
-    return;
-
-  Empty_Bitmap:
-    map->width      = 0;
-    map->rows       = 0;
-    map->pitch      = 0;
-    map->pixel_mode = FT_PIXEL_MODE_MONO;
-  }
-
-
-  static FT_Error
-  Load_SBit_Single( FT_Bitmap*       map,
-                    FT_Int           x_offset,
-                    FT_Int           y_offset,
-                    FT_Int           pix_bits,
-                    FT_UShort        image_format,
-                    TT_SBit_Metrics  metrics,
-                    FT_Stream        stream )
-  {
-    FT_Error  error;
-
-
-    /* check that the source bitmap fits into the target pixmap */
-    if ( x_offset < 0 || x_offset + metrics->width  > map->width ||
-         y_offset < 0 || y_offset + metrics->height > map->rows  )
-    {
-      error = FT_THROW( Invalid_Argument );
-
-      goto Exit;
-    }
-
-    {
-      FT_Int   glyph_width  = metrics->width;
-      FT_Int   glyph_height = metrics->height;
-      FT_Int   glyph_size;
-      FT_Int   line_bits    = pix_bits * glyph_width;
-      FT_Bool  pad_bytes    = 0;
-
-
-      /* compute size of glyph image */
-      switch ( image_format )
-      {
-      case 1:  /* byte-padded formats */
-      case 6:
-        {
-          FT_Int  line_length;
-
-
-          switch ( pix_bits )
-          {
-          case 1:
-            line_length = ( glyph_width + 7 ) >> 3;
-            break;
-          case 2:
-            line_length = ( glyph_width + 3 ) >> 2;
-            break;
-          case 4:
-            line_length = ( glyph_width + 1 ) >> 1;
-            break;
-          default:
-            line_length =   glyph_width;
-          }
-
-          glyph_size = glyph_height * line_length;
-          pad_bytes  = 1;
-        }
-        break;
-
-      case 2:
-      case 5:
-      case 7:
-        line_bits  =   glyph_width  * pix_bits;
-        glyph_size = ( glyph_height * line_bits + 7 ) >> 3;
-        break;
-
-      default:  /* invalid format */
-        return FT_THROW( Invalid_File_Format );
-      }
-
-      /* Now read data and draw glyph into target pixmap       */
-      if ( FT_FRAME_ENTER( glyph_size ) )
-        goto Exit;
-
-      /* don't forget to multiply `x_offset' by `map->pix_bits' as */
-      /* the sbit blitter doesn't make a difference between pixmap */
-      /* depths.                                                   */
-      blit_sbit( map, (FT_Byte*)stream->cursor, line_bits, pad_bytes,
-                 x_offset * pix_bits, y_offset, metrics->height );
-
-      FT_FRAME_EXIT();
-    }
-
-  Exit:
-    return error;
-  }
-
-
-  static FT_Error
-  Load_SBit_Image( TT_SBit_Strike   strike,
-                   TT_SBit_Range    range,
-                   FT_ULong         ebdt_pos,
-                   FT_ULong         glyph_offset,
-                   FT_GlyphSlot     slot,
-                   FT_Int           x_offset,
-                   FT_Int           y_offset,
-                   FT_Stream        stream,
-                   TT_SBit_Metrics  metrics,
-                   FT_Int           depth )
-  {
-    FT_Memory   memory = stream->memory;
-    FT_Bitmap*  map    = &slot->bitmap;
-    FT_Error    error;
-
-
-    /* place stream at beginning of glyph data and read metrics */
-    if ( FT_STREAM_SEEK( ebdt_pos + glyph_offset ) )
-      goto Exit;
-
-    error = tt_load_sbit_metrics( stream, range, metrics );
-    if ( error )
-      goto Exit;
-
-    /* This function is recursive.  At the top-level call, we  */
-    /* compute the dimensions of the higher-level glyph to     */
-    /* allocate the final pixmap buffer.                       */
-    if ( depth == 0 )
-    {
-      FT_Long  size;
-
-
-      map->width = metrics->width;
-      map->rows  = metrics->height;
-
-      switch ( strike->bit_depth )
-      {
-      case 1:
-        map->pixel_mode = FT_PIXEL_MODE_MONO;
-        map->pitch      = ( map->width + 7 ) >> 3;
-        break;
-
-      case 2:
-        map->pixel_mode = FT_PIXEL_MODE_GRAY2;
-        map->pitch      = ( map->width + 3 ) >> 2;
-        break;
-
-      case 4:
-        map->pixel_mode = FT_PIXEL_MODE_GRAY4;
-        map->pitch      = ( map->width + 1 ) >> 1;
-        break;
-
-      case 8:
-        map->pixel_mode = FT_PIXEL_MODE_GRAY;
-        map->pitch      = map->width;
-        break;
-
-      default:
-        return FT_THROW( Invalid_File_Format );
-      }
-
-      size = map->rows * map->pitch;
-
-      /* check that there is no empty image */
-      if ( size == 0 )
-        goto Exit;     /* exit successfully! */
-
-      error = ft_glyphslot_alloc_bitmap( slot, size );
-      if (error)
-        goto Exit;
-    }
-
-    switch ( range->image_format )
-    {
-    case 1:  /* single sbit image - load it */
-    case 2:
-    case 5:
-    case 6:
-    case 7:
-      return Load_SBit_Single( map, x_offset, y_offset, strike->bit_depth,
-                               range->image_format, metrics, stream );
-
-    case 8:  /* compound format */
-      if ( FT_STREAM_SKIP( 1L ) )
-      {
-        error = FT_THROW( Invalid_Stream_Skip );
-        goto Exit;
-      }
-      /* fallthrough */
-
-    case 9:
-      break;
-
-    default: /* invalid image format */
-      return FT_THROW( Invalid_File_Format );
-    }
-
-    /* All right, we have a compound format.  First of all, read */
-    /* the array of elements.                                    */
-    {
-      TT_SBit_Component  components = NULL;
-      TT_SBit_Component  comp;
-      FT_UShort          num_components, count;
-
-
-      if ( FT_READ_USHORT( num_components )           ||
-           FT_NEW_ARRAY( components, num_components ) )
-        goto Exit;
-
-      count = num_components;
-
-      if ( FT_FRAME_ENTER( 4L * num_components ) )
-        goto Fail_Memory;
-
-      for ( comp = components; count > 0; count--, comp++ )
-      {
-        comp->glyph_code = FT_GET_USHORT();
-        comp->x_offset   = FT_GET_CHAR();
-        comp->y_offset   = FT_GET_CHAR();
-      }
-
-      FT_FRAME_EXIT();
-
-      /* Now recursively load each element glyph */
-      count = num_components;
-      comp  = components;
-      for ( ; count > 0; count--, comp++ )
-      {
-        TT_SBit_Range       elem_range;
-        TT_SBit_MetricsRec  elem_metrics;
-        FT_ULong            elem_offset;
-
-
-        /* find the range for this element */
-        error = find_sbit_range( comp->glyph_code,
-                                 strike,
-                                 &elem_range,
-                                 &elem_offset );
-        if ( error )
-          goto Fail_Memory;
-
-        /* now load the element, recursively */
-        error = Load_SBit_Image( strike,
-                                 elem_range,
-                                 ebdt_pos,
-                                 elem_offset,
-                                 slot,
-                                 x_offset + comp->x_offset,
-                                 y_offset + comp->y_offset,
-                                 stream,
-                                 &elem_metrics,
-                                 depth + 1 );
-        if ( error )
-          goto Fail_Memory;
-      }
-
-    Fail_Memory:
-      FT_FREE( components );
-    }
-
-  Exit:
-    return error;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_sbit_image                                            */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads a given glyph sbit image from the font resource.  This also  */
-  /*    returns its metrics.                                               */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face         :: The target face object.                            */
-  /*                                                                       */
-  /*    strike_index :: The current strike index.                          */
-  /*                                                                       */
-  /*    glyph_index  :: The current glyph index.                           */
-  /*                                                                       */
-  /*    load_flags   :: The glyph load flags (the code checks for the flag */
-  /*                    FT_LOAD_CROP_BITMAP).                              */
-  /*                                                                       */
-  /*    stream       :: The input stream.                                  */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    map          :: The target pixmap.                                 */
-  /*                                                                       */
-  /*    metrics      :: A big sbit metrics structure for the glyph image.  */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.  Returns an error if no     */
-  /*    glyph sbit exists for the index.                                   */
-  /*                                                                       */
-  /*  <Note>                                                               */
-  /*    The `map.buffer' field is always freed before the glyph is loaded. */
-  /*                                                                       */
-  FT_LOCAL_DEF( FT_Error )
-  tt_face_load_sbit_image( TT_Face              face,
-                           FT_ULong             strike_index,
-                           FT_UInt              glyph_index,
-                           FT_UInt              load_flags,
-                           FT_Stream            stream,
-                           FT_Bitmap           *map,
-                           TT_SBit_MetricsRec  *metrics )
-  {
-    FT_Error        error;
-    FT_ULong        ebdt_pos, glyph_offset;
-
-    TT_SBit_Strike  strike;
-    TT_SBit_Range   range;
-
-
-    /* Check whether there is a glyph sbit for the current index */
-    error = tt_find_sbit_image( face, glyph_index, strike_index,
-                                &range, &strike, &glyph_offset );
-    if ( error )
-      goto Exit;
-
-    /* now, find the location of the `EBDT' table in */
-    /* the font file                                 */
-    error = face->goto_table( face, TTAG_EBDT, stream, 0 );
-    if ( error )
-      error = face->goto_table( face, TTAG_bdat, stream, 0 );
-    if ( error )
-      goto Exit;
-
-    ebdt_pos = FT_STREAM_POS();
-
-    error = Load_SBit_Image( strike, range, ebdt_pos, glyph_offset,
-                             face->root.glyph, 0, 0, stream, metrics, 0 );
-    if ( error )
-      goto Exit;
-
-    /* setup vertical metrics if needed */
-    if ( strike->flags & 1 )
-    {
-      /* in case of a horizontal strike only */
-      FT_Int  advance;
-
-
-      advance = strike->hori.ascender - strike->hori.descender;
-
-      /* some heuristic values */
-
-      metrics->vertBearingX = (FT_Char)(-metrics->width / 2 );
-      metrics->vertBearingY = (FT_Char)( ( advance - metrics->height ) / 2 );
-      metrics->vertAdvance  = (FT_Char)( advance * 12 / 10 );
-    }
-
-    /* Crop the bitmap now, unless specified otherwise */
-    if ( load_flags & FT_LOAD_CROP_BITMAP )
-      crop_bitmap( map, metrics );
-
-  Exit:
-    return error;
-  }
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
 
 /* END */
--- a/src/sfnt/ttsbit.h
+++ b/src/sfnt/ttsbit.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (specification).       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */
+/*  Copyright 1996-2008, 2013 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -44,22 +44,6 @@
   tt_face_load_strike_metrics( TT_Face           face,
                                FT_ULong          strike_index,
                                FT_Size_Metrics*  metrics );
-
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-  FT_LOCAL( FT_Error )
-  tt_find_sbit_image( TT_Face          face,
-                      FT_UInt          glyph_index,
-                      FT_ULong         strike_index,
-                      TT_SBit_Range   *arange,
-                      TT_SBit_Strike  *astrike,
-                      FT_ULong        *aglyph_offset );
-
-  FT_LOCAL( FT_Error )
-  tt_load_sbit_metrics( FT_Stream        stream,
-                        TT_SBit_Range    range,
-                        TT_SBit_Metrics  metrics );
-
-#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
   FT_LOCAL( FT_Error )
   tt_face_load_sbit_image( TT_Face              face,
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -486,9 +486,6 @@
     tt_slot_init,
     0,                       /* FT_Slot_DoneFunc */
 
-    ft_stub_set_char_sizes,  /* FT_CONFIG_OPTION_OLD_INTERNALS */
-    ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
-
     tt_glyph_load,
 
     tt_get_kerning,
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -708,10 +708,6 @@
     T1_GlyphSlot_Init,
     T1_GlyphSlot_Done,
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    ft_stub_set_char_sizes,
-    ft_stub_set_pixel_sizes,
-#endif
     T1_Load_Glyph,
 
 #ifdef T1_CONFIG_OPTION_NO_AFM
--- a/src/type42/t42drivr.c
+++ b/src/type42/t42drivr.c
@@ -230,10 +230,6 @@
     T42_GlyphSlot_Init,
     T42_GlyphSlot_Done,
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    ft_stub_set_char_sizes,
-    ft_stub_set_pixel_sizes,
-#endif
     T42_GlyphSlot_Load,
 
     0,                 /* FT_Face_GetKerningFunc  */
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -1141,10 +1141,6 @@
     0,                    /* FT_Slot_InitFunc */
     0,                    /* FT_Slot_DoneFunc */
 
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-    ft_stub_set_char_sizes,
-    ft_stub_set_pixel_sizes,
-#endif
     FNT_Load_Glyph,
 
     0,                    /* FT_Face_GetKerningFunc  */