diff options
author | marha <marha@users.sourceforge.net> | 2015-06-15 20:22:43 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2015-06-15 20:22:43 +0200 |
commit | 0b3be550b20ad9f991f77bf979b2c306a7d4ef11 (patch) | |
tree | 523f6db090457118723eca33dabc7758eeb2dcde /freetype/src/autofit | |
parent | 5fe210ff514aa4b3149ea7561862776d7b8849e7 (diff) | |
download | vcxsrv-0b3be550b20ad9f991f77bf979b2c306a7d4ef11.tar.gz vcxsrv-0b3be550b20ad9f991f77bf979b2c306a7d4ef11.tar.bz2 vcxsrv-0b3be550b20ad9f991f77bf979b2c306a7d4ef11.zip |
Update to freetype 2.6
Diffstat (limited to 'freetype/src/autofit')
42 files changed, 683 insertions, 557 deletions
diff --git a/freetype/src/autofit/Jamfile b/freetype/src/autofit/Jamfile index 2714765b5..6600a3447 100644 --- a/freetype/src/autofit/Jamfile +++ b/freetype/src/autofit/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/autofit Jamfile # -# Copyright 2003, 2004, 2005, 2006, 2007, 2009 by +# Copyright 2003-2015 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/freetype/src/autofit/afangles.c b/freetype/src/autofit/afangles.c index f8b095bef..1b1eb31fe 100644 --- a/freetype/src/autofit/afangles.c +++ b/freetype/src/autofit/afangles.c @@ -5,7 +5,7 @@ /* Routines used to compute vector angles with limited accuracy */ /* and very high speed. It also contains sorting routines (body). */ /* */ -/* Copyright 2003-2006, 2011-2012 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -259,7 +259,7 @@ sum += table[j].org; table[j].org = 0; } - table[cur_idx].org = sum / j; + table[cur_idx].org = sum / (FT_Pos)j; if ( i < *count - 1 ) { diff --git a/freetype/src/autofit/afblue.c b/freetype/src/autofit/afblue.c index 811226eac..e2b24519a 100644 --- a/freetype/src/autofit/afblue.c +++ b/freetype/src/autofit/afblue.c @@ -7,7 +7,7 @@ /* */ /* Auto-fitter data for blue strings (body). */ /* */ -/* Copyright 2013 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,6 +26,10 @@ af_blue_strings[] = { /* */ + '\xD8', '\xA7', '\xD8', '\xA5', '\xD9', '\x84', '\xD9', '\x83', '\xD8', '\xB7', '\xD8', '\xB8', /* ا إ ل ك ط ظ */ + '\0', + '\xD8', '\xAA', '\xD8', '\xAB', '\xD8', '\xB7', '\xD8', '\xB8', '\xD9', '\x83', /* ت ث ط ظ ك */ + '\0', '\xD0', '\x91', '\xD0', '\x92', '\xD0', '\x95', '\xD0', '\x9F', '\xD0', '\x97', '\xD0', '\x9E', '\xD0', '\xA1', '\xD0', '\xAD', /* БВЕПЗОСЭ */ '\0', '\xD0', '\x91', '\xD0', '\x92', '\xD0', '\x95', '\xD0', '\xA8', '\xD0', '\x97', '\xD0', '\x9E', '\xD0', '\xA1', '\xD0', '\xAD', /* БВЕШЗОСЭ */ @@ -71,6 +75,20 @@ '\xE0', '\xB0', '\x87', '\xE0', '\xB0', '\x8C', '\xE0', '\xB0', '\x99', '\xE0', '\xB0', '\x9E', '\xE0', '\xB0', '\xA3', '\xE0', '\xB0', '\xB1', '\xE0', '\xB1', '\xAF', /* ఇ ఌ ఙ ఞ ణ ఱ ౯ */ '\0', '\xE0', '\xB0', '\x85', '\xE0', '\xB0', '\x95', '\xE0', '\xB0', '\x9A', '\xE0', '\xB0', '\xB0', '\xE0', '\xB0', '\xBD', '\xE0', '\xB1', '\xA8', '\xE0', '\xB1', '\xAC', /* అ క చ ర ఽ ౨ ౬ */ + '\0', + '\xE0', '\xB8', '\x9A', '\xE0', '\xB9', '\x80', '\xE0', '\xB9', '\x81', '\xE0', '\xB8', '\xAD', '\xE0', '\xB8', '\x81', '\xE0', '\xB8', '\xB2', /* บ เ แ อ ก า */ + '\0', + '\xE0', '\xB8', '\x9A', '\xE0', '\xB8', '\x9B', '\xE0', '\xB8', '\xA9', '\xE0', '\xB8', '\xAF', '\xE0', '\xB8', '\xAD', '\xE0', '\xB8', '\xA2', '\xE0', '\xB8', '\xAE', /* บ ป ษ ฯ อ ย ฮ */ + '\0', + '\xE0', '\xB8', '\x9B', '\xE0', '\xB8', '\x9D', '\xE0', '\xB8', '\x9F', /* ป ฝ ฟ */ + '\0', + '\xE0', '\xB9', '\x82', '\xE0', '\xB9', '\x83', '\xE0', '\xB9', '\x84', /* โ ใ ไ */ + '\0', + '\xE0', '\xB8', '\x8E', '\xE0', '\xB8', '\x8F', '\xE0', '\xB8', '\xA4', '\xE0', '\xB8', '\xA6', /* ฎ ฏ ฤ ฦ */ + '\0', + '\xE0', '\xB8', '\x8D', '\xE0', '\xB8', '\x90', /* ญ ฐ */ + '\0', + '\xE0', '\xB9', '\x90', '\xE0', '\xB9', '\x91', '\xE0', '\xB9', '\x93', /* ๐ ๑ ๓ */ #ifdef AF_CONFIG_OPTION_CJK '\0', '\xE4', '\xBB', '\x96', '\xE4', '\xBB', '\xAC', '\xE4', '\xBD', '\xA0', '\xE4', '\xBE', '\x86', '\xE5', '\x80', '\x91', '\xE5', '\x88', '\xB0', '\xE5', '\x92', '\x8C', '\xE5', '\x9C', '\xB0', /* 他们你來們到和地 */ @@ -121,6 +139,9 @@ af_blue_stringsets[] = { /* */ + { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_ARABIC_JOIN, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 }, { AF_BLUE_STRING_CYRILLIC_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | @@ -160,6 +181,15 @@ { AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_TELUGU_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_THAI_BOTTOM, 0 }, + { AF_BLUE_STRING_THAI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_THAI_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_THAI_DESCENDER, 0 }, + { AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0 }, + { AF_BLUE_STRING_THAI_DIGIT_TOP, 0 }, + { AF_BLUE_STRING_MAX, 0 }, #ifdef AF_CONFIG_OPTION_CJK { AF_BLUE_STRING_CJK_TOP, AF_BLUE_PROPERTY_CJK_TOP }, { AF_BLUE_STRING_CJK_BOTTOM, 0 }, diff --git a/freetype/src/autofit/afblue.cin b/freetype/src/autofit/afblue.cin index c6762bec3..b303a4b2b 100644 --- a/freetype/src/autofit/afblue.cin +++ b/freetype/src/autofit/afblue.cin @@ -4,7 +4,7 @@ /* */ /* Auto-fitter data for blue strings (body). */ /* */ -/* Copyright 2013 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/afblue.dat b/freetype/src/autofit/afblue.dat index 3f98c13b2..fd5684e4a 100644 --- a/freetype/src/autofit/afblue.dat +++ b/freetype/src/autofit/afblue.dat @@ -2,7 +2,7 @@ // // Auto-fitter data for blue strings. // -// Copyright 2013, 2014 by +// Copyright 2013-2015 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, @@ -67,6 +67,11 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: + AF_BLUE_STRING_ARABIC_TOP + "ا إ ل ك ط ظ" + AF_BLUE_STRING_ARABIC_JOIN + "ت ث ط ظ ك" + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP "БВЕПЗОСЭ" AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM @@ -123,10 +128,25 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: // this is just for convenience to simplify reading AF_BLUE_STRING_TELUGU_TOP "ఇ ఌ ఙ ఞ ణ ఱ ౯" - AF_BLUE_STRING_TELUGU_BOTTOM "అ క చ ర ఽ ౨ ౬" + AF_BLUE_STRING_THAI_TOP + "บ เ แ อ ก า" + AF_BLUE_STRING_THAI_BOTTOM + "บ ป ษ ฯ อ ย ฮ" + AF_BLUE_STRING_THAI_ASCENDER + "ป ฝ ฟ" + AF_BLUE_STRING_THAI_LARGE_ASCENDER + "โ ใ ไ" + AF_BLUE_STRING_THAI_DESCENDER + "ฎ ฏ ฤ ฦ" + AF_BLUE_STRING_THAI_LARGE_DESCENDER + "ญ ฐ" + AF_BLUE_STRING_THAI_DIGIT_TOP + "๐ ๑ ๓" + + #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP @@ -268,6 +288,11 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: + AF_BLUE_STRINGSET_ARAB + { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_ARABIC_JOIN, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_CYRL { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 } @@ -319,6 +344,18 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_TELUGU_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_THAI + { AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_THAI_BOTTOM, 0 } + { AF_BLUE_STRING_THAI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_THAI_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_THAI_DESCENDER, 0 } + { AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0 } + { AF_BLUE_STRING_THAI_DIGIT_TOP, 0 } + { AF_BLUE_STRING_MAX, 0 } + + #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI diff --git a/freetype/src/autofit/afblue.h b/freetype/src/autofit/afblue.h index a86184191..94e33a9a2 100644 --- a/freetype/src/autofit/afblue.h +++ b/freetype/src/autofit/afblue.h @@ -7,7 +7,7 @@ /* */ /* Auto-fitter data for blue strings (specification). */ /* */ -/* Copyright 2013, 2014 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -74,30 +74,39 @@ FT_BEGIN_HEADER typedef enum AF_Blue_String_ { - AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 0, - AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 17, - AF_BLUE_STRING_CYRILLIC_SMALL = 34, - AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 51, - AF_BLUE_STRING_DEVANAGARI_BASE = 58, - AF_BLUE_STRING_DEVANAGARI_TOP = 83, - AF_BLUE_STRING_DEVANAGARI_HEAD = 108, - AF_BLUE_STRING_DEVANAGARI_BOTTOM = 133, - AF_BLUE_STRING_GREEK_CAPITAL_TOP = 140, - AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 155, - AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 168, - AF_BLUE_STRING_GREEK_SMALL = 181, - AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 198, - AF_BLUE_STRING_HEBREW_TOP = 215, - AF_BLUE_STRING_HEBREW_BOTTOM = 232, - AF_BLUE_STRING_HEBREW_DESCENDER = 245, - AF_BLUE_STRING_LATIN_CAPITAL_TOP = 256, - AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 265, - AF_BLUE_STRING_LATIN_SMALL_F_TOP = 274, - AF_BLUE_STRING_LATIN_SMALL = 282, - AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 290, - AF_BLUE_STRING_TELUGU_TOP = 296, - AF_BLUE_STRING_TELUGU_BOTTOM = 318, - af_blue_1_1 = 339, + AF_BLUE_STRING_ARABIC_TOP = 0, + AF_BLUE_STRING_ARABIC_JOIN = 13, + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 24, + AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 41, + AF_BLUE_STRING_CYRILLIC_SMALL = 58, + AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 75, + AF_BLUE_STRING_DEVANAGARI_BASE = 82, + AF_BLUE_STRING_DEVANAGARI_TOP = 107, + AF_BLUE_STRING_DEVANAGARI_HEAD = 132, + AF_BLUE_STRING_DEVANAGARI_BOTTOM = 157, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 164, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 179, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 192, + AF_BLUE_STRING_GREEK_SMALL = 205, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 222, + AF_BLUE_STRING_HEBREW_TOP = 239, + AF_BLUE_STRING_HEBREW_BOTTOM = 256, + AF_BLUE_STRING_HEBREW_DESCENDER = 269, + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 280, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 289, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 298, + AF_BLUE_STRING_LATIN_SMALL = 306, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 314, + AF_BLUE_STRING_TELUGU_TOP = 320, + AF_BLUE_STRING_TELUGU_BOTTOM = 342, + AF_BLUE_STRING_THAI_TOP = 364, + AF_BLUE_STRING_THAI_BOTTOM = 383, + AF_BLUE_STRING_THAI_ASCENDER = 405, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 415, + AF_BLUE_STRING_THAI_DESCENDER = 425, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 438, + AF_BLUE_STRING_THAI_DIGIT_TOP = 445, + af_blue_1_1 = 454, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 153, @@ -138,30 +147,32 @@ FT_BEGIN_HEADER /* Properties are specific to a writing system. We assume that a given */ /* blue string can't be used in more than a single writing system, which */ /* is a safe bet. */ -#define AF_BLUE_PROPERTY_LATIN_TOP ( 1 << 0 ) /* must have value 1 */ -#define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1 << 1 ) -#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1 << 2 ) -#define AF_BLUE_PROPERTY_LATIN_LONG ( 1 << 3 ) +#define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must have value 1 */ +#define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 1 ) +#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 2 ) +#define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 3 ) -#define AF_BLUE_PROPERTY_CJK_TOP ( 1 << 0 ) /* must have value 1 */ -#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1 << 1 ) /* must have value 2 */ +#define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must have value 1 */ +#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must have value 2 */ #define AF_BLUE_PROPERTY_CJK_RIGHT AF_BLUE_PROPERTY_CJK_TOP -#define AF_BLUE_STRINGSET_MAX_LEN 7 +#define AF_BLUE_STRINGSET_MAX_LEN 8 /* The AF_Blue_Stringset enumeration values are offsets into the */ /* `af_blue_stringsets' array. */ typedef enum AF_Blue_Stringset_ { - AF_BLUE_STRINGSET_CYRL = 0, - AF_BLUE_STRINGSET_DEVA = 6, - AF_BLUE_STRINGSET_GREK = 12, - AF_BLUE_STRINGSET_HEBR = 19, - AF_BLUE_STRINGSET_LATN = 23, - AF_BLUE_STRINGSET_TELU = 30, - af_blue_2_1 = 33, + AF_BLUE_STRINGSET_ARAB = 0, + AF_BLUE_STRINGSET_CYRL = 3, + AF_BLUE_STRINGSET_DEVA = 9, + AF_BLUE_STRINGSET_GREK = 15, + AF_BLUE_STRINGSET_HEBR = 22, + AF_BLUE_STRINGSET_LATN = 26, + AF_BLUE_STRINGSET_TELU = 33, + AF_BLUE_STRINGSET_THAI = 36, + af_blue_2_1 = 44, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, diff --git a/freetype/src/autofit/afblue.hin b/freetype/src/autofit/afblue.hin index 0b4b48d7f..ad43fe6ce 100644 --- a/freetype/src/autofit/afblue.hin +++ b/freetype/src/autofit/afblue.hin @@ -4,7 +4,7 @@ /* */ /* Auto-fitter data for blue strings (specification). */ /* */ -/* Copyright 2013, 2014 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -96,13 +96,13 @@ FT_BEGIN_HEADER /* Properties are specific to a writing system. We assume that a given */ /* blue string can't be used in more than a single writing system, which */ /* is a safe bet. */ -#define AF_BLUE_PROPERTY_LATIN_TOP ( 1 << 0 ) /* must have value 1 */ -#define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1 << 1 ) -#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1 << 2 ) -#define AF_BLUE_PROPERTY_LATIN_LONG ( 1 << 3 ) +#define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must have value 1 */ +#define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 1 ) +#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 2 ) +#define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 3 ) -#define AF_BLUE_PROPERTY_CJK_TOP ( 1 << 0 ) /* must have value 1 */ -#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1 << 1 ) /* must have value 2 */ +#define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must have value 1 */ +#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must have value 2 */ #define AF_BLUE_PROPERTY_CJK_RIGHT AF_BLUE_PROPERTY_CJK_TOP diff --git a/freetype/src/autofit/afcjk.c b/freetype/src/autofit/afcjk.c index 048e0e7d0..905408bb2 100644 --- a/freetype/src/autofit/afcjk.c +++ b/freetype/src/autofit/afcjk.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK writing system (body). */ /* */ -/* Copyright 2006-2014 by */ +/* Copyright 2006-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -260,8 +260,8 @@ FT_Pos fills[AF_BLUE_STRING_MAX_LEN]; FT_Pos flats[AF_BLUE_STRING_MAX_LEN]; - FT_Int num_fills; - FT_Int num_flats; + FT_UInt num_fills; + FT_UInt num_flats; FT_Bool fill; @@ -720,8 +720,8 @@ { AF_Point pt = seg->first; AF_Point last = seg->last; - AF_Flags f0 = (AF_Flags)( pt->flags & AF_FLAG_CONTROL ); - AF_Flags f1; + FT_UInt f0 = pt->flags & AF_FLAG_CONTROL; + FT_UInt f1; seg->flags &= ~AF_EDGE_ROUND; @@ -729,7 +729,7 @@ for ( ; pt != last; f0 = f1 ) { pt = pt->next; - f1 = (AF_Flags)( pt->flags & AF_FLAG_CONTROL ); + f1 = pt->flags & AF_FLAG_CONTROL; if ( !f0 && !f1 ) break; @@ -863,19 +863,19 @@ if ( link == seg2 ) { - seg->link = 0; + seg->link = NULL; seg->serif = link1; } else if ( link == link2 ) { - seg->link = 0; + seg->link = NULL; seg->serif = seg1; } } } else { - seg1->link = link1->link = 0; + seg1->link = link1->link = NULL; break; } @@ -892,7 +892,7 @@ seg2->num_linked++; if ( seg2->link != seg1 ) { - seg1->link = 0; + seg1->link = NULL; if ( seg2->score < dist_threshold || seg1->score < seg2->score * 4 ) seg1->serif = seg2->link; @@ -1159,7 +1159,7 @@ /* Example: the `c' in cour.pfa at size 13 */ if ( edge->serif && edge->link ) - edge->serif = 0; + edge->serif = NULL; } } @@ -1190,7 +1190,7 @@ /* Compute all edges which lie within blue zones. */ - FT_LOCAL_DEF( void ) + static void af_cjk_hints_compute_blue_edges( AF_GlyphHints hints, AF_CJKMetrics metrics, AF_Dimension dim ) @@ -1301,7 +1301,7 @@ /* compute flags depending on render mode, etc. */ mode = metrics->root.scaler.render_mode; -#ifdef AF_CONFIG_OPTION_USE_WARPER +#if 0 /* AF_CONFIG_OPTION_USE_WARPER */ if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V ) metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL; #endif @@ -1334,6 +1334,12 @@ scaler_flags |= AF_SCALER_FLAG_NO_ADVANCE; +#ifdef AF_CONFIG_OPTION_USE_WARPER + /* get (global) warper flag */ + if ( !metrics->root.globals->module->warping ) + scaler_flags |= AF_SCALER_FLAG_NO_WARPER; +#endif + hints->scaler_flags = scaler_flags; hints->other_flags = other_flags; @@ -1354,13 +1360,13 @@ static FT_Pos af_cjk_snap_width( AF_Width widths, - FT_Int count, + FT_UInt count, FT_Pos width ) { - int n; - FT_Pos best = 64 + 32 + 2; - FT_Pos reference = width; - FT_Pos scaled; + FT_UInt n; + FT_Pos best = 64 + 32 + 2; + FT_Pos reference = width; + FT_Pos scaled; for ( n = 0; n < count; n++ ) @@ -1405,8 +1411,8 @@ af_cjk_compute_stem_width( AF_GlyphHints hints, AF_Dimension dim, FT_Pos width, - AF_Edge_Flags base_flags, - AF_Edge_Flags stem_flags ) + FT_UInt base_flags, + FT_UInt stem_flags ) { AF_CJKMetrics metrics = (AF_CJKMetrics)hints->metrics; AF_CJKAxis axis = &metrics->axis[dim]; @@ -1530,10 +1536,9 @@ { FT_Pos dist = stem_edge->opos - base_edge->opos; - FT_Pos fitted_width = af_cjk_compute_stem_width( - hints, dim, dist, - (AF_Edge_Flags)base_edge->flags, - (AF_Edge_Flags)stem_edge->flags ); + FT_Pos fitted_width = af_cjk_compute_stem_width( hints, dim, dist, + base_edge->flags, + stem_edge->flags ); stem_edge->pos = base_edge->pos + fitted_width; @@ -1611,8 +1616,8 @@ org_len = edge2->opos - edge->opos; cur_len = af_cjk_compute_stem_width( hints, dim, org_len, - (AF_Edge_Flags)edge->flags, - (AF_Edge_Flags)edge2->flags ); + edge->flags, + edge2->flags ); org_center = ( edge->opos + edge2->opos ) / 2 + anchor; cur_pos1 = org_center - cur_len / 2; @@ -1713,7 +1718,7 @@ AF_Edge edge_limit = edges + axis->num_edges; FT_PtrDist n_edges; AF_Edge edge; - AF_Edge anchor = 0; + AF_Edge anchor = NULL; FT_Pos delta = 0; FT_Int skipped = 0; FT_Bool has_last_stem = FALSE; @@ -2191,7 +2196,13 @@ goto Exit; /* analyze glyph outline */ +#ifdef AF_CONFIG_OPTION_USE_WARPER + if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && + AF_HINTS_DO_WARP( hints ) ) || + AF_HINTS_DO_HORIZONTAL( hints ) ) +#else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) +#endif { error = af_cjk_hints_detect_features( hints, AF_DIMENSION_HORZ ); if ( error ) @@ -2217,8 +2228,9 @@ { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; @@ -2240,12 +2252,6 @@ } } -#if 0 - af_glyph_hints_dump_points( hints ); - af_glyph_hints_dump_segments( hints ); - af_glyph_hints_dump_edges( hints ); -#endif - af_glyph_hints_save( hints, outline ); Exit: diff --git a/freetype/src/autofit/afcjk.h b/freetype/src/autofit/afcjk.h index 4dd4f3917..bfd11f2d3 100644 --- a/freetype/src/autofit/afcjk.h +++ b/freetype/src/autofit/afcjk.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK writing system (specification). */ /* */ -/* Copyright 2006, 2007, 2011-2014 by */ +/* Copyright 2006-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -55,14 +55,10 @@ FT_BEGIN_HEADER #define AF_CJK_MAX_WIDTHS 16 - enum - { - AF_CJK_BLUE_ACTIVE = 1 << 0, /* set if zone height is <= 3/4px */ - AF_CJK_BLUE_TOP = 1 << 1, /* result of AF_CJK_IS_TOP_BLUE */ - AF_CJK_BLUE_ADJUSTMENT = 1 << 2, /* used for scale adjustment */ - /* optimization */ - AF_CJK_BLUE_FLAG_MAX - }; +#define AF_CJK_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */ +#define AF_CJK_BLUE_TOP ( 1U << 1 ) /* result of AF_CJK_IS_TOP_BLUE */ +#define AF_CJK_BLUE_ADJUSTMENT ( 1U << 2 ) /* used for scale adjustment */ + /* optimization */ typedef struct AF_CJKBlueRec_ diff --git a/freetype/src/autofit/afcover.h b/freetype/src/autofit/afcover.h index d5ac96944..520e8a4ae 100644 --- a/freetype/src/autofit/afcover.h +++ b/freetype/src/autofit/afcover.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter coverages (specification only). */ /* */ -/* Copyright 2013, 2014 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/afdummy.c b/freetype/src/autofit/afdummy.c index f8702a109..03ca25f33 100644 --- a/freetype/src/autofit/afdummy.c +++ b/freetype/src/autofit/afdummy.c @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (body). */ /* */ -/* Copyright 2003-2005, 2011, 2013 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/afdummy.h b/freetype/src/autofit/afdummy.h index ad1b0d3ab..b4fdc78e3 100644 --- a/freetype/src/autofit/afdummy.h +++ b/freetype/src/autofit/afdummy.h @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (specification). */ /* */ -/* Copyright 2003-2005, 2011, 2013 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/aferrors.h b/freetype/src/autofit/aferrors.h index 50e1a22dd..7b416e470 100644 --- a/freetype/src/autofit/aferrors.h +++ b/freetype/src/autofit/aferrors.h @@ -4,7 +4,7 @@ /* */ /* Autofitter error codes (specification only). */ /* */ -/* Copyright 2005, 2012 by */ +/* Copyright 2005-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/afglobal.c b/freetype/src/autofit/afglobal.c index a54c20c02..64b929313 100644 --- a/freetype/src/autofit/afglobal.c +++ b/freetype/src/autofit/afglobal.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter routines to compute global hinting values (body). */ /* */ -/* Copyright 2003-2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -314,8 +314,9 @@ memory = face->memory; - if ( FT_ALLOC( globals, sizeof ( *globals ) + - face->num_glyphs * sizeof ( FT_Byte ) ) ) + if ( FT_ALLOC( globals, + sizeof ( *globals ) + + (FT_ULong)face->num_glyphs * sizeof ( FT_Byte ) ) ) goto Exit; globals->face = face; diff --git a/freetype/src/autofit/afglobal.h b/freetype/src/autofit/afglobal.h index 38d8d6952..9bbb687e2 100644 --- a/freetype/src/autofit/afglobal.h +++ b/freetype/src/autofit/afglobal.h @@ -5,7 +5,7 @@ /* Auto-fitter routines to compute global hinting values */ /* (specification). */ /* */ -/* Copyright 2003-2005, 2007, 2009, 2011-2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/afhints.c b/freetype/src/autofit/afhints.c index f3cc50f20..37482ebd1 100644 --- a/freetype/src/autofit/afhints.c +++ b/freetype/src/autofit/afhints.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (body). */ /* */ -/* Copyright 2003-2007, 2009-2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -43,7 +43,15 @@ AF_Segment segment = NULL; - if ( axis->num_segments >= axis->max_segments ) + if ( axis->num_segments < AF_SEGMENTS_EMBEDDED ) + { + if ( axis->segments == NULL ) + { + axis->segments = axis->embedded.segments; + axis->max_segments = AF_SEGMENTS_EMBEDDED; + } + } + else if ( axis->num_segments >= axis->max_segments ) { FT_Int old_max = axis->max_segments; FT_Int new_max = old_max; @@ -60,8 +68,18 @@ if ( new_max < old_max || new_max > big_max ) new_max = big_max; - if ( FT_RENEW_ARRAY( axis->segments, old_max, new_max ) ) - goto Exit; + if ( axis->segments == axis->embedded.segments ) + { + if ( FT_NEW_ARRAY( axis->segments, new_max ) ) + goto Exit; + ft_memcpy( axis->segments, axis->embedded.segments, + sizeof ( axis->embedded.segments ) ); + } + else + { + if ( FT_RENEW_ARRAY( axis->segments, old_max, new_max ) ) + goto Exit; + } axis->max_segments = new_max; } @@ -89,7 +107,15 @@ AF_Edge edges; - if ( axis->num_edges >= axis->max_edges ) + if ( axis->num_edges < AF_EDGES_EMBEDDED ) + { + if ( axis->edges == NULL ) + { + axis->edges = axis->embedded.edges; + axis->max_edges = AF_EDGES_EMBEDDED; + } + } + else if ( axis->num_edges >= axis->max_edges ) { FT_Int old_max = axis->max_edges; FT_Int new_max = old_max; @@ -106,8 +132,18 @@ if ( new_max < old_max || new_max > big_max ) new_max = big_max; - if ( FT_RENEW_ARRAY( axis->edges, old_max, new_max ) ) - goto Exit; + if ( axis->edges == axis->embedded.edges ) + { + if ( FT_NEW_ARRAY( axis->edges, new_max ) ) + goto Exit; + ft_memcpy( axis->edges, axis->embedded.edges, + sizeof ( axis->embedded.edges ) ); + } + else + { + if ( FT_RENEW_ARRAY( axis->edges, old_max, new_max ) ) + goto Exit; + } axis->max_edges = new_max; } @@ -195,9 +231,13 @@ AF_Point point; - AF_DUMP(( "Table of points:\n" - " [ index | xorg | yorg | xscale | yscale" - " | xfit | yfit | flags ]\n" )); + AF_DUMP(( "Table of points:\n" )); + + if ( hints->num_points ) + AF_DUMP(( " [ index | xorg | yorg | xscale | yscale" + " | xfit | yfit | flags ]\n" )); + else + AF_DUMP(( " (none)\n" )); for ( point = points; point < limit; point++ ) AF_DUMP(( " [ %5d | %5d | %5d | %6.2f | %6.2f" @@ -218,7 +258,7 @@ static const char* - af_edge_flags_to_string( AF_Edge_Flags flags ) + af_edge_flags_to_string( FT_UInt flags ) { static char temp[32]; int pos = 0; @@ -293,7 +333,7 @@ AF_INDEX_NUM( seg->edge, edges ), seg->height, seg->height - ( seg->max_coord - seg->min_coord ), - af_edge_flags_to_string( (AF_Edge_Flags)seg->flags ) )); + af_edge_flags_to_string( seg->flags ) )); AF_DUMP(( "\n" )); } } @@ -420,7 +460,7 @@ edge->blue_edge ? 'y' : 'n', edge->opos / 64.0, edge->pos / 64.0, - af_edge_flags_to_string( (AF_Edge_Flags)edge->flags ) )); + af_edge_flags_to_string( edge->flags ) )); AF_DUMP(( "\n" )); } } @@ -469,15 +509,15 @@ else { dir = AF_DIR_DOWN; - ll = dy; + ll = -dy; ss = dx; } } - /* return no direction if arm lengths differ too much */ + /* return no direction if arm lengths do not differ enough */ /* (value 14 is heuristic, corresponding to approx. 4.1 degrees) */ - ss *= 14; - if ( FT_ABS( ll ) <= FT_ABS( ss ) ) + /* the long arm is never negative */ + if ( ll <= 14 * FT_ABS( ss ) ) dir = AF_DIR_NONE; return dir; @@ -488,7 +528,8 @@ af_glyph_hints_init( AF_GlyphHints hints, FT_Memory memory ) { - FT_ZERO( hints ); + /* no need to initialize the embedded items */ + FT_MEM_ZERO( hints, sizeof ( *hints ) - sizeof ( hints->embedded ) ); hints->memory = memory; } @@ -496,13 +537,15 @@ FT_LOCAL_DEF( void ) af_glyph_hints_done( AF_GlyphHints hints ) { - FT_Memory memory = hints->memory; + FT_Memory memory; int dim; if ( !( hints && hints->memory ) ) return; + memory = hints->memory; + /* * note that we don't need to free the segment and edge * buffers since they are really within the hints->points array @@ -514,20 +557,24 @@ axis->num_segments = 0; axis->max_segments = 0; - FT_FREE( axis->segments ); + if ( axis->segments != axis->embedded.segments ) + FT_FREE( axis->segments ); axis->num_edges = 0; axis->max_edges = 0; - FT_FREE( axis->edges ); + if ( axis->edges != axis->embedded.edges ) + FT_FREE( axis->edges ); } - FT_FREE( hints->contours ); + if ( hints->contours != hints->embedded.contours ) + FT_FREE( hints->contours ); hints->max_contours = 0; hints->num_contours = 0; - FT_FREE( hints->points ); - hints->num_points = 0; + if ( hints->points != hints->embedded.points ) + FT_FREE( hints->points ); hints->max_points = 0; + hints->num_points = 0; hints->memory = NULL; } @@ -571,15 +618,27 @@ /* first of all, reallocate the contours array if necessary */ new_max = (FT_UInt)outline->n_contours; - old_max = hints->max_contours; - if ( new_max > old_max ) + old_max = (FT_UInt)hints->max_contours; + + if ( new_max <= AF_CONTOURS_EMBEDDED ) + { + if ( hints->contours == NULL ) + { + hints->contours = hints->embedded.contours; + hints->max_contours = AF_CONTOURS_EMBEDDED; + } + } + else if ( new_max > old_max ) { - new_max = ( new_max + 3 ) & ~3; /* round up to a multiple of 4 */ + if ( hints->contours == hints->embedded.contours ) + hints->contours = NULL; + + new_max = ( new_max + 3 ) & ~3U; /* round up to a multiple of 4 */ if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) ) goto Exit; - hints->max_contours = new_max; + hints->max_contours = (FT_Int)new_max; } /* @@ -588,15 +647,27 @@ * hint metrics appropriately */ new_max = (FT_UInt)( outline->n_points + 2 ); - old_max = hints->max_points; - if ( new_max > old_max ) + old_max = (FT_UInt)hints->max_points; + + if ( new_max <= AF_POINTS_EMBEDDED ) + { + if ( hints->points == NULL ) + { + hints->points = hints->embedded.points; + hints->max_points = AF_POINTS_EMBEDDED; + } + } + else if ( new_max > old_max ) { - new_max = ( new_max + 2 + 7 ) & ~7; /* round up to a multiple of 8 */ + if ( hints->points == hints->embedded.points ) + hints->points = NULL; + + new_max = ( new_max + 2 + 7 ) & ~7U; /* round up to a multiple of 8 */ if ( FT_RENEW_ARRAY( hints->points, old_max, new_max ) ) goto Exit; - hints->max_points = new_max; + hints->max_points = (FT_Int)new_max; } hints->num_points = outline->n_points; @@ -721,8 +792,6 @@ FT_Pos out_x, out_y; - FT_Bool is_first; - /* since the first point of a contour could be part of a */ /* series of near points, go backwards to find the first */ @@ -773,17 +842,13 @@ out_x = 0; out_y = 0; - is_first = 1; - - for ( point = first; - point != first || is_first; - point = point->next ) + next = first; + do { AF_Direction out_dir; - is_first = 0; - + point = next; next = point->next; out_x += next->fx - point->fx; @@ -815,7 +880,8 @@ out_x = 0; out_y = 0; - } + + } while ( next != first ); } /* @@ -1045,7 +1111,7 @@ AF_AxisHints axis = &hints->axis[dim]; AF_Edge edges = axis->edges; AF_Edge edge_limit = edges + axis->num_edges; - AF_Flags touch_flag; + FT_UInt touch_flag; if ( dim == AF_DIMENSION_HORZ ) @@ -1226,33 +1292,27 @@ AF_Point ref2 ) { AF_Point p; - FT_Pos u; - FT_Pos v1 = ref1->v; - FT_Pos v2 = ref2->v; - FT_Pos d1 = ref1->u - v1; - FT_Pos d2 = ref2->u - v2; + FT_Pos u, v1, v2, u1, u2, d1, d2; if ( p1 > p2 ) return; - if ( v1 == v2 ) + if ( ref1->v > ref2->v ) { - for ( p = p1; p <= p2; p++ ) - { - u = p->v; - - if ( u <= v1 ) - u += d1; - else - u += d2; - - p->u = u; - } - return; + p = ref1; + ref1 = ref2; + ref2 = p; } - if ( v1 < v2 ) + v1 = ref1->v; + v2 = ref2->v; + u1 = ref1->u; + u2 = ref2->u; + d1 = u1 - v1; + d2 = u2 - v2; + + if ( u1 == u2 || v1 == v2 ) { for ( p = p1; p <= p2; p++ ) { @@ -1263,23 +1323,26 @@ else if ( u >= v2 ) u += d2; else - u = ref1->u + FT_MulDiv( u - v1, ref2->u - ref1->u, v2 - v1 ); + u = u1; p->u = u; } } else { + FT_Fixed scale = FT_DivFix( u2 - u1, v2 - v1 ); + + for ( p = p1; p <= p2; p++ ) { u = p->v; - if ( u <= v2 ) - u += d2; - else if ( u >= v1 ) + if ( u <= v1 ) u += d1; + else if ( u >= v2 ) + u += d2; else - u = ref1->u + FT_MulDiv( u - v1, ref2->u - ref1->u, v2 - v1 ); + u = u1 + FT_MulFix( u - v1, scale ); p->u = u; } @@ -1298,7 +1361,7 @@ AF_Point point_limit = points + hints->num_points; AF_Point* contour = hints->contours; AF_Point* contour_limit = contour + hints->num_contours; - AF_Flags touch_flag; + FT_UInt touch_flag; AF_Point point; AF_Point end_point; AF_Point first_point; diff --git a/freetype/src/autofit/afhints.h b/freetype/src/autofit/afhints.h index 92101de7c..a64c7a4b1 100644 --- a/freetype/src/autofit/afhints.h +++ b/freetype/src/autofit/afhints.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (specification). */ /* */ -/* Copyright 2003-2008, 2010-2012, 2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -207,35 +207,27 @@ FT_BEGIN_HEADER /* point hint flags */ - typedef enum AF_Flags_ - { - AF_FLAG_NONE = 0, - - /* point type flags */ - AF_FLAG_CONIC = 1 << 0, - AF_FLAG_CUBIC = 1 << 1, - AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC, +#define AF_FLAG_NONE 0 - /* point touch flags */ - AF_FLAG_TOUCH_X = 1 << 2, - AF_FLAG_TOUCH_Y = 1 << 3, + /* point type flags */ +#define AF_FLAG_CONIC ( 1U << 0 ) +#define AF_FLAG_CUBIC ( 1U << 1 ) +#define AF_FLAG_CONTROL ( AF_FLAG_CONIC | AF_FLAG_CUBIC ) - /* candidates for weak interpolation have this flag set */ - AF_FLAG_WEAK_INTERPOLATION = 1 << 4 + /* point touch flags */ +#define AF_FLAG_TOUCH_X ( 1U << 2 ) +#define AF_FLAG_TOUCH_Y ( 1U << 3 ) - } AF_Flags; + /* candidates for weak interpolation have this flag set */ +#define AF_FLAG_WEAK_INTERPOLATION ( 1U << 4 ) /* edge hint flags */ - typedef enum AF_Edge_Flags_ - { - AF_EDGE_NORMAL = 0, - AF_EDGE_ROUND = 1 << 0, - AF_EDGE_SERIF = 1 << 1, - AF_EDGE_DONE = 1 << 2, - AF_EDGE_NEUTRAL = 1 << 3 /* set if edge aligns to a neutral blue zone */ - - } AF_Edge_Flags; +#define AF_EDGE_NORMAL 0 +#define AF_EDGE_ROUND ( 1U << 0 ) +#define AF_EDGE_SERIF ( 1U << 1 ) +#define AF_EDGE_DONE ( 1U << 2 ) +#define AF_EDGE_NEUTRAL ( 1U << 3 ) /* edge aligns to a neutral blue zone */ typedef struct AF_PointRec_* AF_Point; @@ -305,6 +297,8 @@ FT_BEGIN_HEADER } AF_EdgeRec; +#define AF_SEGMENTS_EMBEDDED 18 /* number of embedded segments */ +#define AF_EDGES_EMBEDDED 12 /* number of embedded edges */ typedef struct AF_AxisHintsRec_ { @@ -321,9 +315,20 @@ FT_BEGIN_HEADER AF_Direction major_dir; /* either vertical or horizontal */ + /* two arrays to avoid allocation penalty */ + struct + { + AF_SegmentRec segments[AF_SEGMENTS_EMBEDDED]; + AF_EdgeRec edges[AF_EDGES_EMBEDDED]; + } embedded; + + } AF_AxisHintsRec, *AF_AxisHints; +#define AF_POINTS_EMBEDDED 96 /* number of embedded points */ +#define AF_CONTOURS_EMBEDDED 8 /* number of embedded contours */ + typedef struct AF_GlyphHintsRec_ { FT_Memory memory; @@ -352,6 +357,14 @@ FT_BEGIN_HEADER FT_Pos xmin_delta; /* used for warping */ FT_Pos xmax_delta; + /* Two arrays to avoid allocation penalty. */ + /* The `embedded' structure must be the last element! */ + struct + { + AF_Point contours[AF_CONTOURS_EMBEDDED]; + AF_PointRec points[AF_POINTS_EMBEDDED]; + } embedded; + } AF_GlyphHintsRec; @@ -369,9 +382,6 @@ FT_BEGIN_HEADER ( !_af_debug_disable_vert_hints && \ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) ) -#define AF_HINTS_DO_ADVANCE( h ) \ - !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE ) - #define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints ) #else /* !FT_DEBUG_AUTOFIT */ @@ -382,12 +392,17 @@ FT_BEGIN_HEADER #define AF_HINTS_DO_VERTICAL( h ) \ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) +#define AF_HINTS_DO_BLUES( h ) 1 + +#endif /* !FT_DEBUG_AUTOFIT */ + + #define AF_HINTS_DO_ADVANCE( h ) \ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE ) -#define AF_HINTS_DO_BLUES( h ) 1 +#define AF_HINTS_DO_WARP( h ) \ + !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_WARPER ) -#endif /* !FT_DEBUG_AUTOFIT */ FT_LOCAL( AF_Direction ) diff --git a/freetype/src/autofit/afindic.c b/freetype/src/autofit/afindic.c index 197881b61..7412cd1e3 100644 --- a/freetype/src/autofit/afindic.c +++ b/freetype/src/autofit/afindic.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for Indic writing system (body). */ /* */ -/* Copyright 2007, 2011-2013 by */ +/* Copyright 2007-2015 by */ /* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/afindic.h b/freetype/src/autofit/afindic.h index 9e13cf7e3..4c36908ad 100644 --- a/freetype/src/autofit/afindic.h +++ b/freetype/src/autofit/afindic.h @@ -5,7 +5,7 @@ /* Auto-fitter hinting routines for Indic writing system */ /* (specification). */ /* */ -/* Copyright 2007, 2012, 2013 by */ +/* Copyright 2007-2015 by */ /* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/aflatin.c b/freetype/src/autofit/aflatin.c index 36a36896f..893e98673 100644 --- a/freetype/src/autofit/aflatin.c +++ b/freetype/src/autofit/aflatin.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin writing system (body). */ /* */ -/* Copyright 2003-2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -261,8 +261,8 @@ FT_Pos flats [AF_BLUE_STRING_MAX_LEN]; FT_Pos rounds[AF_BLUE_STRING_MAX_LEN]; - FT_Int num_flats; - FT_Int num_rounds; + FT_UInt num_flats; + FT_UInt num_rounds; AF_LatinBlue blue; FT_Error error; @@ -362,9 +362,10 @@ error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); outline = face->glyph->outline; - if ( error || outline.n_points <= 0 ) + /* reject glyphs that don't produce any rendering */ + if ( error || outline.n_points <= 2 ) { - FT_TRACE5(( " U+%04lX contains no outlines\n", ch )); + FT_TRACE5(( " U+%04lX contains no (usable) outlines\n", ch )); continue; } @@ -1791,7 +1792,7 @@ /* Example: the `c' in cour.pfa at size 13 */ if ( edge->serif && edge->link ) - edge->serif = 0; + edge->serif = NULL; } } @@ -1825,7 +1826,7 @@ /* Compute all edges which lie within blue zones. */ - FT_LOCAL_DEF( void ) + static void af_latin_hints_compute_blue_edges( AF_GlyphHints hints, AF_LatinMetrics metrics ) { @@ -1995,11 +1996,20 @@ /* * In `light' hinting mode we disable horizontal hinting completely. * We also do it if the face is italic. + * + * However, if warping is enabled (which only works in `light' hinting + * mode), advance widths get adjusted, too. */ if ( mode == FT_RENDER_MODE_LIGHT || ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; +#ifdef AF_CONFIG_OPTION_USE_WARPER + /* get (global) warper flag */ + if ( !metrics->root.globals->module->warping ) + scaler_flags |= AF_SCALER_FLAG_NO_WARPER; +#endif + hints->scaler_flags = scaler_flags; hints->other_flags = other_flags; @@ -2020,13 +2030,13 @@ static FT_Pos af_latin_snap_width( AF_Width widths, - FT_Int count, + FT_UInt count, FT_Pos width ) { - int n; - FT_Pos best = 64 + 32 + 2; - FT_Pos reference = width; - FT_Pos scaled; + FT_UInt n; + FT_Pos best = 64 + 32 + 2; + FT_Pos reference = width; + FT_Pos scaled; for ( n = 0; n < count; n++ ) @@ -2071,8 +2081,8 @@ af_latin_compute_stem_width( AF_GlyphHints hints, AF_Dimension dim, FT_Pos width, - AF_Edge_Flags base_flags, - AF_Edge_Flags stem_flags ) + FT_UInt base_flags, + FT_UInt stem_flags ) { AF_LatinMetrics metrics = (AF_LatinMetrics)hints->metrics; AF_LatinAxis axis = &metrics->axis[dim]; @@ -2239,10 +2249,9 @@ { FT_Pos dist = stem_edge->opos - base_edge->opos; - FT_Pos fitted_width = af_latin_compute_stem_width( - hints, dim, dist, - (AF_Edge_Flags)base_edge->flags, - (AF_Edge_Flags)stem_edge->flags ); + FT_Pos fitted_width = af_latin_compute_stem_width( hints, dim, dist, + base_edge->flags, + stem_edge->flags ); stem_edge->pos = base_edge->pos + fitted_width; @@ -2281,7 +2290,7 @@ /* The main grid-fitting routine. */ - FT_LOCAL_DEF( void ) + static void af_latin_hint_edges( AF_GlyphHints hints, AF_Dimension dim ) { @@ -2334,7 +2343,7 @@ FT_Byte neutral2 = edge2->flags & AF_EDGE_NEUTRAL; - if ( ( neutral && neutral2 ) || neutral2 ) + if ( neutral2 ) { edge2->blue_edge = NULL; edge2->flags &= ~AF_EDGE_NEUTRAL; @@ -2437,10 +2446,9 @@ org_len = edge2->opos - edge->opos; - cur_len = af_latin_compute_stem_width( - hints, dim, org_len, - (AF_Edge_Flags)edge->flags, - (AF_Edge_Flags)edge2->flags ); + cur_len = af_latin_compute_stem_width( hints, dim, org_len, + edge->flags, + edge2->flags ); /* some voodoo to specially round edges for small stem widths; */ /* the idea is to align the center of a stem, then shifting */ @@ -2507,10 +2515,9 @@ org_len = edge2->opos - edge->opos; org_center = org_pos + ( org_len >> 1 ); - cur_len = af_latin_compute_stem_width( - hints, dim, org_len, - (AF_Edge_Flags)edge->flags, - (AF_Edge_Flags)edge2->flags ); + cur_len = af_latin_compute_stem_width( hints, dim, org_len, + edge->flags, + edge2->flags ); if ( edge2->flags & AF_EDGE_DONE ) { @@ -2568,10 +2575,9 @@ org_len = edge2->opos - edge->opos; org_center = org_pos + ( org_len >> 1 ); - cur_len = af_latin_compute_stem_width( - hints, dim, org_len, - (AF_Edge_Flags)edge->flags, - (AF_Edge_Flags)edge2->flags ); + cur_len = af_latin_compute_stem_width( hints, dim, org_len, + edge->flags, + edge2->flags ); cur_pos1 = FT_PIX_ROUND( org_pos ); delta1 = cur_pos1 + ( cur_len >> 1 ) - org_center; @@ -2815,8 +2821,9 @@ /* analyze glyph outline */ #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT || - AF_HINTS_DO_HORIZONTAL( hints ) ) + if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && + AF_HINTS_DO_WARP( hints ) ) || + AF_HINTS_DO_HORIZONTAL( hints ) ) #else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) #endif @@ -2848,7 +2855,8 @@ { #ifdef AF_CONFIG_OPTION_USE_WARPER if ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) + metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; @@ -2861,7 +2869,7 @@ scale, delta ); continue; } -#endif +#endif /* AF_CONFIG_OPTION_USE_WARPER */ if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) || ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) ) diff --git a/freetype/src/autofit/aflatin.h b/freetype/src/autofit/aflatin.h index 2c0bfca18..6855492ca 100644 --- a/freetype/src/autofit/aflatin.h +++ b/freetype/src/autofit/aflatin.h @@ -5,7 +5,7 @@ /* Auto-fitter hinting routines for latin writing system */ /* (specification). */ /* */ -/* Copyright 2003-2007, 2009, 2011-2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -63,15 +63,11 @@ FT_BEGIN_HEADER #define AF_LATIN_MAX_WIDTHS 16 - enum - { - AF_LATIN_BLUE_ACTIVE = 1 << 0, /* set if zone height is <= 3/4px */ - AF_LATIN_BLUE_TOP = 1 << 1, /* set if we have a top blue zone */ - AF_LATIN_BLUE_NEUTRAL = 1 << 2, /* set if we have neutral blue zone */ - AF_LATIN_BLUE_ADJUSTMENT = 1 << 3, /* used for scale adjustment */ - /* optimization */ - AF_LATIN_BLUE_FLAG_MAX - }; +#define AF_LATIN_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */ +#define AF_LATIN_BLUE_TOP ( 1U << 1 ) /* we have a top blue zone */ +#define AF_LATIN_BLUE_NEUTRAL ( 1U << 2 ) /* we have neutral blue zone */ +#define AF_LATIN_BLUE_ADJUSTMENT ( 1U << 3 ) /* used for scale adjustment */ + /* optimization */ typedef struct AF_LatinBlueRec_ @@ -138,15 +134,11 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ - enum - { - AF_LATIN_HINTS_HORZ_SNAP = 1 << 0, /* enable stem width snapping */ - AF_LATIN_HINTS_VERT_SNAP = 1 << 1, /* enable stem height snapping */ - AF_LATIN_HINTS_STEM_ADJUST = 1 << 2, /* enable stem width/height */ - /* adjustment */ - AF_LATIN_HINTS_MONO = 1 << 3 /* indicate monochrome */ - /* rendering */ - }; +#define AF_LATIN_HINTS_HORZ_SNAP ( 1U << 0 ) /* stem width snapping */ +#define AF_LATIN_HINTS_VERT_SNAP ( 1U << 1 ) /* stem height snapping */ +#define AF_LATIN_HINTS_STEM_ADJUST ( 1U << 2 ) /* stem width/height */ + /* adjustment */ +#define AF_LATIN_HINTS_MONO ( 1U << 3 ) /* monochrome rendering */ #define AF_LATIN_HINTS_DO_HORZ_SNAP( h ) \ diff --git a/freetype/src/autofit/aflatin2.c b/freetype/src/autofit/aflatin2.c index 07590b380..ac9f93325 100644 --- a/freetype/src/autofit/aflatin2.c +++ b/freetype/src/autofit/aflatin2.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin writing system (body). */ /* */ -/* Copyright 2003-2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -835,8 +835,8 @@ { AF_Point pt = first; AF_Point last = point; - AF_Flags f0 = (AF_Flags)( pt->flags & AF_FLAG_CONTROL ); - AF_Flags f1; + FT_UInt f0 = pt->flags & AF_FLAG_CONTROL; + FT_UInt f1; segment->flags &= ~AF_EDGE_ROUND; @@ -844,7 +844,7 @@ for ( ; pt != last; f0 = f1 ) { pt = pt->next; - f1 = (AF_Flags)( pt->flags & AF_FLAG_CONTROL ); + f1 = pt->flags & AF_FLAG_CONTROL; if ( !f0 && !f1 ) break; @@ -1048,7 +1048,7 @@ { if ( seg2->link != seg1 ) { - seg1->link = 0; + seg1->link = NULL; seg1->serif = seg2->link; } } @@ -1128,7 +1128,7 @@ for ( seg = segments; seg < segment_limit; seg++ ) { - AF_Edge found = 0; + AF_Edge found = NULL; FT_Int ee; @@ -1355,7 +1355,7 @@ /* Example: the `c' in cour.pfa at size 13 */ if ( edge->serif && edge->link ) - edge->serif = 0; + edge->serif = NULL; } } @@ -1382,7 +1382,7 @@ } - FT_LOCAL_DEF( void ) + static void af_latin2_hints_compute_blue_edges( AF_GlyphHints hints, AF_LatinMetrics metrics ) { @@ -1513,9 +1513,7 @@ #if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */ if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V ) - { metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL; - } #endif scaler_flags = hints->scaler_flags; @@ -1552,6 +1550,12 @@ ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; +#ifdef AF_CONFIG_OPTION_USE_WARPER + /* get (global) warper flag */ + if ( !metrics->root.globals->module->warping ) + scaler_flags |= AF_SCALER_FLAG_NO_WARPER; +#endif + hints->scaler_flags = scaler_flags; hints->other_flags = other_flags; @@ -1572,13 +1576,13 @@ static FT_Pos af_latin2_snap_width( AF_Width widths, - FT_Int count, + FT_UInt count, FT_Pos width ) { - int n; - FT_Pos best = 64 + 32 + 2; - FT_Pos reference = width; - FT_Pos scaled; + FT_UInt n; + FT_Pos best = 64 + 32 + 2; + FT_Pos reference = width; + FT_Pos scaled; for ( n = 0; n < count; n++ ) @@ -1621,8 +1625,8 @@ af_latin2_compute_stem_width( AF_GlyphHints hints, AF_Dimension dim, FT_Pos width, - AF_Edge_Flags base_flags, - AF_Edge_Flags stem_flags ) + FT_UInt base_flags, + FT_UInt stem_flags ) { AF_LatinMetrics metrics = (AF_LatinMetrics) hints->metrics; AF_LatinAxis axis = & metrics->axis[dim]; @@ -1793,10 +1797,9 @@ { FT_Pos dist = stem_edge->opos - base_edge->opos; - FT_Pos fitted_width = af_latin2_compute_stem_width( - hints, dim, dist, - (AF_Edge_Flags)base_edge->flags, - (AF_Edge_Flags)stem_edge->flags ); + FT_Pos fitted_width = af_latin2_compute_stem_width( hints, dim, dist, + base_edge->flags, + stem_edge->flags ); stem_edge->pos = base_edge->pos + fitted_width; @@ -1830,7 +1833,7 @@ /*************************************************************************/ - FT_LOCAL_DEF( void ) + static void af_latin2_hint_edges( AF_GlyphHints hints, AF_Dimension dim ) { @@ -1838,7 +1841,7 @@ AF_Edge edges = axis->edges; AF_Edge edge_limit = edges + axis->num_edges; AF_Edge edge; - AF_Edge anchor = 0; + AF_Edge anchor = NULL; FT_Int has_serifs = 0; FT_Pos anchor_drift = 0; @@ -1942,10 +1945,9 @@ org_len = edge2->opos - edge->opos; - cur_len = af_latin2_compute_stem_width( - hints, dim, org_len, - (AF_Edge_Flags)edge->flags, - (AF_Edge_Flags)edge2->flags ); + cur_len = af_latin2_compute_stem_width( hints, dim, org_len, + edge->flags, + edge2->flags ); if ( cur_len <= 64 ) u_off = d_off = 32; else @@ -2007,10 +2009,9 @@ org_len = edge2->opos - edge->opos; org_center = org_pos + ( org_len >> 1 ); - cur_len = af_latin2_compute_stem_width( - hints, dim, org_len, - (AF_Edge_Flags)edge->flags, - (AF_Edge_Flags)edge2->flags ); + cur_len = af_latin2_compute_stem_width( hints, dim, org_len, + edge->flags, + edge2->flags ); org_left = org_pos + ( ( org_len - cur_len ) >> 1 ); org_right = org_pos + ( ( org_len + cur_len ) >> 1 ); @@ -2313,8 +2314,9 @@ /* analyze glyph outline */ #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT || - AF_HINTS_DO_HORIZONTAL( hints ) ) + if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && + AF_HINTS_DO_WARP( hints ) ) || + AF_HINTS_DO_HORIZONTAL( hints ) ) #else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) #endif @@ -2337,8 +2339,9 @@ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { #ifdef AF_CONFIG_OPTION_USE_WARPER - if ( ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) ) + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT && + AF_HINTS_DO_WARP( hints ) ) { AF_WarperRec warper; FT_Fixed scale; @@ -2349,7 +2352,7 @@ af_glyph_hints_scale_dim( hints, dim, scale, delta ); continue; } -#endif +#endif /* AF_CONFIG_OPTION_USE_WARPER */ if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) || ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) ) diff --git a/freetype/src/autofit/aflatin2.h b/freetype/src/autofit/aflatin2.h index b5d252a91..932675313 100644 --- a/freetype/src/autofit/aflatin2.h +++ b/freetype/src/autofit/aflatin2.h @@ -5,7 +5,7 @@ /* Auto-fitter hinting routines for latin writing system */ /* (specification). */ /* */ -/* Copyright 2003-2007, 2012, 2013 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/afloader.c b/freetype/src/autofit/afloader.c index fb15c87f0..7c2fa7cff 100644 --- a/freetype/src/autofit/afloader.c +++ b/freetype/src/autofit/afloader.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (body). */ /* */ -/* Copyright 2003-2009, 2011-2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,38 +26,29 @@ /* Initialize glyph loader. */ - FT_LOCAL_DEF( FT_Error ) - af_loader_init( AF_Module module ) + FT_LOCAL_DEF( void ) + af_loader_init( AF_Loader loader, + AF_GlyphHints hints ) { - AF_Loader loader = module->loader; - FT_Memory memory = module->root.library->memory; - - FT_ZERO( loader ); - af_glyph_hints_init( &loader->hints, memory ); -#ifdef FT_DEBUG_AUTOFIT - _af_debug_hints = &loader->hints; -#endif - return FT_GlyphLoader_New( memory, &loader->gloader ); + loader->hints = hints; } /* Reset glyph loader and compute globals if necessary. */ FT_LOCAL_DEF( FT_Error ) - af_loader_reset( AF_Module module, + af_loader_reset( AF_Loader loader, + AF_Module module, FT_Face face ) { - FT_Error error = FT_Err_Ok; - AF_Loader loader = module->loader; + FT_Error error = FT_Err_Ok; loader->face = face; loader->globals = (AF_FaceGlobals)face->autohint.data; - FT_GlyphLoader_Rewind( loader->gloader ); - if ( loader->globals == NULL ) { error = af_face_globals_new( face, &loader->globals, module ); @@ -77,42 +68,33 @@ /* Finalize glyph loader. */ FT_LOCAL_DEF( void ) - af_loader_done( AF_Module module ) + af_loader_done( AF_Loader loader ) { - AF_Loader loader = module->loader; - - - af_glyph_hints_done( &loader->hints ); - loader->face = NULL; loader->globals = NULL; - -#ifdef FT_DEBUG_AUTOFIT - _af_debug_hints = NULL; -#endif - FT_GlyphLoader_Done( loader->gloader ); - loader->gloader = NULL; + loader->hints = NULL; } - /* Load a single glyph component. This routine calls itself */ - /* recursively, if necessary, and does the main work of */ - /* `af_loader_load_glyph.' */ + /* Do the main work of `af_loader_load_glyph'. Note that we never */ + /* have to deal with composite glyphs as those get loaded into */ + /* FT_GLYPH_FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function. */ + /* In the rare cases where FT_LOAD_NO_RECURSE is set, it implies */ + /* FT_LOAD_NO_SCALE and as such the auto-hinter is never called. */ static FT_Error af_loader_load_g( AF_Loader loader, AF_Scaler scaler, FT_UInt glyph_index, - FT_Int32 load_flags, - FT_UInt depth ) + FT_Int32 load_flags ) { FT_Error error; FT_Face face = loader->face; - FT_GlyphLoader gloader = loader->gloader; AF_StyleMetrics metrics = loader->metrics; - AF_GlyphHints hints = &loader->hints; + AF_GlyphHints hints = loader->hints; FT_GlyphSlot slot = face->glyph; FT_Slot_Internal internal = slot->internal; + FT_GlyphLoader gloader = internal->loader; FT_Int32 flags; @@ -144,29 +126,6 @@ loader->trans_delta.x, loader->trans_delta.y ); - /* copy the outline points in the loader's current */ - /* extra points which are used to keep original glyph coordinates */ - error = FT_GLYPHLOADER_CHECK_POINTS( gloader, - slot->outline.n_points + 4, - slot->outline.n_contours ); - if ( error ) - goto Exit; - - FT_ARRAY_COPY( gloader->current.outline.points, - slot->outline.points, - slot->outline.n_points ); - - FT_ARRAY_COPY( gloader->current.outline.contours, - slot->outline.contours, - slot->outline.n_contours ); - - FT_ARRAY_COPY( gloader->current.outline.tags, - slot->outline.tags, - slot->outline.n_points ); - - gloader->current.outline.n_points = slot->outline.n_points; - gloader->current.outline.n_contours = slot->outline.n_contours; - /* compute original horizontal phantom points (and ignore */ /* vertical ones) */ loader->pp1.x = hints->x_delta; @@ -192,7 +151,7 @@ if ( writing_system_class->style_hints_apply ) writing_system_class->style_hints_apply( hints, - &gloader->current.outline, + &gloader->base.outline, metrics ); } @@ -267,128 +226,6 @@ slot->rsb_delta = loader->pp2.x - pp2x; } - /* good, we simply add the glyph to our loader's base */ - FT_GlyphLoader_Add( gloader ); - break; - - case FT_GLYPH_FORMAT_COMPOSITE: - { - FT_UInt nn, num_subglyphs = slot->num_subglyphs; - FT_UInt num_base_subgs, start_point; - FT_SubGlyph subglyph; - - - start_point = gloader->base.outline.n_points; - - /* first of all, copy the subglyph descriptors in the glyph loader */ - error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs ); - if ( error ) - goto Exit; - - FT_ARRAY_COPY( gloader->current.subglyphs, - slot->subglyphs, - num_subglyphs ); - - gloader->current.num_subglyphs = num_subglyphs; - num_base_subgs = gloader->base.num_subglyphs; - - /* now read each subglyph independently */ - for ( nn = 0; nn < num_subglyphs; nn++ ) - { - FT_Vector pp1, pp2; - FT_Pos x, y; - FT_UInt num_points, num_new_points, num_base_points; - - - /* gloader.current.subglyphs can change during glyph loading due */ - /* to re-allocation -- we must recompute the current subglyph on */ - /* each iteration */ - subglyph = gloader->base.subglyphs + num_base_subgs + nn; - - pp1 = loader->pp1; - pp2 = loader->pp2; - - num_base_points = gloader->base.outline.n_points; - - error = af_loader_load_g( loader, scaler, subglyph->index, - load_flags, depth + 1 ); - if ( error ) - goto Exit; - - /* recompute subglyph pointer */ - subglyph = gloader->base.subglyphs + num_base_subgs + nn; - - if ( !( subglyph->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS ) ) - { - loader->pp1 = pp1; - loader->pp2 = pp2; - } - - num_points = gloader->base.outline.n_points; - num_new_points = num_points - num_base_points; - - /* now perform the transformation required for this subglyph */ - - if ( subglyph->flags & ( FT_SUBGLYPH_FLAG_SCALE | - FT_SUBGLYPH_FLAG_XY_SCALE | - FT_SUBGLYPH_FLAG_2X2 ) ) - { - FT_Vector* cur = gloader->base.outline.points + - num_base_points; - FT_Vector* limit = cur + num_new_points; - - - for ( ; cur < limit; cur++ ) - FT_Vector_Transform( cur, &subglyph->transform ); - } - - /* apply offset */ - - if ( !( subglyph->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ) ) - { - FT_Int k = subglyph->arg1; - FT_UInt l = subglyph->arg2; - FT_Vector* p1; - FT_Vector* p2; - - - if ( start_point + k >= num_base_points || - l >= (FT_UInt)num_new_points ) - { - error = FT_THROW( Invalid_Composite ); - goto Exit; - } - - l += num_base_points; - - /* for now, only use the current point coordinates; */ - /* we eventually may consider another approach */ - p1 = gloader->base.outline.points + start_point + k; - p2 = gloader->base.outline.points + start_point + l; - - x = p1->x - p2->x; - y = p1->y - p2->y; - } - else - { - x = FT_MulFix( subglyph->arg1, hints->x_scale ) + hints->x_delta; - y = FT_MulFix( subglyph->arg2, hints->y_scale ) + hints->y_delta; - - x = FT_PIX_ROUND( x ); - y = FT_PIX_ROUND( y ); - } - - { - FT_Outline dummy = gloader->base.outline; - - - dummy.points += num_base_points; - dummy.n_points = (short)num_new_points; - - FT_Outline_Translate( &dummy, x, y ); - } - } - } break; default: @@ -397,7 +234,6 @@ } Hint_Metrics: - if ( depth == 0 ) { FT_BBox bbox; FT_Vector vvector; @@ -472,18 +308,14 @@ slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance ); - /* now copy outline into glyph slot */ - FT_GlyphLoader_Rewind( internal->loader ); - error = FT_GlyphLoader_CopyPoints( internal->loader, gloader ); - if ( error ) - goto Exit; - +#if 0 /* reassign all outline fields except flags to protect them */ slot->outline.n_contours = internal->loader->base.outline.n_contours; slot->outline.n_points = internal->loader->base.outline.n_points; slot->outline.points = internal->loader->base.outline.points; slot->outline.tags = internal->loader->base.outline.tags; slot->outline.contours = internal->loader->base.outline.contours; +#endif slot->format = FT_GLYPH_FORMAT_OUTLINE; } @@ -496,14 +328,14 @@ /* Load a glyph. */ FT_LOCAL_DEF( FT_Error ) - af_loader_load_glyph( AF_Module module, + af_loader_load_glyph( AF_Loader loader, + AF_Module module, FT_Face face, FT_UInt gindex, FT_Int32 load_flags ) { FT_Error error; FT_Size size = face->size; - AF_Loader loader = module->loader; AF_ScalerRec scaler; @@ -521,7 +353,7 @@ scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags ); scaler.flags = 0; /* XXX: fix this */ - error = af_loader_reset( module, face ); + error = af_loader_reset( loader, module, face ); if ( !error ) { AF_StyleMetrics metrics; @@ -558,13 +390,13 @@ if ( writing_system_class->style_hints_init ) { - error = writing_system_class->style_hints_init( &loader->hints, + error = writing_system_class->style_hints_init( loader->hints, metrics ); if ( error ) goto Exit; } - error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 ); + error = af_loader_load_g( loader, &scaler, gindex, load_flags ); } } Exit: diff --git a/freetype/src/autofit/afloader.h b/freetype/src/autofit/afloader.h index 9601e24fc..37cfd1423 100644 --- a/freetype/src/autofit/afloader.h +++ b/freetype/src/autofit/afloader.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (specification). */ /* */ -/* Copyright 2003-2005, 2011-2013 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,13 +20,12 @@ #define __AFLOADER_H__ #include "afhints.h" +#include "afmodule.h" #include "afglobal.h" FT_BEGIN_HEADER - typedef struct AF_ModuleRec_* AF_Module; - /* * The autofitter module's (global) data structure to communicate with * actual fonts. If necessary, `local' data like the current face, the @@ -42,8 +41,7 @@ FT_BEGIN_HEADER AF_FaceGlobals globals; /* current glyph data */ - FT_GlyphLoader gloader; - AF_GlyphHintsRec hints; + AF_GlyphHints hints; AF_StyleMetrics metrics; FT_Bool transformed; FT_Matrix trans_matrix; @@ -55,21 +53,24 @@ FT_BEGIN_HEADER } AF_LoaderRec, *AF_Loader; - FT_LOCAL( FT_Error ) - af_loader_init( AF_Module module ); + FT_LOCAL( void ) + af_loader_init( AF_Loader loader, + AF_GlyphHints hints ); FT_LOCAL( FT_Error ) - af_loader_reset( AF_Module module, + af_loader_reset( AF_Loader loader, + AF_Module module, FT_Face face ); FT_LOCAL( void ) - af_loader_done( AF_Module module ); + af_loader_done( AF_Loader loader ); FT_LOCAL( FT_Error ) - af_loader_load_glyph( AF_Module module, + af_loader_load_glyph( AF_Loader loader, + AF_Module module, FT_Face face, FT_UInt gindex, FT_Int32 load_flags ); diff --git a/freetype/src/autofit/afmodule.c b/freetype/src/autofit/afmodule.c index 641e03ea2..8ae425c00 100644 --- a/freetype/src/autofit/afmodule.c +++ b/freetype/src/autofit/afmodule.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module implementation (body). */ /* */ -/* Copyright 2003-2006, 2009, 2011-2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,10 +23,27 @@ #include "afpic.h" #ifdef FT_DEBUG_AUTOFIT - int _af_debug_disable_horz_hints; - int _af_debug_disable_vert_hints; - int _af_debug_disable_blue_hints; - void* _af_debug_hints; + +#ifndef FT_MAKE_OPTION_SINGLE_OBJECT + extern void + af_glyph_hints_dump_segments( AF_GlyphHints hints, + FT_Bool to_stdout ); + extern void + af_glyph_hints_dump_points( AF_GlyphHints hints, + FT_Bool to_stdout ); + extern void + af_glyph_hints_dump_edges( AF_GlyphHints hints, + FT_Bool to_stdout ); +#endif + + int _af_debug_disable_horz_hints; + int _af_debug_disable_vert_hints; + int _af_debug_disable_blue_hints; + + /* we use a global object instead of a local one for debugging */ + AF_GlyphHintsRec _af_debug_hints_rec[1]; + + void* _af_debug_hints = _af_debug_hints_rec; #endif #include FT_INTERNAL_OBJECTS_H @@ -141,6 +158,17 @@ return error; } +#ifdef AF_CONFIG_OPTION_USE_WARPER + else if ( !ft_strcmp( property_name, "warping" ) ) + { + FT_Bool* warping = (FT_Bool*)value; + + + module->warping = *warping; + + return error; + } +#endif /* AF_CONFIG_OPTION_USE_WARPER */ FT_TRACE0(( "af_property_set: missing property `%s'\n", property_name )); @@ -157,6 +185,9 @@ AF_Module module = (AF_Module)ft_module; FT_UInt fallback_style = module->fallback_style; FT_UInt default_script = module->default_script; +#ifdef AF_CONFIG_OPTION_USE_WARPER + FT_Bool warping = module->warping; +#endif if ( !ft_strcmp( property_name, "glyph-to-script-map" ) ) @@ -203,7 +234,17 @@ return error; } +#ifdef AF_CONFIG_OPTION_USE_WARPER + else if ( !ft_strcmp( property_name, "warping" ) ) + { + FT_Bool* val = (FT_Bool*)value; + + + *val = warping; + return error; + } +#endif /* AF_CONFIG_OPTION_USE_WARPER */ FT_TRACE0(( "af_property_get: missing property `%s'\n", property_name )); @@ -252,18 +293,23 @@ module->fallback_style = AF_STYLE_FALLBACK; module->default_script = AF_SCRIPT_DEFAULT; +#ifdef AF_CONFIG_OPTION_USE_WARPER + module->warping = 0; +#endif - return af_loader_init( module ); + return FT_Err_Ok; } FT_CALLBACK_DEF( void ) af_autofitter_done( FT_Module ft_module ) /* AF_Module */ { - AF_Module module = (AF_Module)ft_module; - + FT_UNUSED( ft_module ); - af_loader_done( module ); +#ifdef FT_DEBUG_AUTOFIT + if ( _af_debug_hints_rec->memory ) + af_glyph_hints_done( _af_debug_hints_rec ); +#endif } @@ -274,10 +320,56 @@ FT_UInt glyph_index, FT_Int32 load_flags ) { + FT_Error error = FT_Err_Ok; + FT_Memory memory = module->root.library->memory; + +#ifdef FT_DEBUG_AUTOFIT + + /* in debug mode, we use a global object that survives this routine */ + + AF_GlyphHints hints = _af_debug_hints_rec; + AF_LoaderRec loader[1]; + FT_UNUSED( size ); - return af_loader_load_glyph( module, slot->face, - glyph_index, load_flags ); + + if ( hints->memory ) + af_glyph_hints_done( hints ); + + af_glyph_hints_init( hints, memory ); + af_loader_init( loader, hints ); + + error = af_loader_load_glyph( loader, module, slot->face, + glyph_index, load_flags ); + + af_glyph_hints_dump_points( hints, 0 ); + af_glyph_hints_dump_segments( hints, 0 ); + af_glyph_hints_dump_edges( hints, 0 ); + + af_loader_done( loader ); + + return error; + +#else /* !FT_DEBUG_AUTOFIT */ + + AF_GlyphHintsRec hints[1]; + AF_LoaderRec loader[1]; + + FT_UNUSED( size ); + + + af_glyph_hints_init( hints, memory ); + af_loader_init( loader, hints ); + + error = af_loader_load_glyph( loader, module, slot->face, + glyph_index, load_flags ); + + af_loader_done( loader ); + af_glyph_hints_done( hints ); + + return error; + +#endif /* !FT_DEBUG_AUTOFIT */ } diff --git a/freetype/src/autofit/afmodule.h b/freetype/src/autofit/afmodule.h index 20b7b9f66..b9c2fd8a2 100644 --- a/freetype/src/autofit/afmodule.h +++ b/freetype/src/autofit/afmodule.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module implementation (specification). */ /* */ -/* Copyright 2003-2005, 2009, 2012, 2013 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,17 +23,13 @@ #include FT_INTERNAL_OBJECTS_H #include FT_MODULE_H -#include "afloader.h" - FT_BEGIN_HEADER /* - * This is the `extended' FT_Module structure which holds the - * autofitter's global data. Right before hinting a glyph, the data - * specific to the glyph's face (blue zones, stem widths, etc.) are - * loaded into `loader' (see function `af_loader_reset'). + * This is the `extended' FT_Module structure that holds the + * autofitter's global data. */ typedef struct AF_ModuleRec_ @@ -42,13 +38,14 @@ FT_BEGIN_HEADER FT_UInt fallback_style; FT_UInt default_script; +#ifdef AF_CONFIG_OPTION_USE_WARPER + FT_Bool warping; +#endif - AF_LoaderRec loader[1]; - - } AF_ModuleRec; + } AF_ModuleRec, *AF_Module; -FT_DECLARE_MODULE(autofit_module_class) +FT_DECLARE_MODULE( autofit_module_class ) FT_END_HEADER diff --git a/freetype/src/autofit/afpic.c b/freetype/src/autofit/afpic.c index cb29fd79f..5589e612c 100644 --- a/freetype/src/autofit/afpic.c +++ b/freetype/src/autofit/afpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009-2014 by */ +/* Copyright 2009-2015 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/afpic.h b/freetype/src/autofit/afpic.h index 9a68b4a5a..25071e3bc 100644 --- a/freetype/src/autofit/afpic.h +++ b/freetype/src/autofit/afpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009, 2011-2013 by */ +/* Copyright 2009-2015 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/afranges.c b/freetype/src/autofit/afranges.c index b2c504d42..c1e0afb7e 100644 --- a/freetype/src/autofit/afranges.c +++ b/freetype/src/autofit/afranges.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter Unicode script ranges (body). */ /* */ -/* Copyright 2013, 2014 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,6 +19,17 @@ #include "afranges.h" + const AF_Script_UniRangeRec af_arab_uniranges[] = + { + AF_UNIRANGE_REC( 0x0600UL, 0x06FFUL ), /* Arabic */ + AF_UNIRANGE_REC( 0x0750UL, 0x07FFUL ), /* Arabic Supplement */ + AF_UNIRANGE_REC( 0x08A0UL, 0x08FFUL ), /* Arabic Extended-A */ + AF_UNIRANGE_REC( 0xFB50UL, 0xFDFFUL ), /* Arabic Presentation Forms-A */ + AF_UNIRANGE_REC( 0xFE70UL, 0xFEFFUL ), /* Arabic Presentation Forms-B */ + AF_UNIRANGE_REC( 0x1EE00UL, 0x1EEFFUL ), /* Arabic Mathematical Alphabetic Symbols */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + const AF_Script_UniRangeRec af_cyrl_uniranges[] = { AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */ @@ -98,6 +109,12 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_thai_uniranges[] = + { + AF_UNIRANGE_REC( 0x0E00UL, 0x0E7FUL ), /* Thai */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + #ifdef AF_CONFIG_OPTION_INDIC const AF_Script_UniRangeRec af_beng_uniranges[] = diff --git a/freetype/src/autofit/afranges.h b/freetype/src/autofit/afranges.h index fe5b2aa7c..7c78ab089 100644 --- a/freetype/src/autofit/afranges.h +++ b/freetype/src/autofit/afranges.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter Unicode script ranges (specification). */ /* */ -/* Copyright 2013, 2014 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/afscript.h b/freetype/src/autofit/afscript.h index efe8754df..dfcc8302a 100644 --- a/freetype/src/autofit/afscript.h +++ b/freetype/src/autofit/afscript.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter scripts (specification only). */ /* */ -/* Copyright 2013, 2014 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,6 +26,11 @@ /* script name tag, followed by a string of standard characters (to */ /* derive the standard width and height of stems). */ + SCRIPT( arab, ARAB, + "Arabic", + HB_SCRIPT_ARABIC, + 0x644, 0x62D, 0x640 ) /* ل ح ـ */ + SCRIPT( cyrl, CYRL, "Cyrillic", HB_SCRIPT_CYRILLIC, @@ -62,6 +67,11 @@ HB_SCRIPT_TELUGU, 0xC66, 0xC67, 0x0 ) /* ౦ ౧ */ + SCRIPT( thai, THAI, + "Thai", + HB_SCRIPT_THAI, + 0xE32, 0xE45, 0xE50 ) /* า ๅ ๐ */ + #ifdef AF_CONFIG_OPTION_INDIC SCRIPT( beng, BENG, diff --git a/freetype/src/autofit/afstyles.h b/freetype/src/autofit/afstyles.h index f14d354cc..bfd5bb910 100644 --- a/freetype/src/autofit/afstyles.h +++ b/freetype/src/autofit/afstyles.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter styles (specification only). */ /* */ -/* Copyright 2013, 2014 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -80,6 +80,14 @@ "default", \ DEFAULT ) + + STYLE( arab_dflt, ARAB_DFLT, + "Arabic default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_ARAB, + AF_BLUE_STRINGSET_ARAB, + AF_COVERAGE_DEFAULT ) + META_STYLE_LATIN( cyrl, CYRL, "Cyrillic" ) META_STYLE_LATIN( grek, GREK, "Greek" ) @@ -122,6 +130,13 @@ AF_BLUE_STRINGSET_TELU, AF_COVERAGE_DEFAULT ) + STYLE( thai_dflt, THAI_DFLT, + "Thai default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_THAI, + AF_BLUE_STRINGSET_THAI, + AF_COVERAGE_DEFAULT ) + #ifdef AF_CONFIG_OPTION_INDIC /* no blue stringset support for the Indic writing system yet */ diff --git a/freetype/src/autofit/aftypes.h b/freetype/src/autofit/aftypes.h index 61badd1b8..78e3fd7ec 100644 --- a/freetype/src/autofit/aftypes.h +++ b/freetype/src/autofit/aftypes.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter types (specification only). */ /* */ -/* Copyright 2003-2009, 2011-2014 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -138,11 +138,10 @@ extern void* _af_debug_hints; AF_Angle _delta = (angle2) - (angle1); \ \ \ - _delta %= AF_ANGLE_2PI; \ - if ( _delta < 0 ) \ + while ( _delta <= -AF_ANGLE_PI ) \ _delta += AF_ANGLE_2PI; \ \ - if ( _delta > AF_ANGLE_PI ) \ + while ( _delta > AF_ANGLE_PI ) \ _delta -= AF_ANGLE_2PI; \ \ result = _delta; \ @@ -168,13 +167,10 @@ extern void* _af_debug_hints; * auto-hinted glyph image. */ - typedef enum AF_ScalerFlags_ - { - AF_SCALER_FLAG_NO_HORIZONTAL = 1, /* disable horizontal hinting */ - AF_SCALER_FLAG_NO_VERTICAL = 2, /* disable vertical hinting */ - AF_SCALER_FLAG_NO_ADVANCE = 4 /* disable advance hinting */ - - } AF_ScalerFlags; +#define AF_SCALER_FLAG_NO_HORIZONTAL 1U /* disable horizontal hinting */ +#define AF_SCALER_FLAG_NO_VERTICAL 2U /* disable vertical hinting */ +#define AF_SCALER_FLAG_NO_ADVANCE 4U /* disable advance hinting */ +#define AF_SCALER_FLAG_NO_WARPER 8U /* disable warper */ typedef struct AF_ScalerRec_ diff --git a/freetype/src/autofit/afwarp.c b/freetype/src/autofit/afwarp.c index 34a97ffc5..59af4f02b 100644 --- a/freetype/src/autofit/afwarp.c +++ b/freetype/src/autofit/afwarp.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter warping algorithm (body). */ /* */ -/* Copyright 2006, 2007, 2011 by */ +/* Copyright 2006-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -76,10 +76,10 @@ FT_Pos xx2, AF_WarpScore base_distort, AF_Segment segments, - FT_UInt num_segments ) + FT_Int num_segments ) { FT_Int idx_min, idx_max, idx0; - FT_UInt nn; + FT_Int nn; AF_WarpScore scores[65]; @@ -171,7 +171,7 @@ FT_Fixed org_scale; FT_Pos org_delta; - FT_UInt nn, num_points, num_segments; + FT_Int nn, num_points, num_segments; FT_Int X1, X2; FT_Int w; diff --git a/freetype/src/autofit/afwarp.h b/freetype/src/autofit/afwarp.h index 7343fdd5e..5a6208a15 100644 --- a/freetype/src/autofit/afwarp.h +++ b/freetype/src/autofit/afwarp.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter warping algorithm (specification). */ /* */ -/* Copyright 2006, 2007 by */ +/* Copyright 2006-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,7 +25,7 @@ FT_BEGIN_HEADER #define AF_WARPER_SCALE -#define AF_WARPER_FLOOR( x ) ( (x) & ~63 ) +#define AF_WARPER_FLOOR( x ) ( (x) & ~TYPEOF( x )63 ) #define AF_WARPER_CEIL( x ) AF_WARPER_FLOOR( (x) + 63 ) diff --git a/freetype/src/autofit/afwrtsys.h b/freetype/src/autofit/afwrtsys.h index 8aa2ed9e6..4aa89d235 100644 --- a/freetype/src/autofit/afwrtsys.h +++ b/freetype/src/autofit/afwrtsys.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter writing systems (specification only). */ /* */ -/* Copyright 2013 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/autofit.c b/freetype/src/autofit/autofit.c index e2b9934e4..b6ed4a0ff 100644 --- a/freetype/src/autofit/autofit.c +++ b/freetype/src/autofit/autofit.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module (body). */ /* */ -/* Copyright 2003-2007, 2011, 2013 by */ +/* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/hbshim.c b/freetype/src/autofit/hbshim.c index a705cef00..c9c1db0be 100644 --- a/freetype/src/autofit/hbshim.c +++ b/freetype/src/autofit/hbshim.c @@ -4,7 +4,7 @@ /* */ /* HarfBuzz interface for accessing OpenType features (body). */ /* */ -/* Copyright 2013, 2014 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -187,7 +187,7 @@ count = 0; #endif - for ( idx = -1; hb_set_next( gsub_lookups, &idx ); ) + for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE4(( " %d", idx )); @@ -218,7 +218,7 @@ count = 0; #endif - for ( idx = -1; hb_set_next( gpos_lookups, &idx ); ) + for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE4(( " %d", idx )); @@ -267,7 +267,8 @@ GET_UTF8_CHAR( ch, p ); - for ( idx = -1; hb_set_next( gsub_lookups, &idx ); ) + for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, + &idx ); ) { hb_codepoint_t gidx = FT_Get_Char_Index( globals->face, ch ); @@ -344,7 +345,7 @@ count = 0; #endif - for ( idx = -1; hb_set_next( gsub_glyphs, &idx ); ) + for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_glyphs, &idx ); ) { #ifdef FT_DEBUG_LEVEL_TRACE if ( !( count % 10 ) ) @@ -441,7 +442,7 @@ if ( feature ) { - FT_UInt upem = metrics->globals->face->units_per_EM; + FT_Int upem = (FT_Int)metrics->globals->face->units_per_EM; hb_font_t* font = metrics->globals->hb_font; hb_buffer_t* buf = hb_buffer_create(); diff --git a/freetype/src/autofit/hbshim.h b/freetype/src/autofit/hbshim.h index 02f1513f6..5636ca649 100644 --- a/freetype/src/autofit/hbshim.h +++ b/freetype/src/autofit/hbshim.h @@ -4,7 +4,7 @@ /* */ /* HarfBuzz interface for accessing OpenType features (specification). */ /* */ -/* Copyright 2013 by */ +/* Copyright 2013-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/freetype/src/autofit/module.mk b/freetype/src/autofit/module.mk index 6ec60912a..33214387f 100644 --- a/freetype/src/autofit/module.mk +++ b/freetype/src/autofit/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2003, 2004, 2005, 2006 by +# Copyright 2003-2015 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/freetype/src/autofit/rules.mk b/freetype/src/autofit/rules.mk index 658f04ea5..6ef959f1b 100644 --- a/freetype/src/autofit/rules.mk +++ b/freetype/src/autofit/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2007, 2011, 2013 by +# Copyright 2003-2015 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -20,7 +20,10 @@ AUTOF_DIR := $(SRC_DIR)/autofit # compilation flags for the driver # -AUTOF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(AUTOF_DIR)) +AUTOF_COMPILE := $(CC) $(ANSIFLAGS) \ + $I$(subst /,$(COMPILER_SEP),$(AUTOF_DIR)) \ + $(INCLUDE_FLAGS) \ + $(FT_CFLAGS) # AUTOF driver sources (i.e., C files) |