shithub: freetype+ttf2subf

Download patch

ref: b2d025306e3d0b3a4a14f63ac171d496d94eaee6
parent: dab2454635b3e2402322eb1f455905735c1b5938
author: Werner Lemberg <[email protected]>
date: Fri Nov 4 01:58:49 EST 2005

* src/base/ftobjs.c (FT_Open_Face): Avoid possible memory leak.


Make compiling instructions in docs/CUSTOMIZE work again.

* builds/unix/unix-cc.in (CPPFLAGS): New variable.
(CFLAGS): Don't include @CPPFLAGS@.
* builds/freetype.mk (FT_CFLAGS): Add CPPFLAGS.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,41 +1,51 @@
+2005-11-03  Ville Syrj�l�  <[email protected]>
+
+	* src/base/ftobjs.c (FT_Open_Face): Avoid possible memory leak.
+
+2005-11-02  Werner Lemberg  <[email protected]>
+
+	Make compiling instructions in docs/CUSTOMIZE work again.
+
+	* builds/unix/unix-cc.in (CPPFLAGS): New variable.
+	(CFLAGS): Don't include @CPPFLAGS@.
+	* builds/freetype.mk (FT_CFLAGS): Add CPPFLAGS.
+
 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:
+	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
+	`apinames' tool located in src/tools/apinames.c.
 
-	updating 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.
 
-	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:
 
-        * src/base/fttrigon.c (ft_trig_prenorm), src/base/ftcalc.c (FT_MulFix):
-        performance optimizations
+        * src/base/fttrigon.c (ft_trig_prenorm), src/base/ftcalc.c
+        (FT_MulFix): Performance optimizations.
 
 	* include/freetype/internal/ftgloader.h, src/base/ftgloader.h:
-	introductin the FT_GLYPHLOADER_CHECKXXXX macros, and fixed a small
-	bug within FT_GlyphLoader_CheckPoints which caused "AdjustPoints" to
-	be called everytime.
+	Introduce the FT_GLYPHLOADER_CHECKXXXX macros, and fix a small bug
+	within FT_GlyphLoader_CheckPoints which caused `AdjustPoints' to be
+	called everytime.
 
-	* src/autofit/afloader.c, src/truetype/ttgload.c: performance
-	optimization: used FT_GLYPHLOADER_CHECK_POINTS macro on
+	* src/autofit/afloader.c, src/truetype/ttgload.c: Performance
+	optimization: Use FT_GLYPHLOADER_CHECK_POINTS macro on
 	profile-detected hot-spots.
 
-	* src/autofit/aftypes.h: introducing AF_ANGLE_DIFF macro to inline
-	FT_Angle_Diff
+	* src/autofit/aftypes.h (AF_ANGLE_DIFF): New macro to inline
+	FT_Angle_Diff.
 
-	* src/autofit/afhints.c (af_direction_compute): re-implement
-	"af_direction_compute", and use AF_ANGLE_DIFF to speed up the
-	detection of inflexions.
+	* src/autofit/afhints.c (af_direction_compute): Re-implement.  Use
+	AF_ANGLE_DIFF to speed up the detection of inflexions.
 
 2005-10-28  suzuki toshiya  <[email protected]>
 
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2001, 2002, 2003, 2004 by
+# Copyright 1996-2000, 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, modified,
@@ -133,7 +133,7 @@
 # $(INCLUDE_FLAGS) should come before $(CFLAGS) to avoid problems with
 # old FreeType versions.
 #
-FT_CFLAGS  = $(INCLUDE_FLAGS) $(CFLAGS)
+FT_CFLAGS  = $(CPPFLAGS) $(INCLUDE_FLAGS) $(CFLAGS)
 FT_CC      = $(CC) $(FT_CFLAGS)
 FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
 
--- a/builds/unix/unix-cc.in
+++ b/builds/unix/unix-cc.in
@@ -2,7 +2,7 @@
 # FreeType 2 template for Unix-specific compiler definitions
 #
 
-# Copyright 1996-2000, 2002, 2003 by
+# Copyright 1996-2000, 2002, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -72,8 +72,8 @@
 #
 #   We use our own FreeType configuration file.
 #
-CFLAGS := -c @XX_CFLAGS@ @CPPFLAGS@ @CFLAGS@ \
-          -DFT_CONFIG_CONFIG_H="<ftconfig.h>"
+CPPFLAGS := @CPPFLAGS@
+CFLAGS   := -c @XX_CFLAGS@ @CFLAGS@ -DFT_CONFIG_CONFIG_H="<ftconfig.h>"
 
 # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
 #
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1939,7 +1939,9 @@
   /*                  first face has index 0.                              */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    aface      :: A handle to a new face object.                       */
+  /*    aface      :: A handle to a new face object.  If `face_index' is   */
+  /*                  greater than or equal to zero, it must be non-NULL.  */
+  /*                  See note below.                                      */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
@@ -1949,11 +1951,15 @@
   /*    slot for the face object which can be accessed directly through    */
   /*    `face->glyph'.                                                     */
   /*                                                                       */
-  /*    @FT_Open_Face can be used to determine and/or check the font       */
-  /*    format of a given font resource.  If the `face_index' field is     */
-  /*    negative, the function does _not_ return any face handle in        */
-  /*    `*aface'; the function's return value is 0 if the font format is   */
-  /*    recognized, or non-zero otherwise.                                 */
+  /*    @FT_Open_Face can be used to quickly check whether the font format */
+  /*    of a given font resource is supported by FreeType.  If the         */
+  /*    `face_index' field is negative, the function returns a more or     */
+  /*    less empty face handle in `*aface' (if `aface' isn't NULL); the    */
+  /*    function's return value is 0 if the font format is recognized, or  */
+  /*    non-zero otherwise.  The only useful field in this special case is */
+  /*    `face->num_faces' which gives the number of faces within the font  */
+  /*    file.  After examination, the returned @FT_Face structure should   */
+  /*    be deallocated with a call to @FT_Done_Face.                       */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Open_Face( FT_Library           library,
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1753,6 +1753,9 @@
 
     if ( aface )
       *aface = face;
+    else
+      FT_Done_Face( face );
+
     goto Exit;
 
   Fail: