shithub: freetype+ttf2subf

Download patch

ref: 621e4886223a6528fee553f6618ed1c22297ad19
parent: c96f69dfaa57af0bd3e5d1f5dd030af69779f820
author: David Turner <[email protected]>
date: Mon Dec 16 16:51:24 EST 2002

2002-12-16  David Turner  <[email protected]>

        * docs/VERSION.DLL: updating document to better explain the differences between
        the three version numbers being used on Unix, as well as provide the AutoConf
        fragment provided by Lars Clausen

        * src/smooth/ftgrays.c (gray_render_conic): fixed small bug that
        prevented bezier arcs with negative vertical coordinates to be rendered
        appropriately


2002-11-27  Vincent Caron <[email protected]>

        * builds/unix/unix-def.in, builds/unix/freetype-config.in,
        builds/unix/configure.ac, src/gzip/rules.mk, src/gzip/ftgzip.c:
        adding support for system zlib installations when available on the
        target platform (Unix only)

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2002-12-16  David Turner  <[email protected]>
+
+        * docs/VERSION.DLL: updating document to better explain the differences between
+        the three version numbers being used on Unix, as well as provide the AutoConf
+        fragment provided by Lars Clausen
+
+        * src/smooth/ftgrays.c (gray_render_conic): fixed small bug that
+        prevented bezier arcs with negative vertical coordinates to be rendered
+        appropriately
+
 2002-12-02  Antoine Leca  <Antoine-FreetypeLeca-Marti.org>
 
         * src/base/ftobjs.c: modified the logic to get Unicode charmaps.
@@ -10,6 +20,13 @@
 
         * include/freetype/ftgzip.h: Correct the name of the controlling
         macro (was __FTXF86_H__ ...)
+
+2002-11-27  Vincent Caron <[email protected]>
+
+        * builds/unix/unix-def.in, builds/unix/freetype-config.in,
+        builds/unix/configure.ac, src/gzip/rules.mk, src/gzip/ftgzip.c:
+        adding support for system zlib installations when available on the
+        target platform (Unix only)
 
 2002-11-23  David Turner  <[email protected]>
 
--- a/README
+++ b/README
@@ -10,7 +10,7 @@
   is called `libttf'.  They are *not* compatible!
 
 
-  FreeType 2.1.3
+  FreeType 2.1.4
   ==============
 
   Please   read  the  docs/CHANGES   file,  it   contains  IMPORTANT
@@ -22,9 +22,9 @@
   Note  that the  FreeType 2  documentation  is now  available as  a
   separate package from our sites.  See:
 
-    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.3.tar.bz2
-    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.3.tar.gz
-    ftp://ftp.freetype.org/pub/freetype2/ftdoc213.zip
+    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.4.tar.bz2
+    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.4.tar.gz
+    ftp://ftp.freetype.org/pub/freetype2/ftdoc214.zip
 
 
   Reports
--- a/builds/unix/configure.ac
+++ b/builds/unix/configure.ac
@@ -81,6 +81,23 @@
 
 AC_CHECK_FUNCS(memcpy memmove)
 
+
+dnl Check for system zlib
+AC_ARG_WITH(zlib,
+  [  --without-zlib          use internal zlib instead of system-wide])
+if test x$with_zlib != xno && test -z "$LIBZ"; then
+  AC_CHECK_LIB(z, gzsetparams, [AC_CHECK_HEADER(zlib.h, LIBZ='-lz')])
+fi
+if test x$with_zlib != xno && test -n "$LIBZ"; then
+  CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
+  SYSTEM_ZLIB=yes
+fi
+AC_SUBST(LIBZ)
+AC_SUBST(CFLAGS)
+AC_SUBST(SYSTEM_ZLIB)
+
+
+
 AC_PROG_LIBTOOL
 
 dnl create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
--- a/builds/unix/freetype-config.in
+++ b/builds/unix/freetype-config.in
@@ -88,7 +88,7 @@
 fi
 
 if test "$echo_libs" = "yes" ; then
- libs="-lfreetype"
+ libs="-lfreetype @LIBZ@"
  if test "@libdir@" != "/usr/lib" ; then
   echo -L@libdir@ $libs
  else
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -85,6 +85,12 @@
 LIB_DIR := $(OBJ_DIR)
 
 
+# The SYSTEM_ZLIB macro is defined if the user whishes to link dynamically
+# whith its system wide zlib. If SYSTEM_ZLIB is 'yes', the zlib part of the
+# ftgzip module is not compiled in.
+SYSTEM_ZLIB := @SYSTEM_ZLIB@
+
+
 # The NO_OUTPUT macro is appended to command lines in order to ignore
 # the output of some programs.
 #
--- a/docs/VERSION.DLL
+++ b/docs/VERSION.DLL
@@ -1,7 +1,78 @@
-Libtool's version for FreeType 2.1.3 is `9.2.3'.
+Due to our use of "libtool" to generate and install the FreeType 2 libraries
+on Unix systems, as well as other historical events, it is generally very
+difficult to know precisely which release of the font engine is installed
+on a given system.
 
-On most platforms, the soname will be `6.3.2' (e.g. `libfreetype.so.6.3.2').
+This file tries to explain why and to document ways to properly detect
+FreeType on Unix.
 
-Libtool's version for FreeType 2.1.2 is `9.1.3'.
 
-On most platforms, the soname will be `6.3.1' (e.g. `libfreetype.so.6.3.1').
+I. Version & Release numbers:
+
+For each new public release of FreeType 2, there are generally *three*
+distinct "version" numbers to consider:
+
+  * the official FT2 release number, like 2.0.9, or 2.1.3
+  
+  * the libtool (and Unix) specific version number, like "9.2.3". This
+    is what "freetype-config --version" will return
+  
+  * the platform-specific shared object number, used for example when
+    the library is installed as "/usr/lib/libfreetype.so.6.3.2"
+
+
+the platform-specific number is, unsurprisingly, platform-specific and varies
+with the operating system you're using (several variants of Linux, FreeBSD,
+Solaris, etc...). You should thus _never_ use it, even for simple tests.
+
+the libtool-specific number does not equal the release number but is tied
+to it.
+
+the release number is available at *compile* time through the following
+macros defined in FT_FREETYPE_H:
+
+  - FREETYPE_MAJOR : major release number
+  - FREETYPE_MINOR : minor release number
+  - FREETYPE_PATCH : patch release number
+
+see below for some Autoconf fragment to 
+
+
+the release number is also available at *runtime* through the 
+"FT_Library_Version" API. Unfortunately, this one wasn't available or
+working correctly before the 2.1.3 official release !!
+
+
+II. Table:
+
+the following is a simple table that gives, for each official release,
+the corresponding libtool number, as well as the shared object number
+found on _most_ systems, but not all of them:
+
+  release       libtool        so
+-------------------------------------
+   2.1.3         9.2.3         6.3.2
+   2.1.2         9.1.3         6.3.1
+   2.1.1           ?            ?
+   2.1.0           ?            ?
+   2.0.9           ?            ?
+
+
+
+
+III. AutoConf Code Fragment:
+
+Lars Clausen contributed the following Autoconf fragment to detect at
+which version of FreeType is installed on your system. This one tests
+for a version that is at least 2.0.9, you should change the last line to
+check against other release numbers.
+
+    AC_MSG_CHECKING([for version of FreeType])
+    FREETYPE_INCLUDE=`freetype-config --cflags | cut -c3-`
+    FREETYPE_MAJOR=`grep '^#define FREETYPE_MAJOR' $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
+    FREETYPE_MINOR=`grep '^#define FREETYPE_MINOR' $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
+    FREETYPE_PATCH=`grep '^#define FREETYPE_PATCH' $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
+    FREETYPE_VERSION=`echo | awk "BEGIN { printf \"%d\", ($FREETYPE_MAJOR * 1000 + $FREETYPE_MINOR) * 1000 + $FREETYPE_PATCH;}"`
+    AC_MSG_RESULT([$FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH])
+    if test "$FREETYPE_VERSION" -ge 2000009; then
+
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1494,6 +1494,16 @@
   /*                                                                       */
   /*    FT_OPEN_PARAMS      :: Use the `num_params' & `params' field.      */
   /*                                                                       */
+  /*    ft_open_memory :: deprecated. use @FT_OPEN_MEMORY instead          */
+  /*                                                                       */
+  /*    ft_open_stream :: deprecated. use @FT_OPEN_STREAM instead          */
+  /*                                                                       */
+  /*    ft_open_pathname :: deprecated. use @FT_OPEN_PATHNAME instead      */
+  /*                                                                       */
+  /*    ft_open_driver :: deprecated, use @FT_OPEN_DRIVER instead          */
+  /*                                                                       */
+  /*    ft_open_params :: deprecated, use @FT_OPEN_PARAMS instead          */
+  /*                                                                       */
   /* <Note>                                                                */
   /*    The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME'     */
   /*    flags are mutually exclusive.                                      */
@@ -1508,11 +1518,11 @@
 
   } FT_Open_Flags;
 
-#define  FT_OPEN_MEMORY    FT_OPEN_MEMORY
-#define  FT_OPEN_STREAM    FT_OPEN_STREAM
-#define  FT_OPEN_PATHNAME  FT_OPEN_PATHNAME
-#define  FT_OPEN_DRIVER    FT_OPEN_DRIVER
-#define  FT_OPEN_PARAMS    FT_OPEN_PARAMS
+#define  ft_open_memory    FT_OPEN_MEMORY     /* deprecated */
+#define  ft_open_stream    FT_OPEN_STREAM     /* deprecated */
+#define  ft_open_pathname  FT_OPEN_PATHNAME   /* deprecated */
+#define  ft_open_driver    FT_OPEN_DRIVER     /* deprecated */
+#define  ft_open_params    FT_OPEN_PARAMS     /* deprecated */
 
 
   /*************************************************************************/
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -459,6 +459,21 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* <FuncType>                                                            */
+  /*    SFNT_Load_Table_Func                                               */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Loads a given SFNT table in memory                                 */
+  /*                                                                       */
+  typedef FT_Error
+  (*SFNT_Load_Table_Func)( FT_Face      face,
+                           FT_ULong     tag,
+                           FT_Long      offset,
+                           FT_Byte*     buffer,
+                           FT_ULong*    length );
+
+  /*************************************************************************/
+  /*                                                                       */
   /* <Struct>                                                              */
   /*    SFNT_Interface                                                     */
   /*                                                                       */
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -593,6 +593,63 @@
   FT_Get_Sfnt_Table( FT_Face      face,
                      FT_Sfnt_Tag  tag );
 
+ /**************************************************************************
+  *
+  * <Function>
+  *    FT_Load_Sfnt_Table
+  *
+  * <Description>
+  *   Loads any font table into client memory.
+  *
+  * <Input>
+  *   face   :: handle to source face.
+  *   tag    :: the 4-byte tag of the table to load. Use the value 0 if
+  *             you want to access the whole font file. Else, you can use
+  *             one of the definitions found in the @FT_TRUETYPE_TAGS_H
+  *             file, or forge a new one with @FT_MAKE_TAG
+  *              
+  *   offset :: the starting offset in the table (or file if tag == 0)
+  *
+  * <Output>
+  *   buffer :: target buffer address. client must ensure that there are
+  *             enough bytes in it.
+  *
+  * <InOut>
+  *   length :: if the 'length' parameter is NULL, then try to load the whole
+  *             table, and return an error code if it fails.
+  *
+  *             else, if '*length' is 0, then exit immediately while returning
+  *             the table's (or file) full size in it.
+  *
+  *             else, the number of bytes to read from the table or file,
+  *             from the starting offset.
+  *
+  * <Return>
+  *   error code. 0 means success
+  *
+  * <Note>
+  *   if you need to determine the table's length you should first call this
+  *   function with "*length" set to 0, as in the following example:
+  *
+  *   {
+  *     FT_ULong  length = 0;
+  *
+  *     error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );
+  *     if ( error ) { ... table does not exist ... }
+  *
+  *     buffer = malloc( length );
+  *     if ( buffer == NULL )  { ... not enough memory ... }
+  *
+  *     error = FT_Load_Sfnt_Table( face,tag, 0, buffer, &length );
+  *     if ( error ) { ... could not load table ... }
+  *   }
+  */
+  FT_EXPORT( FT_Error )
+  FT_Load_Sfnt_Table( FT_Face      face,
+                      FT_ULong     tag,
+                      FT_Long      offset,
+                      FT_Byte*     buffer,
+                      FT_ULong*    length );
 
   /* */
 
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -224,7 +224,7 @@
     FT_Pos  sign = 1;
 
     FT_UNUSED( hinter );
-
+    FT_UNUSED( vertical );
 
     dist = serif->opos - base->opos;
     if ( dist < 0 )
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -22,6 +22,7 @@
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
+#include FT_INTERNAL_SFNT_H    /* for SFNT_Load_Table_Func */
 #include FT_TRUETYPE_TABLES_H
 #include FT_TRUETYPE_IDS_H
 #include FT_OUTLINE_H
@@ -1832,6 +1833,32 @@
 
   Exit:
     return table;
+  }
+
+
+  /* documentation is in tttables.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Load_Sfnt_Table( FT_Face      face,
+                      FT_ULong     tag,
+                      FT_Long      offset,
+                      FT_Byte*     buffer,
+                      FT_ULong*    length )
+  {
+    SFNT_Load_Table_Func  func;
+    FT_Driver             driver;
+
+
+    if ( !face || !FT_IS_SFNT( face ) )
+      return FT_Err_Invalid_Face_Handle;
+
+    driver = face->driver;
+    func   = (SFNT_Load_Table_Func) driver->root.clazz->get_interface(
+                                      FT_MODULE( driver ), "load_sfnt" );
+    if ( !func )
+      return FT_Err_Unimplemented_Feature;
+
+    return func( face, tag, offset, buffer, length );
   }
 
 
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -29,7 +29,7 @@
 
 #ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
 
-#  include "zlib.h"
+#  include <zlib.h>
 
 #else /* !SYSTEM_ZLIB */
 
--- a/src/gzip/rules.mk
+++ b/src/gzip/rules.mk
@@ -21,7 +21,11 @@
 
 # compilation flags for the driver
 #
-GZIP_COMPILE := $(FT_COMPILE) $I$(GZIP_DIR)
+ifeq ($(SYSTEM_ZLIB),)
+  GZIP_COMPILE := $(FT_COMPILE) $I$(GZIP_DIR)
+else
+  GZIP_COMPILE := $(FT_COMPILE)
+endif
 
 
 # gzip support sources (i.e., C files)
@@ -30,15 +34,19 @@
 
 # gzip support headers
 #
-GZIP_DRV_H := 
+GZIP_DRV_H :=
 
 
-# Pfr driver object(s)
+# gzip driver object(s)
 #
 #   GZIP_DRV_OBJ_M is used during `multi' builds
 #   GZIP_DRV_OBJ_S is used during `single' builds
 #
-GZIP_DRV_OBJ_M := $(GZIP_DRV_SRC:$(GZIP_DIR_)%.c=$(OBJ_)%.$O)
+ifeq ($(SYSTEM_ZLIB),)
+  GZIP_DRV_OBJ_M := $(GZIP_DRV_SRC:$(GZIP_DIR_)%.c=$(OBJ_)%.$O)
+else
+  GZIP_DRV_OBJ_M := $(OBJ_)ftgzip.$O
+endif
 GZIP_DRV_OBJ_S := $(OBJ_)ftgzip.$O
 
 # gzip support source file for single build
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -228,6 +228,9 @@
     if ( ft_strcmp( module_interface, "get_sfnt" ) == 0 )
       return (FT_Module_Interface)get_sfnt_table;
 
+    if ( ft_strcmp( module_interface, "load_sfnt" ) == 0 )
+      return (FT_Module_Interface)tt_face_load_any;
+
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
     if ( ft_strcmp( module_interface, "glyph_name" ) == 0 )
       return (FT_Module_Interface)get_sfnt_glyph_name;
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -857,7 +857,7 @@
         if ( y < min ) min = y;
         if ( y > max ) max = y;
 
-        if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < 0 )
+        if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey )
           goto Draw;
 
         gray_split_conic( arc );
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1133,6 +1133,14 @@
       /*  with synthetic fonts, it's possible we get here twice  */
       return;
 
+    if ( parser->root.cursor + 2 > parser->root.limit &&
+         parser->root.cursor[0] == '['                &&
+         parser->root.cursor[1] == ']'                )
+    {
+      /* empty array */
+      return;
+    }
+
     loader->num_subrs = (FT_Int)T1_ToInt( parser );
     if ( parser->root.error )
       return;
@@ -1483,9 +1491,9 @@
 
     /* now add the special functions... */
     T1_FIELD_CALLBACK( "FontName", parse_font_name )
-#if 0    
+#if 0
     T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox )
-#endif    
+#endif
     T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix )
     T1_FIELD_CALLBACK( "Encoding", parse_encoding )
     T1_FIELD_CALLBACK( "Subrs", parse_subrs )