From 727dee178a392d20eb050d0c446f2fcc29058fa1 Mon Sep 17 00:00:00 2001 From: Victoria Lease Date: Mon, 10 Jun 2013 13:55:54 -0700 Subject: Update freetype to 5e094c6fb2ddd6e8901a5679e2cbb8fa476a38ee Integrated patches from freetype2 git repository, up to hashval 5e094c6fb2ddd6e8901a5679e2cbb8fa476a38ee, which is post-2.4.12. Most recent commit message from freetype git: [truetype] Improve handling of broken sbit advance widths. Noteworthy patches included: [cff] Add a new Type 2 interpreter and hinter. Add support for color embedded bitmaps (eg. color emoji). Change-Id: Ia8b6a67bc18f841b24f44edf80f81f663185b598 --- include/freetype/config/ftconfig.h | 49 +- include/freetype/config/ftheader.h | 41 +- include/freetype/config/ftoption.h | 92 ++-- include/freetype/config/ftstdlib.h | 4 +- include/freetype/freetype.h | 124 +++-- include/freetype/ftadvanc.h | 21 +- include/freetype/ftautoh.h | 349 ++++++++++++ include/freetype/ftbitmap.h | 8 +- include/freetype/ftcache.h | 89 +-- include/freetype/ftcffdrv.h | 151 ++++++ include/freetype/ftchapters.h | 16 + include/freetype/fterrdef.h | 6 +- include/freetype/fterrors.h | 23 +- include/freetype/ftglyph.h | 2 +- include/freetype/ftimage.h | 15 +- include/freetype/ftlcdfil.h | 38 ++ include/freetype/ftmodapi.h | 168 +++++- include/freetype/ftmoderr.h | 64 ++- include/freetype/ftoutln.h | 26 +- include/freetype/ftstroke.h | 14 +- include/freetype/ftsynth.h | 7 +- include/freetype/fttrigon.h | 10 +- include/freetype/ftttdrv.h | 150 ++++++ include/freetype/fttypes.h | 28 +- include/freetype/internal/autohint.h | 71 ++- include/freetype/internal/ftcalc.h | 50 +- include/freetype/internal/ftdebug.h | 28 +- include/freetype/internal/ftdriver.h | 398 +++++++------- include/freetype/internal/ftmemory.h | 176 +++--- include/freetype/internal/ftobjs.h | 810 +++++++++++++++++----------- include/freetype/internal/ftpic.h | 32 +- include/freetype/internal/ftrfork.h | 41 +- include/freetype/internal/ftserv.h | 115 +++- include/freetype/internal/ftstream.h | 87 ++- include/freetype/internal/fttrace.h | 10 +- include/freetype/internal/ftvalid.h | 15 +- include/freetype/internal/psaux.h | 10 +- include/freetype/internal/pshints.h | 42 +- include/freetype/internal/services/svprop.h | 81 +++ include/freetype/internal/sfnt.h | 454 +++++----------- include/freetype/internal/t1types.h | 6 +- include/freetype/internal/tttypes.h | 121 +---- include/freetype/ttnameid.h | 20 +- include/freetype/tttables.h | 18 +- include/freetype/tttags.h | 4 +- 45 files changed, 2590 insertions(+), 1494 deletions(-) create mode 100644 include/freetype/ftautoh.h create mode 100644 include/freetype/ftcffdrv.h create mode 100644 include/freetype/ftttdrv.h create mode 100644 include/freetype/internal/services/svprop.h (limited to 'include') diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 5628569..5dce30e 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* ANSI-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2004, 2006-2008, 2010-2011 by */ +/* Copyright 1996-2004, 2006-2008, 2010-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -200,6 +200,30 @@ FT_BEGIN_HEADER /* */ typedef unsigned XXX FT_UInt32; + + /*************************************************************************/ + /* */ + /* */ + /* FT_Int64 */ + /* */ + /* A typedef for a 64bit signed integer type. The size depends on */ + /* the configuration. Only defined if there is real 64bit support; */ + /* otherwise, it gets emulated with a structure (if necessary). */ + /* */ + typedef signed XXX FT_Int64; + + + /*************************************************************************/ + /* */ + /* */ + /* FT_UInt64 */ + /* */ + /* A typedef for a 64bit unsigned integer type. The size depends on */ + /* the configuration. Only defined if there is real 64bit support; */ + /* otherwise, it gets emulated with a structure (if necessary). */ + /* */ + typedef unsigned XXX FT_UInt64; + /* */ #endif @@ -239,13 +263,15 @@ FT_BEGIN_HEADER /* FT_LONG64 must be defined if a 64-bit type is available */ #define FT_LONG64 -#define FT_INT64 long +#define FT_INT64 long +#define FT_UINT64 unsigned long #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ /* this compiler provides the __int64 type */ #define FT_LONG64 -#define FT_INT64 __int64 +#define FT_INT64 __int64 +#define FT_UINT64 unsigned __int64 #elif defined( __BORLANDC__ ) /* Borland C++ */ @@ -254,7 +280,8 @@ FT_BEGIN_HEADER /* this compiler provides the __int64 type */ #define FT_LONG64 -#define FT_INT64 __int64 +#define FT_INT64 __int64 +#define FT_UINT64 unsigned __int64 #elif defined( __WATCOMC__ ) /* Watcom C++ */ @@ -263,13 +290,15 @@ FT_BEGIN_HEADER #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ #define FT_LONG64 -#define FT_INT64 long long int +#define FT_INT64 long long int +#define FT_UINT64 unsigned long long int #elif defined( __GNUC__ ) /* GCC provides the `long long' type */ #define FT_LONG64 -#define FT_INT64 long long int +#define FT_INT64 long long int +#define FT_UINT64 unsigned long long int #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ @@ -293,6 +322,11 @@ FT_BEGIN_HEADER #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ +#ifdef FT_LONG64 + typedef FT_INT64 FT_Int64; + typedef FT_UINT64 FT_UInt64; +#endif + #define FT_BEGIN_STMNT do { #define FT_END_STMNT } while ( 0 ) @@ -355,7 +389,8 @@ FT_BEGIN_HEADER "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ : "=r"(a), "=&r"(t2), "=&r"(t) - : "r"(a), "r"(b) ); + : "r"(a), "r"(b) + : "cc" ); return a; } diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index 2a7b8c4..8371a31 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -4,7 +4,7 @@ /* */ /* Build macros of the FreeType 2 library. */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ +/* Copyright 1996-2008, 2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -315,6 +315,45 @@ #define FT_RENDER_H + /************************************************************************* + * + * @macro: + * FT_AUTOHINTER_H + * + * @description: + * A macro used in #include statements to name the file containing + * structures and macros related to the auto-hinting module. + * + */ +#define FT_AUTOHINTER_H + + + /************************************************************************* + * + * @macro: + * FT_CFF_DRIVER_H + * + * @description: + * A macro used in #include statements to name the file containing + * structures and macros related to the CFF driver module. + * + */ +#define FT_CFF_DRIVER_H + + + /************************************************************************* + * + * @macro: + * FT_TRUETYPE_DRIVER_H + * + * @description: + * A macro used in #include statements to name the file containing + * structures and macros related to the TrueType driver module. + * + */ +#define FT_TRUETYPE_DRIVER_H + + /************************************************************************* * * @macro: diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index c41f089..bb1d2b2 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2011 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -214,6 +214,20 @@ FT_BEGIN_HEADER /* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ + /*************************************************************************/ + /* */ + /* PNG bitmap support. */ + /* */ + /* FreeType now handles loading color bitmap glyphs in the PNG format. */ + /* This requires help from the external libpng library. Uncompressed */ + /* color bitmaps do not need any external libraries and will be */ + /* supported regardless of this configuration. */ + /* */ + /* Define this macro if you want to enable this `feature'. */ + /* */ +/* #define FT_CONFIG_OPTION_USE_PNG */ + + /*************************************************************************/ /* */ /* DLL export compilation */ @@ -558,6 +572,28 @@ FT_BEGIN_HEADER /* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */ + /* EXPERIMENTAL subpixel hinting support into the TrueType driver. This */ + /* replaces the native TrueType hinting mechanism when anything but */ + /* FT_RENDER_MODE_MONO is requested. */ + /* */ + /* Enabling this causes the TrueType driver to ignore instructions under */ + /* certain conditions. This is done in accordance with the guide here, */ + /* with some minor differences: */ + /* */ + /* http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* */ + /* By undefining this, you only compile the code necessary to hint */ + /* TrueType glyphs with native TT hinting. */ + /* */ + /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ + /* defined. */ + /* */ +/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + /*************************************************************************/ /* */ /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ @@ -669,7 +705,7 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */ + /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */ /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ /* required. */ /* */ @@ -713,6 +749,25 @@ FT_BEGIN_HEADER #undef T1_CONFIG_OPTION_NO_MM_SUPPORT + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** C F F D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */ + /* engine gets compiled into FreeType. If defined, it is possible to */ + /* switch between the two engines using the `hinting-engine' property of */ + /* the cff driver module. */ + /* */ +#define CFF_CONFIG_OPTION_OLD_ENGINE + + /*************************************************************************/ /*************************************************************************/ /**** ****/ @@ -752,37 +807,10 @@ FT_BEGIN_HEADER /* - * Define this variable if you want to keep the layout of internal - * structures that was used prior to FreeType 2.2. This also compiles in - * a few obsolete functions to avoid linking problems on typical Unix - * distributions. - * - * For embedded systems or building a new distribution from scratch, it - * is recommended to disable the macro since it reduces the library's code - * size and activates a few memory-saving optimizations as well. + * This macro is obsolete. Support has been removed in FreeType + * version 2.5. */ -#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 +/* #define FT_CONFIG_OPTION_OLD_INTERNALS */ /* diff --git a/include/freetype/config/ftstdlib.h b/include/freetype/config/ftstdlib.h index 11d5d0e..b940efc 100644 --- a/include/freetype/config/ftstdlib.h +++ b/include/freetype/config/ftstdlib.h @@ -5,7 +5,7 @@ /* ANSI-specific library and header configuration file (specification */ /* only). */ /* */ -/* Copyright 2002-2007, 2009, 2011 by */ +/* Copyright 2002-2007, 2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -159,7 +159,7 @@ /* on certain platforms */ #define ft_longjmp longjmp -#define ft_setjmp( b ) setjmp( *(jmp_buf*) &(b) ) /* same thing here */ +#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */ /* the following is only used for debugging purposes, i.e., if */ diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 63c291a..0d5680b 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -4,7 +4,7 @@ /* */ /* FreeType high-level API and common types (specification only). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,6 +16,10 @@ /***************************************************************************/ +#ifndef __FREETYPE_H__ +#define __FREETYPE_H__ + + #ifndef FT_FREETYPE_H #error "`ft2build.h' hasn't been included yet!" #error "Please always use macros to include FreeType header files." @@ -25,14 +29,10 @@ #endif -#ifndef __FREETYPE_H__ -#define __FREETYPE_H__ - - #include #include FT_CONFIG_CONFIG_H -#include FT_ERRORS_H #include FT_TYPES_H +#include FT_ERRORS_H FT_BEGIN_HEADER @@ -237,6 +237,10 @@ FT_BEGIN_HEADER /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */ /* dimensions of the hinted glyph (in case hinting is applicable). */ /* */ + /* Stroking a glyph with an outside border does not increase */ + /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */ + /* values to account for the added width and height. */ + /* */ typedef struct FT_Glyph_Metrics_ { FT_Pos width; @@ -844,8 +848,8 @@ FT_BEGIN_HEADER /* expressed in font units (see */ /* `units_per_EM'). The box is large enough */ /* to contain any glyph from the font. Thus, */ - /* `bbox.yMax' can be seen as the `maximal */ - /* ascender', and `bbox.yMin' as the `minimal */ + /* `bbox.yMax' can be seen as the `maximum */ + /* ascender', and `bbox.yMin' as the `minimum */ /* descender'. Only relevant for scalable */ /* formats. */ /* */ @@ -871,19 +875,22 @@ FT_BEGIN_HEADER /* usually negative. Only relevant for */ /* scalable formats. */ /* */ - /* height :: The height is the vertical distance */ + /* height :: This value is the vertical distance */ /* between two consecutive baselines, */ /* expressed in font units. It is always */ /* positive. Only relevant for scalable */ /* formats. */ /* */ - /* max_advance_width :: The maximal advance width, in font units, */ + /* If you want the global glyph height, use */ + /* `ascender - descender'. */ + /* */ + /* max_advance_width :: The maximum advance width, in font units, */ /* for all glyphs in this face. This can be */ /* used to make word wrapping computations */ /* faster. Only relevant for scalable */ /* formats. */ /* */ - /* max_advance_height :: The maximal advance height, in font units, */ + /* max_advance_height :: The maximum advance height, in font units, */ /* for all glyphs in this face. This is only */ /* relevant for vertical layouts, and is set */ /* to `height' for fonts that do not provide */ @@ -1105,8 +1112,8 @@ FT_BEGIN_HEADER * FT_HAS_VERTICAL( face ) * * @description: - * A macro that returns true whenever a face object contains vertical - * metrics. + * A macro that returns true whenever a face object contains real + * vertical metrics (and not only synthesized ones). * */ #define FT_HAS_VERTICAL( face ) \ @@ -1338,7 +1345,7 @@ FT_BEGIN_HEADER /* height :: The height in 26.6 fractional pixels. See */ /* @FT_FaceRec for the details. */ /* */ - /* max_advance :: The maximal advance width in 26.6 fractional */ + /* max_advance :: The maximum advance width in 26.6 fractional */ /* pixels. See @FT_FaceRec for the details. */ /* */ /* */ @@ -2227,6 +2234,12 @@ FT_BEGIN_HEADER /* particular bitmap strike. Use @FT_Select_Size instead in that */ /* case. */ /* */ + /* The relation between the requested size and the resulting glyph */ + /* size is dependent entirely on how the size is defined in the */ + /* source face. The font designer chooses the final size of each */ + /* glyph relative to this size. For more information refer to */ + /* `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html' */ + /* */ FT_EXPORT( FT_Error ) FT_Request_Size( FT_Face face, FT_Size_Request req ); @@ -2296,6 +2309,11 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* You should not rely on the resulting glyphs matching, or being */ + /* constrained, to this pixel size. Refer to @FT_Request_Size to */ + /* understand how requested sizes relate to actual sizes. */ + /* */ FT_EXPORT( FT_Error ) FT_Set_Pixel_Sizes( FT_Face face, FT_UInt pixel_width, @@ -2409,14 +2427,20 @@ FT_BEGIN_HEADER * behaviour to more specific and useful cases. * * FT_LOAD_NO_SCALE :: - * Don't scale the outline glyph loaded, but keep it in font units. + * Don't scale the loaded outline glyph but keep it in font units. * * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and * unsets @FT_LOAD_RENDER. * + * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using + * FT_LOAD_NO_SCALE usually yields meaningless outlines because the + * subglyphs must be scaled and positioned with hinting instructions. + * This can be solved by loading the font without FT_LOAD_NO_SCALE and + * setting the character size to `font->units_per_EM'. + * * FT_LOAD_NO_HINTING :: - * Disable hinting. This generally generates `blurrier' bitmap glyph - * when the glyph is rendered in any of the anti-aliased modes. See + * Disable hinting. This generally generates `blurrier' bitmap glyphs + * when the glyph are rendered in any of the anti-aliased modes. See * also the note below. * * This flag is implied by @FT_LOAD_NO_SCALE. @@ -2435,8 +2459,14 @@ FT_BEGIN_HEADER * @FT_LOAD_NO_SCALE always sets this flag. * * FT_LOAD_VERTICAL_LAYOUT :: - * Load the glyph for vertical text layout. _Don't_ use it as it is - * problematic currently. + * Load the glyph for vertical text layout. In particular, the + * `advance' value in the @FT_GlyphSlotRec structure is set to the + * `vertAdvance' value of the `metrics' field. + * + * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use + * this flag currently. Reason is that in this case vertical metrics + * get synthesized, and those values are not always consistent across + * various font formats. * * FT_LOAD_FORCE_AUTOHINT :: * Indicates that the auto-hinter is preferred over the font's native @@ -2493,6 +2523,14 @@ FT_BEGIN_HEADER * FT_LOAD_NO_AUTOHINT :: * Disable auto-hinter. See also the note below. * + * FT_LOAD_COLOR :: + * This flag is used to request loading of color embedded-bitmap + * images. The resulting color bitmaps, if available, will have the + * @FT_PIXEL_MODE_BGRA format. When the flag is not used and color + * bitmaps are found, they will be converted to 256-level gray + * bitmaps transparently. Those bitmaps will be in the + * @FT_PIXEL_MODE_GRAY format. + * * @note: * By default, hinting is enabled and the font's native hinter (see * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can @@ -2507,6 +2545,13 @@ FT_BEGIN_HEADER * Besides deciding which hinter to use, you can also decide which * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details. * + * Note that the auto-hinter needs a valid Unicode cmap (either a native + * one or synthesized by FreeType) for producing correct results. If a + * font provides an incorrect mapping (for example, assigning the + * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a + * mathematical integral sign), the auto-hinter might produce useless + * results. + * */ #define FT_LOAD_DEFAULT 0x0 #define FT_LOAD_NO_SCALE ( 1L << 0 ) @@ -2523,6 +2568,8 @@ FT_BEGIN_HEADER #define FT_LOAD_MONOCHROME ( 1L << 12 ) #define FT_LOAD_LINEAR_DESIGN ( 1L << 13 ) #define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) + /* Bits 16..19 are used by `FT_LOAD_TARGET_' */ +#define FT_LOAD_COLOR ( 1L << 20 ) /* */ @@ -2580,7 +2627,8 @@ FT_BEGIN_HEADER * * If @FT_LOAD_RENDER is also set, the glyph is rendered in the * corresponding mode (i.e., the mode which matches the used algorithm - * best) unless @FT_LOAD_MONOCHROME is set. + * best). An exeption is FT_LOAD_TARGET_MONO since it implies + * @FT_LOAD_MONOCHROME. * * You can use a hinting algorithm that doesn't correspond to the same * rendering mode. As an example, it is possible to use the `light' @@ -2922,7 +2970,7 @@ FT_BEGIN_HEADER /* */ /* glyph_index :: The glyph index. */ /* */ - /* buffer_max :: The maximal number of bytes available in the */ + /* buffer_max :: The maximum number of bytes available in the */ /* buffer. */ /* */ /* */ @@ -3081,9 +3129,15 @@ FT_BEGIN_HEADER /* */ /* If you use FreeType to manipulate the contents of font files */ /* directly, be aware that the glyph index returned by this function */ - /* doesn't always correspond to the internal indices used within */ - /* the file. This is done to ensure that value~0 always corresponds */ - /* to the `missing glyph'. */ + /* doesn't always correspond to the internal indices used within the */ + /* file. This is done to ensure that value~0 always corresponds to */ + /* the `missing glyph'. If the first glyph is not named `.notdef', */ + /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */ + /* the glyph ID~0 position, and whatever was there will be moved to */ + /* the position `.notdef' had. For Type~1 fonts, if there is no */ + /* `.notdef' glyph at all, then one will be created at index~0 and */ + /* whatever was there will be moved to the last index -- Type~42 */ + /* fonts are considered invalid under this condition. */ /* */ FT_EXPORT( FT_UInt ) FT_Get_Char_Index( FT_Face face, @@ -3383,9 +3437,13 @@ FT_BEGIN_HEADER /* code range for CJK characters. */ /* */ /* An IVS is registered and unique; for further details please refer */ - /* to Unicode Technical Report #37, the Ideographic Variation */ - /* Database. To date (October 2007), the character with the most */ - /* variants is U+908A, having 8~such IVS. */ + /* to Unicode Technical Standard #37, the Ideographic Variation */ + /* Database: */ + /* */ + /* http://www.unicode.org/reports/tr37/ */ + /* */ + /* To date (November 2012), the character with the most variants is */ + /* U+9089, having 31 such IVS. */ /* */ /* Adobe and MS decided to support IVS with a new cmap subtable */ /* (format~14). It is an odd subtable because it is not a mapping of */ @@ -3614,7 +3672,7 @@ FT_BEGIN_HEADER /* */ /* */ /* A very simple function used to perform the computation `(a*b)/c' */ - /* with maximal accuracy (it uses a 64-bit intermediate integer */ + /* with maximum accuracy (it uses a 64-bit intermediate integer */ /* whenever necessary). */ /* */ /* This function isn't necessarily as fast as some processor specific */ @@ -3649,8 +3707,8 @@ FT_BEGIN_HEADER /* */ /* */ /* A very simple function used to perform the computation */ - /* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */ - /* used to multiply a given value by a 16.16 fixed float factor. */ + /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */ + /* used to multiply a given value by a 16.16 fixed-point factor. */ /* */ /* */ /* a :: The first multiplier. */ @@ -3694,8 +3752,8 @@ FT_BEGIN_HEADER /* */ /* */ /* A very simple function used to perform the computation */ - /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */ - /* used to divide a given value by a 16.16 fixed float factor. */ + /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */ + /* used to divide a given value by a 16.16 fixed-point factor. */ /* */ /* */ /* a :: The first multiplier. */ @@ -3834,7 +3892,7 @@ FT_BEGIN_HEADER */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 4 -#define FREETYPE_PATCH 9 +#define FREETYPE_PATCH 12 /*************************************************************************/ diff --git a/include/freetype/ftadvanc.h b/include/freetype/ftadvanc.h index b2451be..012b74b 100644 --- a/include/freetype/ftadvanc.h +++ b/include/freetype/ftadvanc.h @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (specification only). */ /* */ -/* Copyright 2008 by */ +/* Copyright 2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -82,8 +82,7 @@ FT_BEGIN_HEADER /* */ /* */ /* Retrieve the advance value of a given glyph outline in an */ - /* @FT_Face. By default, the unhinted advance is returned in font */ - /* units. */ + /* @FT_Face. */ /* */ /* */ /* face :: The source @FT_Face handle. */ @@ -94,8 +93,9 @@ FT_BEGIN_HEADER /* calling @FT_Load_Glyph, used to determine what kind */ /* of advances you need. */ /* */ - /* padvance :: The advance value, in either font units or 16.16 */ - /* format. */ + /* padvance :: The advance value. If scaling is performed (based on */ + /* the value of `load_flags'), the advance value is in */ + /* 16.16 format. Otherwise, it is in font units. */ /* */ /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */ /* vertical advance corresponding to a vertical layout. */ @@ -127,8 +127,7 @@ FT_BEGIN_HEADER /* */ /* */ /* Retrieve the advance values of several glyph outlines in an */ - /* @FT_Face. By default, the unhinted advances are returned in font */ - /* units. */ + /* @FT_Face. */ /* */ /* */ /* face :: The source @FT_Face handle. */ @@ -141,8 +140,12 @@ FT_BEGIN_HEADER /* calling @FT_Load_Glyph. */ /* */ /* */ - /* padvance :: The advances, in either font units or 16.16 format. */ - /* This array must contain at least `count' elements. */ + /* padvance :: The advance values. This array, to be provided by the */ + /* caller, must contain at least `count' elements. */ + /* */ + /* If scaling is performed (based on the value of */ + /* `load_flags'), the advance values are in 16.16 format. */ + /* Otherwise, they are in font units. */ /* */ /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */ /* vertical advances corresponding to a vertical layout. */ diff --git a/include/freetype/ftautoh.h b/include/freetype/ftautoh.h new file mode 100644 index 0000000..62ce96d --- /dev/null +++ b/include/freetype/ftautoh.h @@ -0,0 +1,349 @@ +/***************************************************************************/ +/* */ +/* ftautoh.h */ +/* */ +/* FreeType API for controlling the auto-hinter (specification only). */ +/* */ +/* Copyright 2012 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTAUTOH_H__ +#define __FTAUTOH_H__ + +#include +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * auto_hinter + * + * @title: + * The auto-hinter + * + * @abstract: + * Controlling the auto-hinting module. + * + * @description: + * While FreeType's auto-hinter doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * Note that the auto-hinter's module name is `autofitter' for + * historical reasons. + * + */ + + + /************************************************************************** + * + * @property: + * glyph-to-script-map + * + * @description: + * The auto-hinter provides various script modules to hint glyphs. + * Examples of supported scripts are Latin or CJK. Before a glyph is + * auto-hinted, the Unicode character map of the font gets examined, and + * the script is then determined based on Unicode character ranges, see + * below. + * + * OpenType fonts, however, often provide much more glyphs than + * character codes (small caps, superscripts, ligatures, swashes, etc.), + * to be controlled by so-called `features'. Handling OpenType features + * can be quite complicated and thus needs a separate library on top of + * FreeType. + * + * The mapping between glyph indices and scripts (in the auto-hinter + * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an + * array with `num_glyphs' elements, as found in the font's @FT_Face + * structure. The `glyph-to-script-map' property returns a pointer to + * this array which can be modified as needed. Note that the + * modification should happen before the first glyph gets processed by + * the auto-hinter so that the global analysis of the font shapes + * actually uses the modified mapping. + * + * The following example code demonstrates how to access it (omitting + * the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_Prop_GlyphToScriptMap prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * + * prop.face = face; + * + * FT_Property_Get( library, "autofitter", + * "glyph-to-script-map", &prop ); + * + * // adjust `prop.map' as needed right here + * + * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); + * } + * + */ + + + /************************************************************************** + * + * @enum: + * FT_AUTOHINTER_SCRIPT_XXX + * + * @description: + * A list of constants used for the @glyph-to-script-map property to + * specify the script submodule the auto-hinter should use for hinting a + * particular glyph. + * + * @values: + * FT_AUTOHINTER_SCRIPT_NONE :: + * Don't auto-hint this glyph. + * + * FT_AUTOHINTER_SCRIPT_LATIN :: + * Apply the latin auto-hinter. For the auto-hinter, `latin' is a + * very broad term, including Cyrillic and Greek also since characters + * from those scripts share the same design constraints. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+0020 - U+007F // Basic Latin (no control characters) + * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) + * U+0100 - U+017F // Latin Extended-A + * U+0180 - U+024F // Latin Extended-B + * U+0250 - U+02AF // IPA Extensions + * U+02B0 - U+02FF // Spacing Modifier Letters + * U+0300 - U+036F // Combining Diacritical Marks + * U+0370 - U+03FF // Greek and Coptic + * U+0400 - U+04FF // Cyrillic + * U+0500 - U+052F // Cyrillic Supplement + * U+1D00 - U+1D7F // Phonetic Extensions + * U+1D80 - U+1DBF // Phonetic Extensions Supplement + * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement + * U+1E00 - U+1EFF // Latin Extended Additional + * U+1F00 - U+1FFF // Greek Extended + * U+2000 - U+206F // General Punctuation + * U+2070 - U+209F // Superscripts and Subscripts + * U+20A0 - U+20CF // Currency Symbols + * U+2150 - U+218F // Number Forms + * U+2460 - U+24FF // Enclosed Alphanumerics + * U+2C60 - U+2C7F // Latin Extended-C + * U+2DE0 - U+2DFF // Cyrillic Extended-A + * U+2E00 - U+2E7F // Supplemental Punctuation + * U+A640 - U+A69F // Cyrillic Extended-B + * U+A720 - U+A7FF // Latin Extended-D + * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) + * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols + * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement + * } + * + * FT_AUTOHINTER_SCRIPT_CJK :: + * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old + * Vietnamese, and some other scripts. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+1100 - U+11FF // Hangul Jamo + * U+2E80 - U+2EFF // CJK Radicals Supplement + * U+2F00 - U+2FDF // Kangxi Radicals + * U+2FF0 - U+2FFF // Ideographic Description Characters + * U+3000 - U+303F // CJK Symbols and Punctuation + * U+3040 - U+309F // Hiragana + * U+30A0 - U+30FF // Katakana + * U+3100 - U+312F // Bopomofo + * U+3130 - U+318F // Hangul Compatibility Jamo + * U+3190 - U+319F // Kanbun + * U+31A0 - U+31BF // Bopomofo Extended + * U+31C0 - U+31EF // CJK Strokes + * U+31F0 - U+31FF // Katakana Phonetic Extensions + * U+3200 - U+32FF // Enclosed CJK Letters and Months + * U+3300 - U+33FF // CJK Compatibility + * U+3400 - U+4DBF // CJK Unified Ideographs Extension A + * U+4DC0 - U+4DFF // Yijing Hexagram Symbols + * U+4E00 - U+9FFF // CJK Unified Ideographs + * U+A960 - U+A97F // Hangul Jamo Extended-A + * U+AC00 - U+D7AF // Hangul Syllables + * U+D7B0 - U+D7FF // Hangul Jamo Extended-B + * U+F900 - U+FAFF // CJK Compatibility Ideographs + * U+FE10 - U+FE1F // Vertical forms + * U+FE30 - U+FE4F // CJK Compatibility Forms + * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms + * U+1B000 - U+1B0FF // Kana Supplement + * U+1D300 - U+1D35F // Tai Xuan Hing Symbols + * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement + * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B + * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C + * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D + * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement + * } + * + * FT_AUTOHINTER_SCRIPT_INDIC :: + * Apply the indic auto-hinter, covering all major scripts from the + * Indian sub-continent and some other related scripts like Thai, Lao, + * or Tibetan. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+0900 - U+0DFF // Indic Range + * U+0F00 - U+0FFF // Tibetan + * U+1900 - U+194F // Limbu + * U+1B80 - U+1BBF // Sundanese + * U+1C80 - U+1CDF // Meetei Mayak + * U+A800 - U+A82F // Syloti Nagri + * U+11800 - U+118DF // Sharada + * } + * + * Note that currently Indic support is rudimentary only, missing blue + * zone support. + * + */ +#define FT_AUTOHINTER_SCRIPT_NONE 0 +#define FT_AUTOHINTER_SCRIPT_LATIN 1 +#define FT_AUTOHINTER_SCRIPT_CJK 2 +#define FT_AUTOHINTER_SCRIPT_INDIC 3 + + + /************************************************************************** + * + * @struct: + * FT_Prop_GlyphToScriptMap + * + * @description: + * The data exchange structure for the @glyph-to-script-map property. + * + */ + typedef struct FT_Prop_GlyphToScriptMap_ + { + FT_Face face; + FT_Byte* map; + + } FT_Prop_GlyphToScriptMap; + + + /************************************************************************** + * + * @property: + * fallback-script + * + * @description: + * If no auto-hinter script module can be assigned to a glyph, a + * fallback script gets assigned to it (see also the + * @glyph-to-script-map property). By default, this is + * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, + * this fallback value can be changed. + * + * { + * FT_Library library; + * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "fallback-script", &fallback_script ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * It's important to use the right timing for changing this value: The + * creation of the glyph-to-script map which eventually uses the + * fallback script value gets triggered either by setting or reading a + * face-specific property like @glyph-to-script-map, or by auto-hinting + * any glyph from that face. In particular, if you have already created + * an @FT_Face structure but not loaded any glyph (using the + * auto-hinter), a change of the fallback glyph will affect this face. + * + */ + + + /************************************************************************** + * + * @property: + * increase-x-height + * + * @description: + * For ppem values in the range 6~<= ppem <= `increase-x-height', round + * up the font's x~height much more often than normally. If the value + * is set to~0, which is the default, this feature is switched off. Use + * this property to improve the legibility of small font sizes if + * necessary. + * + * { + * FT_Library library; + * FT_Face face; + * FT_Prop_IncreaseXHeight prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); + * + * prop.face = face; + * prop.limit = 14; + * + * FT_Property_Set( library, "autofitter", + * "increase-x-height", &prop ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * Set this value right after calling @FT_Set_Char_Size, but before + * loading any glyph (using the auto-hinter). + * + */ + + + /************************************************************************** + * + * @struct: + * FT_Prop_IncreaseXHeight + * + * @description: + * The data exchange structure for the @increase-x-height property. + * + */ + typedef struct FT_Prop_IncreaseXHeight_ + { + FT_Face face; + FT_UInt limit; + + } FT_Prop_IncreaseXHeight; + + + /* */ + +FT_END_HEADER + +#endif /* __FTAUTOH_H__ */ + + +/* END */ diff --git a/include/freetype/ftbitmap.h b/include/freetype/ftbitmap.h index 9274236..7dbf5ba 100644 --- a/include/freetype/ftbitmap.h +++ b/include/freetype/ftbitmap.h @@ -4,7 +4,7 @@ /* */ /* FreeType utility functions for bitmaps (specification). */ /* */ -/* Copyright 2004, 2005, 2006, 2008 by */ +/* Copyright 2004-2006, 2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -135,9 +135,9 @@ FT_BEGIN_HEADER /* FT_Bitmap_Convert */ /* */ /* */ - /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a */ - /* bitmap object with depth 8bpp, making the number of used bytes per */ - /* line (a.k.a. the `pitch') a multiple of `alignment'. */ + /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp */ + /* to a bitmap object with depth 8bpp, making the number of used */ + /* bytes line (a.k.a. the `pitch') a multiple of `alignment'. */ /* */ /* */ /* library :: A handle to a library object. */ diff --git a/include/freetype/ftcache.h b/include/freetype/ftcache.h index 6af5306..4ec9587 100644 --- a/include/freetype/ftcache.h +++ b/include/freetype/ftcache.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache subsystem (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ +/* Copyright 1996-2008, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -214,17 +214,6 @@ FT_BEGIN_HEADER /* */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /* these macros are incompatible with LLP64, should not be used */ - -#define FT_POINTER_TO_ULONG( p ) ( (FT_ULong)(FT_Pointer)(p) ) - -#define FTC_FACE_ID_HASH( i ) \ - ((FT_UInt32)(( FT_POINTER_TO_ULONG( i ) >> 3 ) ^ \ - ( FT_POINTER_TO_ULONG( i ) << 7 ) ) ) - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ /*************************************************************************/ /*************************************************************************/ @@ -381,7 +370,7 @@ FT_BEGIN_HEADER /* should never try to discard it yourself. */ /* */ /* The @FT_Face object doesn't necessarily have a current size object */ - /* (i.e., face->size can be 0). If you need a specific `font size', */ + /* (i.e., face->size can be~0). If you need a specific `font size', */ /* use @FTC_Manager_LookupSize instead. */ /* */ /* Never change the face's transformation matrix (i.e., never call */ @@ -705,17 +694,6 @@ FT_BEGIN_HEADER (d1)->width == (d2)->width && \ (d1)->flags == (d2)->flags ) -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /* this macro is incompatible with LLP64, should not be used */ - -#define FTC_IMAGE_TYPE_HASH( d ) \ - (FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id ) ^ \ - ( (d)->width << 8 ) ^ (d)->height ^ \ - ( (d)->flags << 4 ) ) - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - /*************************************************************************/ /* */ @@ -723,7 +701,7 @@ FT_BEGIN_HEADER /* FTC_ImageCache */ /* */ /* */ - /* A handle to an glyph image cache object. They are designed to */ + /* A handle to a glyph image cache object. They are designed to */ /* hold many distinct glyph images while not exceeding a certain */ /* memory threshold. */ /* */ @@ -1069,67 +1047,6 @@ FT_BEGIN_HEADER FTC_Node *anode ); - /* */ - -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*@***********************************************************************/ - /* */ - /* */ - /* FTC_FontRec */ - /* */ - /* */ - /* A simple structure used to describe a given `font' to the cache */ - /* manager. Note that a `font' is the combination of a given face */ - /* with a given character size. */ - /* */ - /* */ - /* face_id :: The ID of the face to use. */ - /* */ - /* pix_width :: The character width in integer pixels. */ - /* */ - /* pix_height :: The character height in integer pixels. */ - /* */ - typedef struct FTC_FontRec_ - { - FTC_FaceID face_id; - FT_UShort pix_width; - FT_UShort pix_height; - - } FTC_FontRec; - - - /* */ - - -#define FTC_FONT_COMPARE( f1, f2 ) \ - ( (f1)->face_id == (f2)->face_id && \ - (f1)->pix_width == (f2)->pix_width && \ - (f1)->pix_height == (f2)->pix_height ) - - /* this macro is incompatible with LLP64, should not be used */ -#define FTC_FONT_HASH( f ) \ - (FT_UInt32)( FTC_FACE_ID_HASH((f)->face_id) ^ \ - ((f)->pix_width << 8) ^ \ - ((f)->pix_height) ) - - typedef FTC_FontRec* FTC_Font; - - - FT_EXPORT( FT_Error ) - FTC_Manager_Lookup_Face( FTC_Manager manager, - FTC_FaceID face_id, - FT_Face *aface ); - - FT_EXPORT( FT_Error ) - FTC_Manager_Lookup_Size( FTC_Manager manager, - FTC_Font font, - FT_Face *aface, - FT_Size *asize ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /* */ FT_END_HEADER diff --git a/include/freetype/ftcffdrv.h b/include/freetype/ftcffdrv.h new file mode 100644 index 0000000..ccbcbcc --- /dev/null +++ b/include/freetype/ftcffdrv.h @@ -0,0 +1,151 @@ +/***************************************************************************/ +/* */ +/* ftcffdrv.h */ +/* */ +/* FreeType API for controlling the CFF driver (specification only). */ +/* */ +/* Copyright 2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTCFFDRV_H__ +#define __FTCFFDRV_H__ + +#include +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * cff_driver + * + * @title: + * The CFF driver + * + * @abstract: + * Controlling the CFF driver module. + * + * @description: + * While FreeType's CFF driver doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * The CFF driver's module name is `cff'. + * + */ + + + /************************************************************************** + * + * @property: + * hinting-engine + * + * @description: + * Thanks to Adobe, which contributed a new hinting (and parsing) + * engine, an application can select between `freetype' and `adobe' if + * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration + * macro isn't defined, `hinting-engine' does nothing. + * + * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is + * defined, and `adobe' otherwise. + * + * The following example code demonstrates how to select Adobe's hinting + * engine (omitting the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "hinting-engine", &hinting_engine ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_CFF_HINTING_XXX + * + * @description: + * A list of constants used for the @hinting-engine property to select + * the hinting engine for CFF fonts. + * + * @values: + * FT_CFF_HINTING_FREETYPE :: + * Use the old FreeType hinting engine. + * + * FT_CFF_HINTING_ADOBE :: + * Use the hinting engine contributed by Adobe. + * + */ +#define FT_CFF_HINTING_FREETYPE 0 +#define FT_CFF_HINTING_ADOBE 1 + + + /************************************************************************** + * + * @property: + * no-stem-darkening + * + * @description: + * By default, the Adobe CFF engine darkens stems at smaller sizes, + * regardless of hinting, to enhance contrast. Setting this property, + * stem darkening gets switched off. + * + * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set. + * + * { + * FT_Library library; + * FT_Face face; + * FT_Bool no_stem_darkening = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "no-stem-darkening", &no_stem_darkening ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + */ + + + /* */ + +FT_END_HEADER + + +#endif /* __FTCFFDRV_H__ */ + + +/* END */ diff --git a/include/freetype/ftchapters.h b/include/freetype/ftchapters.h index 6cdf54e..c55670d 100644 --- a/include/freetype/ftchapters.h +++ b/include/freetype/ftchapters.h @@ -64,6 +64,22 @@ /***************************************************************************/ +/***************************************************************************/ +/* */ +/* */ +/* module_specific */ +/* */ +/* */ +/* Controlling FreeType Modules */ +/* */ +/* <Sections> */ +/* auto_hinter */ +/* cff_driver */ +/* tt_driver */ +/* */ +/***************************************************************************/ + + /***************************************************************************/ /* */ /* <Chapter> */ diff --git a/include/freetype/fterrdef.h b/include/freetype/fterrdef.h index fb4b53b..76c7b9e 100644 --- a/include/freetype/fterrdef.h +++ b/include/freetype/fterrdef.h @@ -4,7 +4,7 @@ /* */ /* FreeType error codes (specification). */ /* */ -/* Copyright 2002, 2004, 2006, 2007, 2010-2011 by */ +/* Copyright 2002, 2004, 2006, 2007, 2010-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -56,6 +56,8 @@ "array allocation size too large" ) FT_ERRORDEF_( Missing_Module, 0x0B, \ "missing module" ) + FT_ERRORDEF_( Missing_Property, 0x0C, \ + "missing property" ) /* glyph/character errors */ @@ -215,6 +217,8 @@ "ignore" ) FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, \ "no Unicode glyph name found" ) + FT_ERRORDEF_( Glyph_Too_Big, 0xA4, \ + "glyph to big for hinting" ) /* BDF errors */ diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h index a54699f..0fa3e4d 100644 --- a/include/freetype/fterrors.h +++ b/include/freetype/fterrors.h @@ -4,7 +4,7 @@ /* */ /* FreeType error code handling (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2007 by */ +/* Copyright 1996-2002, 2004, 2007, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -28,9 +28,8 @@ /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ /* defined in ftoption.h in order to make the higher byte indicate */ /* the module where the error has happened (this is not compatible */ - /* with standard builds of FreeType 2). You can then use the macro */ - /* FT_ERROR_BASE macro to extract the generic error code from an */ - /* FT_Error value. */ + /* with standard builds of FreeType 2). See the file `ftmoderr.h' for */ + /* more details. */ /* */ /* */ /* II - Error Message strings */ @@ -101,12 +100,6 @@ #undef FT_NEED_EXTERN_C -#undef FT_ERR_XCAT -#undef FT_ERR_CAT - -#define FT_ERR_XCAT( x, y ) x ## y -#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) - /* FT_ERR_PREFIX is used as a prefix for error identifiers. */ /* By default, we use `FT_Err_'. */ @@ -150,11 +143,11 @@ /* this macro is used to define an error */ -#define FT_ERRORDEF_( e, v, s ) \ +#define FT_ERRORDEF_( e, v, s ) \ FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) /* this is only used for <module>_Err_Ok, which must be 0! */ -#define FT_NOERRORDEF_( e, v, s ) \ +#define FT_NOERRORDEF_( e, v, s ) \ FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) @@ -194,11 +187,9 @@ #undef FT_NEED_EXTERN_C #undef FT_ERR_BASE - /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ -#ifndef FT_KEEP_ERR_PREFIX + /* FT_ERR_PREFIX is needed internally */ +#ifndef FT2_BUILD_LIBRARY #undef FT_ERR_PREFIX -#else -#undef FT_KEEP_ERR_PREFIX #endif #endif /* __FTERRORS_H__ */ diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h index 3de69f7..31dc331 100644 --- a/include/freetype/ftglyph.h +++ b/include/freetype/ftglyph.h @@ -94,7 +94,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* The root glyph structure contains a given glyph image plus its */ - /* advance width in 16.16 fixed float format. */ + /* advance width in 16.16 fixed-point format. */ /* */ /* <Fields> */ /* library :: A handle to the FreeType library object. */ diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index 04b5e04..3b826b1 100644 --- a/include/freetype/ftimage.h +++ b/include/freetype/ftimage.h @@ -5,8 +5,7 @@ /* FreeType glyph image formats and default raster interface */ /* (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -54,7 +53,7 @@ FT_BEGIN_HEADER /* <Description> */ /* The type FT_Pos is used to store vectorial coordinates. Depending */ /* on the context, these can represent distances in integer font */ - /* units, or 16.16, or 26.6 fixed float pixel coordinates. */ + /* units, or 16.16, or 26.6 fixed-point pixel coordinates. */ /* */ typedef signed long FT_Pos; @@ -169,6 +168,15 @@ FT_BEGIN_HEADER /* times taller than the original glyph image. See also */ /* @FT_RENDER_MODE_LCD_V. */ /* */ + /* FT_PIXEL_MODE_BGRA :: */ + /* An image with four 8-bit channels per pixel, representing a */ + /* color image (such as emoticons) with alpha channel. For each */ + /* pixel, the format is BGRA, which means, the blue channel comes */ + /* first in memory. The color channels are pre-multiplied and in */ + /* the sRGB colorspace. For example, full red at half-translucent */ + /* opacity will be represented as `00,00,80,80', not `00,00,FF,80'. */ + /* See also @FT_LOAD_COLOR. */ + /* */ typedef enum FT_Pixel_Mode_ { FT_PIXEL_MODE_NONE = 0, @@ -178,6 +186,7 @@ FT_BEGIN_HEADER FT_PIXEL_MODE_GRAY4, FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V, + FT_PIXEL_MODE_BGRA, FT_PIXEL_MODE_MAX /* do not remove */ diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index 0b55ebe..8b253f1 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -53,6 +53,44 @@ FT_BEGIN_HEADER * *not* implemented in default builds of the library. You need to * #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file * in order to activate it. + * + * FreeType generates alpha coverage maps, which are linear by nature. + * For instance, the value 0x80 in bitmap representation means that + * (within numerical precision) 0x80/0xff fraction of that pixel is + * covered by the glyph's outline. The blending function for placing + * text over a background is + * + * { + * dst = alpha * src + (1 - alpha) * dst , + * } + * + * which is known as OVER. However, when calculating the output of the + * OVER operator, the source colors should first be transformed to a + * linear color space, then alpha blended in that space, and transformed + * back to the output color space. + * + * When linear light blending is used, the default FIR5 filtering + * weights (as given by FT_LCD_FILTER_DEFAULT) are no longer optimal, as + * they have been designed for black on white rendering while lacking + * gamma correction. To preserve color neutrality, weights for a FIR5 + * filter should be chosen according to two free parameters `a' and `c', + * and the FIR weights should be + * + * { + * [a - c, a + c, 2 * a, a + c, a - c] . + * } + * + * This formula generates equal weights for all the color primaries + * across the filter kernel, which makes it colorless. One suggested + * set of weights is + * + * { + * [0x10, 0x50, 0x60, 0x50, 0x10] , + * } + * + * where `a' has value 0x30 and `b' value 0x20. The weights in filter + * may have a sum larger than 0x100, which increases coloration slightly + * but also improves contrast. */ diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h index 8f2e017..8abffb5 100644 --- a/include/freetype/ftmodapi.h +++ b/include/freetype/ftmodapi.h @@ -4,7 +4,7 @@ /* */ /* FreeType modules public interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009, 2010 by */ +/* Copyright 1996-2003, 2006, 2008-2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -42,11 +42,38 @@ FT_BEGIN_HEADER /* Module Management */ /* */ /* <Abstract> */ - /* How to add, upgrade, and remove modules from FreeType. */ + /* How to add, upgrade, remove, and control modules from FreeType. */ /* */ /* <Description> */ /* The definitions below are used to manage modules within FreeType. */ /* Modules can be added, upgraded, and removed at runtime. */ + /* Additionally, some module properties can be controlled also. */ + /* */ + /* Here is a list of possible values of the `module_name' field in */ + /* the @FT_Module_Class structure. */ + /* */ + /* { */ + /* autofitter */ + /* bdf */ + /* cff */ + /* gxvalid */ + /* otvalid */ + /* pcf */ + /* pfr */ + /* psaux */ + /* pshinter */ + /* psnames */ + /* raster1, raster5 */ + /* sfnt */ + /* smooth, smooth-lcd, smooth-lcdv */ + /* truetype */ + /* type1 */ + /* type42 */ + /* t1cid */ + /* winfonts */ + /* } */ + /* */ + /* Note that the FreeType Cache sub-system is not a FreeType module. */ /* */ /*************************************************************************/ @@ -118,7 +145,7 @@ FT_BEGIN_HEADER /* A function used to query a given module for a specific interface. */ /* */ /* <Input> */ - /* module :: The module to finalize. */ + /* module :: The module to be searched. */ /* */ /* name :: The name of the interface in the module. */ /* */ @@ -249,6 +276,137 @@ FT_BEGIN_HEADER FT_Module module ); + /********************************************************************** + * + * @function: + * FT_Property_Set + * + * @description: + * Set a property for a given module. + * + * @input: + * library :: + * A handle to the library the module is part of. + * + * module_name :: + * The module name. + * + * property_name :: + * The property name. Properties are described in the `Synopsis' + * subsection of the module's documentation. + * + * Note that only a few modules have properties. + * + * value :: + * A generic pointer to a variable or structure which gives the new + * value of the property. The exact definition of `value' is + * dependent on the property; see the `Synopsis' subsection of the + * module's documentation. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If `module_name' isn't a valid module name, or `property_name' + * doesn't specify a valid property, or if `value' doesn't represent a + * valid value for the given property, an error is returned. + * + * The following example sets property `bar' (a simple integer) in + * module `foo' to value~1. + * + * { + * FT_UInt bar; + * + * + * bar = 1; + * FT_Property_Set( library, "foo", "bar", &bar ); + * } + * + * Note that the FreeType Cache sub-system doesn't recognize module + * property changes. To avoid glyph lookup confusion within the cache + * you should call @FTC_Manager_Reset to completely flush the cache if + * a module property gets changed after @FTC_Manager_New has been + * called. + * + * It is not possible to set properties of the FreeType Cache + * sub-system itself with FT_Property_Set; use @FTC_Property_Set + * instead. + * + * @since: + * 2.4.11 + * + */ + FT_EXPORT( FT_Error ) + FT_Property_Set( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + const void* value ); + + + /********************************************************************** + * + * @function: + * FT_Property_Get + * + * @description: + * Get a module's property value. + * + * @input: + * library :: + * A handle to the library the module is part of. + * + * module_name :: + * The module name. + * + * property_name :: + * The property name. Properties are described in the `Synopsis' + * subsection of the module's documentation. + * + * @inout: + * value :: + * A generic pointer to a variable or structure which gives the + * value of the property. The exact definition of `value' is + * dependent on the property; see the `Synopsis' subsection of the + * module's documentation. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If `module_name' isn't a valid module name, or `property_name' + * doesn't specify a valid property, or if `value' doesn't represent a + * valid value for the given property, an error is returned. + * + * The following example gets property `baz' (a range) in module `foo'. + * + * { + * typedef range_ + * { + * FT_Int32 min; + * FT_Int32 max; + * + * } range; + * + * range baz; + * + * + * FT_Property_Get( library, "foo", "baz", &baz ); + * } + * + * It is not possible to retrieve properties of the FreeType Cache + * sub-system with FT_Property_Get; use @FTC_Property_Get instead. + * + * @since: + * 2.4.11 + * + */ + FT_EXPORT( FT_Error ) + FT_Property_Get( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + void* value ); + + /*************************************************************************/ /* */ /* <Function> */ @@ -430,13 +588,13 @@ FT_BEGIN_HEADER * scale glyph components with bytecode instructions. It produces * bad output for most other fonts. * - * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: + * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: * The library implements a bytecode interpreter that covers * the full instruction set of the TrueType virtual machine (this * was governed by patents until May 2010, hence the name). * * @since: - * 2.2 + * 2.2 * */ typedef enum FT_TrueTypeEngineType_ diff --git a/include/freetype/ftmoderr.h b/include/freetype/ftmoderr.h index 1bf3b38..5a27db1 100644 --- a/include/freetype/ftmoderr.h +++ b/include/freetype/ftmoderr.h @@ -4,7 +4,7 @@ /* */ /* FreeType module error offsets (specification). */ /* */ -/* Copyright 2001, 2002, 2003, 2004, 2005, 2010 by */ +/* Copyright 2001-2005, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,17 +18,57 @@ /*************************************************************************/ /* */ - /* This file is used to define the FreeType module error offsets. */ + /* This file is used to define the FreeType module error codes. */ /* */ - /* The lower byte gives the error code, the higher byte gives the */ - /* module. The base module has error offset 0. For example, the error */ - /* `FT_Err_Invalid_File_Format' has value 0x003, the error */ - /* `TT_Err_Invalid_File_Format' has value 0x1103, the error */ - /* `T1_Err_Invalid_File_Format' has value 0x1203, etc. */ + /* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */ + /* set, the lower byte of an error value identifies the error code as */ + /* usual. In addition, the higher byte identifies the module. For */ + /* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */ + /* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */ + /* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */ + /* */ + /* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */ + /* including the high byte. */ + /* */ + /* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */ + /* an error value is set to zero. */ + /* */ + /* To hide the various `XXX_Err_' prefixes in the source code, FreeType */ + /* provides some macros in `fttypes.h'. */ + /* */ + /* FT_ERR( err ) */ + /* Add current error module prefix (as defined with the */ + /* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */ + /* the line */ + /* */ + /* error = FT_ERR( Invalid_Outline ); */ + /* */ + /* expands to */ + /* */ + /* error = BDF_Err_Invalid_Outline; */ + /* */ + /* For simplicity, you can always use `FT_Err_Ok' directly instead */ + /* of `FT_ERR( Ok )'. */ + /* */ + /* FT_ERR_EQ( errcode, err ) */ + /* FT_ERR_NEQ( errcode, err ) */ + /* Compare error code `errcode' with the error `err' for equality */ + /* and inequality, respectively. Example: */ + /* */ + /* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */ + /* ... */ + /* */ + /* Using this macro you don't have to think about error prefixes. */ + /* Of course, if module errors are not active, the above example is */ + /* the same as */ + /* */ + /* if ( error == FT_Err_Invalid_Outline ) */ + /* ... */ + /* */ + /* FT_ERROR_BASE( errcode ) */ + /* FT_ERROR_MODULE( errcode ) */ + /* Get base error and module error code, respectively. */ /* */ - /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ - /* to make the higher byte always zero (disabling the module error */ - /* mechanism). */ /* */ /* It can also be used to create a module error message table easily */ /* with something like */ @@ -48,9 +88,6 @@ /* #include FT_MODULE_ERRORS_H */ /* } */ /* */ - /* To use such a table, all errors must be ANDed with 0xFF00 to remove */ - /* the error code. */ - /* */ /*************************************************************************/ @@ -124,6 +161,7 @@ FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) + FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" ) #ifdef FT_MODERR_END_LIST diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h index 1cf3c3f..fd69f28 100644 --- a/include/freetype/ftoutln.h +++ b/include/freetype/ftoutln.h @@ -5,7 +5,7 @@ /* Support for the FT_Outline type used to store glyph shapes of */ /* most scalable font formats (specification). */ /* */ -/* Copyright 1996-2003, 2005-2011 by */ +/* Copyright 1996-2003, 2005-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -59,6 +59,7 @@ FT_BEGIN_HEADER /* FT_Outline_Translate */ /* FT_Outline_Transform */ /* FT_Outline_Embolden */ + /* FT_Outline_EmboldenXY */ /* FT_Outline_Reverse */ /* FT_Outline_Check */ /* */ @@ -124,9 +125,11 @@ FT_BEGIN_HEADER /* outline will *not* necessarily be *freed*, when */ /* destroying the library, by @FT_Done_FreeType. */ /* */ - /* numPoints :: The maximal number of points within the outline. */ + /* numPoints :: The maximum number of points within the outline. */ + /* Must be smaller than or equal to 0xFFFF (65535). */ /* */ - /* numContours :: The maximal number of contours within the outline. */ + /* numContours :: The maximum number of contours within the outline. */ + /* This value must be in the range 0 to `numPoints'. */ /* */ /* <Output> */ /* anoutline :: A handle to the new outline. */ @@ -350,6 +353,23 @@ FT_BEGIN_HEADER FT_Pos strength ); + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_EmboldenXY */ + /* */ + /* <Description> */ + /* Embolden an outline. The new outline will be `xstrength' pixels */ + /* wider and `ystrength' pixels higher. Otherwise, it is similar to */ + /* @FT_Outline_Embolden, which uses the same strength in both */ + /* directions. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Outline_EmboldenXY( FT_Outline* outline, + FT_Pos xstrength, + FT_Pos ystrength ); + + /*************************************************************************/ /* */ /* <Function> */ diff --git a/include/freetype/ftstroke.h b/include/freetype/ftstroke.h index 49ae2bc..a498e4a 100644 --- a/include/freetype/ftstroke.h +++ b/include/freetype/ftstroke.h @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (specification). */ /* */ -/* Copyright 2002-2006, 2008, 2009, 2011 by */ +/* Copyright 2002-2006, 2008, 2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -271,7 +271,7 @@ FT_BEGIN_HEADER * miter_limit :: * The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and * FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles, - * expressed as 16.16 fixed point value. + * expressed as 16.16 fixed-point value. * * @note: * The radius is expressed in the same units as the outline @@ -682,6 +682,11 @@ FT_BEGIN_HEADER * * @note: * The source glyph is untouched in case of error. + * + * Adding stroke may yield a significantly wider and taller glyph + * depending on how large of a radius was used to stroke the glyph. You + * may need to manually adjust horizontal and vertical advance amounts + * to account for this added size. */ FT_EXPORT( FT_Error ) FT_Glyph_Stroke( FT_Glyph *pglyph, @@ -719,6 +724,11 @@ FT_BEGIN_HEADER * * @note: * The source glyph is untouched in case of error. + * + * Adding stroke may yield a significantly wider and taller glyph + * depending on how large of a radius was used to stroke the glyph. You + * may need to manually adjust horizontal and vertical advance amounts + * to account for this added size. */ FT_EXPORT( FT_Error ) FT_Glyph_StrokeBorder( FT_Glyph *pglyph, diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h index a068b79..2074503 100644 --- a/include/freetype/ftsynth.h +++ b/include/freetype/ftsynth.h @@ -5,7 +5,7 @@ /* FreeType synthesizing code for emboldening and slanting */ /* (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2006, 2008 by */ +/* Copyright 2000-2001, 2003, 2006, 2008, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -61,8 +61,9 @@ FT_BEGIN_HEADER /* taste). This function is actually a convenience function, providing */ /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ /* */ - /* For emboldened outlines the metrics are estimates only; if you need */ - /* precise values you should call @FT_Outline_Get_CBox. */ + /* For emboldened outlines the height, width, and advance metrics are */ + /* increased by the strength of the emboldening. You can also call */ + /* @FT_Outline_Get_CBox to get precise values. */ FT_EXPORT( void ) FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); diff --git a/include/freetype/fttrigon.h b/include/freetype/fttrigon.h index 6b77d2e..65143cb 100644 --- a/include/freetype/fttrigon.h +++ b/include/freetype/fttrigon.h @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (specification). */ /* */ -/* Copyright 2001, 2003, 2005, 2007 by */ +/* Copyright 2001, 2003, 2005, 2007, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -46,7 +46,7 @@ FT_BEGIN_HEADER * * @description: * This type is used to model angle values in FreeType. Note that the - * angle is a 16.16 fixed float value expressed in degrees. + * angle is a 16.16 fixed-point value expressed in degrees. * */ typedef FT_Fixed FT_Angle; @@ -106,7 +106,7 @@ FT_BEGIN_HEADER * FT_Sin * * @description: - * Return the sinus of a given angle in fixed point format. + * Return the sinus of a given angle in fixed-point format. * * @input: * angle :: @@ -130,7 +130,7 @@ FT_BEGIN_HEADER * FT_Cos * * @description: - * Return the cosinus of a given angle in fixed point format. + * Return the cosinus of a given angle in fixed-point format. * * @input: * angle :: @@ -154,7 +154,7 @@ FT_BEGIN_HEADER * FT_Tan * * @description: - * Return the tangent of a given angle in fixed point format. + * Return the tangent of a given angle in fixed-point format. * * @input: * angle :: diff --git a/include/freetype/ftttdrv.h b/include/freetype/ftttdrv.h new file mode 100644 index 0000000..d5d3f1c --- /dev/null +++ b/include/freetype/ftttdrv.h @@ -0,0 +1,150 @@ +/***************************************************************************/ +/* */ +/* ftttdrv.h */ +/* */ +/* FreeType API for controlling the TrueType driver */ +/* (specification only). */ +/* */ +/* Copyright 2013 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTTTDRV_H__ +#define __FTTTDRV_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * tt_driver + * + * @title: + * The TrueType driver + * + * @abstract: + * Controlling the TrueType driver module. + * + * @description: + * While FreeType's TrueType driver doesn't expose API functions by + * itself, it is possible to control its behaviour with @FT_Property_Set + * and @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * The TrueType driver's module name is `truetype'. + * + */ + + + /************************************************************************** + * + * @property: + * interpreter-version + * + * @description: + * Currently, two versions are available which represent the bytecode + * interpreter with and without subpixel hinting support, + * respectively. The default is subpixel support if + * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel + * support otherwise (since it isn't available then). + * + * If subpixel hinting is on, many TrueType bytecode instructions + * behave differently compared to B/W or grayscale rendering. The + * main idea is to render at a much increased horizontal resolution, + * then sampling down the created output to subpixel precision. + * However, many older fonts are not suited to this and must be + * specially taken care of by applying (hardcoded) font-specific + * tweaks. + * + * Details on subpixel hinting and some of the necessary tweaks can be + * found in Greg Hitchcock's whitepaper at + * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. + * + * The following example code demonstrates how to activate subpixel + * hinting (omitting the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_38; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "truetype", + * "interpreter-version", + * &interpreter_version ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + */ + + + /************************************************************************** + * + * @enum: + * TT_INTERPRETER_VERSION_XXX + * + * @description: + * A list of constants used for the @interpreter-version property to + * select the hinting engine for Truetype fonts. + * + * The numeric value in the constant names represents the version + * number as returned by the `GETINFO' bytecode instruction. + * + * @values: + * TT_INTERPRETER_VERSION_35 :: + * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in + * Windows~98; only grayscale and B/W rasterizing is supported. + * + * TT_INTERPRETER_VERSION_38 :: + * Version~38 corresponds to MS rasterizer v.1.9; it is roughly + * equivalent to the hinting provided by DirectWrite ClearType (as + * can be found, for example, in the Internet Explorer~9 running on + * Windows~7). + * + * @note: + * This property controls the behaviour of the bytecode interpreter + * and thus how outlines get hinted. It does *not* control how glyph + * get rasterized! In particular, it does not control subpixel color + * filtering. + * + * If FreeType has not been compiled with configuration option + * FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 causes an + * `FT_Err_Unimplemented_Feature' error. + * + */ +#define TT_INTERPRETER_VERSION_35 35 +#define TT_INTERPRETER_VERSION_38 38 + + + /* */ + +FT_END_HEADER + + +#endif /* __FTTTDRV_H__ */ + + +/* END */ diff --git a/include/freetype/fttypes.h b/include/freetype/fttypes.h index 3255527..027e59c 100644 --- a/include/freetype/fttypes.h +++ b/include/freetype/fttypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType simple types definitions (specification only). */ /* */ -/* Copyright 1996-2002, 2004, 2006-2009, 2012 by */ +/* Copyright 1996-2002, 2004, 2006-2009, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -255,7 +255,7 @@ FT_BEGIN_HEADER /* FT_F2Dot14 */ /* */ /* <Description> */ - /* A signed 2.14 fixed float type used for unit vectors. */ + /* A signed 2.14 fixed-point type used for unit vectors. */ /* */ typedef signed short FT_F2Dot14; @@ -266,7 +266,7 @@ FT_BEGIN_HEADER /* FT_F26Dot6 */ /* */ /* <Description> */ - /* A signed 26.6 fixed float type used for vectorial pixel */ + /* A signed 26.6 fixed-point type used for vectorial pixel */ /* coordinates. */ /* */ typedef signed long FT_F26Dot6; @@ -278,7 +278,7 @@ FT_BEGIN_HEADER /* FT_Fixed */ /* */ /* <Description> */ - /* This type is used to store 16.16 fixed float values, like scaling */ + /* This type is used to store 16.16 fixed-point values, like scaling */ /* values or matrix coefficients. */ /* */ typedef signed long FT_Fixed; @@ -362,7 +362,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* A simple structure used to store a 2x2 matrix. Coefficients are */ - /* in 16.16 fixed float format. The computation performed is: */ + /* in 16.16 fixed-point format. The computation performed is: */ /* */ /* { */ /* x' = x*xx + y*xy */ @@ -571,14 +571,24 @@ FT_BEGIN_HEADER /* */ #define FT_IS_EMPTY( list ) ( (list).head == 0 ) +#define FT_BOOL( x ) ( (FT_Bool)( x ) ) - /* return base error code (without module-specific prefix) */ -#define FT_ERROR_BASE( x ) ( (x) & 0xFF ) + /* concatenate C tokens */ +#define FT_ERR_XCAT( x, y ) x ## y +#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) + + /* see `ftmoderr.h' for descriptions of the following macros */ + +#define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e ) - /* return module error code */ +#define FT_ERROR_BASE( x ) ( (x) & 0xFF ) #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U ) -#define FT_BOOL( x ) ( (FT_Bool)( x ) ) +#define FT_ERR_EQ( x, e ) \ + ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) ) +#define FT_ERR_NEQ( x, e ) \ + ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) ) + FT_END_HEADER diff --git a/include/freetype/internal/autohint.h b/include/freetype/internal/autohint.h index 231bdd4..545de93 100644 --- a/include/freetype/internal/autohint.h +++ b/include/freetype/internal/autohint.h @@ -4,7 +4,7 @@ /* */ /* High-level `autohint' module-specific interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2007 by */ +/* Copyright 1996-2002, 2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -86,20 +86,20 @@ FT_BEGIN_HEADER /* FT_AutoHinter_GlobalGetFunc */ /* */ /* <Description> */ - /* Retrieves the global hints computed for a given face object the */ + /* Retrieve the global hints computed for a given face object. The */ /* resulting data is dissociated from the face and will survive a */ /* call to FT_Done_Face(). It must be discarded through the API */ /* FT_AutoHinter_GlobalDoneFunc(). */ /* */ /* <Input> */ - /* hinter :: A handle to the source auto-hinter. */ + /* hinter :: A handle to the source auto-hinter. */ /* */ - /* face :: A handle to the source face object. */ + /* face :: A handle to the source face object. */ /* */ /* <Output> */ - /* global_hints :: A typeless pointer to the global hints. */ + /* global_hints :: A typeless pointer to the global hints. */ /* */ - /* global_len :: The size in bytes of the global hints. */ + /* global_len :: The size in bytes of the global hints. */ /* */ typedef void (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter, @@ -114,7 +114,7 @@ FT_BEGIN_HEADER /* FT_AutoHinter_GlobalDoneFunc */ /* */ /* <Description> */ - /* Discards the global hints retrieved through */ + /* Discard the global hints retrieved through */ /* FT_AutoHinter_GlobalGetFunc(). This is the only way these hints */ /* are freed from memory. */ /* */ @@ -168,8 +168,8 @@ FT_BEGIN_HEADER /* This function is capable of loading composite glyphs by hinting */ /* each sub-glyph independently (which improves quality). */ /* */ - /* It will call the font driver with FT_Load_Glyph(), with */ - /* FT_LOAD_NO_SCALE set. */ + /* It will call the font driver with @FT_Load_Glyph, with */ + /* @FT_LOAD_NO_SCALE set. */ /* */ typedef FT_Error (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter, @@ -182,43 +182,56 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Struct> */ - /* FT_AutoHinter_ServiceRec */ + /* FT_AutoHinter_InterfaceRec */ /* */ /* <Description> */ /* The auto-hinter module's interface. */ /* */ - typedef struct FT_AutoHinter_ServiceRec_ + typedef struct FT_AutoHinter_InterfaceRec_ { FT_AutoHinter_GlobalResetFunc reset_face; FT_AutoHinter_GlobalGetFunc get_global_hints; FT_AutoHinter_GlobalDoneFunc done_global_hints; FT_AutoHinter_GlyphLoadFunc load_glyph; - } FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service; + } FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \ - done_global_hints_, load_glyph_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_AutoHinter_ServiceRec class_ = \ - { \ - reset_face_, get_global_hints_, done_global_hints_, load_glyph_ \ +#define FT_DEFINE_AUTOHINTER_INTERFACE( \ + class_, \ + reset_face_, \ + get_global_hints_, \ + done_global_hints_, \ + load_glyph_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_AutoHinter_InterfaceRec class_ = \ + { \ + reset_face_, \ + get_global_hints_, \ + done_global_hints_, \ + load_glyph_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \ - done_global_hints_, load_glyph_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_AutoHinter_ServiceRec* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->reset_face = reset_face_; \ - clazz->get_global_hints = get_global_hints_; \ - clazz->done_global_hints = done_global_hints_; \ - clazz->load_glyph = load_glyph_; \ +#define FT_DEFINE_AUTOHINTER_INTERFACE( \ + class_, \ + reset_face_, \ + get_global_hints_, \ + done_global_hints_, \ + load_glyph_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_AutoHinter_InterfaceRec* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->reset_face = reset_face_; \ + clazz->get_global_hints = get_global_hints_; \ + clazz->done_global_hints = done_global_hints_; \ + clazz->load_glyph = load_glyph_; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index f8b4324..faac3a3 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */ +/* Copyright 1996-2006, 2008, 2009, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,7 +33,7 @@ FT_BEGIN_HEADER /* FT_FixedSqrt */ /* */ /* <Description> */ - /* Computes the square root of a 16.16 fixed point value. */ + /* Computes the square root of a 16.16 fixed-point value. */ /* */ /* <Input> */ /* x :: The value to compute the root for. */ @@ -48,29 +48,6 @@ FT_BEGIN_HEADER FT_SqrtFixed( FT_Int32 x ); -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Sqrt32 */ - /* */ - /* <Description> */ - /* Computes the square root of an Int32 integer (which will be */ - /* handled as an unsigned long value). */ - /* */ - /* <Input> */ - /* x :: The value to compute the root for. */ - /* */ - /* <Return> */ - /* The result of `sqrt(x)'. */ - /* */ - FT_EXPORT( FT_Int32 ) - FT_Sqrt32( FT_Int32 x ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /*************************************************************************/ /* */ /* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */ @@ -78,8 +55,6 @@ FT_BEGIN_HEADER /*************************************************************************/ -#ifdef TT_USE_BYTECODE_INTERPRETER - /*************************************************************************/ /* */ /* <Function> */ @@ -87,7 +62,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* A very simple function used to perform the computation `(a*b)/c' */ - /* (without rounding) with maximal accuracy (it uses a 64-bit */ + /* (without rounding) with maximum accuracy (it uses a 64-bit */ /* intermediate integer whenever necessary). */ /* */ /* This function isn't necessarily as fast as some processor specific */ @@ -108,8 +83,6 @@ FT_BEGIN_HEADER FT_Long b, FT_Long c ); -#endif /* TT_USE_BYTECODE_INTERPRETER */ - /* * A variant of FT_Matrix_Multiply which scales its result afterwards. @@ -129,7 +102,6 @@ FT_BEGIN_HEADER * A variant of FT_Vector_Transform. See comments for * FT_Matrix_Multiply_Scaled. */ - FT_BASE( void ) FT_Vector_Transform_Scaled( FT_Vector* vector, const FT_Matrix* matrix, @@ -160,6 +132,22 @@ FT_BEGIN_HEADER FT_Pos out_y ); + /* + * Return the most significant bit index. + */ + FT_BASE( FT_Int ) + FT_MSB( FT_UInt32 z ); + + + /* + * Return sqrt(x*x+y*y), which is the same as `FT_Vector_Length' but uses + * two fixed-point arguments instead. + */ + FT_BASE( FT_Fixed ) + FT_Hypot( FT_Fixed x, + FT_Fixed y ); + + #define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 ) #define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 ) #define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h index 7baae35..1ee120f 100644 --- a/include/freetype/internal/ftdebug.h +++ b/include/freetype/internal/ftdebug.h @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008, 2009 by */ +/* Copyright 1996-2002, 2004, 2006-2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -185,7 +185,8 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* Define the FT_ASSERT macro. */ + /* Define the FT_ASSERT and FT_THROW macros. The call to `FT_Throw' */ + /* makes it possible to easily set a breakpoint at this function. */ /* */ /*************************************************************************/ @@ -199,10 +200,18 @@ FT_BEGIN_HEADER __LINE__, __FILE__ ); \ } while ( 0 ) +#define FT_THROW( e ) \ + ( FT_Throw( FT_ERR_CAT( FT_ERR_PREFIX, e ), \ + __LINE__, \ + __FILE__ ) | \ + FT_ERR_CAT( FT_ERR_PREFIX, e ) ) + #else /* !FT_DEBUG_LEVEL_ERROR */ #define FT_ASSERT( condition ) do { } while ( 0 ) +#define FT_THROW( e ) FT_ERR_CAT( FT_ERR_PREFIX, e ) + #endif /* !FT_DEBUG_LEVEL_ERROR */ @@ -226,6 +235,12 @@ FT_BEGIN_HEADER FT_Panic( const char* fmt, ... ); + /* report file name and line number of an error */ + FT_BASE( int ) + FT_Throw( FT_Error error, + int line, + const char* file ); + #endif /* FT_DEBUG_LEVEL_ERROR */ @@ -233,15 +248,6 @@ FT_BEGIN_HEADER ft_debug_init( void ); -#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ - - /* We disable the warning `conditional expression is constant' here */ - /* in order to compile cleanly with the maximum level of warnings. */ -#pragma warning( disable : 4127 ) - -#endif /* _MSC_VER */ - - FT_END_HEADER #endif /* __FTDEBUG_H__ */ diff --git a/include/freetype/internal/ftdriver.h b/include/freetype/internal/ftdriver.h index 6f6b206..940218e 100644 --- a/include/freetype/internal/ftdriver.h +++ b/include/freetype/internal/ftdriver.h @@ -4,7 +4,7 @@ /* */ /* FreeType font driver interface (specification). */ /* */ -/* Copyright 1996-2003, 2006, 2008, 2011 by */ +/* Copyright 1996-2003, 2006, 2008, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -60,22 +60,6 @@ FT_BEGIN_HEADER (*FT_Size_SelectFunc)( FT_Size size, FT_ULong size_index ); -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - typedef FT_Error - (*FT_Size_ResetPointsFunc)( FT_Size size, - FT_F26Dot6 char_width, - FT_F26Dot6 char_height, - FT_UInt horz_resolution, - FT_UInt vert_resolution ); - - typedef FT_Error - (*FT_Size_ResetPixelsFunc)( FT_Size size, - FT_UInt pixel_width, - FT_UInt pixel_height ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - typedef FT_Error (*FT_Slot_LoadFunc)( FT_GlyphSlot slot, FT_Size size, @@ -181,72 +165,42 @@ FT_BEGIN_HEADER /* */ typedef struct FT_Driver_ClassRec_ { - FT_Module_Class root; - - FT_Long face_object_size; - FT_Long size_object_size; - FT_Long slot_object_size; - - FT_Face_InitFunc init_face; - FT_Face_DoneFunc done_face; + FT_Module_Class root; - FT_Size_InitFunc init_size; - FT_Size_DoneFunc done_size; + FT_Long face_object_size; + FT_Long size_object_size; + FT_Long slot_object_size; - FT_Slot_InitFunc init_slot; - FT_Slot_DoneFunc done_slot; + FT_Face_InitFunc init_face; + FT_Face_DoneFunc done_face; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + FT_Size_InitFunc init_size; + FT_Size_DoneFunc done_size; - FT_Size_ResetPointsFunc set_char_sizes; - FT_Size_ResetPixelsFunc set_pixel_sizes; + FT_Slot_InitFunc init_slot; + FT_Slot_DoneFunc done_slot; -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + FT_Slot_LoadFunc load_glyph; - FT_Slot_LoadFunc load_glyph; - - FT_Face_GetKerningFunc get_kerning; - FT_Face_AttachFunc attach_file; - FT_Face_GetAdvancesFunc get_advances; + FT_Face_GetKerningFunc get_kerning; + FT_Face_AttachFunc attach_file; + FT_Face_GetAdvancesFunc get_advances; /* since version 2.2 */ - FT_Size_RequestFunc request_size; - FT_Size_SelectFunc select_size; + FT_Size_RequestFunc request_size; + FT_Size_SelectFunc select_size; } FT_Driver_ClassRec, *FT_Driver_Class; - /* - * The following functions are used as stubs for `set_char_sizes' and - * `set_pixel_sizes'; the code uses `request_size' and `select_size' - * functions instead. - * - * Implementation is in `src/base/ftobjs.c'. - */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - FT_BASE( FT_Error ) - ft_stub_set_char_sizes( FT_Size size, - FT_F26Dot6 width, - FT_F26Dot6 height, - FT_UInt horz_res, - FT_UInt vert_res ); - - FT_BASE( FT_Error ) - ft_stub_set_pixel_sizes( FT_Size size, - FT_UInt width, - FT_UInt height ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - /*************************************************************************/ /* */ /* <Macro> */ /* FT_DECLARE_DRIVER */ /* */ /* <Description> */ - /* Used to create a forward declaration of a */ - /* FT_Driver_ClassRec stract instance. */ + /* Used to create a forward declaration of an FT_Driver_ClassRec */ + /* struct instance. */ /* */ /* <Macro> */ /* FT_DEFINE_DRIVER */ @@ -254,160 +208,194 @@ FT_BEGIN_HEADER /* <Description> */ /* Used to initialize an instance of FT_Driver_ClassRec struct. */ /* */ - /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ - /* to called with a pointer where the allocated stracture is returned.*/ - /* And when it is no longer needed a Destroy function needs */ - /* to be called to release that allocation. */ - /* fcinit.c (ft_create_default_module_classes) already contains */ - /* a mechanism to call these functions for the default modules */ - /* described in ftmodule.h */ + /* When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */ + /* called with a pointer where the allocated structure is returned. */ + /* And when it is no longer needed a `destroy' function needs to be */ + /* called to release that allocation. */ + /* */ + /* `fcinit.c' (ft_create_default_module_classes) already contains a */ + /* mechanism to call these functions for the default modules */ + /* described in `ftmodule.h'. */ /* */ - /* Notice that the created Create and Destroy functions call */ - /* pic_init and pic_free function to allow you to manually allocate */ - /* and initialize any additional global data, like module specific */ + /* Notice that the created `create' and `destroy' functions call */ + /* `pic_init' and `pic_free' to allow you to manually allocate and */ + /* initialize any additional global data, like a module specific */ /* interface, and put them in the global pic container defined in */ - /* ftpic.h. if you don't need them just implement the functions as */ - /* empty to resolve the link error. Also the pic_init and pic_free */ - /* functions should be declared in pic.h, to be referred by driver */ - /* definition calling FT_DEFINE_DRIVER() in following. */ + /* `ftpic.h'. If you don't need them just implement the functions as */ + /* empty to resolve the link error. Also the `pic_init' and */ + /* `pic_free' functions should be declared in `pic.h', to be referred */ + /* by driver definition calling `FT_DEFINE_DRIVER' in following. */ /* */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ - /* allocated in the global scope (or the scope where the macro */ - /* is used). */ + /* allocated in the global scope (or the scope where the macro is */ + /* used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \ - a_, b_, -#else - #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) -#endif - -#define FT_DECLARE_DRIVER(class_) \ +#define FT_DECLARE_DRIVER( class_ ) \ FT_CALLBACK_TABLE \ const FT_Driver_ClassRec class_; -#define FT_DEFINE_DRIVER(class_, \ - flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_, \ - face_object_size_, size_object_size_, \ - slot_object_size_, init_face_, done_face_, \ - init_size_, done_size_, init_slot_, done_slot_, \ - old_set_char_sizes_, old_set_pixel_sizes_, \ - load_glyph_, get_kerning_, attach_file_, \ - get_advances_, request_size_, select_size_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Driver_ClassRec class_ = \ - { \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_, \ - init_,done_,get_interface_) \ - \ - face_object_size_, \ - size_object_size_, \ - slot_object_size_, \ - \ - init_face_, \ - done_face_, \ - \ - init_size_, \ - done_size_, \ - \ - init_slot_, \ - done_slot_, \ - \ - FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \ - \ - load_glyph_, \ - \ - get_kerning_, \ - attach_file_, \ - get_advances_, \ - \ - request_size_, \ - select_size_ \ +#define FT_DEFINE_DRIVER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + face_object_size_, \ + size_object_size_, \ + slot_object_size_, \ + init_face_, \ + done_face_, \ + init_size_, \ + done_size_, \ + init_slot_, \ + done_slot_, \ + load_glyph_, \ + get_kerning_, \ + attach_file_, \ + get_advances_, \ + request_size_, \ + select_size_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Driver_ClassRec class_ = \ + { \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + \ + face_object_size_, \ + size_object_size_, \ + slot_object_size_, \ + \ + init_face_, \ + done_face_, \ + \ + init_size_, \ + done_size_, \ + \ + init_slot_, \ + done_slot_, \ + \ + load_glyph_, \ + \ + get_kerning_, \ + attach_file_, \ + get_advances_, \ + \ + request_size_, \ + select_size_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \ - clazz->set_char_sizes = a_; \ - clazz->set_pixel_sizes = b_; -#else - #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) -#endif - -#define FT_DECLARE_DRIVER(class_) FT_DECLARE_MODULE(class_) - -#define FT_DEFINE_DRIVER(class_, \ - flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_, \ - face_object_size_, size_object_size_, \ - slot_object_size_, init_face_, done_face_, \ - init_size_, done_size_, init_slot_, done_slot_, \ - old_set_char_sizes_, old_set_pixel_sizes_, \ - load_glyph_, get_kerning_, attach_file_, \ - get_advances_, request_size_, select_size_ ) \ - \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \ - class_##_pic_free( library ); \ - if ( dclazz ) \ - FT_FREE( dclazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Driver_Class clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ - return error; \ - \ - error = class_##_pic_init( library ); \ - if(error) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_, \ - init_,done_,get_interface_) \ - \ - clazz->face_object_size = face_object_size_; \ - clazz->size_object_size = size_object_size_; \ - clazz->slot_object_size = slot_object_size_; \ - \ - clazz->init_face = init_face_; \ - clazz->done_face = done_face_; \ - \ - clazz->init_size = init_size_; \ - clazz->done_size = done_size_; \ - \ - clazz->init_slot = init_slot_; \ - clazz->done_slot = done_slot_; \ - \ - FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \ - \ - clazz->load_glyph = load_glyph_; \ - \ - clazz->get_kerning = get_kerning_; \ - clazz->attach_file = attach_file_; \ - clazz->get_advances = get_advances_; \ - \ - clazz->request_size = request_size_; \ - clazz->select_size = select_size_; \ - \ - *output_class = (FT_Module_Class*)clazz; \ - return FT_Err_Ok; \ +#define FT_DECLARE_DRIVER( class_ ) FT_DECLARE_MODULE( class_ ) + +#define FT_DEFINE_DRIVER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + face_object_size_, \ + size_object_size_, \ + slot_object_size_, \ + init_face_, \ + done_face_, \ + init_size_, \ + done_size_, \ + init_slot_, \ + done_slot_, \ + load_glyph_, \ + get_kerning_, \ + attach_file_, \ + get_advances_, \ + request_size_, \ + select_size_ ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \ + \ + \ + class_ ## _pic_free( library ); \ + if ( dclazz ) \ + FT_FREE( dclazz ); \ + } \ + \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ) \ + { \ + FT_Driver_Class clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ + return error; \ + \ + error = class_ ## _pic_init( library ); \ + if ( error ) \ + { \ + FT_FREE( clazz ); \ + return error; \ + } \ + \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + \ + clazz->face_object_size = face_object_size_; \ + clazz->size_object_size = size_object_size_; \ + clazz->slot_object_size = slot_object_size_; \ + \ + clazz->init_face = init_face_; \ + clazz->done_face = done_face_; \ + \ + clazz->init_size = init_size_; \ + clazz->done_size = done_size_; \ + \ + clazz->init_slot = init_slot_; \ + clazz->done_slot = done_slot_; \ + \ + clazz->load_glyph = load_glyph_; \ + \ + clazz->get_kerning = get_kerning_; \ + clazz->attach_file = attach_file_; \ + clazz->get_advances = get_advances_; \ + \ + clazz->request_size = request_size_; \ + clazz->select_size = select_size_; \ + \ + *output_class = (FT_Module_Class*)clazz; \ + \ + return FT_Err_Ok; \ } diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h index 026aa63..3d51aee 100644 --- a/include/freetype/internal/ftmemory.h +++ b/include/freetype/internal/ftmemory.h @@ -4,7 +4,7 @@ /* */ /* The FreeType memory management macros (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2010 by */ +/* Copyright 1996-2002, 2004-2007, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -141,8 +141,10 @@ FT_BEGIN_HEADER const void* P ); -#define FT_MEM_ALLOC( ptr, size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, (size), &error ) ) +#define FT_MEM_ALLOC( ptr, size ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, \ + (FT_Long)(size), \ + &error ) ) #define FT_MEM_FREE( ptr ) \ FT_BEGIN_STMNT \ @@ -154,45 +156,60 @@ FT_BEGIN_HEADER FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) ) #define FT_MEM_REALLOC( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, 1, \ - (cursz), (newsz), \ - (ptr), &error ) ) - -#define FT_MEM_QALLOC( ptr, size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, (size), &error ) ) + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ + 1, \ + (FT_Long)(cursz), \ + (FT_Long)(newsz), \ + (ptr), \ + &error ) ) + +#define FT_MEM_QALLOC( ptr, size ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, \ + (FT_Long)(size), \ + &error ) ) #define FT_MEM_QNEW( ptr ) \ FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) ) -#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, 1, \ - (cursz), (newsz), \ - (ptr), &error ) ) - -#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \ - (cursz), (newsz), \ - (ptr), &error ) ) - -#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (item_size), \ - 0, (count), \ - NULL, &error ) ) - -#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (itmsz), \ - (oldcnt), (newcnt), \ - (ptr), &error ) ) - -#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (item_size), \ - 0, (count), \ - NULL, &error ) ) - -#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (itmsz), \ - (oldcnt), (newcnt), \ - (ptr), &error ) ) +#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ + 1, \ + (FT_Long)(cursz), \ + (FT_Long)(newsz), \ + (ptr), \ + &error ) ) + +#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ + (FT_Long)(item_size), \ + 0, \ + (FT_Long)(count), \ + NULL, \ + &error ) ) + +#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ + (FT_Long)(itmsz), \ + (FT_Long)(oldcnt), \ + (FT_Long)(newcnt), \ + (ptr), \ + &error ) ) + +#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ + (FT_Long)(item_size), \ + 0, \ + (FT_Long)(count), \ + NULL, \ + &error ) ) + +#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ + (FT_Long)(itmsz), \ + (FT_Long)(oldcnt), \ + (FT_Long)(newcnt), \ + (ptr), \ + &error ) ) #define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 ) @@ -236,26 +253,37 @@ FT_BEGIN_HEADER /* _typed_ in order to automatically compute array element sizes. */ /* */ -#define FT_MEM_NEW_ARRAY( ptr, count ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \ - 0, (count), \ - NULL, &error ) ) - -#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \ - (cursz), (newsz), \ - (ptr), &error ) ) - -#define FT_MEM_QNEW_ARRAY( ptr, count ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \ - 0, (count), \ - NULL, &error ) ) - -#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \ - (cursz), (newsz), \ - (ptr), &error ) ) - +#define FT_MEM_NEW_ARRAY( ptr, count ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ + sizeof ( *(ptr) ), \ + 0, \ + (FT_Long)(count), \ + NULL, \ + &error ) ) + +#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ + sizeof ( *(ptr) ), \ + (FT_Long)(cursz), \ + (FT_Long)(newsz), \ + (ptr), \ + &error ) ) + +#define FT_MEM_QNEW_ARRAY( ptr, count ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ + sizeof ( *(ptr) ), \ + 0, \ + (FT_Long)(count), \ + NULL, \ + &error ) ) + +#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ + sizeof ( *(ptr) ), \ + (FT_Long)(cursz), \ + (FT_Long)(newsz), \ + (ptr), \ + &error ) ) #define FT_ALLOC( ptr, size ) \ FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) ) @@ -303,37 +331,6 @@ FT_BEGIN_HEADER FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) ) -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - FT_BASE( FT_Error ) - FT_Alloc( FT_Memory memory, - FT_Long size, - void* *P ); - - FT_BASE( FT_Error ) - FT_QAlloc( FT_Memory memory, - FT_Long size, - void* *p ); - - FT_BASE( FT_Error ) - FT_Realloc( FT_Memory memory, - FT_Long current, - FT_Long size, - void* *P ); - - FT_BASE( FT_Error ) - FT_QRealloc( FT_Memory memory, - FT_Long current, - FT_Long size, - void* *p ); - - FT_BASE( void ) - FT_Free( FT_Memory memory, - void* *P ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - FT_BASE( FT_Pointer ) ft_mem_strdup( FT_Memory memory, const char* str, @@ -345,6 +342,7 @@ FT_BEGIN_HEADER FT_ULong size, FT_Error *p_error ); + #define FT_MEM_STRDUP( dst, str ) \ (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error ) diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index fc18275..8a309b8 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (specification). */ /* */ -/* Copyright 1996-2006, 2008, 2010, 2012 by */ +/* Copyright 1996-2006, 2008, 2010, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -206,46 +206,79 @@ FT_BEGIN_HEADER } FT_CMap_ClassRec; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DECLARE_CMAP_CLASS(class_) \ - FT_CALLBACK_TABLE const FT_CMap_ClassRec class_; - -#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \ - char_next_, char_var_index_, char_var_default_, variant_list_, \ - charvariant_list_, variantchar_list_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_CMap_ClassRec class_ = \ - { \ - size_, init_, done_, char_index_, char_next_, char_var_index_, \ - char_var_default_, variant_list_, charvariant_list_, variantchar_list_ \ +#define FT_DECLARE_CMAP_CLASS( class_ ) \ + FT_CALLBACK_TABLE const FT_CMap_ClassRec class_; + +#define FT_DEFINE_CMAP_CLASS( \ + class_, \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_CMap_ClassRec class_ = \ + { \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_ \ }; + #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DECLARE_CMAP_CLASS(class_) \ - void FT_Init_Class_##class_( FT_Library library, FT_CMap_ClassRec* clazz); - -#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \ - char_next_, char_var_index_, char_var_default_, variant_list_, \ - charvariant_list_, variantchar_list_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_CMap_ClassRec* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->size = size_; \ - clazz->init = init_; \ - clazz->done = done_; \ - clazz->char_index = char_index_; \ - clazz->char_next = char_next_; \ - clazz->char_var_index = char_var_index_; \ - clazz->char_var_default = char_var_default_; \ - clazz->variant_list = variant_list_; \ - clazz->charvariant_list = charvariant_list_; \ - clazz->variantchar_list = variantchar_list_; \ +#define FT_DECLARE_CMAP_CLASS( class_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_CMap_ClassRec* clazz ); + +#define FT_DEFINE_CMAP_CLASS( \ + class_, \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_CMap_ClassRec* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->size = size_; \ + clazz->init = init_; \ + clazz->done = done_; \ + clazz->char_index = char_index_; \ + clazz->char_next = char_next_; \ + clazz->char_var_index = char_var_index_; \ + clazz->char_var_default = char_var_default_; \ + clazz->variant_list = variant_list_; \ + clazz->charvariant_list = charvariant_list_; \ + clazz->variantchar_list = variantchar_list_; \ } + #endif /* FT_CONFIG_OPTION_PIC */ + /* create a new charmap and add it to charmap->face */ FT_BASE( FT_Error ) FT_CMap_New( FT_CMap_Class clazz, @@ -270,13 +303,13 @@ FT_BEGIN_HEADER /* */ /* <Fields> */ /* max_points :: */ - /* The maximal number of points used to store the vectorial outline */ + /* The maximum number of points used to store the vectorial outline */ /* of any glyph in this face. If this value cannot be known in */ /* advance, or if the face isn't scalable, this should be set to 0. */ /* Only relevant for scalable formats. */ /* */ /* max_contours :: */ - /* The maximal number of contours used to store the vectorial */ + /* The maximum number of contours used to store the vectorial */ /* outline of any glyph in this face. If this value cannot be */ /* known in advance, or if the face isn't scalable, this should be */ /* set to 0. Only relevant for scalable formats. */ @@ -319,10 +352,6 @@ FT_BEGIN_HEADER /* */ typedef struct FT_Face_InternalRec_ { -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_UShort reserved1; - FT_Short reserved2; -#endif FT_Matrix transform_matrix; FT_Vector transform_delta; FT_Int transform_flags; @@ -409,6 +438,7 @@ FT_BEGIN_HEADER #endif + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ @@ -503,7 +533,7 @@ FT_BEGIN_HEADER ft_module_get_service( FT_Module module, const char* service_id ); - /* */ + /* */ /*************************************************************************/ @@ -511,7 +541,7 @@ FT_BEGIN_HEADER /*************************************************************************/ /**** ****/ /**** ****/ - /**** FACE, SIZE & GLYPH SLOT OBJECTS ****/ + /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/ /**** ****/ /**** ****/ /*************************************************************************/ @@ -926,12 +956,13 @@ FT_BEGIN_HEADER FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster; #endif + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** ****/ - /**** PIC-Support Macros for ftimage.h ****/ + /**** P I C S U P P O R T ****/ /**** ****/ /**** ****/ /*************************************************************************/ @@ -939,6 +970,9 @@ FT_BEGIN_HEADER /*************************************************************************/ + /* PIC support macros for ftimage.h */ + + /*************************************************************************/ /* */ /* <Macro> */ @@ -947,38 +981,57 @@ FT_BEGIN_HEADER /* <Description> */ /* Used to initialize an instance of FT_Outline_Funcs struct. */ /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* called with a pre-allocated stracture to be filled. */ + /* be called with a pre-allocated structure to be filled. */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ /* is used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \ - cubic_to_, shift_, delta_) \ - static const FT_Outline_Funcs class_ = \ - { \ - move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_ \ +#define FT_DEFINE_OUTLINE_FUNCS( \ + class_, \ + move_to_, \ + line_to_, \ + conic_to_, \ + cubic_to_, \ + shift_, \ + delta_ ) \ + static const FT_Outline_Funcs class_ = \ + { \ + move_to_, \ + line_to_, \ + conic_to_, \ + cubic_to_, \ + shift_, \ + delta_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \ - cubic_to_, shift_, delta_) \ - static FT_Error \ - Init_Class_##class_( FT_Outline_Funcs* clazz ) \ - { \ - clazz->move_to = move_to_; \ - clazz->line_to = line_to_; \ - clazz->conic_to = conic_to_; \ - clazz->cubic_to = cubic_to_; \ - clazz->shift = shift_; \ - clazz->delta = delta_; \ - return FT_Err_Ok; \ +#define FT_DEFINE_OUTLINE_FUNCS( \ + class_, \ + move_to_, \ + line_to_, \ + conic_to_, \ + cubic_to_, \ + shift_, \ + delta_ ) \ + static FT_Error \ + Init_Class_ ## class_( FT_Outline_Funcs* clazz ) \ + { \ + clazz->move_to = move_to_; \ + clazz->line_to = line_to_; \ + clazz->conic_to = conic_to_; \ + clazz->cubic_to = cubic_to_; \ + clazz->shift = shift_; \ + clazz->delta = delta_; \ + \ + return FT_Err_Ok; \ } #endif /* FT_CONFIG_OPTION_PIC */ + /*************************************************************************/ /* */ /* <Macro> */ @@ -987,51 +1040,56 @@ FT_BEGIN_HEADER /* <Description> */ /* Used to initialize an instance of FT_Raster_Funcs struct. */ /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* called with a pre-allocated stracture to be filled. */ + /* be called with a pre-allocated structure to be filled. */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ /* is used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \ - raster_reset_, raster_set_mode_, \ - raster_render_, raster_done_) \ - const FT_Raster_Funcs class_ = \ - { \ - glyph_format_, raster_new_, raster_reset_, \ - raster_set_mode_, raster_render_, raster_done_ \ +#define FT_DEFINE_RASTER_FUNCS( \ + class_, \ + glyph_format_, \ + raster_new_, \ + raster_reset_, \ + raster_set_mode_, \ + raster_render_, \ + raster_done_ ) \ + const FT_Raster_Funcs class_ = \ + { \ + glyph_format_, \ + raster_new_, \ + raster_reset_, \ + raster_set_mode_, \ + raster_render_, \ + raster_done_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \ - raster_reset_, raster_set_mode_, raster_render_, raster_done_) \ - void \ - FT_Init_Class_##class_( FT_Raster_Funcs* clazz ) \ - { \ - clazz->glyph_format = glyph_format_; \ - clazz->raster_new = raster_new_; \ - clazz->raster_reset = raster_reset_; \ - clazz->raster_set_mode = raster_set_mode_; \ - clazz->raster_render = raster_render_; \ - clazz->raster_done = raster_done_; \ +#define FT_DEFINE_RASTER_FUNCS( \ + class_, \ + glyph_format_, \ + raster_new_, \ + raster_reset_, \ + raster_set_mode_, \ + raster_render_, \ + raster_done_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Raster_Funcs* clazz ) \ + { \ + clazz->glyph_format = glyph_format_; \ + clazz->raster_new = raster_new_; \ + clazz->raster_reset = raster_reset_; \ + clazz->raster_set_mode = raster_set_mode_; \ + clazz->raster_render = raster_render_; \ + clazz->raster_done = raster_done_; \ } #endif /* FT_CONFIG_OPTION_PIC */ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** PIC-Support Macros for ftrender.h ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ + /* PIC support macros for ftrender.h */ /*************************************************************************/ @@ -1042,40 +1100,64 @@ FT_BEGIN_HEADER /* <Description> */ /* Used to initialize an instance of FT_Glyph_Class struct. */ /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* called with a pre-allocated stracture to be filled. */ + /* be called with a pre-allocated stcture to be filled. */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ /* is used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \ - transform_, bbox_, prepare_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Glyph_Class class_ = \ - { \ - size_, format_, init_, done_, copy_, transform_, bbox_, prepare_ \ +#define FT_DEFINE_GLYPH( \ + class_, \ + size_, \ + format_, \ + init_, \ + done_, \ + copy_, \ + transform_, \ + bbox_, \ + prepare_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Glyph_Class class_ = \ + { \ + size_, \ + format_, \ + init_, \ + done_, \ + copy_, \ + transform_, \ + bbox_, \ + prepare_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \ - transform_, bbox_, prepare_) \ - void \ - FT_Init_Class_##class_( FT_Glyph_Class* clazz ) \ - { \ - clazz->glyph_size = size_; \ - clazz->glyph_format = format_; \ - clazz->glyph_init = init_; \ - clazz->glyph_done = done_; \ - clazz->glyph_copy = copy_; \ - clazz->glyph_transform = transform_; \ - clazz->glyph_bbox = bbox_; \ - clazz->glyph_prepare = prepare_; \ +#define FT_DEFINE_GLYPH( \ + class_, \ + size_, \ + format_, \ + init_, \ + done_, \ + copy_, \ + transform_, \ + bbox_, \ + prepare_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Glyph_Class* clazz ) \ + { \ + clazz->glyph_size = size_; \ + clazz->glyph_format = format_; \ + clazz->glyph_init = init_; \ + clazz->glyph_done = done_; \ + clazz->glyph_copy = copy_; \ + clazz->glyph_transform = transform_; \ + clazz->glyph_bbox = bbox_; \ + clazz->glyph_prepare = prepare_; \ } #endif /* FT_CONFIG_OPTION_PIC */ + /*************************************************************************/ /* */ /* <Macro> */ @@ -1083,7 +1165,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* Used to create a forward declaration of a */ - /* FT_Renderer_Class stract instance. */ + /* FT_Renderer_Class struct instance. */ /* */ /* <Macro> */ /* FT_DEFINE_RENDERER */ @@ -1091,22 +1173,23 @@ FT_BEGIN_HEADER /* <Description> */ /* Used to initialize an instance of FT_Renderer_Class struct. */ /* */ - /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ - /* to called with a pointer where the allocated stracture is returned.*/ - /* And when it is no longer needed a Destroy function needs */ - /* to be called to release that allocation. */ - /* fcinit.c (ft_create_default_module_classes) already contains */ + /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion will need */ + /* to be called with a pointer where the allocated structure is */ + /* returned. And when it is no longer needed a `destroy' function */ + /* needs to be called to release that allocation. */ + /* `fcinit.c' (ft_create_default_module_classes) already contains */ /* a mechanism to call these functions for the default modules */ - /* described in ftmodule.h */ + /* described in `ftmodule.h'. */ /* */ - /* Notice that the created Create and Destroy functions call */ - /* pic_init and pic_free function to allow you to manually allocate */ - /* and initialize any additional global data, like module specific */ + /* Notice that the created `create' and `destroy' functions call */ + /* `pic_init' and `pic_free' to allow you to manually allocate and */ + /* initialize any additional global data, like a module specific */ /* interface, and put them in the global pic container defined in */ - /* ftpic.h. if you don't need them just implement the functions as */ - /* empty to resolve the link error. Also the pic_init and pic_free */ - /* functions should be declared in pic.h, to be referred by renderer */ - /* definition calling FT_DEFINE_RENDERER() in following. */ + /* `ftpic.h'. If you don't need them just implement the functions as */ + /* empty to resolve the link error. Also the `pic_init' and */ + /* `pic_free' functions should be declared in `pic.h', to be referred */ + /* by the renderer definition calling `FT_DEFINE_RENDERER' in the */ + /* following. */ /* */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ @@ -1114,99 +1197,130 @@ FT_BEGIN_HEADER /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DECLARE_RENDERER(class_) \ - FT_EXPORT_VAR( const FT_Renderer_Class ) class_; - -#define FT_DEFINE_RENDERER(class_, \ - flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_, \ - glyph_format_, render_glyph_, transform_glyph_, \ - get_glyph_cbox_, set_mode_, raster_class_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Renderer_Class class_ = \ - { \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \ - interface_,init_,done_,get_interface_) \ - glyph_format_, \ - \ - render_glyph_, \ - transform_glyph_, \ - get_glyph_cbox_, \ - set_mode_, \ - \ - raster_class_ \ +#define FT_DECLARE_RENDERER( class_ ) \ + FT_EXPORT_VAR( const FT_Renderer_Class ) class_; + +#define FT_DEFINE_RENDERER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + glyph_format_, \ + render_glyph_, \ + transform_glyph_, \ + get_glyph_cbox_, \ + set_mode_, \ + raster_class_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Renderer_Class class_ = \ + { \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + glyph_format_, \ + \ + render_glyph_, \ + transform_glyph_, \ + get_glyph_cbox_, \ + set_mode_, \ + \ + raster_class_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DECLARE_RENDERER(class_) FT_DECLARE_MODULE(class_) - -#define FT_DEFINE_RENDERER(class_, \ - flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_, \ - glyph_format_, render_glyph_, transform_glyph_, \ - get_glyph_cbox_, set_mode_, raster_class_ ) \ - \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \ - FT_Memory memory = library->memory; \ - class_##_pic_free( library ); \ - if ( rclazz ) \ - FT_FREE( rclazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Renderer_Class* clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ - return error; \ - \ - error = class_##_pic_init( library ); \ - if(error) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \ - interface_,init_,done_,get_interface_) \ - \ - clazz->glyph_format = glyph_format_; \ - \ - clazz->render_glyph = render_glyph_; \ - clazz->transform_glyph = transform_glyph_; \ - clazz->get_glyph_cbox = get_glyph_cbox_; \ - clazz->set_mode = set_mode_; \ - \ - clazz->raster_class = raster_class_; \ - \ - *output_class = (FT_Module_Class*)clazz; \ - return FT_Err_Ok; \ +#define FT_DECLARE_RENDERER( class_ ) FT_DECLARE_MODULE( class_ ) + +#define FT_DEFINE_RENDERER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + glyph_format_, \ + render_glyph_, \ + transform_glyph_, \ + get_glyph_cbox_, \ + set_mode_, \ + raster_class_ ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ) \ + { \ + FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \ + FT_Memory memory = library->memory; \ + \ + \ + class_ ## _pic_free( library ); \ + if ( rclazz ) \ + FT_FREE( rclazz ); \ + } \ + \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ) \ + { \ + FT_Renderer_Class* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ + return error; \ + \ + error = class_ ## _pic_init( library ); \ + if ( error ) \ + { \ + FT_FREE( clazz ); \ + return error; \ + } \ + \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + \ + clazz->glyph_format = glyph_format_; \ + \ + clazz->render_glyph = render_glyph_; \ + clazz->transform_glyph = transform_glyph_; \ + clazz->get_glyph_cbox = get_glyph_cbox_; \ + clazz->set_mode = set_mode_; \ + \ + clazz->raster_class = raster_class_; \ + \ + *output_class = (FT_Module_Class*)clazz; \ + \ + return FT_Err_Ok; \ } - - #endif /* FT_CONFIG_OPTION_PIC */ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** PIC-Support Macros for ftmodapi.h ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ + + /* PIC support macros for ftmodapi.h **/ #ifdef FT_CONFIG_OPTION_PIC @@ -1247,6 +1361,7 @@ FT_BEGIN_HEADER #endif + /*************************************************************************/ /* */ /* <Macro> */ @@ -1254,30 +1369,31 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* Used to create a forward declaration of a */ - /* FT_Module_Class stract instance. */ + /* FT_Module_Class struct instance. */ /* */ /* <Macro> */ /* FT_DEFINE_MODULE */ /* */ /* <Description> */ - /* Used to initialize an instance of FT_Module_Class struct. */ + /* Used to initialize an instance of an FT_Module_Class struct. */ /* */ - /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ - /* to called with a pointer where the allocated stracture is returned.*/ - /* And when it is no longer needed a Destroy function needs */ - /* to be called to release that allocation. */ - /* fcinit.c (ft_create_default_module_classes) already contains */ + /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion needs to */ + /* be called with a pointer where the allocated structure is */ + /* returned. And when it is no longer needed a `destroy' function */ + /* needs to be called to release that allocation. */ + /* `fcinit.c' (ft_create_default_module_classes) already contains */ /* a mechanism to call these functions for the default modules */ - /* described in ftmodule.h */ + /* described in `ftmodule.h'. */ /* */ - /* Notice that the created Create and Destroy functions call */ - /* pic_init and pic_free function to allow you to manually allocate */ - /* and initialize any additional global data, like module specific */ + /* Notice that the created `create' and `destroy' functions call */ + /* `pic_init' and `pic_free' to allow you to manually allocate and */ + /* initialize any additional global data, like a module specific */ /* interface, and put them in the global pic container defined in */ - /* ftpic.h. if you don't need them just implement the functions as */ - /* empty to resolve the link error. Also the pic_init and pic_free */ - /* functions should be declared in pic.h, to be referred by module */ - /* definition calling FT_DEFINE_MODULE() in following. */ + /* `ftpic.h'. If you don't need them just implement the functions as */ + /* empty to resolve the link error. Also the `pic_init' and */ + /* `pic_free' functions should be declared in `pic.h', to be referred */ + /* by the module definition calling `FT_DEFINE_MODULE' in the */ + /* following. */ /* */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ @@ -1287,119 +1403,159 @@ FT_BEGIN_HEADER /* FT_DEFINE_ROOT_MODULE */ /* */ /* <Description> */ - /* Used to initialize an instance of FT_Module_Class struct inside */ - /* another stract that contains it or in a function that initializes */ - /* that containing stract */ + /* Used to initialize an instance of an FT_Module_Class struct inside */ + /* another struct that contains it or in a function that initializes */ + /* that containing struct. */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DECLARE_MODULE(class_) \ - FT_CALLBACK_TABLE \ - const FT_Module_Class class_; \ - -#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - { \ - flags_, \ - size_, \ - \ - name_, \ - version_, \ - requires_, \ - \ - interface_, \ - \ - init_, \ - done_, \ - get_interface_, \ +#define FT_DECLARE_MODULE( class_ ) \ + FT_CALLBACK_TABLE \ + const FT_Module_Class class_; + +#define FT_DEFINE_ROOT_MODULE( \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + { \ + flags_, \ + size_, \ + \ + name_, \ + version_, \ + requires_, \ + \ + interface_, \ + \ + init_, \ + done_, \ + get_interface_, \ }, -#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Module_Class class_ = \ - { \ - flags_, \ - size_, \ - \ - name_, \ - version_, \ - requires_, \ - \ - interface_, \ - \ - init_, \ - done_, \ - get_interface_, \ +#define FT_DEFINE_MODULE( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Module_Class class_ = \ + { \ + flags_, \ + size_, \ + \ + name_, \ + version_, \ + requires_, \ + \ + interface_, \ + \ + init_, \ + done_, \ + get_interface_, \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DECLARE_MODULE(class_) \ - FT_Error FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ); \ - void FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ); - -#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - clazz->root.module_flags = flags_; \ - clazz->root.module_size = size_; \ - clazz->root.module_name = name_; \ - clazz->root.module_version = version_; \ - clazz->root.module_requires = requires_; \ - \ - clazz->root.module_interface = interface_; \ - \ - clazz->root.module_init = init_; \ - clazz->root.module_done = done_; \ - clazz->root.get_interface = get_interface_; - -#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - class_##_pic_free( library ); \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Memory memory = library->memory; \ - FT_Module_Class* clazz; \ - FT_Error error; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ - return error; \ - error = class_##_pic_init( library ); \ - if(error) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - clazz->module_flags = flags_; \ - clazz->module_size = size_; \ - clazz->module_name = name_; \ - clazz->module_version = version_; \ - clazz->module_requires = requires_; \ - \ - clazz->module_interface = interface_; \ - \ - clazz->module_init = init_; \ - clazz->module_done = done_; \ - clazz->get_interface = get_interface_; \ - \ - *output_class = clazz; \ - return FT_Err_Ok; \ +#define FT_DECLARE_MODULE( class_ ) \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ); \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ); + +#define FT_DEFINE_ROOT_MODULE( \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + clazz->root.module_flags = flags_; \ + clazz->root.module_size = size_; \ + clazz->root.module_name = name_; \ + clazz->root.module_version = version_; \ + clazz->root.module_requires = requires_; \ + \ + clazz->root.module_interface = interface_; \ + \ + clazz->root.module_init = init_; \ + clazz->root.module_done = done_; \ + clazz->root.get_interface = get_interface_; + +#define FT_DEFINE_MODULE( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + class_ ## _pic_free( library ); \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ) \ + { \ + FT_Memory memory = library->memory; \ + FT_Module_Class* clazz = NULL; \ + FT_Error error; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ + return error; \ + error = class_ ## _pic_init( library ); \ + if ( error ) \ + { \ + FT_FREE( clazz ); \ + return error; \ + } \ + \ + clazz->module_flags = flags_; \ + clazz->module_size = size_; \ + clazz->module_name = name_; \ + clazz->module_version = version_; \ + clazz->module_requires = requires_; \ + \ + clazz->module_interface = interface_; \ + \ + clazz->module_init = init_; \ + clazz->module_done = done_; \ + clazz->get_interface = get_interface_; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/include/freetype/internal/ftpic.h b/include/freetype/internal/ftpic.h index 5b674e6..485ce7a 100644 --- a/include/freetype/internal/ftpic.h +++ b/include/freetype/internal/ftpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services (declaration). */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,29 +31,33 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC - typedef struct FT_PIC_Container_ + typedef struct FT_PIC_Container_ { /* pic containers for base */ - void* base; + void* base; + /* pic containers for modules */ - void* autofit; - void* cff; - void* pshinter; - void* psnames; - void* raster; - void* sfnt; - void* smooth; - void* truetype; + void* autofit; + void* cff; + void* pshinter; + void* psnames; + void* raster; + void* sfnt; + void* smooth; + void* truetype; + } FT_PIC_Container; - /* Initialize the various function tables, structs, etc. stored in the container. */ + + /* Initialize the various function tables, structs, etc. */ + /* stored in the container. */ FT_BASE( FT_Error ) - ft_pic_container_init( FT_Library library ); + ft_pic_container_init( FT_Library library ); /* Destroy the contents of the container. */ FT_BASE( void ) - ft_pic_container_destroy( FT_Library library ); + ft_pic_container_destroy( FT_Library library ); #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/include/freetype/internal/ftrfork.h b/include/freetype/internal/ftrfork.h index 77e1020..6307f2d 100644 --- a/include/freetype/internal/ftrfork.h +++ b/include/freetype/internal/ftrfork.h @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (specification). */ /* */ -/* Copyright 2004, 2006, 2007 by */ +/* Copyright 2004, 2006, 2007, 2012 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -80,26 +80,37 @@ FT_BEGIN_HEADER } ft_raccess_guess_rec; #ifndef FT_CONFIG_OPTION_PIC + /* this array is a storage in non-PIC mode, so ; is needed in END */ -#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ - const type name[] = { -#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ - { raccess_guess_##func_suffix, FT_RFork_Rule_##type_suffix }, -#define CONST_FT_RFORK_RULE_ARRAY_END }; +#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ + const type name[] = { +#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ + { raccess_guess_ ## func_suffix, \ + FT_RFork_Rule_ ## type_suffix }, +#define CONST_FT_RFORK_RULE_ARRAY_END }; + #else /* FT_CONFIG_OPTION_PIC */ + /* this array is a function in PIC mode, so no ; is needed in END */ -#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ - void FT_Init_##name ( type* storage ) { \ - type *local = storage; \ - int i = 0; -#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ - local[i].func = raccess_guess_##func_suffix; \ - local[i].type = FT_RFork_Rule_##type_suffix; \ - i++; -#define CONST_FT_RFORK_RULE_ARRAY_END } +#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ + void \ + FT_Init_ ## name( type* storage ) \ + { \ + type* local = storage; \ + \ + \ + int i = 0; +#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ + local[i].func = raccess_guess_ ## func_suffix; \ + local[i].type = FT_RFork_Rule_ ## type_suffix; \ + i++; +#define CONST_FT_RFORK_RULE_ARRAY_END } + #endif /* FT_CONFIG_OPTION_PIC */ + #endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */ + /*************************************************************************/ /* */ /* <Function> */ diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 4f481db..4ac988b 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -4,7 +4,7 @@ /* */ /* The FreeType services (specification only). */ /* */ -/* Copyright 2003-2007, 2009, 2012 by */ +/* Copyright 2003-2007, 2009, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -34,12 +34,12 @@ FT_BEGIN_HEADER -#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ - - /* we disable the warning `conditional expression is constant' here */ - /* in order to compile cleanly with the maximum level of warnings */ +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + /* We disable the warning `conditional expression is */ + /* constant' in order to compile cleanly with the maximum */ + /* level of warnings. */ +#pragma warning( push ) #pragma warning( disable : 4127 ) - #endif /* _MSC_VER */ /* @@ -92,6 +92,7 @@ FT_BEGIN_HEADER #endif /* !C++ */ + /* * @macro: * FT_FACE_FIND_GLOBAL_SERVICE @@ -167,7 +168,13 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Macro> */ - /* FT_DEFINE_SERVICEDESCREC1 .. FT_DEFINE_SERVICEDESCREC6 */ + /* FT_DEFINE_SERVICEDESCREC1 */ + /* FT_DEFINE_SERVICEDESCREC2 */ + /* FT_DEFINE_SERVICEDESCREC3 */ + /* FT_DEFINE_SERVICEDESCREC4 */ + /* FT_DEFINE_SERVICEDESCREC5 */ + /* FT_DEFINE_SERVICEDESCREC6 */ + /* FT_DEFINE_SERVICEDESCREC7 */ /* */ /* <Description> */ /* Used to initialize an array of FT_ServiceDescRec structures. */ @@ -264,6 +271,26 @@ FT_BEGIN_HEADER { NULL, NULL } \ }; +#define FT_DEFINE_SERVICEDESCREC7( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6, \ + serv_id_7, serv_data_7 ) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { serv_id_2, serv_data_2 }, \ + { serv_id_3, serv_data_3 }, \ + { serv_id_4, serv_data_4 }, \ + { serv_id_5, serv_data_5 }, \ + { serv_id_6, serv_data_6 }, \ + { serv_id_7, serv_data_7 }, \ + { NULL, NULL } \ + }; + #else /* FT_CONFIG_OPTION_PIC */ #define FT_DEFINE_SERVICEDESCREC1( class_, \ @@ -283,7 +310,7 @@ FT_BEGIN_HEADER FT_Create_Class_ ## class_( FT_Library library, \ FT_ServiceDescRec** output_class ) \ { \ - FT_ServiceDescRec* clazz; \ + FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ FT_Memory memory = library->memory; \ \ @@ -319,7 +346,7 @@ FT_BEGIN_HEADER FT_Create_Class_ ## class_( FT_Library library, \ FT_ServiceDescRec** output_class ) \ { \ - FT_ServiceDescRec* clazz; \ + FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ FT_Memory memory = library->memory; \ \ @@ -358,7 +385,7 @@ FT_BEGIN_HEADER FT_Create_Class_ ## class_( FT_Library library, \ FT_ServiceDescRec** output_class ) \ { \ - FT_ServiceDescRec* clazz; \ + FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ FT_Memory memory = library->memory; \ \ @@ -400,7 +427,7 @@ FT_BEGIN_HEADER FT_Create_Class_ ## class_( FT_Library library, \ FT_ServiceDescRec** output_class ) \ { \ - FT_ServiceDescRec* clazz; \ + FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ FT_Memory memory = library->memory; \ \ @@ -445,7 +472,7 @@ FT_BEGIN_HEADER FT_Create_Class_ ## class_( FT_Library library, \ FT_ServiceDescRec** output_class ) \ { \ - FT_ServiceDescRec* clazz; \ + FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ FT_Memory memory = library->memory; \ \ @@ -493,7 +520,7 @@ FT_BEGIN_HEADER FT_Create_Class_ ## class_( FT_Library library, \ FT_ServiceDescRec** output_class) \ { \ - FT_ServiceDescRec* clazz; \ + FT_ServiceDescRec* clazz = NULL; \ FT_Error error; \ FT_Memory memory = library->memory; \ \ @@ -521,6 +548,59 @@ FT_BEGIN_HEADER return FT_Err_Ok; \ } +#define FT_DEFINE_SERVICEDESCREC7( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6, \ + serv_id_7, serv_data_7 ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec** output_class) \ + { \ + FT_ServiceDescRec* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 8 ) ) \ + return error; \ + \ + clazz[0].serv_id = serv_id_1; \ + clazz[0].serv_data = serv_data_1; \ + clazz[1].serv_id = serv_id_2; \ + clazz[1].serv_data = serv_data_2; \ + clazz[2].serv_id = serv_id_3; \ + clazz[2].serv_data = serv_data_3; \ + clazz[3].serv_id = serv_id_4; \ + clazz[3].serv_data = serv_data_4; \ + clazz[4].serv_id = serv_id_5; \ + clazz[4].serv_data = serv_data_5; \ + clazz[5].serv_id = serv_id_6; \ + clazz[5].serv_data = serv_data_6; \ + clazz[6].serv_id = serv_id_7; \ + clazz[6].serv_data = serv_data_7; \ + clazz[7].serv_id = NULL; \ + clazz[7].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } + #endif /* FT_CONFIG_OPTION_PIC */ @@ -573,7 +653,9 @@ FT_BEGIN_HEADER /* * A magic number used within the services cache. */ -#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)-2) /* magic number */ + + /* ensure that value `1' has the same width as a pointer */ +#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~(FT_PtrDist)1) /* @@ -671,6 +753,7 @@ FT_BEGIN_HEADER #define FT_SERVICE_POSTSCRIPT_CMAPS_H <freetype/internal/services/svpscmap.h> #define FT_SERVICE_POSTSCRIPT_INFO_H <freetype/internal/services/svpsinfo.h> #define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h> +#define FT_SERVICE_PROPERTIES_H <freetype/internal/services/svprop.h> #define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h> #define FT_SERVICE_TRUETYPE_ENGINE_H <freetype/internal/services/svtteng.h> #define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h> @@ -680,6 +763,10 @@ FT_BEGIN_HEADER /* */ +#if defined( _MSC_VER ) +#pragma warning( pop ) +#endif + FT_END_HEADER #endif /* __FTSERV_H__ */ diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h index 8b18500..2661858 100644 --- a/include/freetype/internal/ftstream.h +++ b/include/freetype/internal/ftstream.h @@ -4,7 +4,7 @@ /* */ /* Stream handling (specification). */ /* */ -/* Copyright 1996-2002, 2004-2006, 2011 by */ +/* Copyright 1996-2002, 2004-2006, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -154,67 +154,60 @@ FT_BEGIN_HEADER /* */ #define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] ) -#define FT_INT8_( p, i ) ( ((const FT_Char*)(p))[(i)] ) #define FT_INT16( x ) ( (FT_Int16)(x) ) #define FT_UINT16( x ) ( (FT_UInt16)(x) ) #define FT_INT32( x ) ( (FT_Int32)(x) ) #define FT_UINT32( x ) ( (FT_UInt32)(x) ) -#define FT_BYTE_I16( p, i, s ) ( FT_INT16( FT_BYTE_( p, i ) ) << (s) ) + #define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) ) -#define FT_BYTE_I32( p, i, s ) ( FT_INT32( FT_BYTE_( p, i ) ) << (s) ) #define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) ) -#define FT_INT8_I16( p, i, s ) ( FT_INT16( FT_INT8_( p, i ) ) << (s) ) -#define FT_INT8_U16( p, i, s ) ( FT_UINT16( FT_INT8_( p, i ) ) << (s) ) -#define FT_INT8_I32( p, i, s ) ( FT_INT32( FT_INT8_( p, i ) ) << (s) ) -#define FT_INT8_U32( p, i, s ) ( FT_UINT32( FT_INT8_( p, i ) ) << (s) ) - -#define FT_PEEK_SHORT( p ) FT_INT16( FT_INT8_I16( p, 0, 8) | \ - FT_BYTE_I16( p, 1, 0) ) +#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8) | \ + FT_BYTE_U16( p, 1, 0) ) #define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \ FT_BYTE_U16( p, 1, 0 ) ) -#define FT_PEEK_LONG( p ) FT_INT32( FT_INT8_I32( p, 0, 24 ) | \ - FT_BYTE_I32( p, 1, 16 ) | \ - FT_BYTE_I32( p, 2, 8 ) | \ - FT_BYTE_I32( p, 3, 0 ) ) +#define FT_PEEK_LONG( p ) FT_INT32( FT_BYTE_U32( p, 0, 24 ) | \ + FT_BYTE_U32( p, 1, 16 ) | \ + FT_BYTE_U32( p, 2, 8 ) | \ + FT_BYTE_U32( p, 3, 0 ) ) #define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \ FT_BYTE_U32( p, 1, 16 ) | \ FT_BYTE_U32( p, 2, 8 ) | \ FT_BYTE_U32( p, 3, 0 ) ) -#define FT_PEEK_OFF3( p ) FT_INT32( FT_INT8_I32( p, 0, 16 ) | \ - FT_BYTE_I32( p, 1, 8 ) | \ - FT_BYTE_I32( p, 2, 0 ) ) +#define FT_PEEK_OFF3( p ) FT_INT32( FT_BYTE_U32( p, 0, 16 ) | \ + FT_BYTE_U32( p, 1, 8 ) | \ + FT_BYTE_U32( p, 2, 0 ) ) #define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \ FT_BYTE_U32( p, 1, 8 ) | \ FT_BYTE_U32( p, 2, 0 ) ) -#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_INT8_I16( p, 1, 8 ) | \ - FT_BYTE_I16( p, 0, 0 ) ) +#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_BYTE_U16( p, 1, 8 ) | \ + FT_BYTE_U16( p, 0, 0 ) ) #define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \ FT_BYTE_U16( p, 0, 0 ) ) -#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_INT8_I32( p, 3, 24 ) | \ - FT_BYTE_I32( p, 2, 16 ) | \ - FT_BYTE_I32( p, 1, 8 ) | \ - FT_BYTE_I32( p, 0, 0 ) ) +#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_BYTE_U32( p, 3, 24 ) | \ + FT_BYTE_U32( p, 2, 16 ) | \ + FT_BYTE_U32( p, 1, 8 ) | \ + FT_BYTE_U32( p, 0, 0 ) ) #define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \ FT_BYTE_U32( p, 2, 16 ) | \ FT_BYTE_U32( p, 1, 8 ) | \ FT_BYTE_U32( p, 0, 0 ) ) -#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_INT8_I32( p, 2, 16 ) | \ - FT_BYTE_I32( p, 1, 8 ) | \ - FT_BYTE_I32( p, 0, 0 ) ) +#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_BYTE_U32( p, 2, 16 ) | \ + FT_BYTE_U32( p, 1, 8 ) | \ + FT_BYTE_U32( p, 0, 0 ) ) #define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \ FT_BYTE_U32( p, 1, 8 ) | \ @@ -493,37 +486,41 @@ FT_BEGIN_HEADER #define FT_STREAM_POS() \ FT_Stream_Pos( stream ) -#define FT_STREAM_SEEK( position ) \ - FT_SET_ERROR( FT_Stream_Seek( stream, position ) ) +#define FT_STREAM_SEEK( position ) \ + FT_SET_ERROR( FT_Stream_Seek( stream, \ + (FT_ULong)(position) ) ) -#define FT_STREAM_SKIP( distance ) \ - FT_SET_ERROR( FT_Stream_Skip( stream, distance ) ) +#define FT_STREAM_SKIP( distance ) \ + FT_SET_ERROR( FT_Stream_Skip( stream, \ + (FT_Long)(distance) ) ) -#define FT_STREAM_READ( buffer, count ) \ - FT_SET_ERROR( FT_Stream_Read( stream, \ - (FT_Byte*)buffer, \ - count ) ) +#define FT_STREAM_READ( buffer, count ) \ + FT_SET_ERROR( FT_Stream_Read( stream, \ + (FT_Byte*)(buffer), \ + (FT_ULong)(count) ) ) -#define FT_STREAM_READ_AT( position, buffer, count ) \ - FT_SET_ERROR( FT_Stream_ReadAt( stream, \ - position, \ - (FT_Byte*)buffer, \ - count ) ) +#define FT_STREAM_READ_AT( position, buffer, count ) \ + FT_SET_ERROR( FT_Stream_ReadAt( stream, \ + (FT_ULong)(position), \ + (FT_Byte*)buffer, \ + (FT_ULong)(count) ) ) #define FT_STREAM_READ_FIELDS( fields, object ) \ FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) ) -#define FT_FRAME_ENTER( size ) \ - FT_SET_ERROR( \ - FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) ) +#define FT_FRAME_ENTER( size ) \ + FT_SET_ERROR( \ + FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, \ + (FT_ULong)(size) ) ) ) -#define FT_FRAME_EXIT() \ +#define FT_FRAME_EXIT() \ FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) ) #define FT_FRAME_EXTRACT( size, bytes ) \ FT_SET_ERROR( \ - FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size, \ + FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, \ + (FT_ULong)(size), \ (FT_Byte**)&(bytes) ) ) ) #define FT_FRAME_RELEASE( bytes ) \ diff --git a/include/freetype/internal/fttrace.h b/include/freetype/internal/fttrace.h index fbefdbd..a9d98b6 100644 --- a/include/freetype/internal/fttrace.h +++ b/include/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ /* */ /* Tracing handling (specification only). */ /* */ -/* Copyright 2002, 2004-2007, 2009, 2011 by */ +/* Copyright 2002, 2004-2007, 2009, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -38,6 +38,7 @@ FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */ FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */ FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */ FT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */ +FT_TRACE_DEF( bitmap ) /* bitmap checksum (ftobjs.c) */ /* Cache sub-system */ FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */ @@ -73,6 +74,7 @@ FT_TRACE_DEF( t1parse ) /* PostScript helper module `psaux' */ FT_TRACE_DEF( t1decode ) FT_TRACE_DEF( psobjs ) +FT_TRACE_DEF( psconv ) /* PostScript hinting module `pshinter' */ FT_TRACE_DEF( pshrec ) @@ -86,6 +88,10 @@ FT_TRACE_DEF( cffload ) FT_TRACE_DEF( cffobjs ) FT_TRACE_DEF( cffparse ) +FT_TRACE_DEF( cf2blues ) +FT_TRACE_DEF( cf2hints ) +FT_TRACE_DEF( cf2interp ) + /* Type 42 driver component */ FT_TRACE_DEF( t42 ) @@ -136,6 +142,8 @@ FT_TRACE_DEF( gxvprop ) FT_TRACE_DEF( gxvlcar ) /* autofit components */ +FT_TRACE_DEF( afmodule ) +FT_TRACE_DEF( afhints ) FT_TRACE_DEF( afcjk ) FT_TRACE_DEF( aflatin ) FT_TRACE_DEF( aflatin2 ) diff --git a/include/freetype/internal/ftvalid.h b/include/freetype/internal/ftvalid.h index 00cd85e..12ad036 100644 --- a/include/freetype/internal/ftvalid.h +++ b/include/freetype/internal/ftvalid.h @@ -4,7 +4,7 @@ /* */ /* FreeType validation support (specification). */ /* */ -/* Copyright 2004 by */ +/* Copyright 2004, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -76,6 +76,14 @@ FT_BEGIN_HEADER } FT_ValidationLevel; +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + /* We disable the warning `structure was padded due to */ + /* __declspec(align())' in order to compile cleanly with */ + /* the maximum level of warnings. */ +#pragma warning( push ) +#pragma warning( disable : 4324 ) +#endif /* _MSC_VER */ + /* validator structure */ typedef struct FT_ValidatorRec_ { @@ -88,8 +96,11 @@ FT_BEGIN_HEADER } FT_ValidatorRec; +#if defined( _MSC_VER ) +#pragma warning( pop ) +#endif -#define FT_VALIDATOR( x ) ((FT_Validator)( x )) +#define FT_VALIDATOR( x ) ( (FT_Validator)( x ) ) FT_BASE( void ) diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index a96e0df..e903114 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -5,7 +5,7 @@ /* Auxiliary functions and data structures related to PostScript fonts */ /* (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */ +/* Copyright 1996-2004, 2006, 2008, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -101,6 +101,9 @@ FT_BEGIN_HEADER /* capacity :: The current size of the heap block. Increments by */ /* 1kByte chunks. */ /* */ + /* init :: Set to 0xDEADBEEF if `elements' and `lengths' have */ + /* been allocated. */ + /* */ /* max_elems :: The maximum number of elements in table. */ /* */ /* num_elems :: The current number of elements in table. */ @@ -183,6 +186,7 @@ FT_BEGIN_HEADER T1_FIELD_TYPE_STRING, T1_FIELD_TYPE_KEY, T1_FIELD_TYPE_BBOX, + T1_FIELD_TYPE_MM_BBOX, T1_FIELD_TYPE_INTEGER_ARRAY, T1_FIELD_TYPE_FIXED_ARRAY, T1_FIELD_TYPE_CALLBACK, @@ -225,7 +229,7 @@ FT_BEGIN_HEADER T1_Field_ParseFunc reader; FT_UInt offset; /* offset of field in object */ FT_Byte size; /* size of field in bytes */ - FT_UInt array_max; /* maximal number of elements for */ + FT_UInt array_max; /* maximum number of elements for */ /* array */ FT_UInt count_offset; /* offset of element count for */ /* arrays; must not be zero if in */ @@ -531,7 +535,7 @@ FT_BEGIN_HEADER /* */ /* max_points :: maximum points in builder outline */ /* */ - /* max_contours :: Maximal number of contours in builder outline. */ + /* max_contours :: Maximum number of contours in builder outline. */ /* */ /* pos_x :: The horizontal translation (if composite glyph). */ /* */ diff --git a/include/freetype/internal/pshints.h b/include/freetype/internal/pshints.h index 5b7b698..3fb18dc 100644 --- a/include/freetype/internal/pshints.h +++ b/include/freetype/internal/pshints.h @@ -6,7 +6,7 @@ /* recorders (specification only). These are used to support native */ /* T1/T2 hints in the `type1', `cid', and `cff' font drivers. */ /* */ -/* Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2009 by */ +/* Copyright 2001-2003, 2005-2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -679,27 +679,37 @@ FT_BEGIN_HEADER typedef PSHinter_Interface* PSHinter_Service; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_, \ - get_t1_funcs_, get_t2_funcs_) \ - static const PSHinter_Interface class_ = \ - { \ - get_globals_funcs_, get_t1_funcs_, get_t2_funcs_ \ +#define FT_DEFINE_PSHINTER_INTERFACE( \ + class_, \ + get_globals_funcs_, \ + get_t1_funcs_, \ + get_t2_funcs_ ) \ + static const PSHinter_Interface class_ = \ + { \ + get_globals_funcs_, \ + get_t1_funcs_, \ + get_t2_funcs_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_, \ - get_t1_funcs_, get_t2_funcs_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - PSHinter_Interface* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->get_globals_funcs = get_globals_funcs_; \ - clazz->get_t1_funcs = get_t1_funcs_; \ - clazz->get_t2_funcs = get_t2_funcs_; \ +#define FT_DEFINE_PSHINTER_INTERFACE( \ + class_, \ + get_globals_funcs_, \ + get_t1_funcs_, \ + get_t2_funcs_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + PSHinter_Interface* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->get_globals_funcs = get_globals_funcs_; \ + clazz->get_t1_funcs = get_t1_funcs_; \ + clazz->get_t2_funcs = get_t2_funcs_; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/include/freetype/internal/services/svprop.h b/include/freetype/internal/services/svprop.h new file mode 100644 index 0000000..22da0bb --- /dev/null +++ b/include/freetype/internal/services/svprop.h @@ -0,0 +1,81 @@ +/***************************************************************************/ +/* */ +/* svprop.h */ +/* */ +/* The FreeType property service (specification). */ +/* */ +/* Copyright 2012 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVPROP_H__ +#define __SVPROP_H__ + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_PROPERTIES "properties" + + + typedef FT_Error + (*FT_Properties_SetFunc)( FT_Module module, + const char* property_name, + const void* value ); + + typedef FT_Error + (*FT_Properties_GetFunc)( FT_Module module, + const char* property_name, + void* value ); + + + FT_DEFINE_SERVICE( Properties ) + { + FT_Properties_SetFunc set_property; + FT_Properties_GetFunc get_property; + }; + + +#ifndef FT_CONFIG_OPTION_PIC + +#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \ + set_property_, \ + get_property_ ) \ + static const FT_Service_PropertiesRec class_ = \ + { \ + set_property_, \ + get_property_ \ + }; + +#else /* FT_CONFIG_OPTION_PIC */ + +#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \ + set_property_, \ + get_property_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Service_PropertiesRec* clazz ) \ + { \ + clazz->set_property = set_property_; \ + clazz->get_property = get_property_; \ + } + +#endif /* FT_CONFIG_OPTION_PIC */ + + /* */ + + +FT_END_HEADER + + +#endif /* __SVPROP_H__ */ + + +/* END */ diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index 905ca8c..6b5e41f 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ /* */ /* High-level `sfnt' driver interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ +/* Copyright 1996-2006, 2009, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -125,77 +125,6 @@ FT_BEGIN_HEADER (*TT_Done_Face_Func)( TT_Face face ); -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_SFNT_HeaderRec_Func */ - /* */ - /* <Description> */ - /* Loads the header of a SFNT font file. Supports collections. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* face_index :: The index of the TrueType font, if we are opening a */ - /* collection. */ - /* */ - /* <Output> */ - /* sfnt :: The SFNT header. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The stream cursor must be at the font file's origin. */ - /* */ - /* This function recognizes fonts embedded in a `TrueType */ - /* collection'. */ - /* */ - /* This function checks that the header is valid by looking at the */ - /* values of `search_range', `entry_selector', and `range_shift'. */ - /* */ - typedef FT_Error - (*TT_Load_SFNT_HeaderRec_Func)( TT_Face face, - FT_Stream stream, - FT_Long face_index, - SFNT_Header sfnt ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_Directory_Func */ - /* */ - /* <Description> */ - /* Loads the table directory into a face object. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* sfnt :: The SFNT header. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The stream cursor must be on the first byte after the 4-byte font */ - /* format tag. This is the case just after a call to */ - /* TT_Load_Format_Tag(). */ - /* */ - typedef FT_Error - (*TT_Load_Directory_Func)( TT_Face face, - FT_Stream stream, - SFNT_Header sfnt ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /*************************************************************************/ /* */ /* <FuncType> */ @@ -363,88 +292,6 @@ FT_BEGIN_HEADER TT_SBit_MetricsRec *ametrics ); -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Set_SBit_Strike_OldFunc */ - /* */ - /* <Description> */ - /* Select an sbit strike for a given size request. */ - /* */ - /* <Input> */ - /* face :: The target face object. */ - /* */ - /* req :: The size request. */ - /* */ - /* <Output> */ - /* astrike_index :: The index of the sbit strike. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. Returns an error if no */ - /* sbit strike exists for the selected ppem values. */ - /* */ - typedef FT_Error - (*TT_Set_SBit_Strike_OldFunc)( TT_Face face, - FT_UInt x_ppem, - FT_UInt y_ppem, - FT_ULong* astrike_index ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_CharMap_Load_Func */ - /* */ - /* <Description> */ - /* Loads a given TrueType character map into memory. */ - /* */ - /* <Input> */ - /* face :: A handle to the parent face object. */ - /* */ - /* stream :: A handle to the current stream object. */ - /* */ - /* <InOut> */ - /* cmap :: A pointer to a cmap object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The function assumes that the stream is already in use (i.e., */ - /* opened). In case of error, all partially allocated tables are */ - /* released. */ - /* */ - typedef FT_Error - (*TT_CharMap_Load_Func)( TT_Face face, - void* cmap, - FT_Stream input ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_CharMap_Free_Func */ - /* */ - /* <Description> */ - /* Destroys a character mapping table. */ - /* */ - /* <Input> */ - /* face :: A handle to the parent face object. */ - /* */ - /* cmap :: A handle to a cmap object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - typedef FT_Error - (*TT_CharMap_Free_Func)( TT_Face face, - void* cmap ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /*************************************************************************/ /* */ /* <FuncType> */ @@ -657,11 +504,6 @@ FT_BEGIN_HEADER TT_Load_Any_Func load_any; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - TT_Load_SFNT_HeaderRec_Func load_sfnt_header; - TT_Load_Directory_Func load_directory; -#endif - /* these functions are called by `load_face' but they can also */ /* be called from external modules, if there is a need to do so */ TT_Load_Table_Func load_head; @@ -674,12 +516,6 @@ FT_BEGIN_HEADER TT_Load_Table_Func load_name; TT_Free_Table_Func free_name; - /* optional tables */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - TT_Load_Table_Func load_hdmx_stub; - TT_Free_Table_Func free_hdmx_stub; -#endif - /* this field was called `load_kerning' up to version 2.1.10 */ TT_Load_Table_Func load_kern; @@ -690,43 +526,12 @@ FT_BEGIN_HEADER /* version 2.1.10 */ TT_Load_Table_Func load_bhed; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /* see `ttsbit.h' */ - TT_Set_SBit_Strike_OldFunc set_sbit_strike_stub; - TT_Load_Table_Func load_sbits_stub; - - /* - * The following two fields appeared in version 2.1.8, and were placed - * between `load_sbits' and `load_sbit_image'. We support them as a - * special exception since they are used by Xfont library within the - * X.Org xserver, and because the probability that other rogue clients - * use the other version 2.1.7 fields below is _extremely_ low. - * - * Note that this forces us to disable an interesting memory-saving - * optimization though... - */ - - TT_Find_SBit_Image_Func find_sbit_image; - TT_Load_SBit_Metrics_Func load_sbit_metrics; - -#endif - TT_Load_SBit_Image_Func load_sbit_image; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - TT_Free_Table_Func free_sbits_stub; -#endif - /* see `ttpost.h' */ TT_Get_PS_Name_Func get_psname; TT_Free_Table_Func free_psnames; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - TT_CharMap_Load_Func load_charmap_stub; - TT_CharMap_Free_Func free_charmap_stub; -#endif - /* starting here, the structure differs from version 2.1.7 */ /* this field was introduced in version 2.1.8, named `get_psname' */ @@ -755,136 +560,141 @@ FT_BEGIN_HEADER #ifndef FT_CONFIG_OPTION_PIC -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) \ - a, -#else - #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) -#endif -#define FT_INTERNAL(a) \ - a, - -#define FT_DEFINE_SFNT_INTERFACE(class_, \ - goto_table_, init_face_, load_face_, done_face_, get_interface_, \ - load_any_, load_sfnt_header_, load_directory_, load_head_, \ - load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_, \ - load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_, \ - load_kern_, load_gasp_, load_pclt_, load_bhed_, \ - set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_, \ - load_sbit_metrics_, load_sbit_image_, free_sbits_stub_, \ - get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_, \ - get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_, \ - set_sbit_strike_, load_strike_metrics_, get_metrics_ ) \ - static const SFNT_Interface class_ = \ - { \ - FT_INTERNAL(goto_table_) \ - FT_INTERNAL(init_face_) \ - FT_INTERNAL(load_face_) \ - FT_INTERNAL(done_face_) \ - FT_INTERNAL(get_interface_) \ - FT_INTERNAL(load_any_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory_) \ - FT_INTERNAL(load_head_) \ - FT_INTERNAL(load_hhea_) \ - FT_INTERNAL(load_cmap_) \ - FT_INTERNAL(load_maxp_) \ - FT_INTERNAL(load_os2_) \ - FT_INTERNAL(load_post_) \ - FT_INTERNAL(load_name_) \ - FT_INTERNAL(free_name_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub_) \ - FT_INTERNAL(load_kern_) \ - FT_INTERNAL(load_gasp_) \ - FT_INTERNAL(load_pclt_) \ - FT_INTERNAL(load_bhed_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics_) \ - FT_INTERNAL(load_sbit_image_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub_) \ - FT_INTERNAL(get_psname_) \ - FT_INTERNAL(free_psnames_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub_) \ - FT_INTERNAL(get_kerning_) \ - FT_INTERNAL(load_font_dir_) \ - FT_INTERNAL(load_hmtx_) \ - FT_INTERNAL(load_eblc_) \ - FT_INTERNAL(free_eblc_) \ - FT_INTERNAL(set_sbit_strike_) \ - FT_INTERNAL(load_strike_metrics_) \ - FT_INTERNAL(get_metrics_) \ +#define FT_DEFINE_SFNT_INTERFACE( \ + class_, \ + goto_table_, \ + init_face_, \ + load_face_, \ + done_face_, \ + get_interface_, \ + load_any_, \ + load_head_, \ + load_hhea_, \ + load_cmap_, \ + load_maxp_, \ + load_os2_, \ + load_post_, \ + load_name_, \ + free_name_, \ + load_kern_, \ + load_gasp_, \ + load_pclt_, \ + load_bhed_, \ + load_sbit_image_, \ + get_psname_, \ + free_psnames_, \ + get_kerning_, \ + load_font_dir_, \ + load_hmtx_, \ + load_eblc_, \ + free_eblc_, \ + set_sbit_strike_, \ + load_strike_metrics_, \ + get_metrics_ ) \ + static const SFNT_Interface class_ = \ + { \ + goto_table_, \ + init_face_, \ + load_face_, \ + done_face_, \ + get_interface_, \ + load_any_, \ + load_head_, \ + load_hhea_, \ + load_cmap_, \ + load_maxp_, \ + load_os2_, \ + load_post_, \ + load_name_, \ + free_name_, \ + load_kern_, \ + load_gasp_, \ + load_pclt_, \ + load_bhed_, \ + load_sbit_image_, \ + get_psname_, \ + free_psnames_, \ + get_kerning_, \ + load_font_dir_, \ + load_hmtx_, \ + load_eblc_, \ + free_eblc_, \ + set_sbit_strike_, \ + load_strike_metrics_, \ + get_metrics_, \ }; #else /* FT_CONFIG_OPTION_PIC */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) \ - clazz->a = a_; -#else - #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) -#endif -#define FT_INTERNAL(a, a_) \ - clazz->a = a_; - -#define FT_DEFINE_SFNT_INTERFACE(class_, \ - goto_table_, init_face_, load_face_, done_face_, get_interface_, \ - load_any_, load_sfnt_header_, load_directory_, load_head_, \ - load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_, \ - load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_, \ - load_kern_, load_gasp_, load_pclt_, load_bhed_, \ - set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_, \ - load_sbit_metrics_, load_sbit_image_, free_sbits_stub_, \ - get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_, \ - get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_, \ - set_sbit_strike_, load_strike_metrics_, get_metrics_ ) \ - void \ - FT_Init_Class_##class_( FT_Library library, SFNT_Interface* clazz ) \ - { \ - FT_UNUSED(library); \ - FT_INTERNAL(goto_table,goto_table_) \ - FT_INTERNAL(init_face,init_face_) \ - FT_INTERNAL(load_face,load_face_) \ - FT_INTERNAL(done_face,done_face_) \ - FT_INTERNAL(get_interface,get_interface_) \ - FT_INTERNAL(load_any,load_any_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header,load_sfnt_header_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory,load_directory_) \ - FT_INTERNAL(load_head,load_head_) \ - FT_INTERNAL(load_hhea,load_hhea_) \ - FT_INTERNAL(load_cmap,load_cmap_) \ - FT_INTERNAL(load_maxp,load_maxp_) \ - FT_INTERNAL(load_os2,load_os2_) \ - FT_INTERNAL(load_post,load_post_) \ - FT_INTERNAL(load_name,load_name_) \ - FT_INTERNAL(free_name,free_name_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub,load_hdmx_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub,free_hdmx_stub_) \ - FT_INTERNAL(load_kern,load_kern_) \ - FT_INTERNAL(load_gasp,load_gasp_) \ - FT_INTERNAL(load_pclt,load_pclt_) \ - FT_INTERNAL(load_bhed,load_bhed_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub,set_sbit_strike_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub,load_sbits_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image,find_sbit_image_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics,load_sbit_metrics_) \ - FT_INTERNAL(load_sbit_image,load_sbit_image_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub,free_sbits_stub_) \ - FT_INTERNAL(get_psname,get_psname_) \ - FT_INTERNAL(free_psnames,free_psnames_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub,load_charmap_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub,free_charmap_stub_) \ - FT_INTERNAL(get_kerning,get_kerning_) \ - FT_INTERNAL(load_font_dir,load_font_dir_) \ - FT_INTERNAL(load_hmtx,load_hmtx_) \ - FT_INTERNAL(load_eblc,load_eblc_) \ - FT_INTERNAL(free_eblc,free_eblc_) \ - FT_INTERNAL(set_sbit_strike,set_sbit_strike_) \ - FT_INTERNAL(load_strike_metrics,load_strike_metrics_) \ - FT_INTERNAL(get_metrics,get_metrics_) \ +#define FT_INTERNAL( a, a_ ) \ + clazz->a = a_; + +#define FT_DEFINE_SFNT_INTERFACE( \ + class_, \ + goto_table_, \ + init_face_, \ + load_face_, \ + done_face_, \ + get_interface_, \ + load_any_, \ + load_head_, \ + load_hhea_, \ + load_cmap_, \ + load_maxp_, \ + load_os2_, \ + load_post_, \ + load_name_, \ + free_name_, \ + load_kern_, \ + load_gasp_, \ + load_pclt_, \ + load_bhed_, \ + load_sbit_image_, \ + get_psname_, \ + free_psnames_, \ + get_kerning_, \ + load_font_dir_, \ + load_hmtx_, \ + load_eblc_, \ + free_eblc_, \ + set_sbit_strike_, \ + load_strike_metrics_, \ + get_metrics_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + SFNT_Interface* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->goto_table = goto_table_; \ + clazz->init_face = init_face_; \ + clazz->load_face = load_face_; \ + clazz->done_face = done_face_; \ + clazz->get_interface = get_interface_; \ + clazz->load_any = load_any_; \ + clazz->load_head = load_head_; \ + clazz->load_hhea = load_hhea_; \ + clazz->load_cmap = load_cmap_; \ + clazz->load_maxp = load_maxp_; \ + clazz->load_os2 = load_os2_; \ + clazz->load_post = load_post_; \ + clazz->load_name = load_name_; \ + clazz->free_name = free_name_; \ + clazz->load_kern = load_kern_; \ + clazz->load_gasp = load_gasp_; \ + clazz->load_pclt = load_pclt_; \ + clazz->load_bhed = load_bhed_; \ + clazz->load_sbit_image = load_sbit_image_; \ + clazz->get_psname = get_psname_; \ + clazz->free_psnames = free_psnames_; \ + clazz->get_kerning = get_kerning_; \ + clazz->load_font_dir = load_font_dir_; \ + clazz->load_hmtx = load_hmtx_; \ + clazz->load_eblc = load_eblc_; \ + clazz->free_eblc = free_eblc_; \ + clazz->set_sbit_strike = set_sbit_strike_; \ + clazz->load_strike_metrics = load_strike_metrics_; \ + clazz->get_metrics = get_metrics_; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index f859de2..e20237c 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -5,7 +5,7 @@ /* Basic Type1/Type2 type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2004, 2006, 2008, 2009, 2011 by */ +/* Copyright 1996-2004, 2006, 2008, 2009, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -205,10 +205,6 @@ FT_BEGIN_HEADER FT_CharMapRec charmaprecs[2]; FT_CharMap charmaps[2]; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - PS_Unicodes unicode_map; -#endif - /* support for Multiple Masters fonts */ PS_Blend blend; diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 57b1731..1bbfe49 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2002, 2004-2008, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -311,87 +311,6 @@ FT_BEGIN_HEADER } TT_GaspRec; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_HdmxEntryRec */ - /* */ - /* <Description> */ - /* A small structure used to model the pre-computed widths of a given */ - /* size. They are found in the `hdmx' table. */ - /* */ - /* <Fields> */ - /* ppem :: The pixels per EM value at which these metrics apply. */ - /* */ - /* max_width :: The maximum advance width for this metric. */ - /* */ - /* widths :: An array of widths. Note: These are 8-bit bytes. */ - /* */ - typedef struct TT_HdmxEntryRec_ - { - FT_Byte ppem; - FT_Byte max_width; - FT_Byte* widths; - - } TT_HdmxEntryRec, *TT_HdmxEntry; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_HdmxRec */ - /* */ - /* <Description> */ - /* A structure used to model the `hdmx' table, which contains */ - /* pre-computed widths for a set of given sizes/dimensions. */ - /* */ - /* <Fields> */ - /* version :: The version number. */ - /* */ - /* num_records :: The number of hdmx records. */ - /* */ - /* records :: An array of hdmx records. */ - /* */ - typedef struct TT_HdmxRec_ - { - FT_UShort version; - FT_Short num_records; - TT_HdmxEntry records; - - } TT_HdmxRec, *TT_Hdmx; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_Kern0_PairRec */ - /* */ - /* <Description> */ - /* A structure used to model a kerning pair for the kerning table */ - /* format 0. The engine now loads this table if it finds one in the */ - /* font file. */ - /* */ - /* <Fields> */ - /* left :: The index of the left glyph in pair. */ - /* */ - /* right :: The index of the right glyph in pair. */ - /* */ - /* value :: The kerning distance. A positive value spaces the */ - /* glyphs, a negative one makes them closer. */ - /* */ - typedef struct TT_Kern0_PairRec_ - { - FT_UShort left; /* index of left glyph in pair */ - FT_UShort right; /* index of right glyph in pair */ - FT_FWord value; /* kerning value */ - - } TT_Kern0_PairRec, *TT_Kern0_Pair; - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -1269,9 +1188,6 @@ FT_BEGIN_HEADER TT_HoriHeader horizontal; /* TrueType horizontal header */ TT_MaxProfile max_profile; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_ULong max_components; /* stubbed to 0 */ -#endif FT_Bool vertical_info; TT_VertHeader vertical; /* TT Vertical header, if present */ @@ -1308,11 +1224,6 @@ FT_BEGIN_HEADER /* */ /***********************************************************************/ - /* horizontal device metrics */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - TT_HdmxRec hdmx; -#endif - /* grid-fitting and scaling table */ TT_GaspRec gasp; /* the `gasp' table */ @@ -1320,11 +1231,6 @@ FT_BEGIN_HEADER TT_PCLT pclt; /* embedded bitmaps support */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_ULong num_sbit_strikes; - TT_SBit_Strike sbit_strikes; -#endif - FT_ULong num_sbit_scales; TT_SBit_Scale sbit_scales; @@ -1338,12 +1244,6 @@ FT_BEGIN_HEADER /* */ /***********************************************************************/ - /* the glyph locations */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_UShort num_locations_stub; - FT_Long* glyph_locations_stub; -#endif - /* the font program, if any */ FT_ULong font_program_size; FT_Byte* font_program; @@ -1356,13 +1256,6 @@ FT_BEGIN_HEADER FT_ULong cvt_size; FT_Short* cvt; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - /* the format 0 kerning table, if any */ - FT_Int num_kern_pairs; - FT_Int kern_table_index; - TT_Kern0_Pair kern_pairs; -#endif - /* A pointer to the bytecode interpreter to use. This is also */ /* used to hook the debugger for the `ttdebug' utility. */ TT_Interpreter interpreter; @@ -1383,11 +1276,8 @@ FT_BEGIN_HEADER const char* postscript_name; - /* since version 2.1.8, but was originally placed after */ - /* `glyph_locations_stub' */ FT_ULong glyf_len; - /* since version 2.1.8, but was originally placed before `extra' */ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_Bool doblend; GX_Blend blend; @@ -1428,6 +1318,13 @@ FT_BEGIN_HEADER FT_ULong horz_metrics_offset; FT_ULong vert_metrics_offset; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /* since 2.4.12 */ + FT_ULong sph_found_func_flags; /* special functions found */ + /* for this face */ + FT_Bool sph_compatibility_mode; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + } TT_FaceRec; @@ -1443,7 +1340,7 @@ FT_BEGIN_HEADER /* <Fields> */ /* memory :: A handle to the memory manager. */ /* */ - /* max_points :: The maximal size in points of the zone. */ + /* max_points :: The maximum size in points of the zone. */ /* */ /* max_contours :: Max size in links contours of the zone. */ /* */ diff --git a/include/freetype/ttnameid.h b/include/freetype/ttnameid.h index 66aef04..173f88c 100644 --- a/include/freetype/ttnameid.h +++ b/include/freetype/ttnameid.h @@ -4,7 +4,7 @@ /* */ /* TrueType name ID definitions (specification only). */ /* */ -/* Copyright 1996-2002, 2003, 2004, 2006, 2007, 2008 by */ +/* Copyright 1996-2004, 2006-2008, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -316,11 +316,12 @@ FT_BEGIN_HEADER /* */ /* Possible values of the language identifier field in the name records */ /* of the TTF `name' table if the `platform' identifier code is */ - /* TT_PLATFORM_MACINTOSH. */ + /* TT_PLATFORM_MACINTOSH. These values are also used as return values */ + /* for function @FT_Get_CMap_Language_ID. */ /* */ /* The canonical source for the Apple assigned Language ID's is at */ /* */ - /* http://fonts.apple.com/TTRefMan/RM06/Chap6name.html */ + /* https://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html */ /* */ #define TT_MAC_LANGID_ENGLISH 0 #define TT_MAC_LANGID_FRENCH 1 @@ -461,21 +462,10 @@ FT_BEGIN_HEADER /* of the TTF `name' table if the `platform' identifier code is */ /* TT_PLATFORM_MICROSOFT. */ /* */ - /* The canonical source for the MS assigned LCID's (seems to) be at */ + /* The canonical source for the MS assigned LCIDs is */ /* */ /* http://www.microsoft.com/globaldev/reference/lcid-all.mspx */ /* */ - /* It used to be at various places, among them */ - /* */ - /* http://www.microsoft.com/typography/OTSPEC/lcid-cp.txt */ - /* http://www.microsoft.com/globaldev/reference/loclanghome.asp */ - /* http://support.microsoft.com/support/kb/articles/Q224/8/04.ASP */ - /* http://msdn.microsoft.com/library/en-us/passport25/ */ - /* NET_Passport_VBScript_Documentation/Single_Sign_In/ */ - /* Advanced_Single_Sign_In/Localization_and_LCIDs.asp */ - /* */ - /* Hopefully, it seems now that the Globaldev site prevails... */ - /* (updated by Antoine, 2004-02-17) */ #define TT_MS_LANGID_ARABIC_GENERAL 0x0001 #define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401 diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h index 02236c2..fe07117 100644 --- a/include/freetype/tttables.h +++ b/include/freetype/tttables.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType tables definitions and interface */ /* (specification only). */ /* */ -/* Copyright 1996-2005, 2008-2011 by */ +/* Copyright 1996-2005, 2008-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -600,6 +600,16 @@ FT_BEGIN_HEADER /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ /* a list. */ /* */ + /* Here an example how to access the `vhea' table: */ + /* */ + /* { */ + /* TT_VertHeader* vert_header; */ + /* */ + /* */ + /* vert_header = */ + /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, ft_sfnt_vhea ); */ + /* } */ + /* */ FT_EXPORT( void* ) FT_Get_Sfnt_Table( FT_Face face, FT_Sfnt_Tag tag ); @@ -702,7 +712,8 @@ FT_BEGIN_HEADER * FreeType error code. 0~means success. * * @note: - * SFNT tables with length zero are treated as missing. + * While parsing fonts, FreeType handles SFNT tables with length zero as + * missing. * */ FT_EXPORT( FT_Error ) @@ -729,6 +740,9 @@ FT_BEGIN_HEADER /* The language ID of `charmap'. If `charmap' doesn't belong to a */ /* TrueType/sfnt face, just return~0 as the default value. */ /* */ + /* For a format~14 cmap (to access Unicode IVS), the return value is */ + /* 0xFFFFFFFF. */ + /* */ FT_EXPORT( FT_ULong ) FT_Get_CMap_Language_ID( FT_CharMap charmap ); diff --git a/include/freetype/tttags.h b/include/freetype/tttags.h index 307ce4b..be8c524 100644 --- a/include/freetype/tttags.h +++ b/include/freetype/tttags.h @@ -4,7 +4,7 @@ /* */ /* Tags for TrueType and OpenType tables (specification only). */ /* */ -/* Copyright 1996-2001, 2004, 2005, 2007, 2008 by */ +/* Copyright 1996-2001, 2004, 2005, 2007, 2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -40,6 +40,8 @@ FT_BEGIN_HEADER #define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) #define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) #define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' ) +#define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' ) +#define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' ) #define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) #define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) #define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) -- cgit v1.2.3