From dba44cd4e5754b579f2184a864ffe7b79b0a7e56 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 2 Nov 2015 07:10:28 +0400 Subject: Update bundled FreeType to 2.6.1 Change-Id: Ic489f8aa8ad42da3922f542e6c9064afe44f3799 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/3rdparty/freetype/src/autofit/Jamfile | 20 +- src/3rdparty/freetype/src/autofit/afangles.c | 4 +- src/3rdparty/freetype/src/autofit/afblue.c | 88 +++++- src/3rdparty/freetype/src/autofit/afblue.cin | 2 +- src/3rdparty/freetype/src/autofit/afblue.dat | 114 +++++++- src/3rdparty/freetype/src/autofit/afblue.h | 108 ++++--- src/3rdparty/freetype/src/autofit/afblue.hin | 14 +- src/3rdparty/freetype/src/autofit/afcjk.c | 80 +++--- src/3rdparty/freetype/src/autofit/afcjk.h | 17 +- src/3rdparty/freetype/src/autofit/afcover.h | 2 +- src/3rdparty/freetype/src/autofit/afdummy.c | 7 +- src/3rdparty/freetype/src/autofit/afdummy.h | 2 +- src/3rdparty/freetype/src/autofit/aferrors.h | 2 +- src/3rdparty/freetype/src/autofit/afglobal.c | 69 +++-- src/3rdparty/freetype/src/autofit/afglobal.h | 18 +- src/3rdparty/freetype/src/autofit/afhints.c | 199 ++++++++----- src/3rdparty/freetype/src/autofit/afhints.h | 73 +++-- src/3rdparty/freetype/src/autofit/afindic.c | 7 +- src/3rdparty/freetype/src/autofit/afindic.h | 2 +- src/3rdparty/freetype/src/autofit/aflatin.c | 171 ++++++----- src/3rdparty/freetype/src/autofit/aflatin.h | 30 +- src/3rdparty/freetype/src/autofit/aflatin2.c | 80 +++--- src/3rdparty/freetype/src/autofit/aflatin2.h | 2 +- src/3rdparty/freetype/src/autofit/afloader.c | 223 ++------------- src/3rdparty/freetype/src/autofit/afloader.h | 21 +- src/3rdparty/freetype/src/autofit/afmodule.c | 122 +++++++- src/3rdparty/freetype/src/autofit/afmodule.h | 19 +- src/3rdparty/freetype/src/autofit/afpic.c | 2 +- src/3rdparty/freetype/src/autofit/afpic.h | 10 +- src/3rdparty/freetype/src/autofit/afranges.c | 405 +++++++++++++++++++++++++-- src/3rdparty/freetype/src/autofit/afranges.h | 8 +- src/3rdparty/freetype/src/autofit/afscript.h | 36 ++- src/3rdparty/freetype/src/autofit/afstyles.h | 51 +++- src/3rdparty/freetype/src/autofit/aftypes.h | 50 ++-- src/3rdparty/freetype/src/autofit/afwarp.c | 8 +- src/3rdparty/freetype/src/autofit/afwarp.h | 4 +- src/3rdparty/freetype/src/autofit/afwrtsys.h | 2 +- src/3rdparty/freetype/src/autofit/autofit.c | 2 +- src/3rdparty/freetype/src/autofit/hbshim.c | 19 +- src/3rdparty/freetype/src/autofit/hbshim.h | 4 +- src/3rdparty/freetype/src/autofit/module.mk | 2 +- src/3rdparty/freetype/src/autofit/rules.mk | 7 +- 42 files changed, 1448 insertions(+), 658 deletions(-) (limited to 'src/3rdparty/freetype/src/autofit') diff --git a/src/3rdparty/freetype/src/autofit/Jamfile b/src/3rdparty/freetype/src/autofit/Jamfile index 2714765b5b..5cd0b46108 100644 --- a/src/3rdparty/freetype/src/autofit/Jamfile +++ b/src/3rdparty/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, @@ -17,11 +17,25 @@ SubDir FT2_TOP src autofit ; # define FT2_AUTOFIT2 to enable experimental latin hinter replacement if $(FT2_AUTOFIT2) { - DEFINES += FT_OPTION_AUTOFIT2 ; + CCFLAGS += FT_OPTION_AUTOFIT2 ; } if $(FT2_MULTI) { - _sources = afangles afglobal afhints aflatin afcjk afindic afloader afmodule afdummy afwarp afpic ; + _sources = afangles + afblue + afcjk + afdummy + afglobal + afhints + afindic + aflatin + afloader + afmodule + afpic + afranges + afwarp + hbshim + ; if $(FT2_AUTOFIT2) { diff --git a/src/3rdparty/freetype/src/autofit/afangles.c b/src/3rdparty/freetype/src/autofit/afangles.c index f8b095bef3..1b1eb31fe7 100644 --- a/src/3rdparty/freetype/src/autofit/afangles.c +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afblue.c b/src/3rdparty/freetype/src/autofit/afblue.c index 811226eac3..b871e0c651 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.c +++ b/src/3rdparty/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,12 @@ 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', + '\xD9', '\x80', /* ـ */ + '\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', /* БВЕШЗОСЭ */ @@ -58,6 +64,16 @@ '\0', '\xD7', '\xA7', '\xD7', '\x9A', '\xD7', '\x9F', '\xD7', '\xA3', '\xD7', '\xA5', /* קךןףץ */ '\0', + '\xE0', '\xBA', '\xB2', '\xE0', '\xBA', '\x94', '\xE0', '\xBA', '\xAD', '\xE0', '\xBA', '\xA1', '\xE0', '\xBA', '\xA5', '\xE0', '\xBA', '\xA7', '\xE0', '\xBA', '\xA3', '\xE0', '\xBA', '\x87', /* າ ດ ອ ມ ລ ວ ຣ ງ */ + '\0', + '\xE0', '\xBA', '\xB2', '\xE0', '\xBA', '\xAD', '\xE0', '\xBA', '\x9A', '\xE0', '\xBA', '\x8D', '\xE0', '\xBA', '\xA3', '\xE0', '\xBA', '\xAE', '\xE0', '\xBA', '\xA7', '\xE0', '\xBA', '\xA2', /* າ ອ ບ ຍ ຣ ຮ ວ ຢ */ + '\0', + '\xE0', '\xBA', '\x9B', '\xE0', '\xBA', '\xA2', '\xE0', '\xBA', '\x9F', '\xE0', '\xBA', '\x9D', /* ປ ຢ ຟ ຝ */ + '\0', + '\xE0', '\xBB', '\x82', '\xE0', '\xBB', '\x84', '\xE0', '\xBB', '\x83', /* ໂ ໄ ໃ */ + '\0', + '\xE0', '\xBA', '\x87', '\xE0', '\xBA', '\x8A', '\xE0', '\xBA', '\x96', '\xE0', '\xBA', '\xBD', '\xE0', '\xBB', '\x86', '\xE0', '\xBA', '\xAF', /* ງ ຊ ຖ ຽ ໆ ຯ */ + '\0', 'T', 'H', 'E', 'Z', 'O', 'C', 'Q', 'S', /* THEZOCQS */ '\0', 'H', 'E', 'Z', 'L', 'O', 'C', 'U', 'S', /* HEZLOCUS */ @@ -68,9 +84,43 @@ '\0', 'p', 'q', 'g', 'j', 'y', /* pqgjy */ '\0', + '\xE2', '\x82', '\x80', '\xE2', '\x82', '\x83', '\xE2', '\x82', '\x85', '\xE2', '\x82', '\x87', '\xE2', '\x82', '\x88', /* ₀₃₅₇₈ */ + '\0', + '\xE2', '\x82', '\x80', '\xE2', '\x82', '\x81', '\xE2', '\x82', '\x82', '\xE2', '\x82', '\x83', '\xE2', '\x82', '\x88', /* ₀₁₂₃₈ */ + '\0', + '\xE1', '\xB5', '\xA2', '\xE2', '\xB1', '\xBC', '\xE2', '\x82', '\x95', '\xE2', '\x82', '\x96', '\xE2', '\x82', '\x97', /* ᵢⱼₕₖₗ */ + '\0', + '\xE2', '\x82', '\x90', '\xE2', '\x82', '\x91', '\xE2', '\x82', '\x92', '\xE2', '\x82', '\x93', '\xE2', '\x82', '\x99', '\xE2', '\x82', '\x9B', '\xE1', '\xB5', '\xA5', '\xE1', '\xB5', '\xA4', '\xE1', '\xB5', '\xA3', /* ₐₑₒₓₙₛᵥᵤᵣ */ + '\0', + '\xE1', '\xB5', '\xA6', '\xE1', '\xB5', '\xA7', '\xE1', '\xB5', '\xA8', '\xE1', '\xB5', '\xA9', '\xE2', '\x82', '\x9A', /* ᵦᵧᵨᵩₚ */ + '\0', + '\xE2', '\x81', '\xB0', '\xC2', '\xB3', '\xE2', '\x81', '\xB5', '\xE2', '\x81', '\xB7', '\xE1', '\xB5', '\x80', '\xE1', '\xB4', '\xB4', '\xE1', '\xB4', '\xB1', '\xE1', '\xB4', '\xBC', /* ⁰³⁵⁷ᵀᴴᴱᴼ */ + '\0', + '\xE2', '\x81', '\xB0', '\xC2', '\xB9', '\xC2', '\xB2', '\xC2', '\xB3', '\xE1', '\xB4', '\xB1', '\xE1', '\xB4', '\xB8', '\xE1', '\xB4', '\xBC', '\xE1', '\xB5', '\x81', /* ⁰¹²³ᴱᴸᴼᵁ */ + '\0', + '\xE1', '\xB5', '\x87', '\xE1', '\xB5', '\x88', '\xE1', '\xB5', '\x8F', '\xCA', '\xB0', '\xCA', '\xB2', '\xE1', '\xB6', '\xA0', '\xE2', '\x81', '\xB1', /* ᵇᵈᵏʰʲᶠⁱ */ + '\0', + '\xE1', '\xB5', '\x89', '\xE1', '\xB5', '\x92', '\xCA', '\xB3', '\xCB', '\xA2', '\xCB', '\xA3', '\xE1', '\xB6', '\x9C', '\xE1', '\xB6', '\xBB', /* ᵉᵒʳˢˣᶜᶻ */ + '\0', + '\xE1', '\xB5', '\x96', '\xCA', '\xB8', '\xE1', '\xB5', '\x8D', /* ᵖʸᵍ */ + '\0', '\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 +171,10 @@ af_blue_stringsets[] = { /* */ + { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_ARABIC_BOTTOM, 0 }, + { AF_BLUE_STRING_ARABIC_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL }, + { 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 | @@ -149,6 +203,13 @@ { AF_BLUE_STRING_HEBREW_BOTTOM, 0 }, { AF_BLUE_STRING_HEBREW_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_LAO_BOTTOM, 0 }, + { AF_BLUE_STRING_LAO_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LAO_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LAO_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 }, { AF_BLUE_STRING_LATIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, @@ -157,9 +218,34 @@ { AF_BLUE_STRING_LATIN_SMALL, 0 }, { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 }, + { AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 }, + { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { 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/src/3rdparty/freetype/src/autofit/afblue.cin b/src/3rdparty/freetype/src/autofit/afblue.cin index c6762bec30..b303a4b2b0 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.cin +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afblue.dat b/src/3rdparty/freetype/src/autofit/afblue.dat index 3f98c13b24..1b52378ed3 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.dat +++ b/src/3rdparty/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,18 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: + AF_BLUE_STRING_ARABIC_TOP + "ا إ ل ك ط ظ" + AF_BLUE_STRING_ARABIC_BOTTOM + "ت ث ط ظ ك" + // We don't necessarily have access to medial forms via Unicode in case + // Arabic presentational forms are missing. The only character that is + // guaranteed to have the same vertical position with joining (this is, + // non-isolated) forms is U+0640, ARABIC TATWEEL, which must join both + // round and flat curves. + AF_BLUE_STRING_ARABIC_JOIN + "ـ" + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP "БВЕПЗОСЭ" AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM @@ -108,6 +120,17 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_HEBREW_DESCENDER "קךןףץ" + AF_BLUE_STRING_LAO_TOP + "າ ດ ອ ມ ລ ວ ຣ ງ" + AF_BLUE_STRING_LAO_BOTTOM + "າ ອ ບ ຍ ຣ ຮ ວ ຢ" + AF_BLUE_STRING_LAO_ASCENDER + "ປ ຢ ຟ ຝ" + AF_BLUE_STRING_LAO_LARGE_ASCENDER + "ໂ ໄ ໃ" + AF_BLUE_STRING_LAO_DESCENDER + "ງ ຊ ຖ ຽ ໆ ຯ" + AF_BLUE_STRING_LATIN_CAPITAL_TOP "THEZOCQS" AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM @@ -119,14 +142,54 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_LATIN_SMALL_DESCENDER "pqgjy" + // we assume that both the subscript and superscript ranges + // don't contain oldstyle digits (actually, most fonts probably + // have digits only in those ranges) + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP + "₀₃₅₇₈" + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM + "₀₁₂₃₈" + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP + "ᵢⱼₕₖₗ" + AF_BLUE_STRING_LATIN_SUBS_SMALL + "ₐₑₒₓₙₛᵥᵤᵣ" + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER + "ᵦᵧᵨᵩₚ" + + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP + "⁰³⁵⁷ᵀᴴᴱᴼ" + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM + "⁰¹²³ᴱᴸᴼᵁ" + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP + "ᵇᵈᵏʰʲᶠⁱ" + AF_BLUE_STRING_LATIN_SUPS_SMALL + "ᵉᵒʳˢˣᶜᶻ" + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER + "ᵖʸᵍ" + // we separate the letters with spaces to avoid ligatures; // 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 +331,12 @@ 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_BOTTOM, 0 } + { AF_BLUE_STRING_ARABIC_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL } + { 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 } @@ -304,6 +373,15 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_HEBREW_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_LAO + { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_LAO_BOTTOM, 0 } + { AF_BLUE_STRING_LAO_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LAO_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LAO_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_LATN { AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 } @@ -314,11 +392,43 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_LATB + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUBS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 } + { AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + + AF_BLUE_STRINGSET_LATP + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_LATIN_SUPS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 } + { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_TELU { AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { 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/src/3rdparty/freetype/src/autofit/afblue.h b/src/3rdparty/freetype/src/autofit/afblue.h index a86184191d..c26a9c792b 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.h +++ b/src/3rdparty/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,55 @@ 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_BOTTOM = 13, + AF_BLUE_STRING_ARABIC_JOIN = 24, + AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 27, + AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 44, + AF_BLUE_STRING_CYRILLIC_SMALL = 61, + AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 78, + AF_BLUE_STRING_DEVANAGARI_BASE = 85, + AF_BLUE_STRING_DEVANAGARI_TOP = 110, + AF_BLUE_STRING_DEVANAGARI_HEAD = 135, + AF_BLUE_STRING_DEVANAGARI_BOTTOM = 160, + AF_BLUE_STRING_GREEK_CAPITAL_TOP = 167, + AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 182, + AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 195, + AF_BLUE_STRING_GREEK_SMALL = 208, + AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 225, + AF_BLUE_STRING_HEBREW_TOP = 242, + AF_BLUE_STRING_HEBREW_BOTTOM = 259, + AF_BLUE_STRING_HEBREW_DESCENDER = 272, + AF_BLUE_STRING_LAO_TOP = 283, + AF_BLUE_STRING_LAO_BOTTOM = 308, + AF_BLUE_STRING_LAO_ASCENDER = 333, + AF_BLUE_STRING_LAO_LARGE_ASCENDER = 346, + AF_BLUE_STRING_LAO_DESCENDER = 356, + AF_BLUE_STRING_LATIN_CAPITAL_TOP = 375, + AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 384, + AF_BLUE_STRING_LATIN_SMALL_F_TOP = 393, + AF_BLUE_STRING_LATIN_SMALL = 401, + AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 409, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 415, + AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 431, + AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 447, + AF_BLUE_STRING_LATIN_SUBS_SMALL = 463, + AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 491, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 507, + AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 531, + AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 553, + AF_BLUE_STRING_LATIN_SUPS_SMALL = 573, + AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 592, + AF_BLUE_STRING_TELUGU_TOP = 601, + AF_BLUE_STRING_TELUGU_BOTTOM = 623, + AF_BLUE_STRING_THAI_TOP = 645, + AF_BLUE_STRING_THAI_BOTTOM = 664, + AF_BLUE_STRING_THAI_ASCENDER = 686, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 696, + AF_BLUE_STRING_THAI_DESCENDER = 706, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 719, + AF_BLUE_STRING_THAI_DIGIT_TOP = 726, + af_blue_1_1 = 735, #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 +163,35 @@ 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 = 4, + AF_BLUE_STRINGSET_DEVA = 10, + AF_BLUE_STRINGSET_GREK = 16, + AF_BLUE_STRINGSET_HEBR = 23, + AF_BLUE_STRINGSET_LAO = 27, + AF_BLUE_STRINGSET_LATN = 33, + AF_BLUE_STRINGSET_LATB = 40, + AF_BLUE_STRINGSET_LATP = 47, + AF_BLUE_STRINGSET_TELU = 54, + AF_BLUE_STRINGSET_THAI = 57, + af_blue_2_1 = 65, #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/src/3rdparty/freetype/src/autofit/afblue.hin b/src/3rdparty/freetype/src/autofit/afblue.hin index 0b4b48d7fe..ad43fe6cef 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.hin +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afcjk.c b/src/3rdparty/freetype/src/autofit/afcjk.c index 048e0e7d02..0ade4be40b 100644 --- a/src/3rdparty/freetype/src/autofit/afcjk.c +++ b/src/3rdparty/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; @@ -2176,7 +2181,8 @@ /* Apply the complete hinting algorithm to a CJK glyph. */ FT_LOCAL_DEF( FT_Error ) - af_cjk_hints_apply( AF_GlyphHints hints, + af_cjk_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_CJKMetrics metrics ) { @@ -2184,6 +2190,7 @@ int dim; FT_UNUSED( metrics ); + FT_UNUSED( glyph_index ); error = af_glyph_hints_reload( hints, outline ); @@ -2191,7 +2198,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 +2230,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 +2254,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/src/3rdparty/freetype/src/autofit/afcjk.h b/src/3rdparty/freetype/src/autofit/afcjk.h index 4dd4f39177..e395e74a01 100644 --- a/src/3rdparty/freetype/src/autofit/afcjk.h +++ b/src/3rdparty/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_ @@ -119,7 +115,8 @@ FT_BEGIN_HEADER AF_CJKMetrics metrics ); FT_LOCAL( FT_Error ) - af_cjk_hints_apply( AF_GlyphHints hints, + af_cjk_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_CJKMetrics metrics ); diff --git a/src/3rdparty/freetype/src/autofit/afcover.h b/src/3rdparty/freetype/src/autofit/afcover.h index d5ac96944a..520e8a4ae0 100644 --- a/src/3rdparty/freetype/src/autofit/afcover.h +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afdummy.c b/src/3rdparty/freetype/src/autofit/afdummy.c index f8702a109e..18dd301d10 100644 --- a/src/3rdparty/freetype/src/autofit/afdummy.c +++ b/src/3rdparty/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, */ @@ -38,11 +38,14 @@ static FT_Error - af_dummy_hints_apply( AF_GlyphHints hints, + af_dummy_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline ) { FT_Error error; + FT_UNUSED( glyph_index ); + error = af_glyph_hints_reload( hints, outline ); if ( !error ) diff --git a/src/3rdparty/freetype/src/autofit/afdummy.h b/src/3rdparty/freetype/src/autofit/afdummy.h index ad1b0d3abb..b4fdc78e39 100644 --- a/src/3rdparty/freetype/src/autofit/afdummy.h +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/aferrors.h b/src/3rdparty/freetype/src/autofit/aferrors.h index 50e1a22dd5..7b416e470d 100644 --- a/src/3rdparty/freetype/src/autofit/aferrors.h +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afglobal.c b/src/3rdparty/freetype/src/autofit/afglobal.c index a54c20c023..b071cc76fb 100644 --- a/src/3rdparty/freetype/src/autofit/afglobal.c +++ b/src/3rdparty/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, */ @@ -47,6 +47,7 @@ af_ ## s ## _script_class, \ AF_SCRIPT_ ## S, \ af_ ## s ## _uniranges, \ + af_ ## s ## _nonbase_uniranges, \ sc1, sc2, sc3 ) #include "afscript.h" @@ -135,16 +136,15 @@ FT_Error error; FT_Face face = globals->face; FT_CharMap old_charmap = face->charmap; - FT_Byte* gstyles = globals->glyph_styles; + FT_UShort* gstyles = globals->glyph_styles; FT_UInt ss; FT_UInt i; FT_UInt dflt = ~0U; /* a non-valid value */ /* the value AF_STYLE_UNASSIGNED means `uncovered glyph' */ - FT_MEM_SET( globals->glyph_styles, - AF_STYLE_UNASSIGNED, - globals->glyph_count ); + for ( i = 0; i < (FT_UInt)globals->glyph_count; i++ ) + gstyles[i] = AF_STYLE_UNASSIGNED; error = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); if ( error ) @@ -190,10 +190,10 @@ gindex = FT_Get_Char_Index( face, charcode ); - if ( gindex != 0 && - gindex < (FT_ULong)globals->glyph_count && - gstyles[gindex] == AF_STYLE_UNASSIGNED ) - gstyles[gindex] = (FT_Byte)ss; + if ( gindex != 0 && + gindex < (FT_ULong)globals->glyph_count && + ( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) + gstyles[gindex] = (FT_UShort)ss; for (;;) { @@ -202,9 +202,38 @@ if ( gindex == 0 || charcode > range->last ) break; - if ( gindex < (FT_ULong)globals->glyph_count && - gstyles[gindex] == AF_STYLE_UNASSIGNED ) - gstyles[gindex] = (FT_Byte)ss; + if ( gindex < (FT_ULong)globals->glyph_count && + ( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) + gstyles[gindex] = (FT_UShort)ss; + } + } + + /* do the same for the script's non-base characters */ + for ( range = script_class->script_uni_nonbase_ranges; + range->first != 0; + range++ ) + { + FT_ULong charcode = range->first; + FT_UInt gindex; + + + gindex = FT_Get_Char_Index( face, charcode ); + + if ( gindex != 0 && + gindex < (FT_ULong)globals->glyph_count && + ( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss ) + gstyles[gindex] |= AF_NONBASE; + + for (;;) + { + charcode = FT_Get_Next_Char( face, charcode, &gindex ); + + if ( gindex == 0 || charcode > range->last ) + break; + + if ( gindex < (FT_ULong)globals->glyph_count && + ( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss ) + gstyles[gindex] |= AF_NONBASE; } } } @@ -250,9 +279,9 @@ for ( nn = 0; nn < globals->glyph_count; nn++ ) { - if ( ( gstyles[nn] & ~AF_DIGIT ) == AF_STYLE_UNASSIGNED ) + if ( ( gstyles[nn] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) { - gstyles[nn] &= ~AF_STYLE_UNASSIGNED; + gstyles[nn] &= ~AF_STYLE_MASK; gstyles[nn] |= globals->module->fallback_style; } } @@ -276,7 +305,7 @@ for ( idx = 0; idx < globals->glyph_count; idx++ ) { - if ( ( gstyles[idx] & ~AF_DIGIT ) == style_class->style ) + if ( ( gstyles[idx] & AF_STYLE_MASK ) == style_class->style ) { if ( !( count % 10 ) ) FT_TRACE4(( " " )); @@ -314,13 +343,17 @@ memory = face->memory; - if ( FT_ALLOC( globals, sizeof ( *globals ) + - face->num_glyphs * sizeof ( FT_Byte ) ) ) + /* we allocate an AF_FaceGlobals structure together */ + /* with the glyph_styles array */ + if ( FT_ALLOC( globals, + sizeof ( *globals ) + + (FT_ULong)face->num_glyphs * sizeof ( FT_UShort ) ) ) goto Exit; globals->face = face; globals->glyph_count = face->num_glyphs; - globals->glyph_styles = (FT_Byte*)( globals + 1 ); + /* right after the globals structure come the glyph styles */ + globals->glyph_styles = (FT_UShort*)( globals + 1 ); globals->module = module; #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ diff --git a/src/3rdparty/freetype/src/autofit/afglobal.h b/src/3rdparty/freetype/src/autofit/afglobal.h index 38d8d69528..ffb2f86066 100644 --- a/src/3rdparty/freetype/src/autofit/afglobal.h +++ b/src/3rdparty/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, */ @@ -72,10 +72,16 @@ FT_BEGIN_HEADER #endif /* default script for OpenType; ignored if HarfBuzz isn't used */ #define AF_SCRIPT_DEFAULT AF_SCRIPT_LATN - /* a bit mask indicating an uncovered glyph */ -#define AF_STYLE_UNASSIGNED 0x7F - /* if this flag is set, we have an ASCII digit */ -#define AF_DIGIT 0x80 + + /* a bit mask for AF_DIGIT and AF_NONBASE */ +#define AF_STYLE_MASK 0x3FFF + /* an uncovered glyph */ +#define AF_STYLE_UNASSIGNED AF_STYLE_MASK + + /* if this flag is set, we have an ASCII digit */ +#define AF_DIGIT 0x8000U + /* if this flag is set, we have a non-base character */ +#define AF_NONBASE 0x4000U /* `increase-x-height' property */ #define AF_PROP_INCREASE_X_HEIGHT_MIN 6 @@ -100,7 +106,7 @@ FT_BEGIN_HEADER { FT_Face face; FT_Long glyph_count; /* same as face->num_glyphs */ - FT_Byte* glyph_styles; + FT_UShort* glyph_styles; #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ hb_font_t* hb_font; diff --git a/src/3rdparty/freetype/src/autofit/afhints.c b/src/3rdparty/freetype/src/autofit/afhints.c index f3cc50f202..37482ebd1f 100644 --- a/src/3rdparty/freetype/src/autofit/afhints.c +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afhints.h b/src/3rdparty/freetype/src/autofit/afhints.h index 92101de7ca..a64c7a4b11 100644 --- a/src/3rdparty/freetype/src/autofit/afhints.h +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afindic.c b/src/3rdparty/freetype/src/autofit/afindic.c index 197881b614..05b6bdd887 100644 --- a/src/3rdparty/freetype/src/autofit/afindic.c +++ b/src/3rdparty/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 , . */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -79,12 +79,13 @@ static FT_Error - af_indic_hints_apply( AF_GlyphHints hints, + af_indic_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_CJKMetrics metrics ) { /* use CJK routines */ - return af_cjk_hints_apply( hints, outline, metrics ); + return af_cjk_hints_apply( glyph_index, hints, outline, metrics ); } diff --git a/src/3rdparty/freetype/src/autofit/afindic.h b/src/3rdparty/freetype/src/autofit/afindic.h index 9e13cf7e3f..4c36908ada 100644 --- a/src/3rdparty/freetype/src/autofit/afindic.h +++ b/src/3rdparty/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 , . */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/3rdparty/freetype/src/autofit/aflatin.c b/src/3rdparty/freetype/src/autofit/aflatin.c index 36a36896fb..363f72114b 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin.c +++ b/src/3rdparty/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, */ @@ -41,6 +41,10 @@ #define FT_COMPONENT trace_aflatin + /* needed for computation of round vs. flat segments */ +#define FLAT_THRESHOLD( x ) ( x / 14 ) + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -261,8 +265,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; @@ -274,6 +278,8 @@ AF_Blue_Stringset bss = sc->blue_stringset; const AF_Blue_StringRec* bs = &af_blue_stringsets[bss]; + FT_Pos flat_threshold = FLAT_THRESHOLD( metrics->units_per_em ); + /* we walk over the blue character strings as specified in the */ /* style's entry in the `af_blue_stringset' array */ @@ -362,9 +368,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; } @@ -692,16 +699,16 @@ /* now set the `round' flag depending on the segment's kind: */ /* */ /* - if the horizontal distance between the first and last */ - /* `on' point is larger than upem/8 (value 8 is heuristic) */ + /* `on' point is larger than a heuristic threshold */ /* we have a flat segment */ /* - if either the first or the last point of the segment is */ /* an `off' point, the segment is round, otherwise it is */ /* flat */ if ( best_on_point_first >= 0 && best_on_point_last >= 0 && - (FT_UInt)( FT_ABS( points[best_on_point_last].x - - points[best_on_point_first].x ) ) > - metrics->units_per_em / 8 ) + ( FT_ABS( points[best_on_point_last].x - + points[best_on_point_first].x ) ) > + flat_threshold ) round = 0; else round = FT_BOOL( @@ -1031,8 +1038,11 @@ if ( dim == AF_DIMENSION_VERT ) { - FT_TRACE5(( "blue zones (style `%s')\n", - af_style_names[metrics->root.style_class->style] )); +#ifdef FT_DEBUG_LEVEL_TRACE + if ( axis->blue_count ) + FT_TRACE5(( "blue zones (style `%s')\n", + af_style_names[metrics->root.style_class->style] )); +#endif /* scale the blue zones */ for ( nn = 0; nn < axis->blue_count; nn++ ) @@ -1154,14 +1164,17 @@ af_latin_hints_compute_segments( AF_GlyphHints hints, AF_Dimension dim ) { - AF_AxisHints axis = &hints->axis[dim]; - FT_Memory memory = hints->memory; - FT_Error error = FT_Err_Ok; - AF_Segment segment = NULL; - AF_SegmentRec seg0; - AF_Point* contour = hints->contours; - AF_Point* contour_limit = contour + hints->num_contours; - AF_Direction major_dir, segment_dir; + AF_LatinMetrics metrics = (AF_LatinMetrics)hints->metrics; + AF_AxisHints axis = &hints->axis[dim]; + FT_Memory memory = hints->memory; + FT_Error error = FT_Err_Ok; + AF_Segment segment = NULL; + AF_SegmentRec seg0; + AF_Point* contour = hints->contours; + AF_Point* contour_limit = contour + hints->num_contours; + AF_Direction major_dir, segment_dir; + + FT_Pos flat_threshold = FLAT_THRESHOLD( metrics->units_per_em ); FT_ZERO( &seg0 ); @@ -1202,11 +1215,13 @@ /* do each contour separately */ for ( ; contour < contour_limit; contour++ ) { - AF_Point point = contour[0]; - AF_Point last = point->prev; - int on_edge = 0; - FT_Pos min_pos = 32000; /* minimum segment pos != min_coord */ - FT_Pos max_pos = -32000; /* maximum segment pos != max_coord */ + AF_Point point = contour[0]; + AF_Point last = point->prev; + int on_edge = 0; + FT_Pos min_pos = 32000; /* minimum segment pos != min_coord */ + FT_Pos max_pos = -32000; /* maximum segment pos != max_coord */ + FT_Pos min_on_pos = 32000; + FT_Pos max_on_pos = -32000; FT_Bool passed; @@ -1248,6 +1263,16 @@ if ( u > max_pos ) max_pos = u; + /* get minimum and maximum coordinate of on points */ + if ( !( point->flags & AF_FLAG_CONTROL ) ) + { + v = point->v; + if ( v < min_on_pos ) + min_on_pos = v; + if ( v > max_on_pos ) + max_on_pos = v; + } + if ( point->out_dir != segment_dir || point == last ) { /* we are just leaving an edge; record a new segment! */ @@ -1255,9 +1280,10 @@ segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); /* a segment is round if either its first or last point */ - /* is a control point */ - if ( ( segment->first->flags | point->flags ) & - AF_FLAG_CONTROL ) + /* is a control point, and the length of the on points */ + /* inbetween doesn't exceed a heuristic limit */ + if ( ( segment->first->flags | point->flags ) & AF_FLAG_CONTROL && + ( max_on_pos - min_on_pos ) < flat_threshold ) segment->flags |= AF_EDGE_ROUND; /* compute segment size */ @@ -1300,10 +1326,19 @@ /* clear all segment fields */ segment[0] = seg0; - segment->dir = (FT_Char)segment_dir; + segment->dir = (FT_Char)segment_dir; + segment->first = point; + segment->last = point; + min_pos = max_pos = point->u; - segment->first = point; - segment->last = point; + + if ( point->flags & AF_FLAG_CONTROL ) + { + min_on_pos = 32000; + max_on_pos = -32000; + } + else + min_on_pos = max_on_pos = point->v; on_edge = 1; } @@ -1791,7 +1826,7 @@ /* Example: the `c' in cour.pfa at size 13 */ if ( edge->serif && edge->link ) - edge->serif = 0; + edge->serif = NULL; } } @@ -1825,7 +1860,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 +2030,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 +2064,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 +2115,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 +2283,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 +2324,7 @@ /* The main grid-fitting routine. */ - FT_LOCAL_DEF( void ) + static void af_latin_hint_edges( AF_GlyphHints hints, AF_Dimension dim ) { @@ -2334,7 +2377,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 +2480,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 +2549,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 +2609,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; @@ -2799,7 +2839,8 @@ /* Apply the complete hinting algorithm to a latin glyph. */ static FT_Error - af_latin_hints_apply( AF_GlyphHints hints, + af_latin_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_LatinMetrics metrics ) { @@ -2815,8 +2856,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 @@ -2840,7 +2882,9 @@ if ( error ) goto Exit; - af_latin_hints_compute_blue_edges( hints, metrics ); + /* apply blue zones to base characters only */ + if ( !( metrics->root.globals->glyph_styles[glyph_index] & AF_NONBASE ) ) + af_latin_hints_compute_blue_edges( hints, metrics ); } /* grid-fit the outline */ @@ -2848,7 +2892,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 +2906,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/src/3rdparty/freetype/src/autofit/aflatin.h b/src/3rdparty/freetype/src/autofit/aflatin.h index 2c0bfca18b..6855492ca3 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin.h +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/aflatin2.c b/src/3rdparty/freetype/src/autofit/aflatin2.c index 07590b380c..0380ffc04c 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin2.c +++ b/src/3rdparty/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 ); @@ -2299,13 +2300,16 @@ static FT_Error - af_latin2_hints_apply( AF_GlyphHints hints, + af_latin2_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_LatinMetrics metrics ) { FT_Error error; int dim; + FT_UNUSED( glyph_index ); + error = af_glyph_hints_reload( hints, outline ); if ( error ) @@ -2313,8 +2317,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 +2342,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 +2355,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/src/3rdparty/freetype/src/autofit/aflatin2.h b/src/3rdparty/freetype/src/autofit/aflatin2.h index b5d252a91b..9326753130 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin2.h +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afloader.c b/src/3rdparty/freetype/src/autofit/afloader.c index fb15c87f0e..722ffd31ec 100644 --- a/src/3rdparty/freetype/src/autofit/afloader.c +++ b/src/3rdparty/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; @@ -191,8 +150,9 @@ if ( writing_system_class->style_hints_apply ) - writing_system_class->style_hints_apply( hints, - &gloader->current.outline, + writing_system_class->style_hints_apply( glyph_index, + hints, + &gloader->base.outline, metrics ); } @@ -267,128 +227,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 +235,6 @@ } Hint_Metrics: - if ( depth == 0 ) { FT_BBox bbox; FT_Vector vvector; @@ -472,18 +309,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 +329,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 +354,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 +391,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/src/3rdparty/freetype/src/autofit/afloader.h b/src/3rdparty/freetype/src/autofit/afloader.h index 9601e24fce..37cfd14239 100644 --- a/src/3rdparty/freetype/src/autofit/afloader.h +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afmodule.c b/src/3rdparty/freetype/src/autofit/afmodule.c index 641e03ea2b..bbf1372518 100644 --- a/src/3rdparty/freetype/src/autofit/afmodule.c +++ b/src/3rdparty/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,35 @@ #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 + +#ifdef __cplusplus + extern "C" { +#endif + 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 ); +#ifdef __cplusplus + } +#endif + +#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 +166,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 +193,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 +242,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 +301,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 +328,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/src/3rdparty/freetype/src/autofit/afmodule.h b/src/3rdparty/freetype/src/autofit/afmodule.h index 20b7b9f665..b9c2fd8a2d 100644 --- a/src/3rdparty/freetype/src/autofit/afmodule.h +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afpic.c b/src/3rdparty/freetype/src/autofit/afpic.c index cb29fd79fe..5589e612cf 100644 --- a/src/3rdparty/freetype/src/autofit/afpic.c +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afpic.h b/src/3rdparty/freetype/src/autofit/afpic.h index 9a68b4a5a2..9b45069f5d 100644 --- a/src/3rdparty/freetype/src/autofit/afpic.h +++ b/src/3rdparty/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, */ @@ -20,8 +20,6 @@ #define __AFPIC_H__ -FT_BEGIN_HEADER - #include FT_INTERNAL_PIC_H @@ -43,6 +41,8 @@ FT_BEGIN_HEADER #include "aftypes.h" +FT_BEGIN_HEADER + typedef struct AFModulePIC_ { FT_ServiceDescRec* af_services; @@ -93,12 +93,12 @@ FT_BEGIN_HEADER FT_Error autofit_module_class_pic_init( FT_Library library ); +FT_END_HEADER + #endif /* FT_CONFIG_OPTION_PIC */ /* */ -FT_END_HEADER - #endif /* __AFPIC_H__ */ diff --git a/src/3rdparty/freetype/src/autofit/afranges.c b/src/3rdparty/freetype/src/autofit/afranges.c index b2c504d426..13c221364c 100644 --- a/src/3rdparty/freetype/src/autofit/afranges.c +++ b/src/3rdparty/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, */ @@ -18,6 +18,78 @@ #include "afranges.h" + /* + * The algorithm for assigning properties and styles to the `glyph_styles' + * array is as follows (cf. the implementation in + * `af_face_globals_compute_style_coverage'). + * + * Walk over all scripts (as listed in `afscript.h'). + * + * For a given script, walk over all styles (as listed in `afstyles.h'). + * The order of styles is important and should be as follows. + * + * - First come styles based on OpenType features (small caps, for + * example). Since features rely on glyph indices, thus completely + * bypassing character codes, no properties are assigned. + * + * - Next comes the default style, using the character ranges as defined + * below. This also assigns properties. + * + * Note that there also exist fallback scripts, mainly covering + * superscript and subscript glyphs of a script that are not present as + * OpenType features. Fallback scripts are defined below, also + * assigning properties; they are applied after the corresponding + * script. + * + */ + + + /* XXX Check base character ranges again: */ + /* Right now, they are quickly derived by visual inspection. */ + /* I can imagine that fine-tuning is necessary. */ + + /* for the auto-hinter, a `non-base character' is something that should */ + /* not be affected by blue zones, regardless of whether this is a */ + /* spacing or no-spacing glyph */ + + /* the `ta_xxxx_nonbase_uniranges' ranges must be strict subsets */ + /* of the corresponding `ta_xxxx_uniranges' ranges */ + + + 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_arab_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0600UL, 0x0605UL ), + AF_UNIRANGE_REC( 0x0610UL, 0x061AUL ), + AF_UNIRANGE_REC( 0x064BUL, 0x065FUL ), + AF_UNIRANGE_REC( 0x0670UL, 0x0670UL ), + AF_UNIRANGE_REC( 0x06D6UL, 0x06DCUL ), + AF_UNIRANGE_REC( 0x06DFUL, 0x06E4UL ), + AF_UNIRANGE_REC( 0x06E7UL, 0x06E8UL ), + AF_UNIRANGE_REC( 0x06EAUL, 0x06EDUL ), + AF_UNIRANGE_REC( 0x08E3UL, 0x08FFUL ), + AF_UNIRANGE_REC( 0xFBB2UL, 0xFBC1UL ), + AF_UNIRANGE_REC( 0xFE70UL, 0xFE70UL ), + AF_UNIRANGE_REC( 0xFE72UL, 0xFE72UL ), + AF_UNIRANGE_REC( 0xFE74UL, 0xFE74UL ), + AF_UNIRANGE_REC( 0xFE76UL, 0xFE76UL ), + AF_UNIRANGE_REC( 0xFE78UL, 0xFE78UL ), + AF_UNIRANGE_REC( 0xFE7AUL, 0xFE7AUL ), + AF_UNIRANGE_REC( 0xFE7CUL, 0xFE7CUL ), + AF_UNIRANGE_REC( 0xFE7EUL, 0xFE7EUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + const AF_Script_UniRangeRec af_cyrl_uniranges[] = { @@ -28,23 +100,47 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; - /* there are some characters in the Devanagari Unicode block that are */ + const AF_Script_UniRangeRec af_cyrl_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0483UL, 0x0489UL ), + AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), + AF_UNIRANGE_REC( 0xA66FUL, 0xA67FUL ), + AF_UNIRANGE_REC( 0xA69EUL, 0xA69FUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + /* There are some characters in the Devanagari Unicode block that are */ /* generic to Indic scripts; we omit them so that their presence doesn't */ - /* trigger Devanagari */ + /* trigger Devanagari. */ const AF_Script_UniRangeRec af_deva_uniranges[] = { - AF_UNIRANGE_REC( 0x0900UL, 0x093BUL ), /* Devanagari */ + AF_UNIRANGE_REC( 0x0900UL, 0x093BUL ), /* Devanagari */ /* omitting U+093C nukta */ - AF_UNIRANGE_REC( 0x093DUL, 0x0950UL ), + AF_UNIRANGE_REC( 0x093DUL, 0x0950UL ), /* ... continued */ /* omitting U+0951 udatta, U+0952 anudatta */ - AF_UNIRANGE_REC( 0x0953UL, 0x0963UL ), + AF_UNIRANGE_REC( 0x0953UL, 0x0963UL ), /* ... continued */ /* omitting U+0964 danda, U+0965 double danda */ - AF_UNIRANGE_REC( 0x0966UL, 0x097FUL ), - AF_UNIRANGE_REC( 0x20B9UL, 0x20B9UL ), /* (new) Rupee sign */ + AF_UNIRANGE_REC( 0x0966UL, 0x097FUL ), /* ... continued */ + AF_UNIRANGE_REC( 0x20B9UL, 0x20B9UL ), /* (new) Rupee sign */ + AF_UNIRANGE_REC( 0xA8E0UL, 0xA8FFUL ), /* Devanagari Extended */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_deva_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0900UL, 0x0902UL ), + AF_UNIRANGE_REC( 0x093AUL, 0x093AUL ), + AF_UNIRANGE_REC( 0x0941UL, 0x0948UL ), + AF_UNIRANGE_REC( 0x094DUL, 0x094DUL ), + AF_UNIRANGE_REC( 0x0953UL, 0x0957UL ), + AF_UNIRANGE_REC( 0x0962UL, 0x0963UL ), + AF_UNIRANGE_REC( 0xA8E0UL, 0xA8F1UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_grek_uniranges[] = { AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */ @@ -52,6 +148,19 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_grek_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x037AUL, 0x037AUL ), + AF_UNIRANGE_REC( 0x0384UL, 0x0385UL ), + AF_UNIRANGE_REC( 0x1FBDUL, 0x1FC1UL ), + AF_UNIRANGE_REC( 0x1FCDUL, 0x1FCFUL ), + AF_UNIRANGE_REC( 0x1FDDUL, 0x1FDFUL ), + AF_UNIRANGE_REC( 0x1FEDUL, 0x1FEFUL ), + AF_UNIRANGE_REC( 0x1FFDUL, 0x1FFEUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_hebr_uniranges[] = { AF_UNIRANGE_REC( 0x0590UL, 0x05FFUL ), /* Hebrew */ @@ -59,45 +168,171 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_hebr_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0591UL, 0x05BFUL ), + AF_UNIRANGE_REC( 0x05C1UL, 0x05C2UL ), + AF_UNIRANGE_REC( 0x05C4UL, 0x05C5UL ), + AF_UNIRANGE_REC( 0x05C7UL, 0x05C7UL ), + AF_UNIRANGE_REC( 0xFB1EUL, 0xFB1EUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + const AF_Script_UniRangeRec af_lao_uniranges[] = + { + AF_UNIRANGE_REC( 0x0E80UL, 0x0EFFUL ), /* Lao */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_lao_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0EB1UL, 0x0EB1UL ), + AF_UNIRANGE_REC( 0x0EB4UL, 0x0EBCUL ), + AF_UNIRANGE_REC( 0x0EC8UL, 0x0ECDUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_latn_uniranges[] = { AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */ - AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */ + AF_UNIRANGE_REC( 0x00A0UL, 0x00A9UL ), /* Latin-1 Supplement (no control chars) */ + AF_UNIRANGE_REC( 0x00ABUL, 0x00B1UL ), /* ... continued */ + AF_UNIRANGE_REC( 0x00B4UL, 0x00B8UL ), /* ... continued */ + AF_UNIRANGE_REC( 0x00BBUL, 0x00FFUL ), /* ... continued */ AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */ AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */ AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */ - AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */ + AF_UNIRANGE_REC( 0x02B9UL, 0x02DFUL ), /* Spacing Modifier Letters */ + AF_UNIRANGE_REC( 0x02E5UL, 0x02FFUL ), /* ... continued */ AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */ - AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */ - AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */ + AF_UNIRANGE_REC( 0x1AB0UL, 0x1ABEUL ), /* Combining Diacritical Marks Extended */ + AF_UNIRANGE_REC( 0x1D00UL, 0x1D2BUL ), /* Phonetic Extensions */ + AF_UNIRANGE_REC( 0x1D6BUL, 0x1D77UL ), /* ... continued */ + AF_UNIRANGE_REC( 0x1D79UL, 0x1D7FUL ), /* ... continued */ + AF_UNIRANGE_REC( 0x1D80UL, 0x1D9AUL ), /* Phonetic Extensions Supplement */ AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */ AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */ AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */ - AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */ AF_UNIRANGE_REC( 0x20A0UL, 0x20B8UL ), /* Currency Symbols ... */ AF_UNIRANGE_REC( 0x20BAUL, 0x20CFUL ), /* ... except new Rupee sign */ AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */ - AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */ - AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ + AF_UNIRANGE_REC( 0x2C60UL, 0x2C7BUL ), /* Latin Extended-C */ + AF_UNIRANGE_REC( 0x2C7EUL, 0x2C7FUL ), /* ... continued */ AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */ - AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */ + AF_UNIRANGE_REC( 0xA720UL, 0xA76FUL ), /* Latin Extended-D */ + AF_UNIRANGE_REC( 0xA771UL, 0xA7F7UL ), /* ... continued */ + AF_UNIRANGE_REC( 0xA7FAUL, 0xA7FFUL ), /* ... continued */ + AF_UNIRANGE_REC( 0xAB30UL, 0xAB5BUL ), /* Latin Extended-E */ + AF_UNIRANGE_REC( 0xAB60UL, 0xAB6FUL ), /* ... continued */ AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin Ligs) */ AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbols */ - AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ), /* Enclosed Alphanumeric Supplement */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_latn_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x005EUL, 0x0060UL ), + AF_UNIRANGE_REC( 0x007EUL, 0x007EUL ), + AF_UNIRANGE_REC( 0x00A8UL, 0x00A9UL ), + AF_UNIRANGE_REC( 0x00AEUL, 0x00B0UL ), + AF_UNIRANGE_REC( 0x00B4UL, 0x00B4UL ), + AF_UNIRANGE_REC( 0x00B8UL, 0x00B8UL ), + AF_UNIRANGE_REC( 0x00BCUL, 0x00BEUL ), + AF_UNIRANGE_REC( 0x02B9UL, 0x02DFUL ), + AF_UNIRANGE_REC( 0x02E5UL, 0x02FFUL ), + AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), + AF_UNIRANGE_REC( 0x1AB0UL, 0x1ABEUL ), + AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), + AF_UNIRANGE_REC( 0x2017UL, 0x2017UL ), + AF_UNIRANGE_REC( 0x203EUL, 0x203EUL ), + AF_UNIRANGE_REC( 0xA788UL, 0xA788UL ), + AF_UNIRANGE_REC( 0xA7F8UL, 0xA7FAUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + const AF_Script_UniRangeRec af_latb_uniranges[] = + { + AF_UNIRANGE_REC( 0x1D62UL, 0x1D6AUL ), /* some small subscript letters */ + AF_UNIRANGE_REC( 0x2080UL, 0x209CUL ), /* subscript digits and letters */ + AF_UNIRANGE_REC( 0x2C7CUL, 0x2C7CUL ), /* latin subscript small letter j */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_latb_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + const AF_Script_UniRangeRec af_latp_uniranges[] = + { + AF_UNIRANGE_REC( 0x00AAUL, 0x00AAUL ), /* feminine ordinal indicator */ + AF_UNIRANGE_REC( 0x00B2UL, 0x00B3UL ), /* superscript two and three */ + AF_UNIRANGE_REC( 0x00B9UL, 0x00BAUL ), /* superscript one, masc. ord. indic. */ + AF_UNIRANGE_REC( 0x02B0UL, 0x02B8UL ), /* some latin superscript mod. letters */ + AF_UNIRANGE_REC( 0x02E0UL, 0x02E4UL ), /* some IPA modifier letters */ + AF_UNIRANGE_REC( 0x1D2CUL, 0x1D61UL ), /* latin superscript modifier letters */ + AF_UNIRANGE_REC( 0x1D78UL, 0x1D78UL ), /* modifier letter cyrillic en */ + AF_UNIRANGE_REC( 0x1D9BUL, 0x1DBFUL ), /* more modifier letters */ + AF_UNIRANGE_REC( 0x2070UL, 0x207FUL ), /* superscript digits and letters */ + AF_UNIRANGE_REC( 0x2C7DUL, 0x2C7DUL ), /* modifier letter capital v */ + AF_UNIRANGE_REC( 0xA770UL, 0xA770UL ), /* modifier letter us */ + AF_UNIRANGE_REC( 0xA7F8UL, 0xA7F9UL ), /* more modifier letters */ + AF_UNIRANGE_REC( 0xAB5CUL, 0xAB5FUL ), /* more modifier letters */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_latp_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_none_uniranges[] = { AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_none_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_telu_uniranges[] = { AF_UNIRANGE_REC( 0x0C00UL, 0x0C7FUL ), /* Telugu */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_telu_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0C00UL, 0x0C00UL ), + AF_UNIRANGE_REC( 0x0C3EUL, 0x0C40UL ), + AF_UNIRANGE_REC( 0x0C46UL, 0x0C56UL ), + AF_UNIRANGE_REC( 0x0C62UL, 0x0C63UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + + const AF_Script_UniRangeRec af_thai_uniranges[] = + { + AF_UNIRANGE_REC( 0x0E00UL, 0x0E7FUL ), /* Thai */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_thai_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0E31UL, 0x0E31UL ), + AF_UNIRANGE_REC( 0x0E34UL, 0x0E3AUL ), + AF_UNIRANGE_REC( 0x0E47UL, 0x0E4EUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + #ifdef AF_CONFIG_OPTION_INDIC const AF_Script_UniRangeRec af_beng_uniranges[] = @@ -106,72 +341,197 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_beng_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0981UL, 0x0981UL ), + AF_UNIRANGE_REC( 0x09BCUL, 0x09BCUL ), + AF_UNIRANGE_REC( 0x09C1UL, 0x09C4UL ), + AF_UNIRANGE_REC( 0x09CDUL, 0x09CDUL ), + AF_UNIRANGE_REC( 0x09E2UL, 0x09E3UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_gujr_uniranges[] = { AF_UNIRANGE_REC( 0x0A80UL, 0x0AFFUL ), /* Gujarati */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_gujr_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0A81UL, 0x0A82UL ), + AF_UNIRANGE_REC( 0x0ABCUL, 0x0ABCUL ), + AF_UNIRANGE_REC( 0x0AC1UL, 0x0AC8UL ), + AF_UNIRANGE_REC( 0x0ACDUL, 0x0ACDUL ), + AF_UNIRANGE_REC( 0x0AE2UL, 0x0AE3UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_guru_uniranges[] = { AF_UNIRANGE_REC( 0x0A00UL, 0x0A7FUL ), /* Gurmukhi */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_guru_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0A01UL, 0x0A02UL ), + AF_UNIRANGE_REC( 0x0A3CUL, 0x0A3EUL ), + AF_UNIRANGE_REC( 0x0A41UL, 0x0A51UL ), + AF_UNIRANGE_REC( 0x0A70UL, 0x0A71UL ), + AF_UNIRANGE_REC( 0x0A75UL, 0x0A75UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_knda_uniranges[] = { AF_UNIRANGE_REC( 0x0C80UL, 0x0CFFUL ), /* Kannada */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_knda_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0C81UL, 0x0C81UL ), + AF_UNIRANGE_REC( 0x0CBCUL, 0x0CBCUL ), + AF_UNIRANGE_REC( 0x0CBFUL, 0x0CBFUL ), + AF_UNIRANGE_REC( 0x0CC6UL, 0x0CC6UL ), + AF_UNIRANGE_REC( 0x0CCCUL, 0x0CCDUL ), + AF_UNIRANGE_REC( 0x0CE2UL, 0x0CE3UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_limb_uniranges[] = { AF_UNIRANGE_REC( 0x1900UL, 0x194FUL ), /* Limbu */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_limb_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1920UL, 0x1922UL ), + AF_UNIRANGE_REC( 0x1927UL, 0x1934UL ), + AF_UNIRANGE_REC( 0x1937UL, 0x193BUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_mlym_uniranges[] = { AF_UNIRANGE_REC( 0x0D00UL, 0x0D7FUL ), /* Malayalam */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_mlym_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0D01UL, 0x0D01UL ), + AF_UNIRANGE_REC( 0x0D4DUL, 0x0D4EUL ), + AF_UNIRANGE_REC( 0x0D62UL, 0x0D63UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_orya_uniranges[] = { AF_UNIRANGE_REC( 0x0B00UL, 0x0B7FUL ), /* Oriya */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_orya_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0B01UL, 0x0B02UL ), + AF_UNIRANGE_REC( 0x0B3CUL, 0x0B3CUL ), + AF_UNIRANGE_REC( 0x0B3FUL, 0x0B3FUL ), + AF_UNIRANGE_REC( 0x0B41UL, 0x0B44UL ), + AF_UNIRANGE_REC( 0x0B4DUL, 0x0B56UL ), + AF_UNIRANGE_REC( 0x0B62UL, 0x0B63UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_sinh_uniranges[] = { AF_UNIRANGE_REC( 0x0D80UL, 0x0DFFUL ), /* Sinhala */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_sinh_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0DCAUL, 0x0DCAUL ), + AF_UNIRANGE_REC( 0x0DD2UL, 0x0DD6UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_sund_uniranges[] = { - AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL ), /* Sundanese */ + AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL ), /* Sundanese */ + AF_UNIRANGE_REC( 0x1CC0UL, 0x1CCFUL ), /* Sundanese Supplement */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_sund_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1B80UL, 0x1B82UL ), + AF_UNIRANGE_REC( 0x1BA1UL, 0x1BADUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_sylo_uniranges[] = { AF_UNIRANGE_REC( 0xA800UL, 0xA82FUL ), /* Syloti Nagri */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_sylo_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0xA802UL, 0xA802UL ), + AF_UNIRANGE_REC( 0xA806UL, 0xA806UL ), + AF_UNIRANGE_REC( 0xA80BUL, 0xA80BUL ), + AF_UNIRANGE_REC( 0xA825UL, 0xA826UL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_taml_uniranges[] = { AF_UNIRANGE_REC( 0x0B80UL, 0x0BFFUL ), /* Tamil */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_taml_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0B82UL, 0x0B82UL ), + AF_UNIRANGE_REC( 0x0BC0UL, 0x0BC2UL ), + AF_UNIRANGE_REC( 0x0BCDUL, 0x0BCDUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_tibt_uniranges[] = { AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL ), /* Tibetan */ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_tibt_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x0F18UL, 0x0F19UL ), + AF_UNIRANGE_REC( 0x0F35UL, 0x0F35UL ), + AF_UNIRANGE_REC( 0x0F37UL, 0x0F37UL ), + AF_UNIRANGE_REC( 0x0F39UL, 0x0F39UL ), + AF_UNIRANGE_REC( 0x0F3EUL, 0x0F3FUL ), + AF_UNIRANGE_REC( 0x0F71UL, 0x0F7EUL ), + AF_UNIRANGE_REC( 0x0F80UL, 0x0F84UL ), + AF_UNIRANGE_REC( 0x0F86UL, 0x0F87UL ), + AF_UNIRANGE_REC( 0x0F8DUL, 0x0FBCUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + #endif /* !AF_CONFIG_OPTION_INDIC */ #ifdef AF_CONFIG_OPTION_CJK @@ -193,7 +553,6 @@ AF_UNIRANGE_REC( 0x31A0UL, 0x31BFUL ), /* Bopomofo Extended */ AF_UNIRANGE_REC( 0x31C0UL, 0x31EFUL ), /* CJK Strokes */ AF_UNIRANGE_REC( 0x31F0UL, 0x31FFUL ), /* Katakana Phonetic Extensions */ - AF_UNIRANGE_REC( 0x3200UL, 0x32FFUL ), /* Enclosed CJK Letters and Months */ AF_UNIRANGE_REC( 0x3300UL, 0x33FFUL ), /* CJK Compatibility */ AF_UNIRANGE_REC( 0x3400UL, 0x4DBFUL ), /* CJK Unified Ideographs Extension A */ AF_UNIRANGE_REC( 0x4DC0UL, 0x4DFFUL ), /* Yijing Hexagram Symbols */ @@ -207,7 +566,6 @@ AF_UNIRANGE_REC( 0xFF00UL, 0xFFEFUL ), /* Halfwidth and Fullwidth Forms */ AF_UNIRANGE_REC( 0x1B000UL, 0x1B0FFUL ), /* Kana Supplement */ AF_UNIRANGE_REC( 0x1D300UL, 0x1D35FUL ), /* Tai Xuan Hing Symbols */ - AF_UNIRANGE_REC( 0x1F200UL, 0x1F2FFUL ), /* Enclosed Ideographic Supplement */ AF_UNIRANGE_REC( 0x20000UL, 0x2A6DFUL ), /* CJK Unified Ideographs Extension B */ AF_UNIRANGE_REC( 0x2A700UL, 0x2B73FUL ), /* CJK Unified Ideographs Extension C */ AF_UNIRANGE_REC( 0x2B740UL, 0x2B81FUL ), /* CJK Unified Ideographs Extension D */ @@ -215,6 +573,13 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_hani_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x302AUL, 0x302FUL ), + AF_UNIRANGE_REC( 0x3190UL, 0x319FUL ), + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + #endif /* !AF_CONFIG_OPTION_CJK */ /* END */ diff --git a/src/3rdparty/freetype/src/autofit/afranges.h b/src/3rdparty/freetype/src/autofit/afranges.h index fe5b2aa7c1..b080873e77 100644 --- a/src/3rdparty/freetype/src/autofit/afranges.h +++ b/src/3rdparty/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, */ @@ -29,6 +29,12 @@ FT_BEGIN_HEADER #define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) \ extern const AF_Script_UniRangeRec af_ ## s ## _uniranges[]; +#include "afscript.h" + +#undef SCRIPT +#define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) \ + extern const AF_Script_UniRangeRec af_ ## s ## _nonbase_uniranges[]; + #include "afscript.h" /* */ diff --git a/src/3rdparty/freetype/src/autofit/afscript.h b/src/3rdparty/freetype/src/autofit/afscript.h index efe8754df8..b92e84f5ff 100644 --- a/src/3rdparty/freetype/src/autofit/afscript.h +++ b/src/3rdparty/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, */ @@ -25,11 +25,20 @@ /* by a description string. Then comes the corresponding HarfBuzz */ /* script name tag, followed by a string of standard characters (to */ /* derive the standard width and height of stems). */ + /* */ + /* Note that fallback scripts only have a default style, thus we */ + /* use `HB_SCRIPT_INVALID' as the HarfBuzz script name tag for */ + /* them. */ + + SCRIPT( arab, ARAB, + "Arabic", + HB_SCRIPT_ARABIC, + 0x644, 0x62D, 0x640 ) /* ل ح ـ */ SCRIPT( cyrl, CYRL, "Cyrillic", HB_SCRIPT_CYRILLIC, - 0x43E, 0x41E, 0x0 ) /* оО */ + 0x43E, 0x41E, 0x0 ) /* о О */ SCRIPT( deva, DEVA, "Devanagari", @@ -39,18 +48,34 @@ SCRIPT( grek, GREK, "Greek", HB_SCRIPT_GREEK, - 0x3BF, 0x39F, 0x0 ) /* οΟ */ + 0x3BF, 0x39F, 0x0 ) /* ο Ο */ SCRIPT( hebr, HEBR, "Hebrew", HB_SCRIPT_HEBREW, 0x5DD, 0x0, 0x0 ) /* ם */ + /* only digit zero has a simple shape in the Lao script */ + SCRIPT( lao, LAO, + "Lao", + HB_SCRIPT_LAO, + 0xED0, 0x0, 0x0 ) /* ໐ */ + SCRIPT( latn, LATN, "Latin", HB_SCRIPT_LATIN, 'o', 'O', '0' ) + SCRIPT( latb, LATB, + "Latin Subscript Fallback", + HB_SCRIPT_INVALID, + 0x2092, 0x2080, 0x0 ) /* ₒ ₀ */ + + SCRIPT( latp, LATP, + "Latin Superscript Fallback", + HB_SCRIPT_INVALID, + 0x1D52, 0x1D3C, 0x2070 ) /* ᵒ ᴼ ⁰ */ + SCRIPT( none, NONE, "no script", HB_SCRIPT_INVALID, @@ -62,6 +87,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/src/3rdparty/freetype/src/autofit/afstyles.h b/src/3rdparty/freetype/src/autofit/afstyles.h index f14d354ccb..87663c9ee7 100644 --- a/src/3rdparty/freetype/src/autofit/afstyles.h +++ b/src/3rdparty/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, */ @@ -27,7 +27,9 @@ /* coverage. */ /* */ /* Note that styles using `AF_COVERAGE_DEFAULT' should always */ - /* come after styles with other coverages. */ + /* come after styles with other coverages. Also note that */ + /* fallback scripts only use `AF_COVERAGE_DEFAULT' for its */ + /* style. */ /* */ /* Example: */ /* */ @@ -80,8 +82,23 @@ "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" ) + STYLE( deva_dflt, DEVA_DFLT, + "Devanagari default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_DEVA, + AF_BLUE_STRINGSET_DEVA, + AF_COVERAGE_DEFAULT ) + META_STYLE_LATIN( grek, GREK, "Greek" ) STYLE( hebr_dflt, HEBR_DFLT, @@ -90,13 +107,28 @@ AF_SCRIPT_HEBR, AF_BLUE_STRINGSET_HEBR, AF_COVERAGE_DEFAULT ) + + STYLE( lao_dflt, LAO_DFLT, + "Lao default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_LAO, + AF_BLUE_STRINGSET_LAO, + AF_COVERAGE_DEFAULT ) + META_STYLE_LATIN( latn, LATN, "Latin" ) - STYLE( deva_dflt, DEVA_DFLT, - "Devanagari default style", + STYLE( latb_dflt, LATB_DFLT, + "Latin subscript fallback default style", AF_WRITING_SYSTEM_LATIN, - AF_SCRIPT_DEVA, - AF_BLUE_STRINGSET_DEVA, + AF_SCRIPT_LATB, + AF_BLUE_STRINGSET_LATB, + AF_COVERAGE_DEFAULT ) + + STYLE( latp_dflt, LATP_DFLT, + "Latin superscript fallback default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_LATP, + AF_BLUE_STRINGSET_LATP, AF_COVERAGE_DEFAULT ) #ifdef FT_OPTION_AUTOFIT2 @@ -122,6 +154,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/src/3rdparty/freetype/src/autofit/aftypes.h b/src/3rdparty/freetype/src/autofit/aftypes.h index 61badd1b8d..43b38006c2 100644 --- a/src/3rdparty/freetype/src/autofit/aftypes.h +++ b/src/3rdparty/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, */ @@ -41,6 +41,10 @@ #include "afblue.h" +#ifdef FT_DEBUG_AUTOFIT +#include FT_CONFIG_STANDARD_LIBRARY_H +#endif + FT_BEGIN_HEADER @@ -54,8 +58,6 @@ FT_BEGIN_HEADER #ifdef FT_DEBUG_AUTOFIT -#include FT_CONFIG_STANDARD_LIBRARY_H - extern int _af_debug_disable_horz_hints; extern int _af_debug_disable_vert_hints; extern int _af_debug_disable_blue_hints; @@ -138,11 +140,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 +169,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_ @@ -219,7 +217,8 @@ extern void* _af_debug_hints; AF_StyleMetrics metrics ); typedef void - (*AF_WritingSystem_ApplyHintsFunc)( AF_GlyphHints hints, + (*AF_WritingSystem_ApplyHintsFunc)( FT_UInt glyph_index, + AF_GlyphHints hints, FT_Outline* outline, AF_StyleMetrics metrics ); @@ -295,8 +294,9 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * Each script is associated with a set of Unicode ranges that gets used - * to test whether the font face supports the script. + * Each script is associated with two sets of Unicode ranges to test + * whether the font face supports the script, and which non-base + * characters the script contains. * * We use four-letter script tags from the OpenType specification, * extended by `NONE', which indicates `no script'. @@ -333,7 +333,9 @@ extern void* _af_debug_hints; { AF_Script script; - AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ + /* last element in the ranges must be { 0, 0 } */ + AF_Script_UniRange script_uni_ranges; + AF_Script_UniRange script_uni_nonbase_ranges; FT_UInt32 standard_char1; /* for default width and height */ FT_UInt32 standard_char2; /* ditto */ @@ -513,6 +515,7 @@ extern void* _af_debug_hints; script_class, \ script, \ ranges, \ + nonbase_ranges, \ std_char1, \ std_char2, \ std_char3 ) \ @@ -521,6 +524,7 @@ extern void* _af_debug_hints; { \ script, \ ranges, \ + nonbase_ranges, \ std_char1, \ std_char2, \ std_char3 \ @@ -587,17 +591,19 @@ extern void* _af_debug_hints; script_class, \ script_, \ ranges, \ + nonbase_ranges, \ std_char1, \ std_char2, \ std_char3 ) \ FT_LOCAL_DEF( void ) \ FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \ { \ - ac->script = script_; \ - ac->script_uni_ranges = ranges; \ - ac->standard_char1 = std_char1; \ - ac->standard_char2 = std_char2; \ - ac->standard_char3 = std_char3; \ + ac->script = script_; \ + ac->script_uni_ranges = ranges; \ + ac->script_uni_nonbase_ranges = nonbase_ranges; \ + ac->standard_char1 = std_char1; \ + ac->standard_char2 = std_char2; \ + ac->standard_char3 = std_char3; \ } diff --git a/src/3rdparty/freetype/src/autofit/afwarp.c b/src/3rdparty/freetype/src/autofit/afwarp.c index 34a97ffc57..59af4f02bd 100644 --- a/src/3rdparty/freetype/src/autofit/afwarp.c +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/afwarp.h b/src/3rdparty/freetype/src/autofit/afwarp.h index 7343fdd5ef..6069b6b277 100644 --- a/src/3rdparty/freetype/src/autofit/afwarp.h +++ b/src/3rdparty/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) & ~FT_TYPEOF( x )63 ) #define AF_WARPER_CEIL( x ) AF_WARPER_FLOOR( (x) + 63 ) diff --git a/src/3rdparty/freetype/src/autofit/afwrtsys.h b/src/3rdparty/freetype/src/autofit/afwrtsys.h index 8aa2ed9e6b..4aa89d2356 100644 --- a/src/3rdparty/freetype/src/autofit/afwrtsys.h +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/autofit.c b/src/3rdparty/freetype/src/autofit/autofit.c index e2b9934e4b..b6ed4a0ff1 100644 --- a/src/3rdparty/freetype/src/autofit/autofit.c +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/hbshim.c b/src/3rdparty/freetype/src/autofit/hbshim.c index a705cef000..7a45059c39 100644 --- a/src/3rdparty/freetype/src/autofit/hbshim.c +++ b/src/3rdparty/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, */ @@ -98,7 +98,7 @@ FT_Error af_get_coverage( AF_FaceGlobals globals, AF_StyleClass style_class, - FT_Byte* gstyles ) + FT_UShort* gstyles ) { hb_face_t* face; @@ -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 ) ) @@ -362,7 +363,7 @@ continue; if ( gstyles[idx] == AF_STYLE_UNASSIGNED ) - gstyles[idx] = (FT_Byte)style_class->style; + gstyles[idx] = (FT_UShort)style_class->style; #ifdef FT_DEBUG_LEVEL_TRACE else FT_TRACE4(( "*" )); @@ -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(); @@ -508,7 +509,7 @@ FT_Error af_get_coverage( AF_FaceGlobals globals, AF_StyleClass style_class, - FT_Byte* gstyles ) + FT_UShort* gstyles ) { FT_UNUSED( globals ); FT_UNUSED( style_class ); diff --git a/src/3rdparty/freetype/src/autofit/hbshim.h b/src/3rdparty/freetype/src/autofit/hbshim.h index 02f1513f67..3824941ca2 100644 --- a/src/3rdparty/freetype/src/autofit/hbshim.h +++ b/src/3rdparty/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, */ @@ -38,7 +38,7 @@ FT_BEGIN_HEADER FT_Error af_get_coverage( AF_FaceGlobals globals, AF_StyleClass style_class, - FT_Byte* gstyles ); + FT_UShort* gstyles ); FT_Error af_get_char_index( AF_StyleMetrics metrics, diff --git a/src/3rdparty/freetype/src/autofit/module.mk b/src/3rdparty/freetype/src/autofit/module.mk index 6ec60912ab..33214387f5 100644 --- a/src/3rdparty/freetype/src/autofit/module.mk +++ b/src/3rdparty/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/src/3rdparty/freetype/src/autofit/rules.mk b/src/3rdparty/freetype/src/autofit/rules.mk index 658f04ea59..6ef959f1ba 100644 --- a/src/3rdparty/freetype/src/autofit/rules.mk +++ b/src/3rdparty/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) -- cgit v1.2.3