From 40587b66f7c80b30075c1038ac984a4db23f21c1 Mon Sep 17 00:00:00 2001 From: David Turner Date: Mon, 16 Dec 2002 21:51:24 +0000 Subject: [PATCH] 2002-12-16 David Turner * 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 * 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) --- ChangeLog | 17 +++++++ README | 8 ++-- builds/unix/configure.ac | 17 +++++++ builds/unix/freetype-config.in | 2 +- builds/unix/unix-def.in | 6 +++ docs/VERSION.DLL | 79 ++++++++++++++++++++++++++++++-- include/freetype/freetype.h | 20 ++++++-- include/freetype/internal/sfnt.h | 15 ++++++ include/freetype/tttables.h | 57 +++++++++++++++++++++++ src/autohint/ahhint.c | 2 +- src/base/ftobjs.c | 27 +++++++++++ src/gzip/ftgzip.c | 2 +- src/gzip/rules.mk | 16 +++++-- src/sfnt/sfdriver.c | 3 ++ src/smooth/ftgrays.c | 2 +- src/type1/t1load.c | 12 ++++- 16 files changed, 262 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index a577cf2e4..fcc3589f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-12-16 David Turner + + * 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 * src/base/ftobjs.c: modified the logic to get Unicode charmaps. @@ -11,6 +21,13 @@ * include/freetype/ftgzip.h: Correct the name of the controlling macro (was __FTXF86_H__ ...) +2002-11-27 Vincent Caron + + * 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 * src/cff/cffload.c (cff_charser_load): modified charset loader to diff --git a/README b/README index 050338266..8090c6248 100644 --- 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 diff --git a/builds/unix/configure.ac b/builds/unix/configure.ac index a51c941f6..44baa745e 100644 --- a/builds/unix/configure.ac +++ b/builds/unix/configure.ac @@ -81,6 +81,23 @@ AC_SUBST(FTSYS_SRC) 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' diff --git a/builds/unix/freetype-config.in b/builds/unix/freetype-config.in index 7e939c3f8..c5a3e5abc 100644 --- a/builds/unix/freetype-config.in +++ b/builds/unix/freetype-config.in @@ -88,7 +88,7 @@ if test "$echo_cflags" = "yes" ; then fi if test "$echo_libs" = "yes" ; then - libs="-lfreetype" + libs="-lfreetype @LIBZ@" if test "@libdir@" != "/usr/lib" ; then echo -L@libdir@ $libs else diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in index 621d0685e..6797041c5 100644 --- a/builds/unix/unix-def.in +++ b/builds/unix/unix-def.in @@ -85,6 +85,12 @@ endif 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. # diff --git a/docs/VERSION.DLL b/docs/VERSION.DLL index 43b1a1713..e3086e312 100644 --- 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 + diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 3a41daf6a..93077c977 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1494,6 +1494,16 @@ FT_BEGIN_HEADER /* */ /* 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 */ + /* */ /* */ /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */ /* flags are mutually exclusive. */ @@ -1508,11 +1518,11 @@ FT_BEGIN_HEADER } 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 */ /*************************************************************************/ diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index 89e919094..c5f3bd3c9 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -457,6 +457,21 @@ FT_BEGIN_HEADER (*TT_Free_Table_Func)( TT_Face face ); + /*************************************************************************/ + /* */ + /* */ + /* SFNT_Load_Table_Func */ + /* */ + /* */ + /* 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 ); + /*************************************************************************/ /* */ /* */ diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h index d638a21f2..45996322c 100644 --- a/include/freetype/tttables.h +++ b/include/freetype/tttables.h @@ -593,6 +593,63 @@ FT_BEGIN_HEADER FT_Get_Sfnt_Table( FT_Face face, FT_Sfnt_Tag tag ); + /************************************************************************** + * + * + * FT_Load_Sfnt_Table + * + * + * Loads any font table into client memory. + * + * + * 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) + * + * + * buffer :: target buffer address. client must ensure that there are + * enough bytes in it. + * + * + * 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. + * + * + * error code. 0 means success + * + * + * 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 ); /* */ diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c index dacde6eea..689f4b9dd 100644 --- 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 ) diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 5f6d3ba26..3333c92eb 100644 --- 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 @@ -1835,6 +1836,32 @@ } + /* 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 ); + } + + FT_EXPORT_DEF( FT_Error ) FT_Activate_Size( FT_Size size ) { diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c index 91c0cd4f9..b814e8ec5 100644 --- a/src/gzip/ftgzip.c +++ b/src/gzip/ftgzip.c @@ -29,7 +29,7 @@ #ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB -# include "zlib.h" +# include #else /* !SYSTEM_ZLIB */ diff --git a/src/gzip/rules.mk b/src/gzip/rules.mk index a092ce71d..1332fb206 100644 --- a/src/gzip/rules.mk +++ b/src/gzip/rules.mk @@ -21,7 +21,11 @@ GZIP_DIR_ := $(GZIP_DIR)$(SEP) # 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_DRV_SRC := $(GZIP_DIR_)ftgzip.c # 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 diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index f2fa7b46e..c4dd1b478 100644 --- 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; diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index f6723af67..5ca7c7090 100644 --- 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 ); diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 70fda88d7..02220dbca 100644 --- 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 )