shithub: freetype+ttf2subf

Download patch

ref: cee37a3b0a34c88caa981f9ef8cd3080d1fe0def
parent: f2c5330a86b17cd2bb5ff53945a16765200cb59e
author: Werner Lemberg <[email protected]>
date: Sat Nov 12 02:34:40 EST 2005

Clean-up.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,41 +31,71 @@
 
 2005-10-28  David Turner  <[email protected]>
 
-	* builds/exports.mk, builds/freetype.mk, builds/compiler/visualc.mk,
-	builds/dos/dos-def.mk, builds/os2/os2-def.mk,
-	builds/unix/unix-cc.in, builds/unix/unixddef.mk,
-	builds/win32/w32-bcc.mk, builds/win32/w32-gcc.mk,
-	builds/win32/w32-icc.mk, builds/win32/w32-intl.mk,
-	builds/win32/w32-mingw32.mk, builds/win32/w32-vcc.mk,
-	builds/win32/w32-wat.mk, builds/win32/w32-def.mk, Jamfile: Update
-	build system to support the generation of a list of exported symbols
-	or Windows .DEF files by parsing the public headers with the
+	Update build system to support the generation of a list of exported
+	symbols or Windows .DEF files by parsing the public headers with the
 	`apinames' tool located in src/tools/apinames.c.
 
 	Only tested on Unix at the moment.  On Windows, the .DEF file is
 	generated but isn't used yet to generate a DLL.
 
-        * src/pfr/pfrtypes.h, src/pfr/pfrobjs.h, src/pfr/pfrload.c,
-        src/pfr/pfrobjs.c, src/pfr/pfrgload.c: integrated memory optimization
-        without FT_OPTIMIZE_MEMORY
+	* builds/exports.mk: New file.
 
-        * src/base/fttrigon.c (ft_trig_prenorm), src/base/ftcalc.c
-        (FT_MulFix): Performance optimizations.
+	* builds/freetype.mk: Include exports.mk.
+	(dll): New target.
+	(clean_project_dos): Fix rule.
 
-	* include/freetype/internal/ftgloader.h, src/base/ftgloader.h:
-	Introduce the FT_GLYPHLOADER_CHECKXXXX macros, and fix a small bug
-	within FT_GlyphLoader_CheckPoints which caused `AdjustPoints' to be
-	called everytime.
+	* builds/compiler/visualc.mk (TE), builds/dos/dos-def.mk (E),
+	builds/os2/os2-def.mk (E), builds/win32/win32-def.mk (E): New
+	variables for controlling executable extensions.
 
-	* src/autofit/afloader.c, src/truetype/ttgload.c: Performance
-	optimization: Use FT_GLYPHLOADER_CHECK_POINTS macro on
-	profile-detected hot-spots.
+	* builds/unix/unix-cc.in (EXPORTS_LIST, CCexe),
+	builds/win32/w32-bcc.mk, builds/win32/w32-gcc.mk,
+	builds/win32/w32-icc.mk, builds/win32/w32-icc.mk,
+	builds/win32/w32-mingw32.mk, builds/win32/w32-vcc,
+	builds/win32/w32-wat.mk (EXPORTS_LIST, EXPORT_OPTIONS,
+	APINAMES_OPTIONS): New targets for controlling the `apinames' tool.
 
+	* Jamfile (GenExportSymbols): Updated.
+
+
+	* src/pfr/pfrtypes.h, src/pfr/pfrload.c, src/pfr/pfrobjs.c
+	[!FT_OPTIMIZE_MEMORY]: Fold memory optimization code into
+	FT_OPTIMIZE_MEMORY chunks for better maintainability and simplicity.
+
+
+	* src/base/fttrigon.c (ft_trig_prenorm), src/base/ftcalc.c
+	(FT_MulFix): Performance optimizations.
+
+
+	* include/freetype/internal/ftgloadr.h (FT_GLYPHLOADER_CHECK_P,
+	FT_GLYPHLOADER_CHECK_C, FT_GLYPHLOADER_CHECK_POINTS): New macros for
+	checking points and contours.  Update callers to use
+	FT_GLYPHLOADER_CHECK_POINTS instead of FT_GlyphLoader_CheckPoints
+	at profile-detected hot-spots.
+
+	* src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Set `adjust'
+	to 0 to not call `AdjustPoints' every time.
+
+
 	* src/autofit/aftypes.h (AF_ANGLE_DIFF): New macro to inline
 	FT_Angle_Diff.
 
-	* src/autofit/afhints.c (af_direction_compute): Re-implement.  Use
+	* src/autofit/afhints.c (af_direction_compute): Re-implement.
+	(af_glyph_hints_compute_inflections, af_glyph_hints_reload): Use
 	AF_ANGLE_DIFF to speed up the detection of inflexions.
+
+
+	* src/tools/apinames.c: Include <string.h>.
+	(OutputFormat): New enumeration.
+	(names_dump): Add two parameters to control output format and DLL
+	name.
+	(names_dump_windef): Removed.  Code folded into `names_dump'.
+	(read_header_file): Use isalnum, not isalpha.  Otherwise function
+	names with digits aren't read correctly.
+	(usage): Updated.
+	(main): New option `-o' to control output file name.
+	New option `-d' to indicate DLL file name.
+	Extend `-w' flag to handle Borland and Watcom compilers and linkers.
 
 2005-10-28  suzuki toshiya  <[email protected]>
 
--- a/builds/compiler/visualc.mk
+++ b/builds/compiler/visualc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
--- a/builds/dos/dos-def.mk
+++ b/builds/dos/dos-def.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -19,7 +19,7 @@
 PLATFORM  := dos
 
 
-# The executable file extension (for tools). NOTE: WE INCLUDE THE DOT HERE !!
+# The executable file extension (for tools), *with* leading dot.
 #
 E := .exe
 
--- a/builds/os2/os2-def.mk
+++ b/builds/os2/os2-def.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -18,7 +18,7 @@
 BUILD_DIR := $(TOP_DIR)/builds/os2
 PLATFORM  := os2
 
-# The executable file extension (for tools). NOTE: WE INCLUDE THE DOT HERE !!
+# The executable file extension (for tools), *with* leading dot.
 #
 E := .exe
 
--- a/builds/win32/w32-bcc.mk
+++ b/builds/win32/w32-bcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
--- a/builds/win32/w32-gcc.mk
+++ b/builds/win32/w32-gcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
--- a/builds/win32/w32-icc.mk
+++ b/builds/win32/w32-icc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000 by
+# Copyright 1996-2000, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
--- a/builds/win32/w32-intl.mk
+++ b/builds/win32/w32-intl.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
--- a/builds/win32/w32-mingw32.mk
+++ b/builds/win32/w32-mingw32.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
--- a/builds/win32/w32-vcc.mk
+++ b/builds/win32/w32-vcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
--- a/builds/win32/w32-wat.mk
+++ b/builds/win32/w32-wat.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
--- a/builds/win32/win32-def.mk
+++ b/builds/win32/win32-def.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
--- a/include/freetype/internal/ftgloadr.h
+++ b/include/freetype/internal/ftgloadr.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType glyph loader (specification).                           */
 /*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
+/*  Copyright 2002, 2003, 2005 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg                       */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -117,21 +117,23 @@
                               FT_UInt         n_points,
                               FT_UInt         n_contours );
 
-#define  FT_GLYPHLOADER_CHECK_P(_loader,_count)                         \
-   ( (_count) == 0 || (int)((_loader)->base.outline.n_points    +       \
-                            (_loader)->current.outline.n_points +       \
+
+#define FT_GLYPHLOADER_CHECK_P( _loader, _count )                    \
+   ( (_count) == 0 || (int)((_loader)->base.outline.n_points    +    \
+                            (_loader)->current.outline.n_points +    \
                             (_count)) <= (int)(_loader)->max_points )
 
-#define  FT_GLYPHLOADER_CHECK_C(_loader,_count)                           \
-  ( (_count) == 0 || (int)((_loader)->base.outline.n_contours         +   \
-                           (_loader)->current.outline.n_contours      +   \
+#define FT_GLYPHLOADER_CHECK_C( _loader, _count )                     \
+  ( (_count) == 0 || (int)((_loader)->base.outline.n_contours    +    \
+                           (_loader)->current.outline.n_contours +    \
                            (_count)) <= (int)(_loader)->max_contours )
 
-#define  FT_GLYPHLOADER_CHECK_POINTS(_loader,_points,_contours)       \
-  ( ( FT_GLYPHLOADER_CHECK_P(_loader,_points)   &&                    \
-      FT_GLYPHLOADER_CHECK_C(_loader,_contours) )                     \
-    ? 0                                                               \
+#define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points,_contours )      \
+  ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points )   &&                  \
+      FT_GLYPHLOADER_CHECK_C( _loader, _contours ) )                   \
+    ? 0                                                                \
     : FT_GlyphLoader_CheckPoints( (_loader), (_points), (_contours) ) )
+
 
   /* check that there is enough space to add `n_subs' sub-glyphs to */
   /* a glyph loader                                                 */
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -274,22 +274,25 @@
 #if 1
     AF_Direction  dir = AF_DIR_NONE;
 
+
+    /* atan(1/12) == 4.7 degrees */
+
     if ( dx < 0 )
     {
       if ( dy < 0 )
       {
-        if ( -dx*12 < -dy )
+        if ( -dx * 12 < -dy )
           dir = AF_DIR_DOWN;
 
-        else if ( -dy*12 < -dx )
+        else if ( -dy * 12 < -dx )
           dir = AF_DIR_LEFT;
       }
       else /* dy >= 0 */
       {
-        if ( -dx*12 < dy )
+        if ( -dx * 12 < dy )
           dir = AF_DIR_UP;
 
-        else if ( dy*12 < -dx )
+        else if ( dy * 12 < -dx )
           dir = AF_DIR_LEFT;
       }
     }
@@ -297,23 +300,26 @@
     {
       if ( dy < 0 )
       {
-        if ( dx*12 < -dy )
+        if ( dx * 12 < -dy )
           dir = AF_DIR_DOWN;
 
-        else if ( -dy*12 < dx )
+        else if ( -dy * 12 < dx )
           dir = AF_DIR_RIGHT;
       }
       else  /* dy >= 0 */
       {
-        if ( dx*12 < dy )
+        if ( dx * 12 < dy )
           dir = AF_DIR_UP;
 
-        else if ( dy*12 < dx )
+        else if ( dy * 12 < dx )
           dir = AF_DIR_RIGHT;
       }
     }
-    return  dir;
-#else
+
+    return dir;
+
+#else /* 0 */
+
     AF_Direction  dir;
     FT_Pos        ax = FT_ABS( dx );
     FT_Pos        ay = FT_ABS( dy );
@@ -335,7 +341,9 @@
     }
 
     return dir;
-#endif
+
+#endif /* 0 */
+
   }
 
 
@@ -394,7 +402,7 @@
 
       } while ( angle_in == angle_seg );
 
-      first   = start;
+      first = start;
 
       AF_ANGLE_DIFF( diff_in, angle_in, angle_seg );
 
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Arithmetic computations (body).                                      */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -402,8 +402,10 @@
     if ( a == 0 || b == 0x10000L )
       return a;
 
-    sa = (a >> (sizeof(a)*8 - 1)); a = (a^sa) - sa;
-    sb = (b >> (sizeof(b)*8 - 1)); b = (b^sb) - sb;
+    sa = ( a >> ( sizeof ( a ) * 8 - 1 ) );
+     a = ( a ^ sa ) - sa;
+    sb = ( b >> ( sizeof ( b ) * 8 - 1 ) );
+     b = ( b ^ sb ) - sb;
 
     ua = (FT_ULong)a;
     ub = (FT_ULong)b;
@@ -422,10 +424,12 @@
     }
 
     sa ^= sb,
-    ua  = (FT_ULong)((ua ^ sa) - sa);
+    ua  = (FT_ULong)(( ua ^ sa ) - sa);
 
     return (FT_Long)ua;
-#else
+
+#else /* 0 */
+
     FT_Long   s;
     FT_ULong  ua, ub;
 
@@ -453,7 +457,9 @@
     }
 
     return ( s < 0 ? -(FT_Long)ua : (FT_Long)ua );
-#endif
+
+#endif /* 0 */
+
   }
 
 
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Mac FOND support.  Written by [email protected].                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
--- a/src/base/fttrigon.c
+++ b/src/base/fttrigon.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType trigonometric functions (body).                             */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003, 2004 by                                    */
+/*  Copyright 2001, 2002, 2003, 2004, 2005 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -110,23 +110,24 @@
     shift = 0;
 
 #if 1
-    /* determine msb bit index in 'shift' */
-    if ( z >= (1L << 16 ) )
+
+    /* determine msb bit index in `shift' */
+    if ( z >= ( 1L << 16 ) )
     {
       z     >>= 16;
       shift  += 16;
     }
-    if ( z >= (1L << 8) )
+    if ( z >= ( 1L << 8 ) )
     {
       z     >>= 8;
       shift  += 8;
     }
-    if ( z >= (1L << 4) )
+    if ( z >= ( 1L << 4 ) )
     {
       z     >>= 4;
       shift  += 4;
     }
-    if ( z >= (1L << 2) )
+    if ( z >= ( 1L << 2 ) )
     {
       z     >>= 2;
       shift  += 2;
@@ -136,8 +137,7 @@
 
     if ( shift < 28 )
     {
-      shift  = 28-shift;
-
+      shift = 28 - shift;
       vec->x = x << shift;
       vec->y = y << shift;
     }
@@ -148,7 +148,9 @@
       vec->y = y >> shift;
       shift  = -shift;
     }
-#else
+
+#else /* 0 */
+
     if ( z < ( 1L << 27 ) )
     {
       do
@@ -171,7 +173,9 @@
       vec->y = y >> shift;
       shift  = -shift;
     }
-#endif
+
+#endif /* 0 */
+
     return shift;
   }
 
--- a/src/pfr/pfrgload.c
+++ b/src/pfr/pfrgload.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR glyph loader (body).                                    */
 /*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
+/*  Copyright 2002, 2003, 2005 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */