shithub: freetype+ttf2subf

Download patch

ref: f145e312dffc41a190beed96d681661d9c9d2d2a
parent: 0880ac333a2bde53d6bd090b97bafadc7435ad58
author: Werner Lemberg <[email protected]>
date: Sun Feb 19 11:12:18 EST 2006

Formatting, copyright years, minor doc fixes.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,18 @@
 2006-02-17  David Turner  <[email protected]>
 
-    * builds/unix/unix-cc.in: don't filter-out exported functions
-    anymore, this is used to ensure that all FT_BASE internal
-    functions are available for dynamic linking
-    
-    * include/freetype/ftcache.h, src/cache/ftcbasic.c, 
-    src/cache/ftccmap.c: try to revive old functions of the
-    cache sub-system. We also try to support FTC_ImageCache_Lookup
-    and FTC_ImageCache_SBit with legacy signatures through a gross
-    hack (hope it works)
+	* builds/unix/unix-cc.in (LINK_LIBRARY): Don't filter out exported
+	functions anymore.  This ensures that all FT_BASE internal functions
+	are available for dynamic linking.
+
+	* include/freetype/ftcache.h (FTC_IMAGE_TYPE_COMPARE,
+	FTC_IMAGE_TYPE_HASH), src/cache/ftcbasic.c (FTC_OldFontRec,
+	FTC_OldImageDescRec, FTC_ImageCache_Lookup, FTC_Image_Cache_New,
+	FTC_OldImage_Desc, FTC_OLD_IMAGE_FORMAT, ftc_old_image_xxx,
+	ftc_image_type_from_old_desc, FTC_Image_Cache_Lookup,
+	FTC_SBitCache_Lookup, FTC_SBit_Cache_New, FTC_SBit_Cache_Lookup)
+	[FT_CONFIG_OPTION_OLD_INTERNALS]: Try to revive old functions of the
+	cache sub-system.  We try to recognize old legacy signatures with a
+	gross hack (hope it works).
 
 2006-02-17  Werner Lemberg  <[email protected]>
 
--- a/builds/unix/unix-cc.in
+++ b/builds/unix/unix-cc.in
@@ -98,6 +98,7 @@
 #
 LINK_LIBRARY = $(LIBTOOL) --mode=link $(CCraw) -o $@ $(OBJECTS_LIST) \
                           -rpath $(libdir) -version-info $(version_info) \
-                          $(LDFLAGS) #-export-symbols $(EXPORTS_LIST) -no-undefined
+                          $(LDFLAGS) \
+                          # -export-symbols $(EXPORTS_LIST) -no-undefined
 
 # EOF
--- a/include/freetype/ftcache.h
+++ b/include/freetype/ftcache.h
@@ -180,10 +180,10 @@
             (f1)->pix_width  == (f2)->pix_width  && \
             (f1)->pix_height == (f2)->pix_height )
 
-#define FT_POINTER_TO_ULONG( p )  ((FT_ULong)(FT_Pointer)(p))
+#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 ) ^ \
+#define FTC_FACE_ID_HASH( i )                                \
+          ((FT_UInt32)(( FT_POINTER_TO_ULONG( i ) >> 3 ) ^   \
                        ( FT_POINTER_TO_ULONG( i ) << 7 ) ) )
 
 #define FTC_FONT_HASH( f )                              \
@@ -575,19 +575,21 @@
 
   } FTC_ImageTypeRec;
 
-  typedef struct FTC_ImageTypeRec_*   FTC_ImageType;
+  typedef struct FTC_ImageTypeRec_*  FTC_ImageType;
 
- /* */
 
-#define FTC_IMAGE_TYPE_COMPARE( d1, d2 )        \
-          ( (d1)->face_id == (d2)->face_id &&   \
-            (d1)->width   == (d2)->width   &&   \
-            (d1)->flags   == (d2)->flags        )
+  /* */
 
-#define FTC_IMAGE_TYPE_HASH( d )                         \
-          (FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id ) ^ \
-                      ((d)->width << 8) ^ (d)->height  ^ \
-                      ( (d)->flags << 4 )              )
+
+#define FTC_IMAGE_TYPE_COMPARE( d1, d2 )      \
+          ( (d1)->face_id == (d2)->face_id && \
+            (d1)->width   == (d2)->width   && \
+            (d1)->flags   == (d2)->flags   )
+
+#define FTC_IMAGE_TYPE_HASH( d )                          \
+          (FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id )  ^ \
+                      ( (d)->width << 8 ) ^ (d)->height ^ \
+                      ( (d)->flags << 4 )               )
 
 
   /*************************************************************************/
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType basic cache interface (body).                           */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005 by                                          */
+/*  Copyright 2003, 2004, 2005, 2006 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -26,20 +26,23 @@
 #include "ftccback.h"
 #include "ftcerror.h"
 
+
 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
 
- /* these correspond to the FTC_Font and FTC_ImageDesc types
-  * that were defined in FT 2.1.7
-  */
-  typedef struct
+  /*
+   *  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_FaceID  face_id;
+    FT_UShort   pix_width;
+    FT_UShort   pix_height;
 
   } FTC_OldFontRec, *FTC_OldFont;
 
-  typedef struct
+
+  typedef struct  FTC_OldImageDescRec_
   {
     FTC_OldFontRec  font;
     FT_UInt32       flags;
@@ -46,18 +49,22 @@
 
   } 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're 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're really receiving a
-  * 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
    *
@@ -314,19 +321,24 @@
       *anode  = NULL;
 
 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-   /* this one is a major hack used to detect wether we're passed a
-    * regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one
-    */
+
+    /*
+     *  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 ( type->width >= 0x10000 )
     {
       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;
     }
-#endif
+
+#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
+
     {
       query.attrs.scaler.face_id = type->face_id;
       query.attrs.scaler.width   = type->width;
@@ -334,9 +346,9 @@
       query.attrs.load_flags     = type->flags;
     }
 
-    query.attrs.scaler.pixel   = 1;
-    query.attrs.scaler.x_res   = 0;  /* make compilers happy */
-    query.attrs.scaler.y_res   = 0;
+    query.attrs.scaler.pixel = 1;
+    query.attrs.scaler.x_res = 0;  /* make compilers happy */
+    query.attrs.scaler.y_res = 0;
 
     hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
 
@@ -380,8 +392,8 @@
   }
 
 
-  /* yet another backwards-legacy structure... yukkk */
-  typedef struct
+  /* yet another backwards-legacy structure */
+  typedef struct  FTC_OldImage_Desc_
   {
     FTC_FontRec  font;
     FT_UInt      image_type;
@@ -388,6 +400,7 @@
     
   } FTC_OldImage_Desc;
 
+
 #define FTC_OLD_IMAGE_FORMAT( x )  ( (x) & 7 )
 
 
@@ -403,7 +416,7 @@
 #define ftc_old_image_flag_no_sbits    0x0100
 
   /* monochrome bitmap */
-#define ftc_old_image_mono             ftc_old_image_format_bitmap | \
+#define ftc_old_image_mono             ftc_old_image_format_bitmap   | \
                                        ftc_old_image_flag_monochrome
 
   /* anti-aliased bitmap */
@@ -461,6 +474,7 @@
     }
   }                                
 
+
   FT_EXPORT_DEF( FT_Error )
   FTC_Image_Cache_Lookup( FTC_ImageCache      icache,
                           FTC_OldImage_Desc*  desc,
@@ -561,19 +575,23 @@
     *ansbit = NULL;
 
 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
-   /* this one is a major hack used to detect wether we're passed a
-    * regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one
-    */
+
+    /*  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 ( type->width >= 0x10000 )
     {
       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;
     }
-#endif
+
+#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
+
     {
       query.attrs.scaler.face_id = type->face_id;
       query.attrs.scaler.width   = type->width;
@@ -581,9 +599,9 @@
       query.attrs.load_flags     = type->flags;
     }
 
-    query.attrs.scaler.pixel   = 1;
-    query.attrs.scaler.x_res   = 0;  /* make compilers happy */
-    query.attrs.scaler.y_res   = 0;
+    query.attrs.scaler.pixel = 1;
+    query.attrs.scaler.x_res = 0;  /* make compilers happy */
+    query.attrs.scaler.y_res = 0;
 
     /* beware, the hash must be the same for all glyph ranges! */
     hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
@@ -618,6 +636,7 @@
   Exit:
     return error;
   }
+
 
 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
 
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType CharMap cache (body)                                        */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004, 2005 by                         */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -225,16 +225,20 @@
 
 
 #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're being passed.
-  *
-  * fortunately, it seems that no production code is using this function
-  * on Unix distributions.
-  */
+
+  /*
+   *  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 )
@@ -309,7 +313,6 @@
   Exit:
     return gindex;
   }
-
 
 
 /* END */