From 47ed6413ce8f2586b8d542dc46055e075a47022e Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 6 Aug 2010 10:14:25 +0000 Subject: Updated to freetype 2.4.1 --- freetype/include/freetype/config/ftoption.h | 39 +++++++++++++++++++----- freetype/include/freetype/freetype.h | 12 ++++++-- freetype/include/freetype/ftcache.h | 10 +++---- freetype/include/freetype/fterrdef.h | 21 ++++++++----- freetype/include/freetype/ftlcdfil.h | 43 ++++++++++++++++++++++++++- freetype/include/freetype/ftlist.h | 6 +++- freetype/include/freetype/ftmodapi.h | 9 ++++-- freetype/include/freetype/ftrender.h | 6 +--- freetype/include/freetype/ftsystem.h | 7 +++-- freetype/include/freetype/internal/ftmemory.h | 22 ++++++++++---- freetype/include/freetype/ttnameid.h | 2 +- freetype/include/freetype/tttables.h | 19 +++++++----- 12 files changed, 145 insertions(+), 51 deletions(-) (limited to 'freetype/include') diff --git a/freetype/include/freetype/config/ftoption.h b/freetype/include/freetype/config/ftoption.h index 204743600..2b46259c1 100644 --- a/freetype/include/freetype/config/ftoption.h +++ b/freetype/include/freetype/config/ftoption.h @@ -488,8 +488,7 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */ - /* a bytecode interpreter in the TrueType driver. Note that there are */ - /* important patent issues related to the use of the interpreter. */ + /* a bytecode interpreter in the TrueType driver. */ /* */ /* By undefining this, you will only compile the code necessary to load */ /* TrueType glyphs without hinting. */ @@ -497,17 +496,20 @@ FT_BEGIN_HEADER /* Do not #undef this macro here, since the build system might */ /* define it for certain configurations only. */ /* */ -/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ +#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER /*************************************************************************/ /* */ /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ /* of the TrueType bytecode interpreter is used that doesn't implement */ - /* any of the patented opcodes and algorithms. Note that the */ - /* TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you define */ - /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, either define */ - /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ + /* any of the patented opcodes and algorithms. The patents related to */ + /* TrueType hinting have expired worldwide since May 2010; this option */ + /* is now deprecated. */ + /* */ + /* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* */ + /* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, */ + /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */ /* */ /* This macro is only useful for a small number of font files (mostly */ @@ -544,7 +546,7 @@ FT_BEGIN_HEADER /* ... */ /* } */ /* */ -#define TT_CONFIG_OPTION_UNPATENTED_HINTING +/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */ /*************************************************************************/ @@ -690,6 +692,27 @@ FT_BEGIN_HEADER #define FT_CONFIG_OPTION_OLD_INTERNALS + /* + * To detect legacy cache-lookup call from a rogue client (<= 2.1.7), + * we restrict the number of charmaps in a font. The current API of + * FTC_CMapCache_Lookup() takes cmap_index & charcode, but old API + * takes charcode only. To determine the passed value is for cmap_index + * or charcode, the possible cmap_index is restricted not to exceed + * the minimum possible charcode by a rogue client. It is also very + * unlikely that a rogue client is interested in Unicode values 0 to 15. + * + * NOTE: The original threshold was 4 deduced from popular number of + * cmap subtables in UCS-4 TrueType fonts, but now it is not + * irregular for OpenType fonts to have more than 4 subtables, + * because variation selector subtables are available for Apple + * and Microsoft platforms. + */ + +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS +#define FT_MAX_CHARMAP_CACHEABLE 15 +#endif + + /* * This macro is defined if either unpatented or native TrueType * hinting is requested by the definitions above. diff --git a/freetype/include/freetype/freetype.h b/freetype/include/freetype/freetype.h index 942a740f0..e2ab77437 100644 --- a/freetype/include/freetype/freetype.h +++ b/freetype/include/freetype/freetype.h @@ -2997,7 +2997,7 @@ FT_BEGIN_HEADER * * @return: * The index into the array of character maps within the face to which - * `charmap' belongs. + * `charmap' belongs. If an error occurs, -1 is returned. * */ FT_EXPORT( FT_Int ) @@ -3773,8 +3773,8 @@ FT_BEGIN_HEADER * */ #define FREETYPE_MAJOR 2 -#define FREETYPE_MINOR 3 -#define FREETYPE_PATCH 12 +#define FREETYPE_MINOR 4 +#define FREETYPE_PATCH 1 /*************************************************************************/ @@ -3834,6 +3834,9 @@ FT_BEGIN_HEADER /* 1~if this is a TrueType font that uses one of the patented */ /* opcodes, 0~otherwise. */ /* */ + /* */ + /* Since May 2010, TrueType hinting is no longer patented. */ + /* */ /* */ /* 2.3.5 */ /* */ @@ -3861,6 +3864,9 @@ FT_BEGIN_HEADER /* an SFNT font, or if the unpatented hinter is not compiled in this */ /* instance of the library. */ /* */ + /* */ + /* Since May 2010, TrueType hinting is no longer patented. */ + /* */ /* */ /* 2.3.5 */ /* */ diff --git a/freetype/include/freetype/ftcache.h b/freetype/include/freetype/ftcache.h index 0916d70a3..a9e1237bc 100644 --- a/freetype/include/freetype/ftcache.h +++ b/freetype/include/freetype/ftcache.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache subsystem (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -263,10 +263,10 @@ FT_BEGIN_HEADER /* reference-counted. A node with a count of~0 might be flushed */ /* out of a full cache whenever a lookup request is performed. */ /* */ - /* If you lookup nodes, you have the ability to `acquire' them, i.e., */ - /* to increment their reference count. This will prevent the node */ - /* from being flushed out of the cache until you explicitly `release' */ - /* it (see @FTC_Node_Unref). */ + /* If you look up nodes, you have the ability to `acquire' them, */ + /* i.e., to increment their reference count. This will prevent the */ + /* node from being flushed out of the cache until you explicitly */ + /* `release' it (see @FTC_Node_Unref). */ /* */ /* See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup. */ /* */ diff --git a/freetype/include/freetype/fterrdef.h b/freetype/include/freetype/fterrdef.h index d7ad256bd..bf5222060 100644 --- a/freetype/include/freetype/fterrdef.h +++ b/freetype/include/freetype/fterrdef.h @@ -4,7 +4,7 @@ /* */ /* FreeType error codes (specification). */ /* */ -/* Copyright 2002, 2004, 2006, 2007 by */ +/* Copyright 2002, 2004, 2006, 2007, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -211,6 +211,9 @@ "argument stack underflow" ) FT_ERRORDEF_( Ignore, 0xA2, \ "ignore" ) + FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, \ + "no Unicode glyph name found" ) + /* BDF errors */ @@ -220,19 +223,21 @@ "`FONT' field missing" ) FT_ERRORDEF_( Missing_Size_Field, 0xB2, \ "`SIZE' field missing" ) - FT_ERRORDEF_( Missing_Chars_Field, 0xB3, \ + FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3, \ + "`FONTBOUNDINGBOX' field missing" ) + FT_ERRORDEF_( Missing_Chars_Field, 0xB4, \ "`CHARS' field missing" ) - FT_ERRORDEF_( Missing_Startchar_Field, 0xB4, \ + FT_ERRORDEF_( Missing_Startchar_Field, 0xB5, \ "`STARTCHAR' field missing" ) - FT_ERRORDEF_( Missing_Encoding_Field, 0xB5, \ + FT_ERRORDEF_( Missing_Encoding_Field, 0xB6, \ "`ENCODING' field missing" ) - FT_ERRORDEF_( Missing_Bbx_Field, 0xB6, \ + FT_ERRORDEF_( Missing_Bbx_Field, 0xB7, \ "`BBX' field missing" ) - FT_ERRORDEF_( Bbx_Too_Big, 0xB7, \ + FT_ERRORDEF_( Bbx_Too_Big, 0xB8, \ "`BBX' too big" ) - FT_ERRORDEF_( Corrupted_Font_Header, 0xB8, \ + FT_ERRORDEF_( Corrupted_Font_Header, 0xB9, \ "Font header corrupted or missing fields" ) - FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xB9, \ + FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA, \ "Font glyphs corrupted or missing fields" ) diff --git a/freetype/include/freetype/ftlcdfil.h b/freetype/include/freetype/ftlcdfil.h index c6201b38e..e7f592714 100644 --- a/freetype/include/freetype/ftlcdfil.h +++ b/freetype/include/freetype/ftlcdfil.h @@ -5,7 +5,7 @@ /* FreeType API for color filtering of subpixel bitmap glyphs */ /* (specification). */ /* */ -/* Copyright 2006, 2007, 2008 by */ +/* Copyright 2006, 2007, 2008, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -161,6 +161,47 @@ FT_BEGIN_HEADER FT_Library_SetLcdFilter( FT_Library library, FT_LcdFilter filter ); + + /************************************************************************** + * + * @func: + * FT_Library_SetLcdFilterWeights + * + * @description: + * Use this function to override the filter weights selected by + * @FT_Library_SetLcdFilter. By default, FreeType uses the quintuple + * (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10, + * 0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and + * FT_LCD_FILTER_LEGACY. + * + * @input: + * library :: + * A handle to the target library instance. + * + * weights :: + * A pointer to an array; the function copies the first five bytes and + * uses them to specify the filter weights. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Due to *PATENTS* covering subpixel rendering, this function doesn't + * do anything except returning `FT_Err_Unimplemented_Feature' if the + * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not + * defined in your build of the library, which should correspond to all + * default builds of FreeType. + * + * This function must be called after @FT_Library_SetLcdFilter to have + * any effect. + * + * @since: + * 2.4.0 + */ + FT_EXPORT( FT_Error ) + FT_Library_SetLcdFilterWeights( FT_Library library, + unsigned char *weights ); + /* */ diff --git a/freetype/include/freetype/ftlist.h b/freetype/include/freetype/ftlist.h index 93b05fc0d..bb6f7f119 100644 --- a/freetype/include/freetype/ftlist.h +++ b/freetype/include/freetype/ftlist.h @@ -4,7 +4,7 @@ /* */ /* Generic list support for FreeType (specification). */ /* */ -/* Copyright 1996-2001, 2003, 2007 by */ +/* Copyright 1996-2001, 2003, 2007, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -255,6 +255,10 @@ FT_BEGIN_HEADER /* user :: A user-supplied field which is passed as the last */ /* argument to the destructor. */ /* */ + /* */ + /* This function expects that all nodes added by @FT_List_Add or */ + /* @FT_List_Insert have been dynamically allocated. */ + /* */ FT_EXPORT( void ) FT_List_Finalize( FT_List list, FT_List_Destructor destroy, diff --git a/freetype/include/freetype/ftmodapi.h b/freetype/include/freetype/ftmodapi.h index 3c9b876df..17868b2f8 100644 --- a/freetype/include/freetype/ftmodapi.h +++ b/freetype/include/freetype/ftmodapi.h @@ -4,7 +4,7 @@ /* */ /* FreeType modules public interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by */ +/* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -263,6 +263,9 @@ FT_BEGIN_HEADER /* @FT_Add_Default_Modules or a series of calls to @FT_Add_Module) */ /* instead of @FT_Init_FreeType to initialize the FreeType library. */ /* */ + /* Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a */ + /* library instance. */ + /* */ /* */ /* memory :: A handle to the original memory object. */ /* */ @@ -394,8 +397,8 @@ FT_BEGIN_HEADER * * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: * The library implements a bytecode interpreter that covers - * the full instruction set of the TrueType virtual machine. - * See the file `docs/PATENTS' for legal aspects. + * the full instruction set of the TrueType virtual machine (this + * was governed by patents until May 2010, hence the name). * * @since: * 2.2 diff --git a/freetype/include/freetype/ftrender.h b/freetype/include/freetype/ftrender.h index 41c31eac4..e06a8142e 100644 --- a/freetype/include/freetype/ftrender.h +++ b/freetype/include/freetype/ftrender.h @@ -4,7 +4,7 @@ /* */ /* FreeType renderer modules public interface (specification). */ /* */ -/* Copyright 1996-2001, 2005, 2006 by */ +/* Copyright 1996-2001, 2005, 2006, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -141,10 +141,6 @@ FT_BEGIN_HEADER /* raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only. */ /* This is a pointer to its raster's class. */ /* */ - /* raster :: For @FT_GLYPH_FORMAT_OUTLINE renderers only. */ - /* This is a pointer to the corresponding raster */ - /* object, if any. */ - /* */ typedef struct FT_Renderer_Class_ { FT_Module_Class root; diff --git a/freetype/include/freetype/ftsystem.h b/freetype/include/freetype/ftsystem.h index a95b2c76b..e07460c55 100644 --- a/freetype/include/freetype/ftsystem.h +++ b/freetype/include/freetype/ftsystem.h @@ -4,7 +4,7 @@ /* */ /* FreeType low-level system interface definition (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2005 by */ +/* Copyright 1996-2001, 2002, 2005, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -240,7 +240,8 @@ FT_BEGIN_HEADER * * @note: * This function might be called to perform a seek or skip operation - * with a `count' of~0. + * with a `count' of~0. A non-zero return value then indicates an + * error. * */ typedef unsigned long @@ -301,7 +302,7 @@ FT_BEGIN_HEADER * The stream's input function. * * close :: - * The stream;s close function. + * The stream's close function. * * memory :: * The memory manager to use to preload frames. This is set diff --git a/freetype/include/freetype/internal/ftmemory.h b/freetype/include/freetype/internal/ftmemory.h index 2010ca90d..026aa63ea 100644 --- a/freetype/include/freetype/internal/ftmemory.h +++ b/freetype/include/freetype/internal/ftmemory.h @@ -4,7 +4,7 @@ /* */ /* The FreeType memory management macros (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007 by */ +/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -58,15 +58,27 @@ FT_BEGIN_HEADER /* - * C++ refuses to handle statements like p = (void*)anything; where `p' - * is a typed pointer. Since we don't have a `typeof' operator in - * standard C++, we have to use ugly casts. + * C++ refuses to handle statements like p = (void*)anything, with `p' a + * typed pointer. Since we don't have a `typeof' operator in standard + * C++, we have to use a template to emulate it. */ #ifdef __cplusplus -#define FT_ASSIGNP( p, val ) *((void**)&(p)) = (val) + + extern "C++" + template inline T* + cplusplus_typeof( T*, + void *v ) + { + return static_cast ( v ); + } + +#define FT_ASSIGNP( p, val ) (p) = cplusplus_typeof( (p), (val) ) + #else + #define FT_ASSIGNP( p, val ) (p) = (val) + #endif diff --git a/freetype/include/freetype/ttnameid.h b/freetype/include/freetype/ttnameid.h index cbeac78db..66aef0432 100644 --- a/freetype/include/freetype/ttnameid.h +++ b/freetype/include/freetype/ttnameid.h @@ -64,7 +64,7 @@ FT_BEGIN_HEADER * MacOS systems (even if they contain a Microsoft charmap as well). * * TT_PLATFORM_ISO :: - * This value was used to specify Unicode charmaps. It is however + * This value was used to specify ISO/IEC 10646 charmaps. It is however * now deprecated. See @TT_ISO_ID_XXX for a list of corresponding * `encoding_id' values. * diff --git a/freetype/include/freetype/tttables.h b/freetype/include/freetype/tttables.h index c12b17268..4610e501f 100644 --- a/freetype/include/freetype/tttables.h +++ b/freetype/include/freetype/tttables.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType tables definitions and interface */ /* (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -557,13 +557,13 @@ FT_BEGIN_HEADER /* */ typedef enum FT_Sfnt_Tag_ { - ft_sfnt_head = 0, - ft_sfnt_maxp = 1, - ft_sfnt_os2 = 2, - ft_sfnt_hhea = 3, - ft_sfnt_vhea = 4, - ft_sfnt_post = 5, - ft_sfnt_pclt = 6, + ft_sfnt_head = 0, /* TT_Header */ + ft_sfnt_maxp = 1, /* TT_MaxProfile */ + ft_sfnt_os2 = 2, /* TT_OS2 */ + ft_sfnt_hhea = 3, /* TT_HoriHeader */ + ft_sfnt_vhea = 4, /* TT_VertHeader */ + ft_sfnt_post = 5, /* TT_Postscript */ + ft_sfnt_pclt = 6, /* TT_PCLT */ sfnt_max /* internal end mark */ @@ -590,6 +590,9 @@ FT_BEGIN_HEADER /* error, or if the corresponding table was not found *OR* loaded */ /* from the file. */ /* */ + /* Use a typecast according to `tag' to access the structure */ + /* elements. */ + /* */ /* */ /* The table is owned by the face object and disappears with it. */ /* */ -- cgit v1.2.3