diff options
Diffstat (limited to 'src/3rdparty/freetype/src')
467 files changed, 5725 insertions, 17361 deletions
diff --git a/src/3rdparty/freetype/src/Jamfile b/src/3rdparty/freetype/src/Jamfile deleted file mode 100644 index 3ad2d5c962..0000000000 --- a/src/3rdparty/freetype/src/Jamfile +++ /dev/null @@ -1,19 +0,0 @@ -# FreeType 2 src Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) ; - -for xx in $(FT2_COMPONENTS) -{ - SubInclude FT2_TOP $(FT2_SRC_DIR) $(xx) ; -} - -# end of src Jamfile diff --git a/src/3rdparty/freetype/src/autofit/Jamfile b/src/3rdparty/freetype/src/autofit/Jamfile deleted file mode 100644 index ea69dee377..0000000000 --- a/src/3rdparty/freetype/src/autofit/Jamfile +++ /dev/null @@ -1,53 +0,0 @@ -# FreeType 2 src/autofit Jamfile -# -# Copyright (C) 2003-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP src autofit ; - -{ - local _sources ; - - # define FT2_AUTOFIT2 to enable experimental latin hinter replacement - if $(FT2_AUTOFIT2) - { - CCFLAGS += FT_OPTION_AUTOFIT2 ; - } - if $(FT2_MULTI) - { - _sources = afangles - afblue - afcjk - afdummy - afglobal - afhints - afindic - aflatin - afloader - afmodule - afpic - afranges - afshaper - afwarp - ; - - if $(FT2_AUTOFIT2) - { - _sources += aflatin2 ; - } - } - else - { - _sources = autofit ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/autofit Jamfile diff --git a/src/3rdparty/freetype/src/autofit/afangles.c b/src/3rdparty/freetype/src/autofit/afangles.c index 9e1f7a21ff..a2d45eb72c 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 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.c b/src/3rdparty/freetype/src/autofit/afblue.c index b99dbeb19c..9ebffdd099 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 (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -134,7 +134,7 @@ '\0', '\xF0', '\x90', '\x90', '\xA8', ' ', '\xF0', '\x90', '\x90', '\xAA', ' ', '\xF0', '\x90', '\x90', '\xAC', ' ', '\xF0', '\x90', '\x90', '\xBF', ' ', '\xF0', '\x90', '\x91', '\x83', /* 𐐨 𐐪 𐐬 𐐿 𐑃 */ '\0', - '\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x85', ' ', '\xE0', '\xA4', '\x86', ' ', '\xE0', '\xA4', '\xA5', ' ', '\xE0', '\xA4', '\xA7', ' ', '\xE0', '\xA4', '\xAD', ' ', '\xE0', '\xA4', '\xB6', /* क म अ आ थ ध भ श */ + '\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xA8', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x89', ' ', '\xE0', '\xA4', '\x9B', ' ', '\xE0', '\xA4', '\x9F', ' ', '\xE0', '\xA4', '\xA0', ' ', '\xE0', '\xA4', '\xA1', /* क न म उ छ ट ठ ड */ '\0', '\xE0', '\xA4', '\x88', ' ', '\xE0', '\xA4', '\x90', ' ', '\xE0', '\xA4', '\x93', ' ', '\xE0', '\xA4', '\x94', ' ', '\xE0', '\xA4', '\xBF', ' ', '\xE0', '\xA5', '\x80', ' ', '\xE0', '\xA5', '\x8B', ' ', '\xE0', '\xA5', '\x8C', /* ई ऐ ओ औ ि ी ो ौ */ '\0', @@ -296,6 +296,20 @@ '\0', '\xE0', '\xB4', '\x9F', ' ', '\xE0', '\xB4', '\xA0', ' ', '\xE0', '\xB4', '\xA7', ' ', '\xE0', '\xB4', '\xB6', ' ', '\xE0', '\xB4', '\x98', ' ', '\xE0', '\xB4', '\x9A', ' ', '\xE0', '\xB4', '\xA5', ' ', '\xE0', '\xB4', '\xB2', /* ട ഠ ധ ശ ഘ ച ഥ ല */ '\0', + '\xF0', '\x96', '\xB9', '\x80', ' ', '\xF0', '\x96', '\xB9', '\x81', ' ', '\xF0', '\x96', '\xB9', '\x82', ' ', '\xF0', '\x96', '\xB9', '\x83', ' ', '\xF0', '\x96', '\xB9', '\x8F', ' ', '\xF0', '\x96', '\xB9', '\x9A', ' ', '\xF0', '\x96', '\xB9', '\x9F', /* 𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹟 */ + '\0', + '\xF0', '\x96', '\xB9', '\x80', ' ', '\xF0', '\x96', '\xB9', '\x81', ' ', '\xF0', '\x96', '\xB9', '\x82', ' ', '\xF0', '\x96', '\xB9', '\x83', ' ', '\xF0', '\x96', '\xB9', '\x8F', ' ', '\xF0', '\x96', '\xB9', '\x9A', ' ', '\xF0', '\x96', '\xB9', '\x92', ' ', '\xF0', '\x96', '\xB9', '\x93', /* 𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹒 𖹓 */ + '\0', + '\xF0', '\x96', '\xB9', '\xA4', ' ', '\xF0', '\x96', '\xB9', '\xAC', ' ', '\xF0', '\x96', '\xB9', '\xA7', ' ', '\xF0', '\x96', '\xB9', '\xB4', ' ', '\xF0', '\x96', '\xB9', '\xB6', ' ', '\xF0', '\x96', '\xB9', '\xBE', /* 𖹤 𖹬 𖹧 𖹴 𖹶 𖹾 */ + '\0', + '\xF0', '\x96', '\xB9', '\xA0', ' ', '\xF0', '\x96', '\xB9', '\xA1', ' ', '\xF0', '\x96', '\xB9', '\xA2', ' ', '\xF0', '\x96', '\xB9', '\xB9', ' ', '\xF0', '\x96', '\xB9', '\xB3', ' ', '\xF0', '\x96', '\xB9', '\xAE', /* 𖹠 𖹡 𖹢 𖹹 𖹳 𖹮 */ + '\0', + '\xF0', '\x96', '\xB9', '\xA0', ' ', '\xF0', '\x96', '\xB9', '\xA1', ' ', '\xF0', '\x96', '\xB9', '\xA2', ' ', '\xF0', '\x96', '\xB9', '\xB3', ' ', '\xF0', '\x96', '\xB9', '\xAD', ' ', '\xF0', '\x96', '\xB9', '\xBD', /* 𖹠 𖹡 𖹢 𖹳 𖹭 𖹽 */ + '\0', + '\xF0', '\x96', '\xB9', '\xA5', ' ', '\xF0', '\x96', '\xB9', '\xA8', ' ', '\xF0', '\x96', '\xB9', '\xA9', /* 𖹥 𖹨 𖹩 */ + '\0', + '\xF0', '\x96', '\xBA', '\x80', ' ', '\xF0', '\x96', '\xBA', '\x85', ' ', '\xF0', '\x96', '\xBA', '\x88', ' ', '\xF0', '\x96', '\xBA', '\x84', ' ', '\xF0', '\x96', '\xBA', '\x8D', /* 𖺀 𖺅 𖺈 𖺄 𖺍 */ + '\0', '\xE1', '\xA0', '\xB3', ' ', '\xE1', '\xA0', '\xB4', ' ', '\xE1', '\xA0', '\xB6', ' ', '\xE1', '\xA0', '\xBD', ' ', '\xE1', '\xA1', '\x82', ' ', '\xE1', '\xA1', '\x8A', ' ', '\xE2', '\x80', '\x8D', '\xE1', '\xA1', '\xA1', '\xE2', '\x80', '\x8D', ' ', '\xE2', '\x80', '\x8D', '\xE1', '\xA1', '\xB3', '\xE2', '\x80', '\x8D', /* ᠳ ᠴ ᠶ ᠽ ᡂ ᡊ ᡡ ᡳ */ '\0', '\xE1', '\xA1', '\x83', /* ᡃ */ @@ -340,6 +354,12 @@ '\0', '\xF0', '\x90', '\x92', '\x80', ' ', '\xF0', '\x90', '\x92', '\x82', ' ', '\xF0', '\x90', '\x92', '\x86', ' ', '\xF0', '\x90', '\x92', '\x88', ' ', '\xF0', '\x90', '\x92', '\x8A', ' ', '\xF0', '\x90', '\x92', '\x92', ' ', '\xF0', '\x90', '\x92', '\xA0', ' ', '\xF0', '\x90', '\x92', '\xA9', /* 𐒀 𐒂 𐒆 𐒈 𐒊 𐒒 𐒠 𐒩 */ '\0', + '\xF0', '\x90', '\xB4', '\x83', ' ', '\xF0', '\x90', '\xB4', '\x80', ' ', '\xF0', '\x90', '\xB4', '\x86', ' ', '\xF0', '\x90', '\xB4', '\x96', ' ', '\xF0', '\x90', '\xB4', '\x95', /* 𐴃 𐴀 𐴆 𐴖 𐴕 */ + '\0', + '\xF0', '\x90', '\xB4', '\x94', ' ', '\xF0', '\x90', '\xB4', '\x96', ' ', '\xF0', '\x90', '\xB4', '\x95', ' ', '\xF0', '\x90', '\xB4', '\x91', ' ', '\xF0', '\x90', '\xB4', '\x90', /* 𐴔 𐴖 𐴕 𐴑 𐴐 */ + '\0', + '\xD9', '\x80', /* ـ */ + '\0', '\xEA', '\xA2', '\x9C', ' ', '\xEA', '\xA2', '\x9E', ' ', '\xEA', '\xA2', '\xB3', ' ', '\xEA', '\xA2', '\x82', ' ', '\xEA', '\xA2', '\x96', ' ', '\xEA', '\xA2', '\x92', ' ', '\xEA', '\xA2', '\x9D', ' ', '\xEA', '\xA2', '\x9B', /* ꢜ ꢞ ꢳ ꢂ ꢖ ꢒ ꢝ ꢛ */ '\0', '\xEA', '\xA2', '\x82', ' ', '\xEA', '\xA2', '\xA8', ' ', '\xEA', '\xA2', '\xBA', ' ', '\xEA', '\xA2', '\xA4', ' ', '\xEA', '\xA2', '\x8E', /* ꢂ ꢨ ꢺ ꢤ ꢎ */ @@ -488,14 +508,14 @@ { AF_BLUE_STRING_CHAKMA_BOTTOM, 0 }, { AF_BLUE_STRING_CHAKMA_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 }, - { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_CARIAN_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, @@ -595,6 +615,9 @@ { AF_BLUE_STRING_HEBREW_BOTTOM, 0 }, { AF_BLUE_STRING_HEBREW_DESCENDER, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_KAYAH_LI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_KAYAH_LI_BOTTOM, 0 }, @@ -613,9 +636,6 @@ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_KANNADA_BOTTOM, 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 }, @@ -653,6 +673,15 @@ { AF_BLUE_STRING_MALAYALAM_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM, 0 }, + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM, 0 }, + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER, 0 }, + { AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_MONGOLIAN_TOP_BASE, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE, 0 }, { AF_BLUE_STRING_MAX, 0 }, @@ -687,6 +716,10 @@ { AF_BLUE_STRING_OSMANYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_OSMANYA_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_ROHINGYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_ROHINGYA_BOTTOM, 0 }, + { AF_BLUE_STRING_ROHINGYA_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_SAURASHTRA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_SAURASHTRA_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, @@ -714,9 +747,6 @@ { AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_TELUGU_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, - { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }, - { AF_BLUE_STRING_TIFINAGH, 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 }, @@ -726,6 +756,9 @@ { AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0 }, { AF_BLUE_STRING_THAI_DIGIT_TOP, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_TIFINAGH, 0 }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_VAI_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, diff --git a/src/3rdparty/freetype/src/autofit/afblue.cin b/src/3rdparty/freetype/src/autofit/afblue.cin index 6545d1fd43..c6a697fee0 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 (C) 2013-2019 by + * Copyright (C) 2013-2020 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 46db43fe22..b19b8df0f4 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 (C) 2013-2019 by +// Copyright (C) 2013-2020 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, @@ -203,7 +203,7 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: "𐐨 𐐪 𐐬 𐐿 𐑃" AF_BLUE_STRING_DEVANAGARI_BASE - "क म अ आ थ ध भ श" + "क न म उ छ ट ठ ड" AF_BLUE_STRING_DEVANAGARI_TOP "ई ऐ ओ औ ि ी ो ौ" // note that some fonts have extreme variation in the height of the @@ -392,6 +392,21 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_MALAYALAM_BOTTOM "ട ഠ ധ ശ ഘ ച ഥ ല" + AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP + "𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹟" + AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM + "𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹒 𖹓" + AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP + "𖹤 𖹬 𖹧 𖹴 𖹶 𖹾" + AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP + "𖹠 𖹡 𖹢 𖹹 𖹳 𖹮" + AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM + "𖹠 𖹡 𖹢 𖹳 𖹭 𖹽" + AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER + "𖹥 𖹨 𖹩" + AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP + "𖺀 𖺅 𖺈 𖺄 𖺍" + AF_BLUE_STRING_MONGOLIAN_TOP_BASE "ᠳ ᠴ ᠶ ᠽ ᡂ ᡊ ᡡ ᡳ" AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE @@ -443,6 +458,13 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_OSMANYA_BOTTOM "𐒀 𐒂 𐒆 𐒈 𐒊 𐒒 𐒠 𐒩" + AF_BLUE_STRING_ROHINGYA_TOP + "𐴃 𐴀 𐴆 𐴖 𐴕" + AF_BLUE_STRING_ROHINGYA_BOTTOM + "𐴔 𐴖 𐴕 𐴑 𐴐" + AF_BLUE_STRING_ROHINGYA_JOIN + "ـ" + AF_BLUE_STRING_SAURASHTRA_TOP "ꢜ ꢞ ꢳ ꢂ ꢖ ꢒ ꢝ ꢛ" AF_BLUE_STRING_SAURASHTRA_BOTTOM @@ -734,14 +756,14 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_CANS - { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 } - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | - AF_BLUE_PROPERTY_LATIN_X_HEIGHT } - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 } - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 } - { AF_BLUE_STRING_MAX, 0 } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } AF_BLUE_STRINGSET_CARI { AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP } @@ -874,6 +896,11 @@ 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_KNDA + { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_KANNADA_BOTTOM, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_KALI { AF_BLUE_STRING_KAYAH_LI_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } @@ -898,11 +925,6 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_KNDA - { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_KANNADA_BOTTOM, 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 } @@ -952,6 +974,17 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_MEDF + { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM, 0 } + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP | + AF_BLUE_PROPERTY_LATIN_X_HEIGHT } + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM, 0 } + { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER, 0 } + { AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_MONG { AF_BLUE_STRING_MONGOLIAN_TOP_BASE, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE, 0 } @@ -1002,6 +1035,12 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_OSMANYA_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_ROHG + { AF_BLUE_STRING_ROHINGYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_ROHINGYA_BOTTOM, 0 } + { AF_BLUE_STRING_ROHINGYA_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_SAUR { AF_BLUE_STRING_SAURASHTRA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_SAURASHTRA_BOTTOM, 0 } @@ -1043,11 +1082,6 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_TELUGU_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } - AF_BLUE_STRINGSET_TFNG - { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP } - { AF_BLUE_STRING_TIFINAGH, 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 } @@ -1059,6 +1093,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN: { AF_BLUE_STRING_THAI_DIGIT_TOP, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_TFNG + { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_TIFINAGH, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_VAII { AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_VAI_BOTTOM, 0 } diff --git a/src/3rdparty/freetype/src/autofit/afblue.h b/src/3rdparty/freetype/src/autofit/afblue.h index b69b1df521..486d663b6c 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 (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -212,58 +212,68 @@ FT_BEGIN_HEADER AF_BLUE_STRING_LISU_BOTTOM = 3506, AF_BLUE_STRING_MALAYALAM_TOP = 3538, AF_BLUE_STRING_MALAYALAM_BOTTOM = 3582, - AF_BLUE_STRING_MONGOLIAN_TOP_BASE = 3614, - AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE = 3658, - AF_BLUE_STRING_MYANMAR_TOP = 3662, - AF_BLUE_STRING_MYANMAR_BOTTOM = 3694, - AF_BLUE_STRING_MYANMAR_ASCENDER = 3726, - AF_BLUE_STRING_MYANMAR_DESCENDER = 3754, - AF_BLUE_STRING_NKO_TOP = 3786, - AF_BLUE_STRING_NKO_BOTTOM = 3810, - AF_BLUE_STRING_NKO_SMALL_TOP = 3825, - AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3834, - AF_BLUE_STRING_OL_CHIKI = 3846, - AF_BLUE_STRING_OLD_TURKIC_TOP = 3870, - AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3885, - AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3905, - AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3945, - AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3975, - AF_BLUE_STRING_OSAGE_SMALL_TOP = 3990, - AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 4030, - AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4070, - AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4095, - AF_BLUE_STRING_OSMANYA_TOP = 4110, - AF_BLUE_STRING_OSMANYA_BOTTOM = 4150, - AF_BLUE_STRING_SAURASHTRA_TOP = 4190, - AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4222, - AF_BLUE_STRING_SHAVIAN_TOP = 4242, - AF_BLUE_STRING_SHAVIAN_BOTTOM = 4252, - AF_BLUE_STRING_SHAVIAN_DESCENDER = 4277, - AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4287, - AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4322, - AF_BLUE_STRING_SINHALA_TOP = 4337, - AF_BLUE_STRING_SINHALA_BOTTOM = 4369, - AF_BLUE_STRING_SINHALA_DESCENDER = 4401, - AF_BLUE_STRING_SUNDANESE_TOP = 4445, - AF_BLUE_STRING_SUNDANESE_BOTTOM = 4469, - AF_BLUE_STRING_SUNDANESE_DESCENDER = 4501, - AF_BLUE_STRING_TAI_VIET_TOP = 4509, - AF_BLUE_STRING_TAI_VIET_BOTTOM = 4529, - AF_BLUE_STRING_TAMIL_TOP = 4541, - AF_BLUE_STRING_TAMIL_BOTTOM = 4573, - AF_BLUE_STRING_TELUGU_TOP = 4605, - AF_BLUE_STRING_TELUGU_BOTTOM = 4633, - AF_BLUE_STRING_THAI_TOP = 4661, - AF_BLUE_STRING_THAI_BOTTOM = 4685, - AF_BLUE_STRING_THAI_ASCENDER = 4713, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4725, - AF_BLUE_STRING_THAI_DESCENDER = 4737, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4753, - AF_BLUE_STRING_THAI_DIGIT_TOP = 4761, - AF_BLUE_STRING_TIFINAGH = 4773, - AF_BLUE_STRING_VAI_TOP = 4805, - AF_BLUE_STRING_VAI_BOTTOM = 4837, - af_blue_1_1 = 4868, + AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP = 3614, + AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM = 3649, + AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP = 3689, + AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP = 3719, + AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM = 3749, + AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER = 3779, + AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP = 3794, + AF_BLUE_STRING_MONGOLIAN_TOP_BASE = 3819, + AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE = 3863, + AF_BLUE_STRING_MYANMAR_TOP = 3867, + AF_BLUE_STRING_MYANMAR_BOTTOM = 3899, + AF_BLUE_STRING_MYANMAR_ASCENDER = 3931, + AF_BLUE_STRING_MYANMAR_DESCENDER = 3959, + AF_BLUE_STRING_NKO_TOP = 3991, + AF_BLUE_STRING_NKO_BOTTOM = 4015, + AF_BLUE_STRING_NKO_SMALL_TOP = 4030, + AF_BLUE_STRING_NKO_SMALL_BOTTOM = 4039, + AF_BLUE_STRING_OL_CHIKI = 4051, + AF_BLUE_STRING_OLD_TURKIC_TOP = 4075, + AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 4090, + AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 4110, + AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 4150, + AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 4180, + AF_BLUE_STRING_OSAGE_SMALL_TOP = 4195, + AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 4235, + AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4275, + AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4300, + AF_BLUE_STRING_OSMANYA_TOP = 4315, + AF_BLUE_STRING_OSMANYA_BOTTOM = 4355, + AF_BLUE_STRING_ROHINGYA_TOP = 4395, + AF_BLUE_STRING_ROHINGYA_BOTTOM = 4420, + AF_BLUE_STRING_ROHINGYA_JOIN = 4445, + AF_BLUE_STRING_SAURASHTRA_TOP = 4448, + AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4480, + AF_BLUE_STRING_SHAVIAN_TOP = 4500, + AF_BLUE_STRING_SHAVIAN_BOTTOM = 4510, + AF_BLUE_STRING_SHAVIAN_DESCENDER = 4535, + AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4545, + AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4580, + AF_BLUE_STRING_SINHALA_TOP = 4595, + AF_BLUE_STRING_SINHALA_BOTTOM = 4627, + AF_BLUE_STRING_SINHALA_DESCENDER = 4659, + AF_BLUE_STRING_SUNDANESE_TOP = 4703, + AF_BLUE_STRING_SUNDANESE_BOTTOM = 4727, + AF_BLUE_STRING_SUNDANESE_DESCENDER = 4759, + AF_BLUE_STRING_TAI_VIET_TOP = 4767, + AF_BLUE_STRING_TAI_VIET_BOTTOM = 4787, + AF_BLUE_STRING_TAMIL_TOP = 4799, + AF_BLUE_STRING_TAMIL_BOTTOM = 4831, + AF_BLUE_STRING_TELUGU_TOP = 4863, + AF_BLUE_STRING_TELUGU_BOTTOM = 4891, + AF_BLUE_STRING_THAI_TOP = 4919, + AF_BLUE_STRING_THAI_BOTTOM = 4943, + AF_BLUE_STRING_THAI_ASCENDER = 4971, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4983, + AF_BLUE_STRING_THAI_DESCENDER = 4995, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 5011, + AF_BLUE_STRING_THAI_DIGIT_TOP = 5019, + AF_BLUE_STRING_TIFINAGH = 5031, + AF_BLUE_STRING_VAI_TOP = 5063, + AF_BLUE_STRING_VAI_BOTTOM = 5095, + af_blue_1_1 = 5126, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -347,35 +357,37 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_GUJR = 112, AF_BLUE_STRINGSET_GURU = 118, AF_BLUE_STRINGSET_HEBR = 124, - AF_BLUE_STRINGSET_KALI = 128, - AF_BLUE_STRINGSET_KHMR = 134, - AF_BLUE_STRINGSET_KHMS = 140, - AF_BLUE_STRINGSET_KNDA = 143, + AF_BLUE_STRINGSET_KNDA = 128, + AF_BLUE_STRINGSET_KALI = 131, + AF_BLUE_STRINGSET_KHMR = 137, + AF_BLUE_STRINGSET_KHMS = 143, AF_BLUE_STRINGSET_LAO = 146, AF_BLUE_STRINGSET_LATN = 152, AF_BLUE_STRINGSET_LATB = 159, AF_BLUE_STRINGSET_LATP = 166, AF_BLUE_STRINGSET_LISU = 173, AF_BLUE_STRINGSET_MLYM = 176, - AF_BLUE_STRINGSET_MONG = 179, - AF_BLUE_STRINGSET_MYMR = 182, - AF_BLUE_STRINGSET_NKOO = 187, - AF_BLUE_STRINGSET_NONE = 192, - AF_BLUE_STRINGSET_OLCK = 193, - AF_BLUE_STRINGSET_ORKH = 196, - AF_BLUE_STRINGSET_OSGE = 199, - AF_BLUE_STRINGSET_OSMA = 207, - AF_BLUE_STRINGSET_SAUR = 210, - AF_BLUE_STRINGSET_SHAW = 213, - AF_BLUE_STRINGSET_SINH = 219, - AF_BLUE_STRINGSET_SUND = 223, - AF_BLUE_STRINGSET_TAML = 227, - AF_BLUE_STRINGSET_TAVT = 230, - AF_BLUE_STRINGSET_TELU = 233, - AF_BLUE_STRINGSET_TFNG = 236, - AF_BLUE_STRINGSET_THAI = 239, - AF_BLUE_STRINGSET_VAII = 247, - af_blue_2_1 = 250, + AF_BLUE_STRINGSET_MEDF = 179, + AF_BLUE_STRINGSET_MONG = 187, + AF_BLUE_STRINGSET_MYMR = 190, + AF_BLUE_STRINGSET_NKOO = 195, + AF_BLUE_STRINGSET_NONE = 200, + AF_BLUE_STRINGSET_OLCK = 201, + AF_BLUE_STRINGSET_ORKH = 204, + AF_BLUE_STRINGSET_OSGE = 207, + AF_BLUE_STRINGSET_OSMA = 215, + AF_BLUE_STRINGSET_ROHG = 218, + AF_BLUE_STRINGSET_SAUR = 222, + AF_BLUE_STRINGSET_SHAW = 225, + AF_BLUE_STRINGSET_SINH = 231, + AF_BLUE_STRINGSET_SUND = 235, + AF_BLUE_STRINGSET_TAML = 239, + AF_BLUE_STRINGSET_TAVT = 242, + AF_BLUE_STRINGSET_TELU = 245, + AF_BLUE_STRINGSET_THAI = 248, + AF_BLUE_STRINGSET_TFNG = 256, + AF_BLUE_STRINGSET_VAII = 259, + af_blue_2_1 = 262, #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 30a28dafa5..3957027091 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 (C) 2013-2019 by + * Copyright (C) 2013-2020 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/afcjk.c b/src/3rdparty/freetype/src/autofit/afcjk.c index a61689bee3..3b340cd5ed 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 (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -22,9 +22,8 @@ * */ -#include <ft2build.h> -#include FT_ADVANCES_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/ftadvanc.h> +#include <freetype/internal/ftdebug.h> #include "afglobal.h" #include "aflatin.h" @@ -158,7 +157,7 @@ if ( !glyph_index ) goto Exit; - FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n", + FT_TRACE5(( "standard character: U+%04lX (glyph index %ld)\n", ch, glyph_index )); error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); @@ -261,9 +260,9 @@ dim == AF_DIMENSION_VERT ? "horizontal" : "vertical" )); - FT_TRACE5(( " %d (standard)", axis->standard_width )); + FT_TRACE5(( " %ld (standard)", axis->standard_width )); for ( i = 1; i < axis->width_count; i++ ) - FT_TRACE5(( " %d", axis->widths[i].org )); + FT_TRACE5(( " %ld", axis->widths[i].org )); FT_TRACE5(( "\n" )); } @@ -728,7 +727,7 @@ delta2 = FT_MulFix( delta2, scale ); - FT_TRACE5(( "delta: %d", delta1 )); + FT_TRACE5(( "delta: %ld", delta1 )); if ( delta2 < 32 ) delta2 = 0; #if 0 @@ -737,7 +736,7 @@ #endif else delta2 = FT_PIX_ROUND( delta2 ); - FT_TRACE5(( "/%d\n", delta2 )); + FT_TRACE5(( "/%ld\n", delta2 )); if ( delta1 < 0 ) delta2 = -delta2; @@ -806,7 +805,7 @@ { AF_AxisHints axis = &hints->axis[dim]; AF_Segment segments = axis->segments; - AF_Segment segment_limit = segments + axis->num_segments; + AF_Segment segment_limit = FT_OFFSET( segments, axis->num_segments ); FT_Error error; AF_Segment seg; @@ -1644,7 +1643,7 @@ stem_edge->pos = base_edge->pos + fitted_width; - FT_TRACE5(( " CJKLINK: edge %d @%d (opos=%.2f) linked to %.2f," + FT_TRACE5(( " CJKLINK: edge %ld @%d (opos=%.2f) linked to %.2f," " dist was %.2f, now %.2f\n", stem_edge - hints->axis[dim].edges, stem_edge->fpos, stem_edge->opos / 64.0, stem_edge->pos / 64.0, @@ -1866,7 +1865,7 @@ continue; #ifdef FT_DEBUG_LEVEL_TRACE - FT_TRACE5(( " CJKBLUE: edge %d @%d (opos=%.2f) snapped to %.2f," + FT_TRACE5(( " CJKBLUE: edge %ld @%d (opos=%.2f) snapped to %.2f," " was %.2f\n", edge1 - edges, edge1->fpos, edge1->opos / 64.0, blue->fit / 64.0, edge1->pos / 64.0 )); @@ -1930,7 +1929,7 @@ /* this should not happen, but it's better to be safe */ if ( edge2->blue_edge ) { - FT_TRACE5(( "ASSERTION FAILED for edge %d\n", edge2-edges )); + FT_TRACE5(( "ASSERTION FAILED for edge %ld\n", edge2-edges )); af_cjk_align_linked_edge( hints, dim, edge2, edge ); edge->flags |= AF_EDGE_DONE; diff --git a/src/3rdparty/freetype/src/autofit/afcjk.h b/src/3rdparty/freetype/src/autofit/afcjk.h index 59acae5342..fd0f451aa8 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 (C) 2006-2019 by + * Copyright (C) 2006-2020 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/afcover.h b/src/3rdparty/freetype/src/autofit/afcover.h index ff207a97e0..03085ad07e 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 (C) 2013-2019 by + * Copyright (C) 2013-2020 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 7e07a41e7d..77d31df974 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 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.h b/src/3rdparty/freetype/src/autofit/afdummy.h index ab9227d35d..efd799e84b 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 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 2ec336f72c..f90899944b 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 (C) 2005-2019 by + * Copyright (C) 2005-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -26,7 +26,7 @@ #ifndef AFERRORS_H_ #define AFERRORS_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -34,7 +34,7 @@ #define FT_ERR_PREFIX AF_Err_ #define FT_ERR_BASE FT_Mod_Err_Autofit -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* AFERRORS_H_ */ diff --git a/src/3rdparty/freetype/src/autofit/afglobal.c b/src/3rdparty/freetype/src/autofit/afglobal.c index 6a9a1e5aaa..d5129423d5 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,7 +19,7 @@ #include "afglobal.h" #include "afranges.h" #include "afshaper.h" -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> /************************************************************************** @@ -306,7 +306,7 @@ if ( !( count % 10 ) ) FT_TRACE4(( " " )); - FT_TRACE4(( " %d", idx )); + FT_TRACE4(( " %ld", idx )); count++; if ( !( count % 10 ) ) diff --git a/src/3rdparty/freetype/src/autofit/afglobal.h b/src/3rdparty/freetype/src/autofit/afglobal.h index 52f38350db..fecf7af977 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 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/afhints.c b/src/3rdparty/freetype/src/autofit/afhints.c index ed111c4117..a8e00890ef 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -18,8 +18,8 @@ #include "afhints.h" #include "aferrors.h" -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/ftdebug.h> /************************************************************************** diff --git a/src/3rdparty/freetype/src/autofit/afhints.h b/src/3rdparty/freetype/src/autofit/afhints.h index e0cf612f0c..6397f098f0 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 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/afindic.c b/src/3rdparty/freetype/src/autofit/afindic.c index a17117c712..bc2837a26d 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 (C) 2007-2019 by + * Copyright (C) 2007-2020 by * Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. * * This file is part of the FreeType project, and may only be used, diff --git a/src/3rdparty/freetype/src/autofit/afindic.h b/src/3rdparty/freetype/src/autofit/afindic.h index bc5bc59fa5..088b88b19d 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 (C) 2007-2019 by + * Copyright (C) 2007-2020 by * Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. * * This file is part of the FreeType project, and may only be used, diff --git a/src/3rdparty/freetype/src/autofit/aflatin.c b/src/3rdparty/freetype/src/autofit/aflatin.c index 27d4024882..21ec02ebd2 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,9 +16,8 @@ */ -#include <ft2build.h> -#include FT_ADVANCES_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/ftadvanc.h> +#include <freetype/internal/ftdebug.h> #include "afglobal.h" #include "aflatin.h" @@ -155,7 +154,7 @@ goto Exit; } - FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n", + FT_TRACE5(( "standard character: U+%04lX (glyph index %ld)\n", ch, glyph_index )); error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); @@ -258,9 +257,9 @@ dim == AF_DIMENSION_VERT ? "horizontal" : "vertical" )); - FT_TRACE5(( " %d (standard)", axis->standard_width )); + FT_TRACE5(( " %ld (standard)", axis->standard_width )); for ( i = 1; i < axis->width_count; i++ ) - FT_TRACE5(( " %d", axis->widths[i].org )); + FT_TRACE5(( " %ld", axis->widths[i].org )); FT_TRACE5(( "\n" )); } @@ -1032,7 +1031,7 @@ { *a = *b; FT_TRACE5(( "blue zone overlap:" - " adjusting %s %d to %ld\n", + " adjusting %s %ld to %ld\n", a_is_top ? "overshoot" : "reference", blue_sorted[i] - axis->blues, *a )); @@ -1280,7 +1279,7 @@ "af_latin_metrics_scale_dim:" " x height alignment (style `%s'):\n" " " - " vertical scaling changed from %.5f to %.5f (by %d%%)\n" + " vertical scaling changed from %.5f to %.5f (by %ld%%)\n" "\n", af_style_names[metrics->root.style_class->style], scale / 65536.0, @@ -1333,7 +1332,7 @@ width->cur = FT_MulFix( width->org, scale ); width->fit = width->cur; - FT_TRACE5(( " %d scaled to %.2f\n", + FT_TRACE5(( " %ld scaled to %.2f\n", width->org, width->cur / 64.0 )); } @@ -1474,8 +1473,8 @@ AF_LatinBlue blue = &axis->blues[nn]; - FT_TRACE5(( " reference %d: %d scaled to %.2f%s\n" - " overshoot %d: %d scaled to %.2f%s\n", + FT_TRACE5(( " reference %d: %ld scaled to %.2f%s\n" + " overshoot %d: %ld scaled to %.2f%s\n", nn, blue->ref.org, blue->ref.fit / 64.0, @@ -1910,7 +1909,7 @@ /* sense -- this is used to better detect and ignore serifs */ { AF_Segment segments = axis->segments; - AF_Segment segments_end = segments + axis->num_segments; + AF_Segment segments_end = FT_OFFSET( segments, axis->num_segments ); for ( segment = segments; segment < segments_end; segment++ ) @@ -2314,7 +2313,7 @@ */ { AF_Edge edges = axis->edges; - AF_Edge edge_limit = edges + axis->num_edges; + AF_Edge edge_limit = FT_OFFSET( edges, axis->num_edges ); AF_Edge edge; @@ -2945,7 +2944,7 @@ stem_edge->pos = base_edge->pos + fitted_width; - FT_TRACE5(( " LINK: edge %d (opos=%.2f) linked to %.2f," + FT_TRACE5(( " LINK: edge %ld (opos=%.2f) linked to %.2f," " dist was %.2f, now %.2f\n", stem_edge - hints->axis[dim].edges, stem_edge->opos / 64.0, stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 )); @@ -3069,12 +3068,12 @@ #ifdef FT_DEBUG_LEVEL_TRACE if ( !anchor ) - FT_TRACE5(( " BLUE_ANCHOR: edge %d (opos=%.2f) snapped to %.2f," - " was %.2f (anchor=edge %d)\n", + FT_TRACE5(( " BLUE_ANCHOR: edge %ld (opos=%.2f) snapped to %.2f," + " was %.2f (anchor=edge %ld)\n", edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0, edge1->pos / 64.0, edge - edges )); else - FT_TRACE5(( " BLUE: edge %d (opos=%.2f) snapped to %.2f," + FT_TRACE5(( " BLUE: edge %ld (opos=%.2f) snapped to %.2f," " was %.2f\n", edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0, edge1->pos / 64.0 )); @@ -3123,7 +3122,7 @@ /* this should not happen, but it's better to be safe */ if ( edge2->blue_edge ) { - FT_TRACE5(( " ASSERTION FAILED for edge %d\n", edge2 - edges )); + FT_TRACE5(( " ASSERTION FAILED for edge %ld\n", edge2 - edges )); af_latin_align_linked_edge( hints, dim, edge2, edge ); edge->flags |= AF_EDGE_DONE; @@ -3191,7 +3190,7 @@ anchor = edge; edge->flags |= AF_EDGE_DONE; - FT_TRACE5(( " ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)" + FT_TRACE5(( " ANCHOR: edge %ld (opos=%.2f) and %ld (opos=%.2f)" " snapped to %.2f and %.2f\n", edge - edges, edge->opos / 64.0, edge2 - edges, edge2->opos / 64.0, @@ -3220,7 +3219,7 @@ if ( edge2->flags & AF_EDGE_DONE ) { - FT_TRACE5(( " ADJUST: edge %d (pos=%.2f) moved to %.2f\n", + FT_TRACE5(( " ADJUST: edge %ld (pos=%.2f) moved to %.2f\n", edge - edges, edge->pos / 64.0, ( edge2->pos - cur_len ) / 64.0 )); @@ -3261,7 +3260,7 @@ edge->pos = cur_pos1 - cur_len / 2; edge2->pos = cur_pos1 + cur_len / 2; - FT_TRACE5(( " STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)" + FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)" " snapped to %.2f and %.2f\n", edge - edges, edge->opos / 64.0, edge2 - edges, edge2->opos / 64.0, @@ -3292,7 +3291,7 @@ edge->pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2; edge2->pos = edge->pos + cur_len; - FT_TRACE5(( " STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)" + FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)" " snapped to %.2f and %.2f\n", edge - edges, edge->opos / 64.0, edge2 - edges, edge2->opos / 64.0, @@ -3315,7 +3314,7 @@ if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 ) { #ifdef FT_DEBUG_LEVEL_TRACE - FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n", + FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n", edge - edges, edge->pos / 64.0, edge[-1].pos / 64.0 )); @@ -3417,7 +3416,7 @@ if ( delta < 64 + 16 ) { af_latin_align_serif_edge( hints, edge->serif, edge ); - FT_TRACE5(( " SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)" + FT_TRACE5(( " SERIF: edge %ld (opos=%.2f) serif to %ld (opos=%.2f)" " aligned to %.2f\n", edge - edges, edge->opos / 64.0, edge->serif - edges, edge->serif->opos / 64.0, @@ -3427,7 +3426,7 @@ { edge->pos = FT_PIX_ROUND( edge->opos ); anchor = edge; - FT_TRACE5(( " SERIF_ANCHOR: edge %d (opos=%.2f)" + FT_TRACE5(( " SERIF_ANCHOR: edge %ld (opos=%.2f)" " snapped to %.2f\n", edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); } @@ -3455,8 +3454,8 @@ after->pos - before->pos, after->opos - before->opos ); - FT_TRACE5(( " SERIF_LINK1: edge %d (opos=%.2f) snapped to %.2f" - " from %d (opos=%.2f)\n", + FT_TRACE5(( " SERIF_LINK1: edge %ld (opos=%.2f) snapped to %.2f" + " from %ld (opos=%.2f)\n", edge - edges, edge->opos / 64.0, edge->pos / 64.0, before - edges, before->opos / 64.0 )); @@ -3465,7 +3464,7 @@ { edge->pos = anchor->pos + ( ( edge->opos - anchor->opos + 16 ) & ~31 ); - FT_TRACE5(( " SERIF_LINK2: edge %d (opos=%.2f)" + FT_TRACE5(( " SERIF_LINK2: edge %ld (opos=%.2f)" " snapped to %.2f\n", edge - edges, edge->opos / 64.0, edge->pos / 64.0 )); } @@ -3485,7 +3484,7 @@ if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 ) { #ifdef FT_DEBUG_LEVEL_TRACE - FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n", + FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n", edge - edges, edge->pos / 64.0, edge[-1].pos / 64.0 )); @@ -3506,7 +3505,7 @@ if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 ) { #ifdef FT_DEBUG_LEVEL_TRACE - FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n", + FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n", edge - edges, edge->pos / 64.0, edge[1].pos / 64.0 )); diff --git a/src/3rdparty/freetype/src/autofit/aflatin.h b/src/3rdparty/freetype/src/autofit/aflatin.h index 40479538c2..62bc4c8d44 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 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/aflatin2.c b/src/3rdparty/freetype/src/autofit/aflatin2.c index c601ab8d9a..902f3982e0 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin2.c +++ b/src/3rdparty/freetype/src/autofit/aflatin2.c @@ -9,7 +9,7 @@ * * Auto-fitter hinting routines for latin writing system (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -21,7 +21,7 @@ */ -#include FT_ADVANCES_H +#include <freetype/ftadvanc.h> #ifdef FT_OPTION_AUTOFIT2 diff --git a/src/3rdparty/freetype/src/autofit/aflatin2.h b/src/3rdparty/freetype/src/autofit/aflatin2.h index 507cef3df2..c2aebc49ac 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin2.h +++ b/src/3rdparty/freetype/src/autofit/aflatin2.h @@ -10,7 +10,7 @@ * Auto-fitter hinting routines for latin writing system * (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 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 83743b7be1..c35d85c4cf 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -22,7 +22,7 @@ #include "aferrors.h" #include "afmodule.h" -#include FT_INTERNAL_CALC_H +#include <freetype/internal/ftcalc.h> /* Initialize glyph loader. */ diff --git a/src/3rdparty/freetype/src/autofit/afloader.h b/src/3rdparty/freetype/src/autofit/afloader.h index d1e0f3c093..97282371cd 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 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/afmodule.c b/src/3rdparty/freetype/src/autofit/afmodule.c index 3e46a3655a..e16494460e 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -53,10 +53,10 @@ void* _af_debug_hints = _af_debug_hints_rec; #endif -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_DRIVER_H -#include FT_SERVICE_PROPERTIES_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/ftdriver.h> +#include <freetype/internal/services/svprop.h> /************************************************************************** @@ -149,7 +149,7 @@ if ( !af_style_classes[ss] ) { FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'\n", - fallback_script, property_name )); + *fallback_script, property_name )); return FT_THROW( Invalid_Argument ); } @@ -550,8 +550,8 @@ NULL, /* reset_face */ NULL, /* get_global_hints */ NULL, /* done_global_hints */ - (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph ) /* load_glyph */ - + (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph /* load_glyph */ + ) FT_DEFINE_MODULE( autofit_module_class, diff --git a/src/3rdparty/freetype/src/autofit/afmodule.h b/src/3rdparty/freetype/src/autofit/afmodule.h index b410809aa8..e8fe4a93aa 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,9 +19,8 @@ #ifndef AFMODULE_H_ #define AFMODULE_H_ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_MODULE_H +#include <freetype/internal/ftobjs.h> +#include <freetype/ftmodapi.h> FT_BEGIN_HEADER @@ -47,6 +46,7 @@ FT_BEGIN_HEADER } AF_ModuleRec, *AF_Module; +FT_DECLARE_AUTOHINTER_INTERFACE( af_autofitter_interface ) FT_DECLARE_MODULE( autofit_module_class ) diff --git a/src/3rdparty/freetype/src/autofit/afpic.c b/src/3rdparty/freetype/src/autofit/afpic.c deleted file mode 100644 index d48d016a0e..0000000000 --- a/src/3rdparty/freetype/src/autofit/afpic.c +++ /dev/null @@ -1,152 +0,0 @@ -/***************************************************************************/ -/* */ -/* afpic.c */ -/* */ -/* The FreeType position independent code services for autofit module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include "afpic.h" -#include "afglobal.h" -#include "aferrors.h" - - -#ifdef FT_CONFIG_OPTION_PIC - - /* forward declaration of PIC init functions from afmodule.c */ - FT_Error - FT_Create_Class_af_services( FT_Library library, - FT_ServiceDescRec** output_class ); - - void - FT_Destroy_Class_af_services( FT_Library library, - FT_ServiceDescRec* clazz ); - - void - FT_Init_Class_af_service_properties( FT_Service_PropertiesRec* clazz ); - - void FT_Init_Class_af_autofitter_interface( - FT_Library library, - FT_AutoHinter_InterfaceRec* clazz ); - - - /* forward declaration of PIC init functions from writing system classes */ -#undef WRITING_SYSTEM -#define WRITING_SYSTEM( ws, WS ) /* empty */ - -#include "afwrtsys.h" - - - void - autofit_module_class_pic_free( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - - - if ( pic_container->autofit ) - { - AFModulePIC* container = (AFModulePIC*)pic_container->autofit; - - - if ( container->af_services ) - FT_Destroy_Class_af_services( library, - container->af_services ); - container->af_services = NULL; - - FT_FREE( container ); - pic_container->autofit = NULL; - } - } - - - FT_Error - autofit_module_class_pic_init( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_UInt ss; - FT_Error error = FT_Err_Ok; - AFModulePIC* container = NULL; - FT_Memory memory = library->memory; - - - /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) - return error; - FT_MEM_SET( container, 0, sizeof ( *container ) ); - pic_container->autofit = container; - - /* initialize pointer table - */ - /* this is how the module usually expects this data */ - error = FT_Create_Class_af_services( library, - &container->af_services ); - if ( error ) - goto Exit; - - FT_Init_Class_af_service_properties( &container->af_service_properties ); - - for ( ss = 0; ss < AF_WRITING_SYSTEM_MAX; ss++ ) - container->af_writing_system_classes[ss] = - &container->af_writing_system_classes_rec[ss]; - container->af_writing_system_classes[AF_WRITING_SYSTEM_MAX] = NULL; - - for ( ss = 0; ss < AF_SCRIPT_MAX; ss++ ) - container->af_script_classes[ss] = - &container->af_script_classes_rec[ss]; - container->af_script_classes[AF_SCRIPT_MAX] = NULL; - - for ( ss = 0; ss < AF_STYLE_MAX; ss++ ) - container->af_style_classes[ss] = - &container->af_style_classes_rec[ss]; - container->af_style_classes[AF_STYLE_MAX] = NULL; - -#undef WRITING_SYSTEM -#define WRITING_SYSTEM( ws, WS ) \ - FT_Init_Class_af_ ## ws ## _writing_system_class( \ - &container->af_writing_system_classes_rec[ss++] ); - - ss = 0; -#include "afwrtsys.h" - -#undef SCRIPT -#define SCRIPT( s, S, d, h, H, sss ) \ - FT_Init_Class_af_ ## s ## _script_class( \ - &container->af_script_classes_rec[ss++] ); - - ss = 0; -#include "afscript.h" - -#undef STYLE -#define STYLE( s, S, d, ws, sc, bss, c ) \ - FT_Init_Class_af_ ## s ## _style_class( \ - &container->af_style_classes_rec[ss++] ); - - ss = 0; -#include "afstyles.h" - - FT_Init_Class_af_autofitter_interface( - library, &container->af_autofitter_interface ); - - Exit: - if ( error ) - autofit_module_class_pic_free( library ); - return error; - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/autofit/afpic.h b/src/3rdparty/freetype/src/autofit/afpic.h deleted file mode 100644 index 0c73456785..0000000000 --- a/src/3rdparty/freetype/src/autofit/afpic.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************/ -/* */ -/* afpic.h */ -/* */ -/* The FreeType position independent code services for autofit module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef AFPIC_H_ -#define AFPIC_H_ - - -#include FT_INTERNAL_PIC_H - - -#ifndef FT_CONFIG_OPTION_PIC - -#define AF_SERVICES_GET af_services -#define AF_SERVICE_PROPERTIES_GET af_service_properties - -#define AF_WRITING_SYSTEM_CLASSES_GET af_writing_system_classes -#define AF_SCRIPT_CLASSES_GET af_script_classes -#define AF_STYLE_CLASSES_GET af_style_classes -#define AF_INTERFACE_GET af_autofitter_interface - -#else /* FT_CONFIG_OPTION_PIC */ - - /* some include files required for members of AFModulePIC */ -#include FT_SERVICE_PROPERTIES_H - -#include "aftypes.h" - - -FT_BEGIN_HEADER - - typedef struct AFModulePIC_ - { - FT_ServiceDescRec* af_services; - FT_Service_PropertiesRec af_service_properties; - - AF_WritingSystemClass af_writing_system_classes - [AF_WRITING_SYSTEM_MAX + 1]; - AF_WritingSystemClassRec af_writing_system_classes_rec - [AF_WRITING_SYSTEM_MAX]; - - AF_ScriptClass af_script_classes - [AF_SCRIPT_MAX + 1]; - AF_ScriptClassRec af_script_classes_rec - [AF_SCRIPT_MAX]; - - AF_StyleClass af_style_classes - [AF_STYLE_MAX + 1]; - AF_StyleClassRec af_style_classes_rec - [AF_STYLE_MAX]; - - FT_AutoHinter_InterfaceRec af_autofitter_interface; - - } AFModulePIC; - - -#define GET_PIC( lib ) \ - ( (AFModulePIC*)( (lib)->pic_container.autofit ) ) - -#define AF_SERVICES_GET \ - ( GET_PIC( library )->af_services ) -#define AF_SERVICE_PROPERTIES_GET \ - ( GET_PIC( library )->af_service_properties ) - -#define AF_WRITING_SYSTEM_CLASSES_GET \ - ( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_writing_system_classes ) -#define AF_SCRIPT_CLASSES_GET \ - ( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_script_classes ) -#define AF_STYLE_CLASSES_GET \ - ( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_style_classes ) -#define AF_INTERFACE_GET \ - ( GET_PIC( library )->af_autofitter_interface ) - - - /* see afpic.c for the implementation */ - void - autofit_module_class_pic_free( FT_Library library ); - - FT_Error - autofit_module_class_pic_init( FT_Library library ); - -FT_END_HEADER - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - -#endif /* AFPIC_H_ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/autofit/afranges.c b/src/3rdparty/freetype/src/autofit/afranges.c index 45c8bbfc95..c8ebf5e784 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 (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -664,6 +664,18 @@ }; + const AF_Script_UniRangeRec af_medf_uniranges[] = + { + AF_UNIRANGE_REC( 0x16E40, 0x16E9F ), /* Medefaidrin */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_medf_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_mong_uniranges[] = { AF_UNIRANGE_REC( 0x1800, 0x18AF ), /* Mongolian */ @@ -778,6 +790,18 @@ }; + const AF_Script_UniRangeRec af_rohg_uniranges[] = + { + AF_UNIRANGE_REC( 0x10D00, 0x10D3F ), /* Hanifi Rohingya */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_rohg_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_saur_uniranges[] = { AF_UNIRANGE_REC( 0xA880, 0xA8DF ), /* Saurashtra */ diff --git a/src/3rdparty/freetype/src/autofit/afranges.h b/src/3rdparty/freetype/src/autofit/afranges.h index d5917aefed..c2ffda4b0f 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 (C) 2013-2019 by + * Copyright (C) 2013-2020 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/afscript.h b/src/3rdparty/freetype/src/autofit/afscript.h index 2da8c70183..4cf9cc19f5 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 (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -243,6 +243,12 @@ HINTING_BOTTOM_TO_TOP, "\xE0\xB4\xA0 \xE0\xB4\xB1" ) /* ഠ റ */ + SCRIPT( medf, MEDF, + "Medefaidrin", + HB_SCRIPT_MEDEFAIDRIN, + HINTING_BOTTOM_TO_TOP, + "\xF0\x96\xB9\xA1 \xF0\x96\xB9\x9B \xF0\x96\xB9\xAF" ) /* 𖹡 𖹛 𖹯 */ + SCRIPT( mong, MONG, "Mongolian", HB_SCRIPT_MONGOLIAN, @@ -291,6 +297,12 @@ HINTING_BOTTOM_TO_TOP, "\xF0\x90\x92\x86 \xF0\x90\x92\xA0" ) /* 𐒆 𐒠 */ + SCRIPT( rohg, ROHG, + "Hanifi Rohingya", + HB_SCRIPT_HANIFI_ROHINGYA, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\xB4\xB0" ) /* 𐴰 */ + SCRIPT( saur, SAUR, "Saurashtra", HB_SCRIPT_SAURASHTRA, diff --git a/src/3rdparty/freetype/src/autofit/afshaper.c b/src/3rdparty/freetype/src/autofit/afshaper.c index a5191c6915..bbf7b6b1f9 100644 --- a/src/3rdparty/freetype/src/autofit/afshaper.c +++ b/src/3rdparty/freetype/src/autofit/afshaper.c @@ -4,7 +4,7 @@ * * HarfBuzz interface for accessing OpenType features (body). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,9 +16,8 @@ */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_ADVANCES_H +#include <freetype/freetype.h> +#include <freetype/ftadvanc.h> #include "afglobal.h" #include "aftypes.h" #include "afshaper.h" diff --git a/src/3rdparty/freetype/src/autofit/afshaper.h b/src/3rdparty/freetype/src/autofit/afshaper.h index 06a1e06616..138c27b32b 100644 --- a/src/3rdparty/freetype/src/autofit/afshaper.h +++ b/src/3rdparty/freetype/src/autofit/afshaper.h @@ -4,7 +4,7 @@ * * HarfBuzz interface for accessing OpenType features (specification). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define AFSHAPER_H_ -#include <ft2build.h> -#include FT_FREETYPE_H +#include <freetype/freetype.h> #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ diff --git a/src/3rdparty/freetype/src/autofit/afstyles.h b/src/3rdparty/freetype/src/autofit/afstyles.h index 8d1d70812f..9113ec451e 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 (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -322,6 +322,13 @@ AF_BLUE_STRINGSET_MLYM, AF_COVERAGE_DEFAULT ) + STYLE( medf_dflt, MEDF_DFLT, + "Medefaidrin default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_MEDF, + AF_BLUE_STRINGSET_MEDF, + AF_COVERAGE_DEFAULT ) + STYLE( mong_dflt, MONG_DFLT, "Mongolian default style", AF_WRITING_SYSTEM_LATIN, @@ -378,6 +385,13 @@ AF_BLUE_STRINGSET_OSMA, AF_COVERAGE_DEFAULT ) + STYLE( rohg_dflt, ROHG_DFLT, + "Hanifi Rohingya default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_ROHG, + AF_BLUE_STRINGSET_ROHG, + AF_COVERAGE_DEFAULT ) + STYLE( saur_dflt, SAUR_DFLT, "Saurashtra default style", AF_WRITING_SYSTEM_LATIN, diff --git a/src/3rdparty/freetype/src/autofit/aftypes.h b/src/3rdparty/freetype/src/autofit/aftypes.h index 579003d27d..5f040c6b4b 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -32,12 +32,11 @@ #ifndef AFTYPES_H_ #define AFTYPES_H_ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_OUTLINE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/freetype.h> +#include <freetype/ftoutln.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> #include "afblue.h" diff --git a/src/3rdparty/freetype/src/autofit/afwarp.c b/src/3rdparty/freetype/src/autofit/afwarp.c index 84e9753ad9..808280df5d 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 (C) 2006-2019 by + * Copyright (C) 2006-2020 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/afwarp.h b/src/3rdparty/freetype/src/autofit/afwarp.h index 9a2c9a42c1..cdea23e7de 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 (C) 2006-2019 by + * Copyright (C) 2006-2020 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/afwrtsys.h b/src/3rdparty/freetype/src/autofit/afwrtsys.h index 5611cf441a..3990633d2d 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 (C) 2013-2019 by + * Copyright (C) 2013-2020 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 facfec1744..ef5e7f1452 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 (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "afangles.c" #include "afblue.c" diff --git a/src/3rdparty/freetype/src/autofit/hbshim.c b/src/3rdparty/freetype/src/autofit/hbshim.c deleted file mode 100644 index 7a45059c39..0000000000 --- a/src/3rdparty/freetype/src/autofit/hbshim.c +++ /dev/null @@ -1,546 +0,0 @@ -/***************************************************************************/ -/* */ -/* hbshim.c */ -/* */ -/* HarfBuzz interface for accessing OpenType features (body). */ -/* */ -/* Copyright 2013-2015 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include "afglobal.h" -#include "aftypes.h" -#include "hbshim.h" - -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_afharfbuzz - - - /* - * We use `sets' (in the HarfBuzz sense, which comes quite near to the - * usual mathematical meaning) to manage both lookups and glyph indices. - * - * 1. For each coverage, collect lookup IDs in a set. Note that an - * auto-hinter `coverage' is represented by one `feature', and a - * feature consists of an arbitrary number of (font specific) `lookup's - * that actually do the mapping job. Please check the OpenType - * specification for more details on features and lookups. - * - * 2. Create glyph ID sets from the corresponding lookup sets. - * - * 3. The glyph set corresponding to AF_COVERAGE_DEFAULT is computed - * with all lookups specific to the OpenType script activated. It - * relies on the order of AF_DEFINE_STYLE_CLASS entries so that - * special coverages (like `oldstyle figures') don't get overwritten. - * - */ - - - /* load coverage tags */ -#undef COVERAGE -#define COVERAGE( name, NAME, description, \ - tag1, tag2, tag3, tag4 ) \ - static const hb_tag_t name ## _coverage[] = \ - { \ - HB_TAG( tag1, tag2, tag3, tag4 ), \ - HB_TAG_NONE \ - }; - - -#include "afcover.h" - - - /* define mapping between coverage tags and AF_Coverage */ -#undef COVERAGE -#define COVERAGE( name, NAME, description, \ - tag1, tag2, tag3, tag4 ) \ - name ## _coverage, - - - static const hb_tag_t* coverages[] = - { -#include "afcover.h" - - NULL /* AF_COVERAGE_DEFAULT */ - }; - - - /* load HarfBuzz script tags */ -#undef SCRIPT -#define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) h, - - - static const hb_script_t scripts[] = - { -#include "afscript.h" - }; - - - FT_Error - af_get_coverage( AF_FaceGlobals globals, - AF_StyleClass style_class, - FT_UShort* gstyles ) - { - hb_face_t* face; - - hb_set_t* gsub_lookups; /* GSUB lookups for a given script */ - hb_set_t* gsub_glyphs; /* glyphs covered by GSUB lookups */ - hb_set_t* gpos_lookups; /* GPOS lookups for a given script */ - hb_set_t* gpos_glyphs; /* glyphs covered by GPOS lookups */ - - hb_script_t script; - const hb_tag_t* coverage_tags; - hb_tag_t script_tags[] = { HB_TAG_NONE, - HB_TAG_NONE, - HB_TAG_NONE, - HB_TAG_NONE }; - - hb_codepoint_t idx; -#ifdef FT_DEBUG_LEVEL_TRACE - int count; -#endif - - - if ( !globals || !style_class || !gstyles ) - return FT_THROW( Invalid_Argument ); - - face = hb_font_get_face( globals->hb_font ); - - gsub_lookups = hb_set_create(); - gsub_glyphs = hb_set_create(); - gpos_lookups = hb_set_create(); - gpos_glyphs = hb_set_create(); - - coverage_tags = coverages[style_class->coverage]; - script = scripts[style_class->script]; - - /* Convert a HarfBuzz script tag into the corresponding OpenType */ - /* tag or tags -- some Indic scripts like Devanagari have an old */ - /* and a new set of features. */ - hb_ot_tags_from_script( script, - &script_tags[0], - &script_tags[1] ); - - /* `hb_ot_tags_from_script' usually returns HB_OT_TAG_DEFAULT_SCRIPT */ - /* as the second tag. We change that to HB_TAG_NONE except for the */ - /* default script. */ - if ( style_class->script == globals->module->default_script && - style_class->coverage == AF_COVERAGE_DEFAULT ) - { - if ( script_tags[0] == HB_TAG_NONE ) - script_tags[0] = HB_OT_TAG_DEFAULT_SCRIPT; - else - { - if ( script_tags[1] == HB_TAG_NONE ) - script_tags[1] = HB_OT_TAG_DEFAULT_SCRIPT; - else if ( script_tags[1] != HB_OT_TAG_DEFAULT_SCRIPT ) - script_tags[2] = HB_OT_TAG_DEFAULT_SCRIPT; - } - } - else - { - if ( script_tags[1] == HB_OT_TAG_DEFAULT_SCRIPT ) - script_tags[1] = HB_TAG_NONE; - } - - hb_ot_layout_collect_lookups( face, - HB_OT_TAG_GSUB, - script_tags, - NULL, - coverage_tags, - gsub_lookups ); - - if ( hb_set_is_empty( gsub_lookups ) ) - goto Exit; /* nothing to do */ - - hb_ot_layout_collect_lookups( face, - HB_OT_TAG_GPOS, - script_tags, - NULL, - coverage_tags, - gpos_lookups ); - - FT_TRACE4(( "GSUB lookups (style `%s'):\n" - " ", - af_style_names[style_class->style] )); - -#ifdef FT_DEBUG_LEVEL_TRACE - count = 0; -#endif - - for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); ) - { -#ifdef FT_DEBUG_LEVEL_TRACE - FT_TRACE4(( " %d", idx )); - count++; -#endif - - /* get output coverage of GSUB feature */ - hb_ot_layout_lookup_collect_glyphs( face, - HB_OT_TAG_GSUB, - idx, - NULL, - NULL, - NULL, - gsub_glyphs ); - } - -#ifdef FT_DEBUG_LEVEL_TRACE - if ( !count ) - FT_TRACE4(( " (none)" )); - FT_TRACE4(( "\n\n" )); -#endif - - FT_TRACE4(( "GPOS lookups (style `%s'):\n" - " ", - af_style_names[style_class->style] )); - -#ifdef FT_DEBUG_LEVEL_TRACE - count = 0; -#endif - - for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); ) - { -#ifdef FT_DEBUG_LEVEL_TRACE - FT_TRACE4(( " %d", idx )); - count++; -#endif - - /* get input coverage of GPOS feature */ - hb_ot_layout_lookup_collect_glyphs( face, - HB_OT_TAG_GPOS, - idx, - NULL, - gpos_glyphs, - NULL, - NULL ); - } - -#ifdef FT_DEBUG_LEVEL_TRACE - if ( !count ) - FT_TRACE4(( " (none)" )); - FT_TRACE4(( "\n\n" )); -#endif - - /* - * We now check whether we can construct blue zones, using glyphs - * covered by the feature only. In case there is not a single zone - * (this is, not a single character is covered), we skip this coverage. - * - */ - if ( style_class->coverage != AF_COVERAGE_DEFAULT ) - { - AF_Blue_Stringset bss = style_class->blue_stringset; - const AF_Blue_StringRec* bs = &af_blue_stringsets[bss]; - - FT_Bool found = 0; - - - for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ ) - { - const char* p = &af_blue_strings[bs->string]; - - - while ( *p ) - { - hb_codepoint_t ch; - - - GET_UTF8_CHAR( ch, p ); - - for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, - &idx ); ) - { - hb_codepoint_t gidx = FT_Get_Char_Index( globals->face, ch ); - - - if ( hb_ot_layout_lookup_would_substitute( face, idx, - &gidx, 1, 1 ) ) - { - found = 1; - break; - } - } - } - } - - if ( !found ) - { - FT_TRACE4(( " no blue characters found; style skipped\n" )); - goto Exit; - } - } - - /* - * Various OpenType features might use the same glyphs at different - * vertical positions; for example, superscript and subscript glyphs - * could be the same. However, the auto-hinter is completely - * agnostic of OpenType features after the feature analysis has been - * completed: The engine then simply receives a glyph index and returns a - * hinted and usually rendered glyph. - * - * Consider the superscript feature of font `pala.ttf': Some of the - * glyphs are `real', this is, they have a zero vertical offset, but - * most of them are small caps glyphs shifted up to the superscript - * position (this is, the `sups' feature is present in both the GSUB and - * GPOS tables). The code for blue zones computation actually uses a - * feature's y offset so that the `real' glyphs get correct hints. But - * later on it is impossible to decide whether a glyph index belongs to, - * say, the small caps or superscript feature. - * - * For this reason, we don't assign a style to a glyph if the current - * feature covers the glyph in both the GSUB and the GPOS tables. This - * is quite a broad condition, assuming that - * - * (a) glyphs that get used in multiple features are present in a - * feature without vertical shift, - * - * and - * - * (b) a feature's GPOS data really moves the glyph vertically. - * - * Not fulfilling condition (a) makes a font larger; it would also - * reduce the number of glyphs that could be addressed directly without - * using OpenType features, so this assumption is rather strong. - * - * Condition (b) is much weaker, and there might be glyphs which get - * missed. However, the OpenType features we are going to handle are - * primarily located in GSUB, and HarfBuzz doesn't provide an API to - * directly get the necessary information from the GPOS table. A - * possible solution might be to directly parse the GPOS table to find - * out whether a glyph gets shifted vertically, but this is something I - * would like to avoid if not really necessary. - * - * Note that we don't follow this logic for the default coverage. - * Complex scripts like Devanagari have mandatory GPOS features to - * position many glyph elements, using mark-to-base or mark-to-ligature - * tables; the number of glyphs missed due to condition (b) would be far - * too large. - * - */ - if ( style_class->coverage != AF_COVERAGE_DEFAULT ) - hb_set_subtract( gsub_glyphs, gpos_glyphs ); - -#ifdef FT_DEBUG_LEVEL_TRACE - FT_TRACE4(( " glyphs without GPOS data (`*' means already assigned)" )); - count = 0; -#endif - - for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_glyphs, &idx ); ) - { -#ifdef FT_DEBUG_LEVEL_TRACE - if ( !( count % 10 ) ) - FT_TRACE4(( "\n" - " " )); - - FT_TRACE4(( " %d", idx )); - count++; -#endif - - /* glyph indices returned by `hb_ot_layout_lookup_collect_glyphs' */ - /* can be arbitrary: some fonts use fake indices for processing */ - /* internal to GSUB or GPOS, which is fully valid */ - if ( idx >= (hb_codepoint_t)globals->glyph_count ) - continue; - - if ( gstyles[idx] == AF_STYLE_UNASSIGNED ) - gstyles[idx] = (FT_UShort)style_class->style; -#ifdef FT_DEBUG_LEVEL_TRACE - else - FT_TRACE4(( "*" )); -#endif - } - -#ifdef FT_DEBUG_LEVEL_TRACE - if ( !count ) - FT_TRACE4(( "\n" - " (none)" )); - FT_TRACE4(( "\n\n" )); -#endif - - Exit: - hb_set_destroy( gsub_lookups ); - hb_set_destroy( gsub_glyphs ); - hb_set_destroy( gpos_lookups ); - hb_set_destroy( gpos_glyphs ); - - return FT_Err_Ok; - } - - - /* construct HarfBuzz features */ -#undef COVERAGE -#define COVERAGE( name, NAME, description, \ - tag1, tag2, tag3, tag4 ) \ - static const hb_feature_t name ## _feature[] = \ - { \ - { \ - HB_TAG( tag1, tag2, tag3, tag4 ), \ - 1, 0, (unsigned int)-1 \ - } \ - }; - - -#include "afcover.h" - - - /* define mapping between HarfBuzz features and AF_Coverage */ -#undef COVERAGE -#define COVERAGE( name, NAME, description, \ - tag1, tag2, tag3, tag4 ) \ - name ## _feature, - - - static const hb_feature_t* features[] = - { -#include "afcover.h" - - NULL /* AF_COVERAGE_DEFAULT */ - }; - - - FT_Error - af_get_char_index( AF_StyleMetrics metrics, - FT_ULong charcode, - FT_ULong *codepoint, - FT_Long *y_offset ) - { - AF_StyleClass style_class; - - const hb_feature_t* feature; - - FT_ULong in_idx, out_idx; - - - if ( !metrics ) - return FT_THROW( Invalid_Argument ); - - in_idx = FT_Get_Char_Index( metrics->globals->face, charcode ); - - style_class = metrics->style_class; - - feature = features[style_class->coverage]; - - if ( feature ) - { - 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(); - - uint32_t c = (uint32_t)charcode; - - hb_glyph_info_t* ginfo; - hb_glyph_position_t* gpos; - unsigned int gcount; - - - /* we shape at a size of units per EM; this means font units */ - hb_font_set_scale( font, upem, upem ); - - /* XXX: is this sufficient for a single character of any script? */ - hb_buffer_set_direction( buf, HB_DIRECTION_LTR ); - hb_buffer_set_script( buf, scripts[style_class->script] ); - - /* we add one character to `buf' ... */ - hb_buffer_add_utf32( buf, &c, 1, 0, 1 ); - - /* ... and apply one feature */ - hb_shape( font, buf, feature, 1 ); - - ginfo = hb_buffer_get_glyph_infos( buf, &gcount ); - gpos = hb_buffer_get_glyph_positions( buf, &gcount ); - - out_idx = ginfo[0].codepoint; - - /* getting the same index indicates no substitution, */ - /* which means that the glyph isn't available in the feature */ - if ( in_idx == out_idx ) - { - *codepoint = 0; - *y_offset = 0; - } - else - { - *codepoint = out_idx; - *y_offset = gpos[0].y_offset; - } - - hb_buffer_destroy( buf ); - -#ifdef FT_DEBUG_LEVEL_TRACE - if ( gcount > 1 ) - FT_TRACE1(( "af_get_char_index:" - " input character mapped to multiple glyphs\n" )); -#endif - } - else - { - *codepoint = in_idx; - *y_offset = 0; - } - - return FT_Err_Ok; - } - - -#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ - - - FT_Error - af_get_coverage( AF_FaceGlobals globals, - AF_StyleClass style_class, - FT_UShort* gstyles ) - { - FT_UNUSED( globals ); - FT_UNUSED( style_class ); - FT_UNUSED( gstyles ); - - return FT_Err_Ok; - } - - - FT_Error - af_get_char_index( AF_StyleMetrics metrics, - FT_ULong charcode, - FT_ULong *codepoint, - FT_Long *y_offset ) - { - FT_Face face; - - - if ( !metrics ) - return FT_THROW( Invalid_Argument ); - - face = metrics->globals->face; - - *codepoint = FT_Get_Char_Index( face, charcode ); - *y_offset = 0; - - return FT_Err_Ok; - } - - -#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/autofit/hbshim.h b/src/3rdparty/freetype/src/autofit/hbshim.h deleted file mode 100644 index 3824941ca2..0000000000 --- a/src/3rdparty/freetype/src/autofit/hbshim.h +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************/ -/* */ -/* hbshim.h */ -/* */ -/* HarfBuzz interface for accessing OpenType features (specification). */ -/* */ -/* Copyright 2013-2015 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __HBSHIM_H__ -#define __HBSHIM_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H - - -#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ - -#include <hb.h> -#include <hb-ot.h> -#include <hb-ft.h> - -#endif - - -FT_BEGIN_HEADER - - FT_Error - af_get_coverage( AF_FaceGlobals globals, - AF_StyleClass style_class, - FT_UShort* gstyles ); - - FT_Error - af_get_char_index( AF_StyleMetrics metrics, - FT_ULong charcode, - FT_ULong *codepoint, - FT_Long *y_offset ); - - /* */ - -FT_END_HEADER - -#endif /* __HBSHIM_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/autofit/module.mk b/src/3rdparty/freetype/src/autofit/module.mk index cf77b169f7..c32781f478 100644 --- a/src/3rdparty/freetype/src/autofit/module.mk +++ b/src/3rdparty/freetype/src/autofit/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2019 by +# Copyright (C) 2003-2020 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 c59da33a55..553ddce6b7 100644 --- a/src/3rdparty/freetype/src/autofit/rules.mk +++ b/src/3rdparty/freetype/src/autofit/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2019 by +# Copyright (C) 2003-2020 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/base/Jamfile b/src/3rdparty/freetype/src/base/Jamfile deleted file mode 100644 index 8e1ec42756..0000000000 --- a/src/3rdparty/freetype/src/base/Jamfile +++ /dev/null @@ -1,90 +0,0 @@ -# FreeType 2 src/base Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) base ; - - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = basepic - ftadvanc - ftcalc - ftcolor - ftdbgmem - fterrors - ftfntfmt - ftgloadr - fthash - ftlcdfil - ftobjs - ftoutln - ftpic - ftpsprop - ftrfork - ftsnames - ftstream - fttrigon - ftutil - ; - } - else - { - _sources = ftbase ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# Add the optional/replaceable files. -# -{ - local _sources = ftbbox - ftbdf - ftbitmap - ftcid - ftdebug - ftfstype - ftgasp - ftglyph - ftgxval - ftinit - ftmm - ftotval - ftpatent - ftpfr - ftstroke - ftsynth - ftsystem - fttype1 - ftwinfnt - ; - - Library $(FT2_LIB) : $(_sources).c ; -} - -# Add Macintosh-specific file to the library when necessary. -# -if $(MAC) -{ - Library $(FT2_LIB) : ftmac.c ; -} -else if $(OS) = MACOSX -{ - if $(FT2_MULTI) - { - Library $(FT2_LIB) : ftmac.c ; - } -} - -# end of src/base Jamfile diff --git a/src/3rdparty/freetype/src/base/basepic.c b/src/3rdparty/freetype/src/base/basepic.c deleted file mode 100644 index bc80406441..0000000000 --- a/src/3rdparty/freetype/src/base/basepic.c +++ /dev/null @@ -1,108 +0,0 @@ -/***************************************************************************/ -/* */ -/* basepic.c */ -/* */ -/* The FreeType position independent code services for base. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include "basepic.h" - - -#ifdef FT_CONFIG_OPTION_PIC - - /* forward declaration of PIC init functions from ftglyph.c */ - void - FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz ); - - void - FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz ); - -#ifdef FT_CONFIG_OPTION_MAC_FONTS - /* forward declaration of PIC init function from ftrfork.c */ - /* (not modularized) */ - void - FT_Init_Table_ft_raccess_guess_table( ft_raccess_guess_rec* record ); -#endif - - /* forward declaration of PIC init functions from ftinit.c */ - FT_Error - ft_create_default_module_classes( FT_Library library ); - - void - ft_destroy_default_module_classes( FT_Library library ); - - - void - ft_base_pic_free( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - - - if ( pic_container->base ) - { - /* destroy default module classes */ - /* (in case FT_Add_Default_Modules was used) */ - ft_destroy_default_module_classes( library ); - - FT_FREE( pic_container->base ); - pic_container->base = NULL; - } - } - - - FT_Error - ft_base_pic_init( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - BasePIC* container = NULL; - FT_Memory memory = library->memory; - - - /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC( container, sizeof ( *container ) ) ) - return error; - FT_MEM_SET( container, 0, sizeof ( *container ) ); - pic_container->base = container; - - /* initialize default modules list and pointers */ - error = ft_create_default_module_classes( library ); - if ( error ) - goto Exit; - - /* initialize pointer table - */ - /* this is how the module usually expects this data */ - FT_Init_Class_ft_outline_glyph_class( - &container->ft_outline_glyph_class ); - FT_Init_Class_ft_bitmap_glyph_class( - &container->ft_bitmap_glyph_class ); -#ifdef FT_CONFIG_OPTION_MAC_FONTS - FT_Init_Table_ft_raccess_guess_table( - (ft_raccess_guess_rec*)&container->ft_raccess_guess_table ); -#endif - - Exit: - if ( error ) - ft_base_pic_free( library ); - return error; - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/base/basepic.h b/src/3rdparty/freetype/src/base/basepic.h deleted file mode 100644 index 492d1ede56..0000000000 --- a/src/3rdparty/freetype/src/base/basepic.h +++ /dev/null @@ -1,91 +0,0 @@ -/***************************************************************************/ -/* */ -/* basepic.h */ -/* */ -/* The FreeType position independent code services for base. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef BASEPIC_H_ -#define BASEPIC_H_ - - -#include FT_INTERNAL_PIC_H - - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class -#define FT_BITMAP_GLYPH_CLASS_GET &ft_bitmap_glyph_class -#define FT_DEFAULT_MODULES_GET ft_default_modules - -#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#define FT_RACCESS_GUESS_TABLE_GET ft_raccess_guess_table -#endif - -#else /* FT_CONFIG_OPTION_PIC */ - -#include FT_GLYPH_H - -#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#include FT_INTERNAL_RFORK_H -#endif - - -FT_BEGIN_HEADER - - typedef struct BasePIC_ - { - FT_Module_Class** default_module_classes; - FT_Glyph_Class ft_outline_glyph_class; - FT_Glyph_Class ft_bitmap_glyph_class; - -#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK - ft_raccess_guess_rec ft_raccess_guess_table[FT_RACCESS_N_RULES]; -#endif - - } BasePIC; - - -#define GET_PIC( lib ) ( (BasePIC*)( (lib)->pic_container.base ) ) - -#define FT_OUTLINE_GLYPH_CLASS_GET \ - ( &GET_PIC( library )->ft_outline_glyph_class ) -#define FT_BITMAP_GLYPH_CLASS_GET \ - ( &GET_PIC( library )->ft_bitmap_glyph_class ) -#define FT_DEFAULT_MODULES_GET \ - ( GET_PIC( library )->default_module_classes ) - -#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#define FT_RACCESS_GUESS_TABLE_GET \ - ( GET_PIC( library )->ft_raccess_guess_table ) -#endif - - - /* see basepic.c for the implementation */ - void - ft_base_pic_free( FT_Library library ); - - FT_Error - ft_base_pic_init( FT_Library library ); - -FT_END_HEADER - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - -#endif /* BASEPIC_H_ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/base/ftadvanc.c b/src/3rdparty/freetype/src/base/ftadvanc.c index 0dfba57036..c689e6a15b 100644 --- a/src/3rdparty/freetype/src/base/ftadvanc.c +++ b/src/3rdparty/freetype/src/base/ftadvanc.c @@ -4,7 +4,7 @@ * * Quick computation of advance widths (body). * - * Copyright (C) 2008-2019 by + * Copyright (C) 2008-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_ADVANCES_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/ftadvanc.h> +#include <freetype/internal/ftobjs.h> static FT_Error diff --git a/src/3rdparty/freetype/src/base/ftapi.c b/src/3rdparty/freetype/src/base/ftapi.c deleted file mode 100644 index 32d6e95d19..0000000000 --- a/src/3rdparty/freetype/src/base/ftapi.c +++ /dev/null @@ -1,121 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftapi.c */ -/* */ -/* The FreeType compatibility functions (body). */ -/* */ -/* Copyright 2002-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_LIST_H -#include FT_OUTLINE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TABLES_H -#include FT_OUTLINE_H - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** C O M P A T I B I L I T Y ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - /* backward compatibility API */ - - FT_BASE_DEF( void ) - FT_New_Memory_Stream( FT_Library library, - FT_Byte* base, - FT_ULong size, - FT_Stream stream ) - { - FT_UNUSED( library ); - - FT_Stream_OpenMemory( stream, base, size ); - } - - - FT_BASE_DEF( FT_Error ) - FT_Seek_Stream( FT_Stream stream, - FT_ULong pos ) - { - return FT_Stream_Seek( stream, pos ); - } - - - FT_BASE_DEF( FT_Error ) - FT_Skip_Stream( FT_Stream stream, - FT_Long distance ) - { - return FT_Stream_Skip( stream, distance ); - } - - - FT_BASE_DEF( FT_Error ) - FT_Read_Stream( FT_Stream stream, - FT_Byte* buffer, - FT_ULong count ) - { - return FT_Stream_Read( stream, buffer, count ); - } - - - FT_BASE_DEF( FT_Error ) - FT_Read_Stream_At( FT_Stream stream, - FT_ULong pos, - FT_Byte* buffer, - FT_ULong count ) - { - return FT_Stream_ReadAt( stream, pos, buffer, count ); - } - - - FT_BASE_DEF( FT_Error ) - FT_Extract_Frame( FT_Stream stream, - FT_ULong count, - FT_Byte** pbytes ) - { - return FT_Stream_ExtractFrame( stream, count, pbytes ); - } - - - FT_BASE_DEF( void ) - FT_Release_Frame( FT_Stream stream, - FT_Byte** pbytes ) - { - FT_Stream_ReleaseFrame( stream, pbytes ); - } - - FT_BASE_DEF( FT_Error ) - FT_Access_Frame( FT_Stream stream, - FT_ULong count ) - { - return FT_Stream_EnterFrame( stream, count ); - } - - - FT_BASE_DEF( void ) - FT_Forget_Frame( FT_Stream stream ) - { - FT_Stream_ExitFrame( stream ); - } - - -/* END */ diff --git a/src/3rdparty/freetype/src/base/ftbase.c b/src/3rdparty/freetype/src/base/ftbase.c index fb8cbfcc27..bfbaffd64e 100644 --- a/src/3rdparty/freetype/src/base/ftbase.c +++ b/src/3rdparty/freetype/src/base/ftbase.c @@ -4,7 +4,7 @@ * * Single object library component (body only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,7 +16,6 @@ */ -#include <ft2build.h> #define FT_MAKE_OPTION_SINGLE_OBJECT #include "ftadvanc.c" diff --git a/src/3rdparty/freetype/src/base/ftbase.h b/src/3rdparty/freetype/src/base/ftbase.h index 35b1c47fd9..25afa9bc31 100644 --- a/src/3rdparty/freetype/src/base/ftbase.h +++ b/src/3rdparty/freetype/src/base/ftbase.h @@ -4,7 +4,7 @@ * * Private functions used in the `base' module (specification). * - * Copyright (C) 2008-2019 by + * Copyright (C) 2008-2020 by * David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. * * This file is part of the FreeType project, and may only be used, @@ -20,13 +20,16 @@ #define FTBASE_H_ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/ftobjs.h> FT_BEGIN_HEADER + FT_DECLARE_GLYPH( ft_bitmap_glyph_class ) + FT_DECLARE_GLYPH( ft_outline_glyph_class ) + + #ifdef FT_CONFIG_OPTION_MAC_FONTS /* MacOS resource fork cannot exceed 16MB at least for Carbon code; */ diff --git a/src/3rdparty/freetype/src/base/ftbbox.c b/src/3rdparty/freetype/src/base/ftbbox.c index a0b2c46f7b..30a4eba0b3 100644 --- a/src/3rdparty/freetype/src/base/ftbbox.c +++ b/src/3rdparty/freetype/src/base/ftbbox.c @@ -4,7 +4,7 @@ * * FreeType bbox computation (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used @@ -24,14 +24,13 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_BBOX_H -#include FT_IMAGE_H -#include FT_OUTLINE_H -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/ftbbox.h> +#include <freetype/ftimage.h> +#include <freetype/ftoutln.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/ftobjs.h> typedef struct TBBox_Rec_ @@ -294,10 +293,10 @@ if ( shift > 2 ) shift = 2; - q1 <<= shift; - q2 <<= shift; - q3 <<= shift; - q4 <<= shift; + q1 *= 1 << shift; + q2 *= 1 << shift; + q3 *= 1 << shift; + q4 *= 1 << shift; } else { diff --git a/src/3rdparty/freetype/src/base/ftbdf.c b/src/3rdparty/freetype/src/base/ftbdf.c index c0fccd7b7c..fc374c6675 100644 --- a/src/3rdparty/freetype/src/base/ftbdf.c +++ b/src/3rdparty/freetype/src/base/ftbdf.c @@ -4,7 +4,7 @@ * * FreeType API for accessing BDF-specific strings (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_BDF_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svbdf.h> /* documentation is in ftbdf.h */ diff --git a/src/3rdparty/freetype/src/base/ftbitmap.c b/src/3rdparty/freetype/src/base/ftbitmap.c index 0e0a76fe40..584213ddcf 100644 --- a/src/3rdparty/freetype/src/base/ftbitmap.c +++ b/src/3rdparty/freetype/src/base/ftbitmap.c @@ -4,7 +4,7 @@ * * FreeType utility functions for bitmaps (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_BITMAP_H -#include FT_IMAGE_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/ftbitmap.h> +#include <freetype/ftimage.h> +#include <freetype/internal/ftobjs.h> /************************************************************************** @@ -909,13 +908,13 @@ #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE5(( "FT_Bitmap_Blend:\n" - " source bitmap: (%d, %d) -- (%d, %d); %d x %d\n", + " source bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n", source_llx / 64, source_lly / 64, source_urx / 64, source_ury / 64, source_->width, source_->rows )); if ( target->width && target->rows ) - FT_TRACE5(( " target bitmap: (%d, %d) -- (%d, %d); %d x %d\n", + FT_TRACE5(( " target bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n", target_llx / 64, target_lly / 64, target_urx / 64, target_ury / 64, target->width, target->rows )); @@ -923,7 +922,7 @@ FT_TRACE5(( " target bitmap: empty\n" )); if ( final_width && final_rows ) - FT_TRACE5(( " final bitmap: (%d, %d) -- (%d, %d); %d x %d\n", + FT_TRACE5(( " final bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n", final_llx / 64, final_lly / 64, final_urx / 64, final_ury / 64, final_width, final_rows )); diff --git a/src/3rdparty/freetype/src/base/ftcalc.c b/src/3rdparty/freetype/src/base/ftcalc.c index 315dc44185..b5258c85a1 100644 --- a/src/3rdparty/freetype/src/base/ftcalc.c +++ b/src/3rdparty/freetype/src/base/ftcalc.c @@ -4,7 +4,7 @@ * * Arithmetic computations (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -32,12 +32,11 @@ */ -#include <ft2build.h> -#include FT_GLYPH_H -#include FT_TRIGONOMETRY_H -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/ftglyph.h> +#include <freetype/fttrigon.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftobjs.h> #ifdef FT_MULFIX_ASSEMBLER diff --git a/src/3rdparty/freetype/src/base/ftcid.c b/src/3rdparty/freetype/src/base/ftcid.c index 190b23f357..ce8a876adc 100644 --- a/src/3rdparty/freetype/src/base/ftcid.c +++ b/src/3rdparty/freetype/src/base/ftcid.c @@ -4,7 +4,7 @@ * * FreeType API for accessing CID font information. * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * Derek Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, @@ -16,10 +16,9 @@ */ -#include <ft2build.h> -#include FT_CID_H -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_CID_H +#include <freetype/ftcid.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svcid.h> /* documentation is in ftcid.h */ diff --git a/src/3rdparty/freetype/src/base/ftcolor.c b/src/3rdparty/freetype/src/base/ftcolor.c index 8cb057a365..a50d680096 100644 --- a/src/3rdparty/freetype/src/base/ftcolor.c +++ b/src/3rdparty/freetype/src/base/ftcolor.c @@ -4,7 +4,7 @@ * * FreeType's glyph color management (body). * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_COLOR_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/sfnt.h> +#include <freetype/internal/tttypes.h> +#include <freetype/ftcolor.h> #ifdef TT_CONFIG_OPTION_COLOR_LAYERS diff --git a/src/3rdparty/freetype/src/base/ftdbgmem.c b/src/3rdparty/freetype/src/base/ftdbgmem.c index 55cd269e1f..eb0d651607 100644 --- a/src/3rdparty/freetype/src/base/ftdbgmem.c +++ b/src/3rdparty/freetype/src/base/ftdbgmem.c @@ -4,7 +4,7 @@ * * Memory debugger (body). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -18,11 +18,11 @@ #include <ft2build.h> #include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_MEMORY_H -#include FT_SYSTEM_H -#include FT_ERRORS_H -#include FT_TYPES_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftmemory.h> +#include <freetype/ftsystem.h> +#include <freetype/fterrors.h> +#include <freetype/fttypes.h> #ifdef FT_DEBUG_MEMORY @@ -621,8 +621,10 @@ if ( node->size < 0 ) ft_mem_debug_panic( - "freeing memory block at %p more than once at (%s:%ld)\n" - "block allocated at (%s:%ld) and released at (%s:%ld)", + "freeing memory block at %p more than once\n" + " at (%s:%ld)!\n" + " Block was allocated at (%s:%ld)\n" + " and released at (%s:%ld).", address, FT_FILENAME( _ft_debug_file ), _ft_debug_lineno, FT_FILENAME( node->source->file_name ), node->source->line_no, diff --git a/src/3rdparty/freetype/src/base/ftdebug.c b/src/3rdparty/freetype/src/base/ftdebug.c index ec72337873..62cf680b01 100644 --- a/src/3rdparty/freetype/src/base/ftdebug.c +++ b/src/3rdparty/freetype/src/base/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -41,9 +41,8 @@ */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/freetype.h> +#include <freetype/internal/ftdebug.h> #ifdef FT_DEBUG_LEVEL_ERROR @@ -126,7 +125,7 @@ static const char* ft_trace_toggles[trace_count + 1] = { -#include FT_INTERNAL_TRACE_H +#include <freetype/internal/fttrace.h> NULL }; diff --git a/src/3rdparty/freetype/src/base/fterrors.c b/src/3rdparty/freetype/src/base/fterrors.c index 84fe590289..eba9e76563 100644 --- a/src/3rdparty/freetype/src/base/fterrors.c +++ b/src/3rdparty/freetype/src/base/fterrors.c @@ -4,7 +4,7 @@ * * FreeType API for error code handling. * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * Armin Hasitzka, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,9 +16,8 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_ERRORS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/fterrors.h> /* documentation is in fterrors.h */ @@ -38,7 +37,7 @@ #define FT_ERRORDEF( e, v, s ) case v: return s; #define FT_ERROR_END_LIST } -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* defined( FT_CONFIG_OPTION_ERROR_STRINGS ) || ... */ diff --git a/src/3rdparty/freetype/src/base/ftfntfmt.c b/src/3rdparty/freetype/src/base/ftfntfmt.c index 54ba537416..a45317e797 100644 --- a/src/3rdparty/freetype/src/base/ftfntfmt.c +++ b/src/3rdparty/freetype/src/base/ftfntfmt.c @@ -4,7 +4,7 @@ * * FreeType utility file for font formats (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,10 +16,9 @@ */ -#include <ft2build.h> -#include FT_FONT_FORMATS_H -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_FONT_FORMAT_H +#include <freetype/ftfntfmt.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svfntfmt.h> /* documentation is in ftfntfmt.h */ diff --git a/src/3rdparty/freetype/src/base/ftfstype.c b/src/3rdparty/freetype/src/base/ftfstype.c index 45e2d8089b..bca548fc56 100644 --- a/src/3rdparty/freetype/src/base/ftfstype.c +++ b/src/3rdparty/freetype/src/base/ftfstype.c @@ -4,7 +4,7 @@ * * FreeType utility file to access FSType data (body). * - * Copyright (C) 2008-2019 by + * Copyright (C) 2008-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -15,11 +15,10 @@ * */ -#include <ft2build.h> -#include FT_TYPE1_TABLES_H -#include FT_TRUETYPE_TABLES_H -#include FT_INTERNAL_SERVICE_H -#include FT_SERVICE_POSTSCRIPT_INFO_H +#include <freetype/t1tables.h> +#include <freetype/tttables.h> +#include <freetype/internal/ftserv.h> +#include <freetype/internal/services/svpsinfo.h> /* documentation is in freetype.h */ diff --git a/src/3rdparty/freetype/src/base/ftgasp.c b/src/3rdparty/freetype/src/base/ftgasp.c index 720fb113ca..eed05a3265 100644 --- a/src/3rdparty/freetype/src/base/ftgasp.c +++ b/src/3rdparty/freetype/src/base/ftgasp.c @@ -4,7 +4,7 @@ * * Access of TrueType's `gasp' table (body). * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,9 +16,8 @@ */ -#include <ft2build.h> -#include FT_GASP_H -#include FT_INTERNAL_TRUETYPE_TYPES_H +#include <freetype/ftgasp.h> +#include <freetype/internal/tttypes.h> FT_EXPORT_DEF( FT_Int ) diff --git a/src/3rdparty/freetype/src/base/ftgloadr.c b/src/3rdparty/freetype/src/base/ftgloadr.c index bfeed461a8..05fc7692bb 100644 --- a/src/3rdparty/freetype/src/base/ftgloadr.c +++ b/src/3rdparty/freetype/src/base/ftgloadr.c @@ -4,7 +4,7 @@ * * The FreeType glyph loader (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_GLYPH_LOADER_H -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftgloadr.h> +#include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftobjs.h> #undef FT_COMPONENT #define FT_COMPONENT gloader @@ -93,6 +92,7 @@ base->outline.n_points = 0; base->outline.n_contours = 0; + base->outline.flags = 0; base->num_subglyphs = 0; *current = *base; @@ -146,9 +146,9 @@ FT_Outline* current = &loader->current.outline; - current->points = base->points + base->n_points; - current->tags = base->tags + base->n_points; - current->contours = base->contours + base->n_contours; + current->points = FT_OFFSET( base->points, base->n_points ); + current->tags = FT_OFFSET( base->tags, base->n_points ); + current->contours = FT_OFFSET( base->contours, base->n_contours ); /* handle extra points table - if any */ if ( loader->use_extra ) @@ -169,6 +169,10 @@ FT_Memory memory = loader->memory; + if ( loader->max_points == 0 || + loader->base.extra_points != NULL ) + return FT_Err_Ok; + if ( !FT_NEW_ARRAY( loader->base.extra_points, 2 * loader->max_points ) ) { loader->use_extra = 1; @@ -189,7 +193,7 @@ FT_GlyphLoad current = &loader->current; - current->subglyphs = base->subglyphs + base->num_subglyphs; + current->subglyphs = FT_OFFSET( base->subglyphs, base->num_subglyphs ); } @@ -211,6 +215,10 @@ FT_UInt new_max, old_max; + error = FT_GlyphLoader_CreateExtra( loader ); + if ( error ) + return error; + /* check points & tags */ new_max = (FT_UInt)base->n_points + (FT_UInt)current->n_points + n_points; @@ -244,6 +252,10 @@ loader->max_points = new_max; } + error = FT_GlyphLoader_CreateExtra( loader ); + if ( error ) + return error; + /* check contours */ old_max = loader->max_contours; new_max = (FT_UInt)base->n_contours + (FT_UInt)current->n_contours + diff --git a/src/3rdparty/freetype/src/base/ftglyph.c b/src/3rdparty/freetype/src/base/ftglyph.c index e6b1327901..825eba2c4d 100644 --- a/src/3rdparty/freetype/src/base/ftglyph.c +++ b/src/3rdparty/freetype/src/base/ftglyph.c @@ -4,7 +4,7 @@ * * FreeType convenience functions to handle glyphs (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -28,13 +28,14 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_GLYPH_H -#include FT_OUTLINE_H -#include FT_BITMAP_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/ftglyph.h> +#include <freetype/ftoutln.h> +#include <freetype/ftbitmap.h> +#include <freetype/internal/ftobjs.h> + +#include "ftbase.h" /************************************************************************** diff --git a/src/3rdparty/freetype/src/base/ftgxval.c b/src/3rdparty/freetype/src/base/ftgxval.c index 0677d26faa..f04df14526 100644 --- a/src/3rdparty/freetype/src/base/ftgxval.c +++ b/src/3rdparty/freetype/src/base/ftgxval.c @@ -4,7 +4,7 @@ * * FreeType API for validating TrueTypeGX/AAT tables (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * Masatake YAMATO, Redhat K.K, * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -25,11 +25,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_GX_VALIDATE_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svgxval.h> /* documentation is in ftgxval.h */ diff --git a/src/3rdparty/freetype/src/base/fthash.c b/src/3rdparty/freetype/src/base/fthash.c index 387e6d26db..449b03a5c1 100644 --- a/src/3rdparty/freetype/src/base/fthash.c +++ b/src/3rdparty/freetype/src/base/fthash.c @@ -39,9 +39,8 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_HASH_H -#include FT_INTERNAL_MEMORY_H +#include <freetype/internal/fthash.h> +#include <freetype/internal/ftmemory.h> #define INITIAL_HT_SIZE 241 diff --git a/src/3rdparty/freetype/src/base/ftinit.c b/src/3rdparty/freetype/src/base/ftinit.c index c73cd78b83..0acc75e460 100644 --- a/src/3rdparty/freetype/src/base/ftinit.c +++ b/src/3rdparty/freetype/src/base/ftinit.c @@ -4,7 +4,7 @@ * * FreeType initialization layer (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -39,9 +39,9 @@ #include <ft2build.h> #include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_MODULE_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/ftmodapi.h> /************************************************************************** diff --git a/src/3rdparty/freetype/src/base/ftlcdfil.c b/src/3rdparty/freetype/src/base/ftlcdfil.c index d9f4af4293..1e84dbc894 100644 --- a/src/3rdparty/freetype/src/base/ftlcdfil.c +++ b/src/3rdparty/freetype/src/base/ftlcdfil.c @@ -4,7 +4,7 @@ * * FreeType API for color filtering of subpixel bitmap glyphs (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_LCD_FILTER_H -#include FT_IMAGE_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/ftlcdfil.h> +#include <freetype/ftimage.h> +#include <freetype/internal/ftobjs.h> #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING diff --git a/src/3rdparty/freetype/src/base/ftmac.c b/src/3rdparty/freetype/src/base/ftmac.c index 5f23ceea9f..55a631fd74 100644 --- a/src/3rdparty/freetype/src/base/ftmac.c +++ b/src/3rdparty/freetype/src/base/ftmac.c @@ -8,7 +8,7 @@ * This file is for Mac OS X only; see builds/mac/ftoldmac.c for * classic platforms built by MPW. * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -65,10 +65,9 @@ */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_STREAM_H +#include <freetype/freetype.h> +#include <freetype/tttags.h> +#include <freetype/internal/ftstream.h> #include "ftbase.h" diff --git a/src/3rdparty/freetype/src/base/ftmm.c b/src/3rdparty/freetype/src/base/ftmm.c index ba9e67f008..9a702b9933 100644 --- a/src/3rdparty/freetype/src/base/ftmm.c +++ b/src/3rdparty/freetype/src/base/ftmm.c @@ -4,7 +4,7 @@ * * Multiple Master font support (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,13 +16,12 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_MULTIPLE_MASTERS_H -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_MULTIPLE_MASTERS_H -#include FT_SERVICE_METRICS_VARIATIONS_H +#include <freetype/ftmm.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svmm.h> +#include <freetype/internal/services/svmetric.h> /************************************************************************** diff --git a/src/3rdparty/freetype/src/base/ftobjs.c b/src/3rdparty/freetype/src/base/ftobjs.c index e301f8f11a..c060bbbc87 100644 --- a/src/3rdparty/freetype/src/base/ftobjs.c +++ b/src/3rdparty/freetype/src/base/ftobjs.c @@ -4,7 +4,7 @@ * * The FreeType private base classes (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,32 +16,31 @@ */ -#include <ft2build.h> -#include FT_LIST_H -#include FT_OUTLINE_H -#include FT_FONT_FORMATS_H +#include <freetype/ftlist.h> +#include <freetype/ftoutln.h> +#include <freetype/ftfntfmt.h> -#include FT_INTERNAL_VALIDATE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_RFORK_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */ -#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Driver */ +#include <freetype/internal/ftvalid.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftrfork.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/sfnt.h> /* for SFNT_Load_Table_Func */ +#include <freetype/internal/psaux.h> /* for PS_Driver */ -#include FT_TRUETYPE_TABLES_H -#include FT_TRUETYPE_TAGS_H -#include FT_TRUETYPE_IDS_H +#include <freetype/tttables.h> +#include <freetype/tttags.h> +#include <freetype/ttnameid.h> -#include FT_SERVICE_PROPERTIES_H -#include FT_SERVICE_SFNT_H -#include FT_SERVICE_POSTSCRIPT_NAME_H -#include FT_SERVICE_GLYPH_DICT_H -#include FT_SERVICE_TT_CMAP_H -#include FT_SERVICE_KERNING_H -#include FT_SERVICE_TRUETYPE_ENGINE_H +#include <freetype/internal/services/svprop.h> +#include <freetype/internal/services/svsfnt.h> +#include <freetype/internal/services/svpostnm.h> +#include <freetype/internal/services/svgldict.h> +#include <freetype/internal/services/svttcmap.h> +#include <freetype/internal/services/svkern.h> +#include <freetype/internal/services/svtteng.h> -#include FT_DRIVER_H +#include <freetype/ftdriver.h> #ifdef FT_CONFIG_OPTION_MAC_FONTS #include "ftbase.h" @@ -50,7 +49,7 @@ #ifdef FT_DEBUG_LEVEL_TRACE -#include FT_BITMAP_H +#include <freetype/ftbitmap.h> #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ /* We disable the warning `conversion from XXX to YYY, */ @@ -1063,11 +1062,30 @@ slot->linearHoriAdvance / 65536.0 )); FT_TRACE5(( " linear y advance: %f\n", slot->linearVertAdvance / 65536.0 )); + FT_TRACE5(( "\n" )); FT_TRACE5(( " bitmap %dx%d, %s (mode %d)\n", slot->bitmap.width, slot->bitmap.rows, pixel_modes[slot->bitmap.pixel_mode], slot->bitmap.pixel_mode )); + FT_TRACE5(( "\n" )); + + { + FT_Glyph_Metrics* metrics = &slot->metrics; + + + FT_TRACE5(( " metrics:\n" )); + FT_TRACE5(( " width: %f\n", metrics->width / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( "\n" )); + FT_TRACE5(( " horiBearingX: %f\n", metrics->horiBearingX / 64.0 )); + FT_TRACE5(( " horiBearingY: %f\n", metrics->horiBearingY / 64.0 )); + FT_TRACE5(( " horiAdvance: %f\n", metrics->horiAdvance / 64.0 )); + FT_TRACE5(( "\n" )); + FT_TRACE5(( " vertBearingX: %f\n", metrics->vertBearingX / 64.0 )); + FT_TRACE5(( " vertBearingY: %f\n", metrics->vertBearingY / 64.0 )); + FT_TRACE5(( " vertAdvance: %f\n", metrics->vertAdvance / 64.0 )); + } #endif Exit: @@ -1842,15 +1860,15 @@ /* FT2 allocator takes signed long buffer length, * too large value causing overflow should be checked */ - FT_TRACE4(( " POST fragment #%d: length=0x%08x" - " total pfb_len=0x%08x\n", + FT_TRACE4(( " POST fragment #%d: length=0x%08lx" + " total pfb_len=0x%08lx\n", i, temp, pfb_len + temp + 6 )); if ( FT_MAC_RFORK_MAX_LEN < temp || FT_MAC_RFORK_MAX_LEN - temp < pfb_len + 6 ) { FT_TRACE2(( " MacOS resource length cannot exceed" - " 0x%08x\n", + " 0x%08lx\n", FT_MAC_RFORK_MAX_LEN )); error = FT_THROW( Invalid_Offset ); @@ -1861,13 +1879,13 @@ } FT_TRACE2(( " total buffer size to concatenate" - " %d POST fragments: 0x%08x\n", + " %ld POST fragments: 0x%08lx\n", resource_cnt, pfb_len + 2 )); if ( pfb_len + 2 < 6 ) { FT_TRACE2(( " too long fragment length makes" - " pfb_len confused: pfb_len=0x%08x\n", + " pfb_len confused: pfb_len=0x%08lx\n", pfb_len )); error = FT_THROW( Array_Too_Large ); @@ -1910,7 +1928,7 @@ goto Exit2; FT_TRACE3(( "POST fragment[%d]:" - " offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n", + " offsets=0x%08lx, rlen=0x%08lx, flags=0x%04x\n", i, offsets[i], rlen, flags )); error = FT_ERR( Array_Too_Large ); @@ -1937,7 +1955,7 @@ else { FT_TRACE3(( " Write POST fragment #%d header (4-byte) to buffer" - " %p + 0x%08x\n", + " %p + 0x%08lx\n", i, pfb_data, pfb_lenpos )); if ( pfb_lenpos + 3 > pfb_len + 2 ) @@ -1952,7 +1970,7 @@ break; FT_TRACE3(( " Write POST fragment #%d header (6-byte) to buffer" - " %p + 0x%08x\n", + " %p + 0x%08lx\n", i, pfb_data, pfb_pos )); if ( pfb_pos + 6 > pfb_len + 2 ) @@ -1974,8 +1992,8 @@ if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len ) goto Exit2; - FT_TRACE3(( " Load POST fragment #%d (%d byte) to buffer" - " %p + 0x%08x\n", + FT_TRACE3(( " Load POST fragment #%d (%ld byte) to buffer" + " %p + 0x%08lx\n", i, rlen, pfb_data, pfb_pos )); error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen ); @@ -2260,7 +2278,7 @@ args2.flags = FT_OPEN_PATHNAME; args2.pathname = file_names[i] ? file_names[i] : args->pathname; - FT_TRACE3(( "Try rule %d: %s (offset=%d) ...", + FT_TRACE3(( "Try rule %d: %s (offset=%ld) ...", i, args2.pathname, offsets[i] )); error = FT_Stream_New( library, &args2, &stream2 ); @@ -2858,6 +2876,8 @@ if ( error ) { FT_FREE( node ); + if ( size ) + FT_FREE( size->internal ); FT_FREE( size ); } @@ -3213,9 +3233,9 @@ FT_Size_Metrics* metrics = &face->size->metrics; - FT_TRACE5(( " x scale: %d (%f)\n", + FT_TRACE5(( " x scale: %ld (%f)\n", metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", + FT_TRACE5(( " y scale: %ld (%f)\n", metrics->y_scale, metrics->y_scale / 65536.0 )); FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); @@ -3288,9 +3308,9 @@ FT_Size_Metrics* metrics = &face->size->metrics; - FT_TRACE5(( " x scale: %d (%f)\n", + FT_TRACE5(( " x scale: %ld (%f)\n", metrics->x_scale, metrics->x_scale / 65536.0 )); - FT_TRACE5(( " y scale: %d (%f)\n", + FT_TRACE5(( " y scale: %ld (%f)\n", metrics->y_scale, metrics->y_scale / 65536.0 )); FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); @@ -3450,7 +3470,7 @@ if ( akerning->x != orig_x_rounded || akerning->y != orig_y_rounded ) FT_TRACE5(( "FT_Get_Kerning: horizontal kerning" - " (%d, %d) scaled down to (%d, %d) pixels\n", + " (%ld, %ld) scaled down to (%ld, %ld) pixels\n", orig_x_rounded / 64, orig_y_rounded / 64, akerning->x / 64, akerning->y / 64 )); } @@ -3722,7 +3742,7 @@ if ( charcode > 0xFFFFFFFFUL ) { FT_TRACE1(( "FT_Get_Char_Index: too large charcode" )); - FT_TRACE1(( " 0x%x is truncated\n", charcode )); + FT_TRACE1(( " 0x%lx is truncated\n", charcode )); } result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode ); @@ -3898,13 +3918,13 @@ { FT_TRACE1(( "FT_Face_GetCharVariantIndex:" " too large charcode" )); - FT_TRACE1(( " 0x%x is truncated\n", charcode )); + FT_TRACE1(( " 0x%lx is truncated\n", charcode )); } if ( variantSelector > 0xFFFFFFFFUL ) { FT_TRACE1(( "FT_Face_GetCharVariantIndex:" " too large variantSelector" )); - FT_TRACE1(( " 0x%x is truncated\n", variantSelector )); + FT_TRACE1(( " 0x%lx is truncated\n", variantSelector )); } result = vcmap->clazz->char_var_index( vcmap, ucmap, @@ -3941,13 +3961,13 @@ { FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:" " too large charcode" )); - FT_TRACE1(( " 0x%x is truncated\n", charcode )); + FT_TRACE1(( " 0x%lx is truncated\n", charcode )); } if ( variantSelector > 0xFFFFFFFFUL ) { FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:" " too large variantSelector" )); - FT_TRACE1(( " 0x%x is truncated\n", variantSelector )); + FT_TRACE1(( " 0x%lx is truncated\n", variantSelector )); } result = vcmap->clazz->char_var_default( vcmap, @@ -4010,7 +4030,7 @@ if ( charcode > 0xFFFFFFFFUL ) { FT_TRACE1(( "FT_Face_GetVariantsOfChar: too large charcode" )); - FT_TRACE1(( " 0x%x is truncated\n", charcode )); + FT_TRACE1(( " 0x%lx is truncated\n", charcode )); } result = vcmap->clazz->charvariant_list( vcmap, memory, @@ -4044,7 +4064,7 @@ if ( variantSelector > 0xFFFFFFFFUL ) { FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" )); - FT_TRACE1(( " 0x%x is truncated\n", variantSelector )); + FT_TRACE1(( " 0x%lx is truncated\n", variantSelector )); } result = vcmap->clazz->variantchar_list( vcmap, memory, diff --git a/src/3rdparty/freetype/src/base/ftotval.c b/src/3rdparty/freetype/src/base/ftotval.c index 007576ce6e..90a5dd617c 100644 --- a/src/3rdparty/freetype/src/base/ftotval.c +++ b/src/3rdparty/freetype/src/base/ftotval.c @@ -4,7 +4,7 @@ * * FreeType API for validating OpenType tables (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -15,12 +15,11 @@ * */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_OPENTYPE_VALIDATE_H -#include FT_OPENTYPE_VALIDATE_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svotval.h> +#include <freetype/ftotval.h> /* documentation is in ftotval.h */ diff --git a/src/3rdparty/freetype/src/base/ftoutln.c b/src/3rdparty/freetype/src/base/ftoutln.c index 0e2ba3475d..311f098e3a 100644 --- a/src/3rdparty/freetype/src/base/ftoutln.c +++ b/src/3rdparty/freetype/src/base/ftoutln.c @@ -4,7 +4,7 @@ * * FreeType outline management (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> -#include FT_OUTLINE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_DEBUG_H -#include FT_TRIGONOMETRY_H +#include <freetype/ftoutln.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/fttrigon.h> /************************************************************************** @@ -275,7 +274,7 @@ first = (FT_UInt)last + 1; } - FT_TRACE5(( "FT_Outline_Decompose: Done\n", n )); + FT_TRACE5(( "FT_Outline_Decompose: Done\n" )); return FT_Err_Ok; Invalid_Outline: @@ -711,7 +710,7 @@ FT_Vector* limit; - if ( !outline || !matrix ) + if ( !outline || !matrix || !outline->points ) return; vec = outline->points; @@ -1061,6 +1060,11 @@ if ( cbox.xMin == cbox.xMax || cbox.yMin == cbox.yMax ) return FT_ORIENTATION_NONE; + /* Reject values large outlines. */ + if ( cbox.xMin < -0x1000000L || cbox.yMin < -0x1000000L || + cbox.xMax > 0x1000000L || cbox.yMax > 0x1000000L ) + return FT_ORIENTATION_NONE; + xshift = FT_MSB( (FT_UInt32)( FT_ABS( cbox.xMax ) | FT_ABS( cbox.xMin ) ) ) - 14; xshift = FT_MAX( xshift, 0 ); diff --git a/src/3rdparty/freetype/src/base/ftpatent.c b/src/3rdparty/freetype/src/base/ftpatent.c index 020f4646eb..a02c636a65 100644 --- a/src/3rdparty/freetype/src/base/ftpatent.c +++ b/src/3rdparty/freetype/src/base/ftpatent.c @@ -5,7 +5,7 @@ * FreeType API for checking patented TrueType bytecode instructions * (body). Obsolete, retained for backward compatibility. * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * David Turner. * * This file is part of the FreeType project, and may only be used, @@ -16,13 +16,12 @@ * */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_STREAM_H -#include FT_SERVICE_SFNT_H -#include FT_SERVICE_TRUETYPE_GLYF_H +#include <freetype/freetype.h> +#include <freetype/tttags.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/services/svsfnt.h> +#include <freetype/internal/services/svttglyf.h> /* documentation is in freetype.h */ diff --git a/src/3rdparty/freetype/src/base/ftpfr.c b/src/3rdparty/freetype/src/base/ftpfr.c index aeff1db8bd..c656fcd9b9 100644 --- a/src/3rdparty/freetype/src/base/ftpfr.c +++ b/src/3rdparty/freetype/src/base/ftpfr.c @@ -4,7 +4,7 @@ * * FreeType API for accessing PFR-specific data (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -15,11 +15,10 @@ * */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_PFR_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svpfr.h> /* check the format */ diff --git a/src/3rdparty/freetype/src/base/ftpic.c b/src/3rdparty/freetype/src/base/ftpic.c deleted file mode 100644 index 1492e1809a..0000000000 --- a/src/3rdparty/freetype/src/base/ftpic.c +++ /dev/null @@ -1,55 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftpic.c */ -/* */ -/* The FreeType position independent code services (body). */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include "basepic.h" - -#ifdef FT_CONFIG_OPTION_PIC - - /* documentation is in ftpic.h */ - - FT_BASE_DEF( FT_Error ) - ft_pic_container_init( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error; - - - FT_MEM_SET( pic_container, 0, sizeof ( *pic_container ) ); - - error = ft_base_pic_init( library ); - if ( error ) - return error; - - return FT_Err_Ok; - } - - - /* Destroy the contents of the container. */ - FT_BASE_DEF( void ) - ft_pic_container_destroy( FT_Library library ) - { - ft_base_pic_free( library ); - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/base/ftpsprop.c b/src/3rdparty/freetype/src/base/ftpsprop.c index 52b9d453ad..8c29f50f6b 100644 --- a/src/3rdparty/freetype/src/base/ftpsprop.c +++ b/src/3rdparty/freetype/src/base/ftpsprop.c @@ -5,7 +5,7 @@ * Get and set properties of PostScript drivers (body). * See `ftdriver.h' for available properties. * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,12 +17,11 @@ */ -#include <ft2build.h> -#include FT_DRIVER_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_POSTSCRIPT_PROPS_H +#include <freetype/ftdriver.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/psaux.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftpsprop.h> /************************************************************************** @@ -165,9 +164,9 @@ driver->hinting_engine = *hinting_engine; else error = FT_ERR( Unimplemented_Feature ); - - return error; } + + return error; } else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) diff --git a/src/3rdparty/freetype/src/base/ftrfork.c b/src/3rdparty/freetype/src/base/ftrfork.c index 73b7eb0ded..f989be47f4 100644 --- a/src/3rdparty/freetype/src/base/ftrfork.c +++ b/src/3rdparty/freetype/src/base/ftrfork.c @@ -4,7 +4,7 @@ * * Embedded resource forks accessor (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * Masatake YAMATO and Redhat K.K. * * FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are @@ -24,10 +24,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_RFORK_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftrfork.h> #include "ftbase.h" @@ -240,7 +239,7 @@ (char)( 0xFF & ( tag_internal >> 16 ) ), (char)( 0xFF & ( tag_internal >> 8 ) ), (char)( 0xFF & ( tag_internal >> 0 ) ) )); - FT_TRACE3(( " : subcount=%d, suboffset=0x%04x\n", + FT_TRACE3(( " : subcount=%d, suboffset=0x%04lx\n", subcnt, rpos )); if ( tag_internal == tag ) @@ -286,7 +285,7 @@ ref[j].offset = temp & 0xFFFFFFL; FT_TRACE3(( " [%d]:" - " resource_id=0x%04x, offset=0x%08x\n", + " resource_id=0x%04x, offset=0x%08lx\n", j, (FT_UShort)ref[j].res_id, ref[j].offset )); } @@ -302,7 +301,7 @@ for ( j = 0; j < *count; j++ ) FT_TRACE3(( " [%d]:" - " resource_id=0x%04x, offset=0x%08x\n", + " resource_id=0x%04x, offset=0x%08lx\n", j, ref[j].res_id, ref[j].offset )); } diff --git a/src/3rdparty/freetype/src/base/ftsnames.c b/src/3rdparty/freetype/src/base/ftsnames.c index 7ab3fe3cfa..8507f28d36 100644 --- a/src/3rdparty/freetype/src/base/ftsnames.c +++ b/src/3rdparty/freetype/src/base/ftsnames.c @@ -7,7 +7,7 @@ * * This is _not_ used to retrieve glyph names! * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,12 +19,11 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_SFNT_NAMES_H -#include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_INTERNAL_STREAM_H +#include <freetype/ftsnames.h> +#include <freetype/internal/tttypes.h> +#include <freetype/internal/ftstream.h> #ifdef TT_CONFIG_OPTION_SFNT_NAMES diff --git a/src/3rdparty/freetype/src/base/ftstream.c b/src/3rdparty/freetype/src/base/ftstream.c index 4b0890d7fd..d940254d8b 100644 --- a/src/3rdparty/freetype/src/base/ftstream.c +++ b/src/3rdparty/freetype/src/base/ftstream.c @@ -4,7 +4,7 @@ * * I/O stream support (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,9 +16,8 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftdebug.h> /************************************************************************** @@ -286,7 +285,7 @@ } stream->cursor = stream->base; - stream->limit = stream->cursor + count; + stream->limit = FT_OFFSET( stream->cursor, count ); stream->pos += read_bytes; } else diff --git a/src/3rdparty/freetype/src/base/ftstroke.c b/src/3rdparty/freetype/src/base/ftstroke.c index 1b2c0f657c..56f98e1d92 100644 --- a/src/3rdparty/freetype/src/base/ftstroke.c +++ b/src/3rdparty/freetype/src/base/ftstroke.c @@ -4,7 +4,7 @@ * * FreeType path stroker (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,13 +16,12 @@ */ -#include <ft2build.h> -#include FT_STROKER_H -#include FT_TRIGONOMETRY_H -#include FT_OUTLINE_H -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/ftstroke.h> +#include <freetype/fttrigon.h> +#include <freetype/ftoutln.h> +#include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftobjs.h> /* declare an extern to access `ft_outline_glyph_class' globally */ @@ -540,63 +539,52 @@ FT_Angle angle_start, FT_Angle angle_diff ) { - FT_Angle total, angle, step, rotate, next, theta; - FT_Vector a, b, a2, b2; - FT_Fixed length; + FT_Fixed coef; + FT_Vector a0, a1, a2, a3; + FT_Int i, arcs = 1; FT_Error error = FT_Err_Ok; - /* compute start point */ - FT_Vector_From_Polar( &a, radius, angle_start ); - a.x += center->x; - a.y += center->y; + /* number of cubic arcs to draw */ + while ( angle_diff > FT_ARC_CUBIC_ANGLE * arcs || + -angle_diff > FT_ARC_CUBIC_ANGLE * arcs ) + arcs++; - total = angle_diff; - angle = angle_start; - rotate = ( angle_diff >= 0 ) ? FT_ANGLE_PI2 : -FT_ANGLE_PI2; + /* control tangents */ + coef = FT_Tan( angle_diff / ( 4 * arcs ) ); + coef += coef / 3; - while ( total != 0 ) - { - step = total; - if ( step > FT_ARC_CUBIC_ANGLE ) - step = FT_ARC_CUBIC_ANGLE; - - else if ( step < -FT_ARC_CUBIC_ANGLE ) - step = -FT_ARC_CUBIC_ANGLE; - - next = angle + step; - theta = step; - if ( theta < 0 ) - theta = -theta; + /* compute start and first control point */ + FT_Vector_From_Polar( &a0, radius, angle_start ); + a1.x = FT_MulFix( -a0.y, coef ); + a1.y = FT_MulFix( a0.x, coef ); - theta >>= 1; + a0.x += center->x; + a0.y += center->y; + a1.x += a0.x; + a1.y += a0.y; - /* compute end point */ - FT_Vector_From_Polar( &b, radius, next ); - b.x += center->x; - b.y += center->y; - - /* compute first and second control points */ - length = FT_MulDiv( radius, FT_Sin( theta ) * 4, - ( 0x10000L + FT_Cos( theta ) ) * 3 ); - - FT_Vector_From_Polar( &a2, length, angle + rotate ); - a2.x += a.x; - a2.y += a.y; + for ( i = 1; i <= arcs; i++ ) + { + /* compute end and second control point */ + FT_Vector_From_Polar( &a3, radius, + angle_start + i * angle_diff / arcs ); + a2.x = FT_MulFix( a3.y, coef ); + a2.y = FT_MulFix( -a3.x, coef ); - FT_Vector_From_Polar( &b2, length, next - rotate ); - b2.x += b.x; - b2.y += b.y; + a3.x += center->x; + a3.y += center->y; + a2.x += a3.x; + a2.y += a3.y; /* add cubic arc */ - error = ft_stroke_border_cubicto( border, &a2, &b2, &b ); + error = ft_stroke_border_cubicto( border, &a1, &a2, &a3 ); if ( error ) break; - /* process the rest of the arc ?? */ - a = b; - total -= step; - angle = next; + /* a0 = a3; */ + a1.x = a3.x - a2.x + a3.x; + a1.y = a3.y - a2.y + a3.y; } return error; @@ -934,55 +922,40 @@ error = ft_stroker_arcto( stroker, side ); } - else if ( stroker->line_cap == FT_STROKER_LINECAP_SQUARE ) + else { - /* add a square cap */ - FT_Vector delta, delta2; - FT_Angle rotate = FT_SIDE_TO_ROTATE( side ); + /* add a square or butt cap */ + FT_Vector middle, delta; FT_Fixed radius = stroker->radius; FT_StrokeBorder border = stroker->borders + side; - FT_Vector_From_Polar( &delta2, radius, angle + rotate ); - FT_Vector_From_Polar( &delta, radius, angle ); - - delta.x += stroker->center.x + delta2.x; - delta.y += stroker->center.y + delta2.y; - - error = ft_stroke_border_lineto( border, &delta, FALSE ); - if ( error ) - goto Exit; - - FT_Vector_From_Polar( &delta2, radius, angle - rotate ); - FT_Vector_From_Polar( &delta, radius, angle ); - - delta.x += delta2.x + stroker->center.x; - delta.y += delta2.y + stroker->center.y; + /* compute middle point and first angle point */ + FT_Vector_From_Polar( &middle, radius, angle ); + delta.x = side ? middle.y : -middle.y; + delta.y = side ? -middle.x : middle.x; - error = ft_stroke_border_lineto( border, &delta, FALSE ); - } - else if ( stroker->line_cap == FT_STROKER_LINECAP_BUTT ) - { - /* add a butt ending */ - FT_Vector delta; - FT_Angle rotate = FT_SIDE_TO_ROTATE( side ); - FT_Fixed radius = stroker->radius; - FT_StrokeBorder border = stroker->borders + side; - - - FT_Vector_From_Polar( &delta, radius, angle + rotate ); + if ( stroker->line_cap == FT_STROKER_LINECAP_SQUARE ) + { + middle.x += stroker->center.x; + middle.y += stroker->center.y; + } + else /* FT_STROKER_LINECAP_BUTT */ + { + middle.x = stroker->center.x; + middle.y = stroker->center.y; + } - delta.x += stroker->center.x; - delta.y += stroker->center.y; + delta.x += middle.x; + delta.y += middle.y; error = ft_stroke_border_lineto( border, &delta, FALSE ); if ( error ) goto Exit; - FT_Vector_From_Polar( &delta, radius, angle - rotate ); - - delta.x += stroker->center.x; - delta.y += stroker->center.y; + /* compute second angle point */ + delta.x = middle.x - delta.x + middle.x; + delta.y = middle.y - delta.y + middle.y; error = ft_stroke_border_lineto( border, &delta, FALSE ); } @@ -1000,8 +973,8 @@ { FT_StrokeBorder border = stroker->borders + side; FT_Angle phi, theta, rotate; - FT_Fixed length, thcos; - FT_Vector delta; + FT_Fixed length; + FT_Vector sigma, delta; FT_Error error = FT_Err_Ok; FT_Bool intersect; /* use intersection of lines? */ @@ -1019,10 +992,13 @@ else { /* compute minimum required length of lines */ - FT_Fixed min_length = ft_pos_abs( FT_MulFix( stroker->radius, - FT_Tan( theta ) ) ); + FT_Fixed min_length; + FT_Vector_Unit( &sigma, theta ); + min_length = + ft_pos_abs( FT_MulDiv( stroker->radius, sigma.y, sigma.x ) ); + intersect = FT_BOOL( min_length && stroker->line_length >= min_length && line_length >= min_length ); @@ -1040,13 +1016,11 @@ else { /* compute median angle */ - phi = stroker->angle_in + theta; - - thcos = FT_Cos( theta ); + phi = stroker->angle_in + theta + rotate; - length = FT_DivFix( stroker->radius, thcos ); + length = FT_DivFix( stroker->radius, sigma.x ); - FT_Vector_From_Polar( &delta, length, phi + rotate ); + FT_Vector_From_Polar( &delta, length, phi ); delta.x += stroker->center.x; delta.y += stroker->center.y; } @@ -1073,10 +1047,10 @@ else { /* this is a mitered (pointed) or beveled (truncated) corner */ - FT_Fixed sigma = 0, radius = stroker->radius; - FT_Angle theta = 0, phi = 0; - FT_Fixed thcos = 0; - FT_Bool bevel, fixed_bevel; + FT_Fixed radius = stroker->radius; + FT_Vector sigma; + FT_Angle theta = 0, phi = 0; + FT_Bool bevel, fixed_bevel; rotate = FT_SIDE_TO_ROTATE( side ); @@ -1087,26 +1061,20 @@ fixed_bevel = FT_BOOL( stroker->line_join != FT_STROKER_LINEJOIN_MITER_VARIABLE ); + /* check miter limit first */ if ( !bevel ) { - theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ); + theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ) / 2; - if ( theta == FT_ANGLE_PI ) - { - theta = rotate; - phi = stroker->angle_in; - } - else - { - theta /= 2; - phi = stroker->angle_in + theta + rotate; - } + if ( theta == FT_ANGLE_PI2 ) + theta = -rotate; - thcos = FT_Cos( theta ); - sigma = FT_MulFix( stroker->miter_limit, thcos ); + phi = stroker->angle_in + theta + rotate; + + FT_Vector_From_Polar( &sigma, stroker->miter_limit, theta ); /* is miter limit exceeded? */ - if ( sigma < 0x10000L ) + if ( sigma.x < 0x10000L ) { /* don't create variable bevels for very small deviations; */ /* FT_Sin(x) = 0 for x <= 57 */ @@ -1133,36 +1101,34 @@ border->movable = FALSE; error = ft_stroke_border_lineto( border, &delta, FALSE ); } - else /* variable bevel */ + else /* variable bevel or clipped miter */ { /* the miter is truncated */ FT_Vector middle, delta; - FT_Fixed length; + FT_Fixed coef; - /* compute middle point */ + /* compute middle point and first angle point */ FT_Vector_From_Polar( &middle, FT_MulFix( radius, stroker->miter_limit ), phi ); - middle.x += stroker->center.x; - middle.y += stroker->center.y; - /* compute first angle point */ - length = FT_MulDiv( radius, 0x10000L - sigma, - ft_pos_abs( FT_Sin( theta ) ) ); + coef = FT_DivFix( 0x10000L - sigma.x, sigma.y ); + delta.x = FT_MulFix( middle.y, coef ); + delta.y = FT_MulFix( -middle.x, coef ); - FT_Vector_From_Polar( &delta, length, phi + rotate ); - delta.x += middle.x; - delta.y += middle.y; + middle.x += stroker->center.x; + middle.y += stroker->center.y; + delta.x += middle.x; + delta.y += middle.y; error = ft_stroke_border_lineto( border, &delta, FALSE ); if ( error ) goto Exit; /* compute second angle point */ - FT_Vector_From_Polar( &delta, length, phi - rotate ); - delta.x += middle.x; - delta.y += middle.y; + delta.x = middle.x - delta.x + middle.x; + delta.y = middle.y - delta.y + middle.y; error = ft_stroke_border_lineto( border, &delta, FALSE ); if ( error ) @@ -1189,7 +1155,7 @@ FT_Vector delta; - length = FT_DivFix( stroker->radius, thcos ); + length = FT_MulDiv( stroker->radius, stroker->miter_limit, sigma.x ); FT_Vector_From_Polar( &delta, length, phi ); delta.x += stroker->center.x; diff --git a/src/3rdparty/freetype/src/base/ftsynth.c b/src/3rdparty/freetype/src/base/ftsynth.c index f87ed65e75..a9119e2b24 100644 --- a/src/3rdparty/freetype/src/base/ftsynth.c +++ b/src/3rdparty/freetype/src/base/ftsynth.c @@ -4,7 +4,7 @@ * * FreeType synthesizing code for emboldening and slanting (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> -#include FT_SYNTHESIS_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H -#include FT_OUTLINE_H -#include FT_BITMAP_H +#include <freetype/ftsynth.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/ftoutln.h> +#include <freetype/ftbitmap.h> /************************************************************************** @@ -130,7 +129,7 @@ if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN ) { FT_TRACE1(( "FT_GlyphSlot_Embolden:" )); - FT_TRACE1(( "too strong emboldening parameter ystr=%d\n", ystr )); + FT_TRACE1(( "too strong emboldening parameter ystr=%ld\n", ystr )); return; } error = FT_GlyphSlot_Own_Bitmap( slot ); diff --git a/src/3rdparty/freetype/src/base/ftsystem.c b/src/3rdparty/freetype/src/base/ftsystem.c index f92b3a03d5..3013cbda9d 100644 --- a/src/3rdparty/freetype/src/base/ftsystem.c +++ b/src/3rdparty/freetype/src/base/ftsystem.c @@ -4,7 +4,7 @@ * * ANSI-specific FreeType low-level system interface (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -27,11 +27,11 @@ #include <ft2build.h> #include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_SYSTEM_H -#include FT_ERRORS_H -#include FT_TYPES_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/ftsystem.h> +#include <freetype/fterrors.h> +#include <freetype/fttypes.h> /************************************************************************** diff --git a/src/3rdparty/freetype/src/base/fttrigon.c b/src/3rdparty/freetype/src/base/fttrigon.c index 38721977c7..c6f027cf61 100644 --- a/src/3rdparty/freetype/src/base/fttrigon.c +++ b/src/3rdparty/freetype/src/base/fttrigon.c @@ -4,7 +4,7 @@ * * FreeType trigonometric functions (body). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -29,10 +29,9 @@ * */ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_CALC_H -#include FT_TRIGONOMETRY_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/fttrigon.h> /* the Cordic shrink factor 0.858785336480436 * 2^32 */ diff --git a/src/3rdparty/freetype/src/base/fttype1.c b/src/3rdparty/freetype/src/base/fttype1.c index 26d4f1c3a8..be60ed6ec5 100644 --- a/src/3rdparty/freetype/src/base/fttype1.c +++ b/src/3rdparty/freetype/src/base/fttype1.c @@ -4,7 +4,7 @@ * * FreeType utility file for PS names support (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_SERVICE_H -#include FT_SERVICE_POSTSCRIPT_INFO_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftserv.h> +#include <freetype/internal/services/svpsinfo.h> /* documentation is in t1tables.h */ diff --git a/src/3rdparty/freetype/src/base/ftutil.c b/src/3rdparty/freetype/src/base/ftutil.c index 92bd857e92..d90cfbcd26 100644 --- a/src/3rdparty/freetype/src/base/ftutil.c +++ b/src/3rdparty/freetype/src/base/ftutil.c @@ -4,7 +4,7 @@ * * FreeType utility file for memory and list management (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_OBJECTS_H -#include FT_LIST_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/ftlist.h> /************************************************************************** diff --git a/src/3rdparty/freetype/src/base/ftver.rc b/src/3rdparty/freetype/src/base/ftver.rc index 1354497423..0b92e9b899 100644 --- a/src/3rdparty/freetype/src/base/ftver.rc +++ b/src/3rdparty/freetype/src/base/ftver.rc @@ -4,7 +4,7 @@ /* */ /* FreeType VERSIONINFO resource for Windows DLLs. */ /* */ -/* Copyright (C) 2018-2019 by */ +/* Copyright (C) 2018-2020 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,8 +18,8 @@ #include<windows.h> -#define FT_VERSION 2,10,1,0 -#define FT_VERSION_STR "2.10.1" +#define FT_VERSION 2,10,4,0 +#define FT_VERSION_STR "2.10.4" VS_VERSION_INFO VERSIONINFO FILEVERSION FT_VERSION @@ -45,7 +45,7 @@ BEGIN VALUE "FileVersion", FT_VERSION_STR VALUE "ProductName", "FreeType" VALUE "ProductVersion", FT_VERSION_STR - VALUE "LegalCopyright", "\251 2018-2019 The FreeType Project www.freetype.org. All rights reserved." + VALUE "LegalCopyright", "\251 2000-2020 The FreeType Project www.freetype.org. All rights reserved." VALUE "InternalName", "freetype" VALUE "OriginalFilename", FT_FILENAME END diff --git a/src/3rdparty/freetype/src/base/ftwinfnt.c b/src/3rdparty/freetype/src/base/ftwinfnt.c index 59daa77031..699dc3d700 100644 --- a/src/3rdparty/freetype/src/base/ftwinfnt.c +++ b/src/3rdparty/freetype/src/base/ftwinfnt.c @@ -4,7 +4,7 @@ * * FreeType API for accessing Windows FNT specific info (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_WINFONTS_H -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_WINFNT_H +#include <freetype/internal/ftdebug.h> +#include <freetype/ftwinfnt.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svwinfnt.h> /* documentation is in ftwinfnt.h */ diff --git a/src/3rdparty/freetype/src/base/rules.mk b/src/3rdparty/freetype/src/base/rules.mk index 4b24c6dce7..411c4c821f 100644 --- a/src/3rdparty/freetype/src/base/rules.mk +++ b/src/3rdparty/freetype/src/base/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/bdf/Jamfile b/src/3rdparty/freetype/src/bdf/Jamfile deleted file mode 100644 index a49c7f5d33..0000000000 --- a/src/3rdparty/freetype/src/bdf/Jamfile +++ /dev/null @@ -1,31 +0,0 @@ -# FreeType 2 src/bdf Jamfile -# -# Copyright (C) 2002-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) bdf ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = bdfdrivr - bdflib - ; - } - else - { - _sources = bdf ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/bdf Jamfile diff --git a/src/3rdparty/freetype/src/bdf/bdf.c b/src/3rdparty/freetype/src/bdf/bdf.c index e54df6649b..249012e590 100644 --- a/src/3rdparty/freetype/src/bdf/bdf.c +++ b/src/3rdparty/freetype/src/bdf/bdf.c @@ -26,7 +26,6 @@ THE SOFTWARE. #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "bdflib.c" #include "bdfdrivr.c" diff --git a/src/3rdparty/freetype/src/bdf/bdf.h b/src/3rdparty/freetype/src/bdf/bdf.h index d9abd2378f..5acbd5f2f9 100644 --- a/src/3rdparty/freetype/src/bdf/bdf.h +++ b/src/3rdparty/freetype/src/bdf/bdf.h @@ -30,10 +30,9 @@ * Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher */ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_HASH_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/fthash.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/bdf/bdfdrivr.c b/src/3rdparty/freetype/src/bdf/bdfdrivr.c index 60eb93305e..d29188b97b 100644 --- a/src/3rdparty/freetype/src/bdf/bdfdrivr.c +++ b/src/3rdparty/freetype/src/bdf/bdfdrivr.c @@ -24,16 +24,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_OBJECTS_H -#include FT_BDF_H -#include FT_TRUETYPE_IDS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/ftbdf.h> +#include <freetype/ttnameid.h> -#include FT_SERVICE_BDF_H -#include FT_SERVICE_FONT_FORMAT_H +#include <freetype/internal/services/svbdf.h> +#include <freetype/internal/services/svfntfmt.h> #include "bdf.h" #include "bdfdrivr.h" @@ -184,7 +183,8 @@ THE SOFTWARE. Exit: if ( charcode > 0xFFFFFFFFUL ) { - FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%x > 32bit API" )); + FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%lx > 32bit API", + charcode )); *acharcode = 0; /* XXX: result should be changed to indicate an overflow error */ } @@ -402,10 +402,10 @@ THE SOFTWARE. bdf_property_t* prop = NULL; - FT_TRACE4(( " number of glyphs: allocated %d (used %d)\n", + FT_TRACE4(( " number of glyphs: allocated %ld (used %ld)\n", font->glyphs_size, font->glyphs_used )); - FT_TRACE4(( " number of unencoded glyphs: allocated %d (used %d)\n", + FT_TRACE4(( " number of unencoded glyphs: allocated %ld (used %ld)\n", font->unencoded_size, font->unencoded_used )); @@ -457,13 +457,13 @@ THE SOFTWARE. if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF ) { font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF; - FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %d\n", + FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %ld\n", font->font_ascent )); } if ( font->font_descent > 0x7FFF || font->font_descent < -0x7FFF ) { font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF; - FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %d\n", + FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %ld\n", font->font_descent )); } @@ -504,7 +504,7 @@ THE SOFTWARE. prop->value.l < -0x504C2L ) { bsize->size = 0x7FFF; - FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n", + FT_TRACE0(( "BDF_Face_Init: clamping point size to value %ld\n", bsize->size )); } else @@ -517,7 +517,7 @@ THE SOFTWARE. if ( font->point_size > 0x7FFF ) { bsize->size = 0x7FFF; - FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n", + FT_TRACE0(( "BDF_Face_Init: clamping point size to value %ld\n", bsize->size )); } else @@ -539,7 +539,7 @@ THE SOFTWARE. if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF ) { bsize->y_ppem = 0x7FFF << 6; - FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %d\n", + FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %ld\n", bsize->y_ppem )); } else @@ -615,7 +615,7 @@ THE SOFTWARE. for ( n = 0; n < font->glyphs_size; n++ ) { (face->en_table[n]).enc = cur[n].encoding; - FT_TRACE4(( " idx %d, val 0x%lX\n", n, cur[n].encoding )); + FT_TRACE4(( " idx %ld, val 0x%lX\n", n, cur[n].encoding )); (face->en_table[n]).glyph = (FT_UShort)n; if ( cur[n].encoding == font->default_char ) @@ -624,7 +624,7 @@ THE SOFTWARE. face->default_glyph = (FT_UInt)n; else FT_TRACE1(( "BDF_Face_Init:" - " idx %d is too large for this system\n", n )); + " idx %ld is too large for this system\n", n )); } } } @@ -825,7 +825,7 @@ THE SOFTWARE. bitmap->rows = glyph.bbx.height; bitmap->width = glyph.bbx.width; if ( glyph.bpr > FT_INT_MAX ) - FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n", + FT_TRACE1(( "BDF_Glyph_Load: too large pitch %ld is truncated\n", glyph.bpr )); bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */ @@ -902,7 +902,8 @@ THE SOFTWARE. if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) ) { FT_TRACE1(( "bdf_get_bdf_property:" - " too large integer 0x%x is truncated\n" )); + " too large integer 0x%lx is truncated\n", + prop->value.l )); } aproperty->type = BDF_PROPERTY_TYPE_INTEGER; aproperty->u.integer = (FT_Int32)prop->value.l; @@ -912,7 +913,8 @@ THE SOFTWARE. if ( prop->value.ul > 0xFFFFFFFFUL ) { FT_TRACE1(( "bdf_get_bdf_property:" - " too large cardinal 0x%x is truncated\n" )); + " too large cardinal 0x%lx is truncated\n", + prop->value.ul )); } aproperty->type = BDF_PROPERTY_TYPE_CARDINAL; aproperty->u.cardinal = (FT_UInt32)prop->value.ul; diff --git a/src/3rdparty/freetype/src/bdf/bdfdrivr.h b/src/3rdparty/freetype/src/bdf/bdfdrivr.h index b37b84ea31..54aaa3353c 100644 --- a/src/3rdparty/freetype/src/bdf/bdfdrivr.h +++ b/src/3rdparty/freetype/src/bdf/bdfdrivr.h @@ -28,8 +28,7 @@ THE SOFTWARE. #ifndef BDFDRIVR_H_ #define BDFDRIVR_H_ -#include <ft2build.h> -#include FT_INTERNAL_DRIVER_H +#include <freetype/internal/ftdrv.h> #include "bdf.h" diff --git a/src/3rdparty/freetype/src/bdf/bdferror.h b/src/3rdparty/freetype/src/bdf/bdferror.h index dbe41c02ab..c1b5444871 100644 --- a/src/3rdparty/freetype/src/bdf/bdferror.h +++ b/src/3rdparty/freetype/src/bdf/bdferror.h @@ -29,7 +29,7 @@ #ifndef BDFERROR_H_ #define BDFERROR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -37,7 +37,7 @@ #define FT_ERR_PREFIX BDF_Err_ #define FT_ERR_BASE FT_Mod_Err_BDF -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* BDFERROR_H_ */ diff --git a/src/3rdparty/freetype/src/bdf/bdflib.c b/src/3rdparty/freetype/src/bdf/bdflib.c index 63813f7edc..a4ddb9a1d9 100644 --- a/src/3rdparty/freetype/src/bdf/bdflib.c +++ b/src/3rdparty/freetype/src/bdf/bdflib.c @@ -31,12 +31,11 @@ */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/freetype.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftobjs.h> #include "bdf.h" #include "bdferror.h" diff --git a/src/3rdparty/freetype/src/bzip2/Jamfile b/src/3rdparty/freetype/src/bzip2/Jamfile deleted file mode 100644 index 4b77916a8d..0000000000 --- a/src/3rdparty/freetype/src/bzip2/Jamfile +++ /dev/null @@ -1,18 +0,0 @@ -# FreeType 2 src/bzip2 Jamfile -# -# Copyright (C) 2010-2019 by -# Joel Klinghed -# -# based on `src/lzw/Jamfile' -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) bzip2 ; - -Library $(FT2_LIB) : ftbzip2.c ; - -# end of src/bzip2 Jamfile diff --git a/src/3rdparty/freetype/src/bzip2/ftbzip2.c b/src/3rdparty/freetype/src/bzip2/ftbzip2.c index 1fda59b60c..411c5d263b 100644 --- a/src/3rdparty/freetype/src/bzip2/ftbzip2.c +++ b/src/3rdparty/freetype/src/bzip2/ftbzip2.c @@ -8,7 +8,7 @@ * parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2010-2019 by + * Copyright (C) 2010-2020 by * Joel Klinghed. * * based on `src/gzip/ftgzip.c' @@ -22,15 +22,14 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_DEBUG_H -#include FT_BZIP2_H +#include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/ftbzip2.h> #include FT_CONFIG_STANDARD_LIBRARY_H -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -38,7 +37,7 @@ #define FT_ERR_PREFIX Bzip2_Err_ #define FT_ERR_BASE FT_Mod_Err_Bzip2 -#include FT_ERRORS_H +#include <freetype/fterrors.h> #ifdef FT_CONFIG_OPTION_USE_BZIP2 diff --git a/src/3rdparty/freetype/src/bzip2/rules.mk b/src/3rdparty/freetype/src/bzip2/rules.mk index f365c1f76d..eed0f4baa4 100644 --- a/src/3rdparty/freetype/src/bzip2/rules.mk +++ b/src/3rdparty/freetype/src/bzip2/rules.mk @@ -2,7 +2,7 @@ # FreeType 2 BZIP2 support configuration rules # -# Copyright (C) 2010-2019 by +# Copyright (C) 2010-2020 by # Joel Klinghed. # # based on `src/lzw/rules.mk' diff --git a/src/3rdparty/freetype/src/cache/Jamfile b/src/3rdparty/freetype/src/cache/Jamfile deleted file mode 100644 index 51f7196d1b..0000000000 --- a/src/3rdparty/freetype/src/cache/Jamfile +++ /dev/null @@ -1,37 +0,0 @@ -# FreeType 2 src/cache Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) cache ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = ftcbasic - ftccache - ftcglyph - ftcimage - ftcmanag - ftccmap - ftcmru - ftcsbits - ; - } - else - { - _sources = ftcache ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/cache Jamfile diff --git a/src/3rdparty/freetype/src/cache/ftcache.c b/src/3rdparty/freetype/src/cache/ftcache.c index a6a3e63ef0..e90f4639cb 100644 --- a/src/3rdparty/freetype/src/cache/ftcache.c +++ b/src/3rdparty/freetype/src/cache/ftcache.c @@ -4,7 +4,7 @@ * * The FreeType Caching sub-system (body only). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "ftcbasic.c" #include "ftccache.c" diff --git a/src/3rdparty/freetype/src/cache/ftcbasic.c b/src/3rdparty/freetype/src/cache/ftcbasic.c index a473585ebc..43ea314d4a 100644 --- a/src/3rdparty/freetype/src/cache/ftcbasic.c +++ b/src/3rdparty/freetype/src/cache/ftcbasic.c @@ -4,7 +4,7 @@ * * The FreeType basic cache interface (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,10 +16,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_CACHE_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/ftcache.h> #include "ftcglyph.h" #include "ftcimage.h" #include "ftcsbits.h" @@ -111,7 +110,9 @@ if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs ) FT_TRACE1(( "ftc_basic_family_get_count:" - " too large number of glyphs in this face, truncated\n", + " the number of glyphs in this face is %ld,\n" + " " + " which is too much and thus truncated\n", face->num_glyphs )); if ( !error ) @@ -394,7 +395,7 @@ #if FT_ULONG_MAX > FT_UINT_MAX if ( load_flags > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_LookupScaler:" - " higher bits in load_flags 0x%x are dropped\n", + " higher bits in load_flags 0x%lx are dropped\n", load_flags & ~((FT_ULong)FT_UINT_MAX) )); #endif @@ -594,7 +595,7 @@ #if FT_ULONG_MAX > FT_UINT_MAX if ( load_flags > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_LookupScaler:" - " higher bits in load_flags 0x%x are dropped\n", + " higher bits in load_flags 0x%lx are dropped\n", load_flags & ~((FT_ULong)FT_UINT_MAX) )); #endif diff --git a/src/3rdparty/freetype/src/cache/ftccache.c b/src/3rdparty/freetype/src/cache/ftccache.c index f38ca44ddd..1c8e0f3221 100644 --- a/src/3rdparty/freetype/src/cache/ftccache.c +++ b/src/3rdparty/freetype/src/cache/ftccache.c @@ -4,7 +4,7 @@ * * The FreeType internal cache interface (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,10 +16,9 @@ */ -#include <ft2build.h> #include "ftcmanag.h" -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> #include "ftccback.h" #include "ftcerror.h" diff --git a/src/3rdparty/freetype/src/cache/ftccache.h b/src/3rdparty/freetype/src/cache/ftccache.h index 140ceadb11..11698bb0e9 100644 --- a/src/3rdparty/freetype/src/cache/ftccache.h +++ b/src/3rdparty/freetype/src/cache/ftccache.h @@ -4,7 +4,7 @@ * * FreeType internal cache interface (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,7 +19,7 @@ #ifndef FTCCACHE_H_ #define FTCCACHE_H_ - +#include <freetype/internal/compiler-macros.h> #include "ftcmru.h" FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/cache/ftccback.h b/src/3rdparty/freetype/src/cache/ftccback.h index 9321bc3d4e..542acb1565 100644 --- a/src/3rdparty/freetype/src/cache/ftccback.h +++ b/src/3rdparty/freetype/src/cache/ftccback.h @@ -4,7 +4,7 @@ * * Callback functions of the caching sub-system (specification only). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -18,14 +18,14 @@ #ifndef FTCCBACK_H_ #define FTCCBACK_H_ -#include <ft2build.h> -#include FT_CACHE_H +#include <freetype/ftcache.h> #include "ftcmru.h" #include "ftcimage.h" #include "ftcmanag.h" #include "ftcglyph.h" #include "ftcsbits.h" +FT_BEGIN_HEADER FT_LOCAL( void ) ftc_inode_free( FTC_Node inode, @@ -85,6 +85,7 @@ ftc_node_destroy( FTC_Node node, FTC_Manager manager ); +FT_END_HEADER #endif /* FTCCBACK_H_ */ diff --git a/src/3rdparty/freetype/src/cache/ftccmap.c b/src/3rdparty/freetype/src/cache/ftccmap.c index 76ba10e3e9..468c008cf6 100644 --- a/src/3rdparty/freetype/src/cache/ftccmap.c +++ b/src/3rdparty/freetype/src/cache/ftccmap.c @@ -4,7 +4,7 @@ * * FreeType CharMap cache (body) * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,13 +16,12 @@ */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_CACHE_H +#include <freetype/freetype.h> +#include <freetype/ftcache.h> #include "ftcmanag.h" -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> #include "ftccback.h" #include "ftcerror.h" diff --git a/src/3rdparty/freetype/src/cache/ftcerror.h b/src/3rdparty/freetype/src/cache/ftcerror.h index e2d6417180..bedfd28371 100644 --- a/src/3rdparty/freetype/src/cache/ftcerror.h +++ b/src/3rdparty/freetype/src/cache/ftcerror.h @@ -4,7 +4,7 @@ * * Caching sub-system error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -26,7 +26,7 @@ #ifndef FTCERROR_H_ #define FTCERROR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -34,7 +34,7 @@ #define FT_ERR_PREFIX FTC_Err_ #define FT_ERR_BASE FT_Mod_Err_Cache -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* FTCERROR_H_ */ diff --git a/src/3rdparty/freetype/src/cache/ftcglyph.c b/src/3rdparty/freetype/src/cache/ftcglyph.c index 2a0e97d4af..7f5438aad5 100644 --- a/src/3rdparty/freetype/src/cache/ftcglyph.c +++ b/src/3rdparty/freetype/src/cache/ftcglyph.c @@ -4,7 +4,7 @@ * * FreeType Glyph Image (FT_Glyph) cache (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_CACHE_H +#include <freetype/internal/ftobjs.h> +#include <freetype/ftcache.h> #include "ftcglyph.h" -#include FT_ERRORS_H +#include <freetype/fterrors.h> #include "ftccback.h" #include "ftcerror.h" diff --git a/src/3rdparty/freetype/src/cache/ftcglyph.h b/src/3rdparty/freetype/src/cache/ftcglyph.h index 5a1f0e2a74..5629545f3c 100644 --- a/src/3rdparty/freetype/src/cache/ftcglyph.h +++ b/src/3rdparty/freetype/src/cache/ftcglyph.h @@ -4,7 +4,7 @@ * * FreeType abstract glyph cache (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -117,7 +117,6 @@ #define FTCGLYPH_H_ -#include <ft2build.h> #include "ftcmanag.h" diff --git a/src/3rdparty/freetype/src/cache/ftcimage.c b/src/3rdparty/freetype/src/cache/ftcimage.c index 9e64d51a22..58ebad8c93 100644 --- a/src/3rdparty/freetype/src/cache/ftcimage.c +++ b/src/3rdparty/freetype/src/cache/ftcimage.c @@ -4,7 +4,7 @@ * * FreeType Image cache (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_CACHE_H +#include <freetype/ftcache.h> #include "ftcimage.h" -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftobjs.h> #include "ftccback.h" #include "ftcerror.h" diff --git a/src/3rdparty/freetype/src/cache/ftcimage.h b/src/3rdparty/freetype/src/cache/ftcimage.h index dcb101fabc..a400788b3c 100644 --- a/src/3rdparty/freetype/src/cache/ftcimage.h +++ b/src/3rdparty/freetype/src/cache/ftcimage.h @@ -4,7 +4,7 @@ * * FreeType Generic Image cache (specification) * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -36,8 +36,7 @@ #define FTCIMAGE_H_ -#include <ft2build.h> -#include FT_CACHE_H +#include <freetype/ftcache.h> #include "ftcglyph.h" FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/cache/ftcmanag.c b/src/3rdparty/freetype/src/cache/ftcmanag.c index bd585968e3..436d41f374 100644 --- a/src/3rdparty/freetype/src/cache/ftcmanag.c +++ b/src/3rdparty/freetype/src/cache/ftcmanag.c @@ -4,7 +4,7 @@ * * FreeType Cache Manager (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> -#include FT_CACHE_H +#include <freetype/ftcache.h> #include "ftcmanag.h" -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_SIZES_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/ftsizes.h> #include "ftccback.h" #include "ftcerror.h" diff --git a/src/3rdparty/freetype/src/cache/ftcmanag.h b/src/3rdparty/freetype/src/cache/ftcmanag.h index 60c66c8fc8..6c6ec68545 100644 --- a/src/3rdparty/freetype/src/cache/ftcmanag.h +++ b/src/3rdparty/freetype/src/cache/ftcmanag.h @@ -4,7 +4,7 @@ * * FreeType Cache Manager (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -63,8 +63,7 @@ #define FTCMANAG_H_ -#include <ft2build.h> -#include FT_CACHE_H +#include <freetype/ftcache.h> #include "ftcmru.h" #include "ftccache.h" diff --git a/src/3rdparty/freetype/src/cache/ftcmru.c b/src/3rdparty/freetype/src/cache/ftcmru.c index 18a7b80054..8feed45f6b 100644 --- a/src/3rdparty/freetype/src/cache/ftcmru.c +++ b/src/3rdparty/freetype/src/cache/ftcmru.c @@ -4,7 +4,7 @@ * * FreeType MRU support (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_CACHE_H +#include <freetype/ftcache.h> #include "ftcmru.h" -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> #include "ftcerror.h" diff --git a/src/3rdparty/freetype/src/cache/ftcmru.h b/src/3rdparty/freetype/src/cache/ftcmru.h index 58721ed340..ac4f9b126d 100644 --- a/src/3rdparty/freetype/src/cache/ftcmru.h +++ b/src/3rdparty/freetype/src/cache/ftcmru.h @@ -4,7 +4,7 @@ * * Simple MRU list-cache (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -44,8 +44,8 @@ #define FTCMRU_H_ -#include <ft2build.h> -#include FT_FREETYPE_H +#include <freetype/freetype.h> +#include <freetype/internal/compiler-macros.h> #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" diff --git a/src/3rdparty/freetype/src/cache/ftcsbits.c b/src/3rdparty/freetype/src/cache/ftcsbits.c index 06b46c896e..e0db930af8 100644 --- a/src/3rdparty/freetype/src/cache/ftcsbits.c +++ b/src/3rdparty/freetype/src/cache/ftcsbits.c @@ -4,7 +4,7 @@ * * FreeType sbits manager (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> -#include FT_CACHE_H +#include <freetype/ftcache.h> #include "ftcsbits.h" -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_ERRORS_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/fterrors.h> #include "ftccback.h" #include "ftcerror.h" diff --git a/src/3rdparty/freetype/src/cache/ftcsbits.h b/src/3rdparty/freetype/src/cache/ftcsbits.h index f1b71c2835..46f797e724 100644 --- a/src/3rdparty/freetype/src/cache/ftcsbits.h +++ b/src/3rdparty/freetype/src/cache/ftcsbits.h @@ -4,7 +4,7 @@ * * A small-bitmap cache (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define FTCSBITS_H_ -#include <ft2build.h> -#include FT_CACHE_H +#include <freetype/ftcache.h> #include "ftcglyph.h" diff --git a/src/3rdparty/freetype/src/cache/rules.mk b/src/3rdparty/freetype/src/cache/rules.mk index 1618d98303..4738b5153a 100644 --- a/src/3rdparty/freetype/src/cache/rules.mk +++ b/src/3rdparty/freetype/src/cache/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2000-2019 by +# Copyright (C) 2000-2020 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/cff/Jamfile b/src/3rdparty/freetype/src/cff/Jamfile deleted file mode 100644 index 10f49cef12..0000000000 --- a/src/3rdparty/freetype/src/cff/Jamfile +++ /dev/null @@ -1,36 +0,0 @@ -# FreeType 2 src/cff Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) cff ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = cffcmap - cffdrivr - cffgload - cffload - cffobjs - cffparse - cffpic - ; - } - else - { - _sources = cff ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/cff Jamfile diff --git a/src/3rdparty/freetype/src/cff/cf2arrst.c b/src/3rdparty/freetype/src/cff/cf2arrst.c deleted file mode 100644 index 89f3e9f1d7..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2arrst.c +++ /dev/null @@ -1,241 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2arrst.c */ -/* */ -/* Adobe's code for Array Stacks (body). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#include "cf2ft.h" -#include FT_INTERNAL_DEBUG_H - -#include "cf2glue.h" -#include "cf2arrst.h" - -#include "cf2error.h" - - - /* - * CF2_ArrStack uses an error pointer, to enable shared errors. - * Shared errors are necessary when multiple objects allow the program - * to continue after detecting errors. Only the first error should be - * recorded. - */ - - FT_LOCAL_DEF( void ) - cf2_arrstack_init( CF2_ArrStack arrstack, - FT_Memory memory, - FT_Error* error, - size_t sizeItem ) - { - FT_ASSERT( arrstack != NULL ); - - /* initialize the structure */ - arrstack->memory = memory; - arrstack->error = error; - arrstack->sizeItem = sizeItem; - arrstack->allocated = 0; - arrstack->chunk = 10; /* chunks of 10 items */ - arrstack->count = 0; - arrstack->totalSize = 0; - arrstack->ptr = NULL; - } - - - FT_LOCAL_DEF( void ) - cf2_arrstack_finalize( CF2_ArrStack arrstack ) - { - FT_Memory memory = arrstack->memory; /* for FT_FREE */ - - - FT_ASSERT( arrstack != NULL ); - - arrstack->allocated = 0; - arrstack->count = 0; - arrstack->totalSize = 0; - - /* free the data buffer */ - FT_FREE( arrstack->ptr ); - } - - - /* allocate or reallocate the buffer size; */ - /* return false on memory error */ - static FT_Bool - cf2_arrstack_setNumElements( CF2_ArrStack arrstack, - size_t numElements ) - { - FT_ASSERT( arrstack != NULL ); - - { - FT_Error error = FT_Err_Ok; /* for FT_REALLOC */ - FT_Memory memory = arrstack->memory; /* for FT_REALLOC */ - - size_t newSize = numElements * arrstack->sizeItem; - - - if ( numElements > FT_LONG_MAX / arrstack->sizeItem ) - goto exit; - - - FT_ASSERT( newSize > 0 ); /* avoid realloc with zero size */ - - if ( !FT_REALLOC( arrstack->ptr, arrstack->totalSize, newSize ) ) - { - arrstack->allocated = numElements; - arrstack->totalSize = newSize; - - if ( arrstack->count > numElements ) - { - /* we truncated the list! */ - CF2_SET_ERROR( arrstack->error, Stack_Overflow ); - arrstack->count = numElements; - return FALSE; - } - - return TRUE; /* success */ - } - } - - exit: - /* if there's not already an error, store this one */ - CF2_SET_ERROR( arrstack->error, Out_Of_Memory ); - - return FALSE; - } - - - /* set the count, ensuring allocation is sufficient */ - FT_LOCAL_DEF( void ) - cf2_arrstack_setCount( CF2_ArrStack arrstack, - size_t numElements ) - { - FT_ASSERT( arrstack != NULL ); - - if ( numElements > arrstack->allocated ) - { - /* expand the allocation first */ - if ( !cf2_arrstack_setNumElements( arrstack, numElements ) ) - return; - } - - arrstack->count = numElements; - } - - - /* clear the count */ - FT_LOCAL_DEF( void ) - cf2_arrstack_clear( CF2_ArrStack arrstack ) - { - FT_ASSERT( arrstack != NULL ); - - arrstack->count = 0; - } - - - /* current number of items */ - FT_LOCAL_DEF( size_t ) - cf2_arrstack_size( const CF2_ArrStack arrstack ) - { - FT_ASSERT( arrstack != NULL ); - - return arrstack->count; - } - - - FT_LOCAL_DEF( void* ) - cf2_arrstack_getBuffer( const CF2_ArrStack arrstack ) - { - FT_ASSERT( arrstack != NULL ); - - return arrstack->ptr; - } - - - /* return pointer to the given element */ - FT_LOCAL_DEF( void* ) - cf2_arrstack_getPointer( const CF2_ArrStack arrstack, - size_t idx ) - { - void* newPtr; - - - FT_ASSERT( arrstack != NULL ); - - if ( idx >= arrstack->count ) - { - /* overflow */ - CF2_SET_ERROR( arrstack->error, Stack_Overflow ); - idx = 0; /* choose safe default */ - } - - newPtr = (FT_Byte*)arrstack->ptr + idx * arrstack->sizeItem; - - return newPtr; - } - - - /* push (append) an element at the end of the list; */ - /* return false on memory error */ - /* TODO: should there be a length param for extra checking? */ - FT_LOCAL_DEF( void ) - cf2_arrstack_push( CF2_ArrStack arrstack, - const void* ptr ) - { - FT_ASSERT( arrstack != NULL ); - - if ( arrstack->count == arrstack->allocated ) - { - /* grow the buffer by one chunk */ - if ( !cf2_arrstack_setNumElements( - arrstack, arrstack->allocated + arrstack->chunk ) ) - { - /* on error, ignore the push */ - return; - } - } - - FT_ASSERT( ptr != NULL ); - - { - size_t offset = arrstack->count * arrstack->sizeItem; - void* newPtr = (FT_Byte*)arrstack->ptr + offset; - - - FT_MEM_COPY( newPtr, ptr, arrstack->sizeItem ); - arrstack->count += 1; - } - } - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2arrst.h b/src/3rdparty/freetype/src/cff/cf2arrst.h deleted file mode 100644 index ff5ad8b126..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2arrst.h +++ /dev/null @@ -1,100 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2arrst.h */ -/* */ -/* Adobe's code for Array Stacks (specification). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2ARRST_H__ -#define __CF2ARRST_H__ - - -#include "cf2error.h" - - -FT_BEGIN_HEADER - - - /* need to define the struct here (not opaque) so it can be allocated by */ - /* clients */ - typedef struct CF2_ArrStackRec_ - { - FT_Memory memory; - FT_Error* error; - - size_t sizeItem; /* bytes per element */ - size_t allocated; /* items allocated */ - size_t chunk; /* allocation increment in items */ - size_t count; /* number of elements allocated */ - size_t totalSize; /* total bytes allocated */ - - void* ptr; /* ptr to data */ - - } CF2_ArrStackRec, *CF2_ArrStack; - - - FT_LOCAL( void ) - cf2_arrstack_init( CF2_ArrStack arrstack, - FT_Memory memory, - FT_Error* error, - size_t sizeItem ); - FT_LOCAL( void ) - cf2_arrstack_finalize( CF2_ArrStack arrstack ); - - FT_LOCAL( void ) - cf2_arrstack_setCount( CF2_ArrStack arrstack, - size_t numElements ); - FT_LOCAL( void ) - cf2_arrstack_clear( CF2_ArrStack arrstack ); - FT_LOCAL( size_t ) - cf2_arrstack_size( const CF2_ArrStack arrstack ); - - FT_LOCAL( void* ) - cf2_arrstack_getBuffer( const CF2_ArrStack arrstack ); - FT_LOCAL( void* ) - cf2_arrstack_getPointer( const CF2_ArrStack arrstack, - size_t idx ); - - FT_LOCAL( void ) - cf2_arrstack_push( CF2_ArrStack arrstack, - const void* ptr ); - - -FT_END_HEADER - - -#endif /* __CF2ARRST_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2blues.c b/src/3rdparty/freetype/src/cff/cf2blues.c deleted file mode 100644 index 250f89e0df..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2blues.c +++ /dev/null @@ -1,579 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2blues.c */ -/* */ -/* Adobe's code for handling Blue Zones (body). */ -/* */ -/* Copyright 2009-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#include "cf2ft.h" -#include FT_INTERNAL_DEBUG_H - -#include "cf2blues.h" -#include "cf2hints.h" -#include "cf2font.h" - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_cf2blues - - - /* - * For blue values, the FreeType parser produces an array of integers, - * while the Adobe CFF engine produces an array of fixed. - * Define a macro to convert FreeType to fixed. - */ -#define cf2_blueToFixed( x ) cf2_intToFixed( x ) - - - FT_LOCAL_DEF( void ) - cf2_blues_init( CF2_Blues blues, - CF2_Font font ) - { - /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; - - CF2_Fixed zoneHeight; - CF2_Fixed maxZoneHeight = 0; - CF2_Fixed csUnitsPerPixel; - - size_t numBlueValues; - size_t numOtherBlues; - size_t numFamilyBlues; - size_t numFamilyOtherBlues; - - FT_Pos* blueValues; - FT_Pos* otherBlues; - FT_Pos* familyBlues; - FT_Pos* familyOtherBlues; - - size_t i; - CF2_Fixed emBoxBottom, emBoxTop; - -#if 0 - CF2_Int unitsPerEm = font->unitsPerEm; - - - if ( unitsPerEm == 0 ) - unitsPerEm = 1000; -#endif - - FT_ZERO( blues ); - blues->scale = font->innerTransform.d; - - cf2_getBlueMetrics( decoder, - &blues->blueScale, - &blues->blueShift, - &blues->blueFuzz ); - - cf2_getBlueValues( decoder, &numBlueValues, &blueValues ); - cf2_getOtherBlues( decoder, &numOtherBlues, &otherBlues ); - cf2_getFamilyBlues( decoder, &numFamilyBlues, &familyBlues ); - cf2_getFamilyOtherBlues( decoder, &numFamilyOtherBlues, &familyOtherBlues ); - - /* - * synthetic em box hint heuristic - * - * Apply this when ideographic dictionary (LanguageGroup 1) has no - * real alignment zones. Adobe tools generate dummy zones at -250 and - * 1100 for a 1000 unit em. Fonts with ICF-based alignment zones - * should not enable the heuristic. When the heuristic is enabled, - * the font's blue zones are ignored. - * - */ - - /* get em box from OS/2 typoAscender/Descender */ - /* TODO: FreeType does not parse these metrics. Skip them for now. */ -#if 0 - FCM_getHorizontalLineMetrics( &e, - font->font, - &ascender, - &descender, - &linegap ); - if ( ascender - descender == unitsPerEm ) - { - emBoxBottom = cf2_intToFixed( descender ); - emBoxTop = cf2_intToFixed( ascender ); - } - else -#endif - { - emBoxBottom = CF2_ICF_Bottom; - emBoxTop = CF2_ICF_Top; - } - - if ( cf2_getLanguageGroup( decoder ) == 1 && - ( numBlueValues == 0 || - ( numBlueValues == 4 && - cf2_blueToFixed( blueValues[0] ) < emBoxBottom && - cf2_blueToFixed( blueValues[1] ) < emBoxBottom && - cf2_blueToFixed( blueValues[2] ) > emBoxTop && - cf2_blueToFixed( blueValues[3] ) > emBoxTop ) ) ) - { - /* - * Construct hint edges suitable for synthetic ghost hints at top - * and bottom of em box. +-CF2_MIN_COUNTER allows for unhinted - * features above or below the last hinted edge. This also gives a - * net 1 pixel boost to the height of ideographic glyphs. - * - * Note: Adjust synthetic hints outward by epsilon (0x.0001) to - * avoid interference. E.g., some fonts have real hints at - * 880 and -120. - */ - - blues->emBoxBottomEdge.csCoord = emBoxBottom - CF2_FIXED_EPSILON; - blues->emBoxBottomEdge.dsCoord = cf2_fixedRound( - FT_MulFix( - blues->emBoxBottomEdge.csCoord, - blues->scale ) ) - - CF2_MIN_COUNTER; - blues->emBoxBottomEdge.scale = blues->scale; - blues->emBoxBottomEdge.flags = CF2_GhostBottom | - CF2_Locked | - CF2_Synthetic; - - blues->emBoxTopEdge.csCoord = emBoxTop + CF2_FIXED_EPSILON + - 2 * font->darkenY; - blues->emBoxTopEdge.dsCoord = cf2_fixedRound( - FT_MulFix( - blues->emBoxTopEdge.csCoord, - blues->scale ) ) + - CF2_MIN_COUNTER; - blues->emBoxTopEdge.scale = blues->scale; - blues->emBoxTopEdge.flags = CF2_GhostTop | - CF2_Locked | - CF2_Synthetic; - - blues->doEmBoxHints = TRUE; /* enable the heuristic */ - - return; - } - - /* copy `BlueValues' and `OtherBlues' to a combined array of top and */ - /* bottom zones */ - for ( i = 0; i < numBlueValues; i += 2 ) - { - blues->zone[blues->count].csBottomEdge = - cf2_blueToFixed( blueValues[i] ); - blues->zone[blues->count].csTopEdge = - cf2_blueToFixed( blueValues[i + 1] ); - - zoneHeight = blues->zone[blues->count].csTopEdge - - blues->zone[blues->count].csBottomEdge; - - if ( zoneHeight < 0 ) - { - FT_TRACE4(( "cf2_blues_init: ignoring negative zone height\n" )); - continue; /* reject this zone */ - } - - if ( zoneHeight > maxZoneHeight ) - { - /* take maximum before darkening adjustment */ - /* so overshoot suppression point doesn't change */ - maxZoneHeight = zoneHeight; - } - - /* adjust both edges of top zone upward by twice darkening amount */ - if ( i != 0 ) - { - blues->zone[blues->count].csTopEdge += 2 * font->darkenY; - blues->zone[blues->count].csBottomEdge += 2 * font->darkenY; - } - - /* first `BlueValue' is bottom zone; others are top */ - if ( i == 0 ) - { - blues->zone[blues->count].bottomZone = - TRUE; - blues->zone[blues->count].csFlatEdge = - blues->zone[blues->count].csTopEdge; - } - else - { - blues->zone[blues->count].bottomZone = - FALSE; - blues->zone[blues->count].csFlatEdge = - blues->zone[blues->count].csBottomEdge; - } - - blues->count += 1; - } - - for ( i = 0; i < numOtherBlues; i += 2 ) - { - blues->zone[blues->count].csBottomEdge = - cf2_blueToFixed( otherBlues[i] ); - blues->zone[blues->count].csTopEdge = - cf2_blueToFixed( otherBlues[i + 1] ); - - zoneHeight = blues->zone[blues->count].csTopEdge - - blues->zone[blues->count].csBottomEdge; - - if ( zoneHeight < 0 ) - { - FT_TRACE4(( "cf2_blues_init: ignoring negative zone height\n" )); - continue; /* reject this zone */ - } - - if ( zoneHeight > maxZoneHeight ) - { - /* take maximum before darkening adjustment */ - /* so overshoot suppression point doesn't change */ - maxZoneHeight = zoneHeight; - } - - /* Note: bottom zones are not adjusted for darkening amount */ - - /* all OtherBlues are bottom zone */ - blues->zone[blues->count].bottomZone = - TRUE; - blues->zone[blues->count].csFlatEdge = - blues->zone[blues->count].csTopEdge; - - blues->count += 1; - } - - /* Adjust for FamilyBlues */ - - /* Search for the nearest flat edge in `FamilyBlues' or */ - /* `FamilyOtherBlues'. According to the Black Book, any matching edge */ - /* must be within one device pixel */ - - csUnitsPerPixel = FT_DivFix( cf2_intToFixed( 1 ), blues->scale ); - - /* loop on all zones in this font */ - for ( i = 0; i < blues->count; i++ ) - { - size_t j; - CF2_Fixed minDiff; - CF2_Fixed flatFamilyEdge, diff; - /* value for this font */ - CF2_Fixed flatEdge = blues->zone[i].csFlatEdge; - - - if ( blues->zone[i].bottomZone ) - { - /* In a bottom zone, the top edge is the flat edge. */ - /* Search `FamilyOtherBlues' for bottom zones; look for closest */ - /* Family edge that is within the one pixel threshold. */ - - minDiff = CF2_FIXED_MAX; - - for ( j = 0; j < numFamilyOtherBlues; j += 2 ) - { - /* top edge */ - flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] ); - - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); - - if ( diff < minDiff && diff < csUnitsPerPixel ) - { - blues->zone[i].csFlatEdge = flatFamilyEdge; - minDiff = diff; - - if ( diff == 0 ) - break; - } - } - - /* check the first member of FamilyBlues, which is a bottom zone */ - if ( numFamilyBlues >= 2 ) - { - /* top edge */ - flatFamilyEdge = cf2_blueToFixed( familyBlues[1] ); - - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); - - if ( diff < minDiff && diff < csUnitsPerPixel ) - blues->zone[i].csFlatEdge = flatFamilyEdge; - } - } - else - { - /* In a top zone, the bottom edge is the flat edge. */ - /* Search `FamilyBlues' for top zones; skip first zone, which is a */ - /* bottom zone; look for closest Family edge that is within the */ - /* one pixel threshold */ - - minDiff = CF2_FIXED_MAX; - - for ( j = 2; j < numFamilyBlues; j += 2 ) - { - /* bottom edge */ - flatFamilyEdge = cf2_blueToFixed( familyBlues[j] ); - - /* adjust edges of top zone upward by twice darkening amount */ - flatFamilyEdge += 2 * font->darkenY; /* bottom edge */ - - diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); - - if ( diff < minDiff && diff < csUnitsPerPixel ) - { - blues->zone[i].csFlatEdge = flatFamilyEdge; - minDiff = diff; - - if ( diff == 0 ) - break; - } - } - } - } - - /* TODO: enforce separation of zones, including BlueFuzz */ - - /* Adjust BlueScale; similar to AdjustBlueScale() in coretype */ - /* `bcsetup.c'. */ - - if ( maxZoneHeight > 0 ) - { - if ( blues->blueScale > FT_DivFix( cf2_intToFixed( 1 ), - maxZoneHeight ) ) - { - /* clamp at maximum scale */ - blues->blueScale = FT_DivFix( cf2_intToFixed( 1 ), - maxZoneHeight ); - } - - /* - * TODO: Revisit the bug fix for 613448. The minimum scale - * requirement catches a number of library fonts. For - * example, with default BlueScale (.039625) and 0.4 minimum, - * the test below catches any font with maxZoneHeight < 10.1. - * There are library fonts ranging from 2 to 10 that get - * caught, including e.g., Eurostile LT Std Medium with - * maxZoneHeight of 6. - * - */ -#if 0 - if ( blueScale < .4 / maxZoneHeight ) - { - tetraphilia_assert( 0 ); - /* clamp at minimum scale, per bug 0613448 fix */ - blueScale = .4 / maxZoneHeight; - } -#endif - - } - - /* - * Suppress overshoot and boost blue zones at small sizes. Boost - * amount varies linearly from 0.5 pixel near 0 to 0 pixel at - * blueScale cutoff. - * Note: This boost amount is different from the coretype heuristic. - * - */ - - if ( blues->scale < blues->blueScale ) - { - blues->suppressOvershoot = TRUE; - - /* Change rounding threshold for `dsFlatEdge'. */ - /* Note: constant changed from 0.5 to 0.6 to avoid a problem with */ - /* 10ppem Arial */ - - blues->boost = cf2_floatToFixed( .6 ) - - FT_MulDiv( cf2_floatToFixed ( .6 ), - blues->scale, - blues->blueScale ); - if ( blues->boost > 0x7FFF ) - { - /* boost must remain less than 0.5, or baseline could go negative */ - blues->boost = 0x7FFF; - } - } - - /* boost and darkening have similar effects; don't do both */ - if ( font->stemDarkened ) - blues->boost = 0; - - /* set device space alignment for each zone; */ - /* apply boost amount before rounding flat edge */ - - for ( i = 0; i < blues->count; i++ ) - { - if ( blues->zone[i].bottomZone ) - blues->zone[i].dsFlatEdge = cf2_fixedRound( - FT_MulFix( - blues->zone[i].csFlatEdge, - blues->scale ) - - blues->boost ); - else - blues->zone[i].dsFlatEdge = cf2_fixedRound( - FT_MulFix( - blues->zone[i].csFlatEdge, - blues->scale ) + - blues->boost ); - } - } - - - /* - * Check whether `stemHint' is captured by one of the blue zones. - * - * Zero, one or both edges may be valid; only valid edges can be - * captured. For compatibility with CoolType, search top and bottom - * zones in the same pass (see `BlueLock'). If a hint is captured, - * return true and position the edge(s) in one of 3 ways: - * - * 1) If `BlueScale' suppresses overshoot, position the captured edge - * at the flat edge of the zone. - * 2) If overshoot is not suppressed and `BlueShift' requires - * overshoot, position the captured edge a minimum of 1 device pixel - * from the flat edge. - * 3) If overshoot is not suppressed or required, position the captured - * edge at the nearest device pixel. - * - */ - FT_LOCAL_DEF( FT_Bool ) - cf2_blues_capture( const CF2_Blues blues, - CF2_Hint bottomHintEdge, - CF2_Hint topHintEdge ) - { - /* TODO: validate? */ - CF2_Fixed csFuzz = blues->blueFuzz; - - /* new position of captured edge */ - CF2_Fixed dsNew; - - /* amount that hint is moved when positioned */ - CF2_Fixed dsMove = 0; - - FT_Bool captured = FALSE; - CF2_UInt i; - - - /* assert edge flags are consistent */ - FT_ASSERT( !cf2_hint_isTop( bottomHintEdge ) && - !cf2_hint_isBottom( topHintEdge ) ); - - /* TODO: search once without blue fuzz for compatibility with coretype? */ - for ( i = 0; i < blues->count; i++ ) - { - if ( blues->zone[i].bottomZone && - cf2_hint_isBottom( bottomHintEdge ) ) - { - if ( ( blues->zone[i].csBottomEdge - csFuzz ) <= - bottomHintEdge->csCoord && - bottomHintEdge->csCoord <= - ( blues->zone[i].csTopEdge + csFuzz ) ) - { - /* bottom edge captured by bottom zone */ - - if ( blues->suppressOvershoot ) - dsNew = blues->zone[i].dsFlatEdge; - - else if ( ( blues->zone[i].csTopEdge - bottomHintEdge->csCoord ) >= - blues->blueShift ) - { - /* guarantee minimum of 1 pixel overshoot */ - dsNew = FT_MIN( - cf2_fixedRound( bottomHintEdge->dsCoord ), - blues->zone[i].dsFlatEdge - cf2_intToFixed( 1 ) ); - } - - else - { - /* simply round captured edge */ - dsNew = cf2_fixedRound( bottomHintEdge->dsCoord ); - } - - dsMove = dsNew - bottomHintEdge->dsCoord; - captured = TRUE; - - break; - } - } - - if ( !blues->zone[i].bottomZone && cf2_hint_isTop( topHintEdge ) ) - { - if ( ( blues->zone[i].csBottomEdge - csFuzz ) <= - topHintEdge->csCoord && - topHintEdge->csCoord <= - ( blues->zone[i].csTopEdge + csFuzz ) ) - { - /* top edge captured by top zone */ - - if ( blues->suppressOvershoot ) - dsNew = blues->zone[i].dsFlatEdge; - - else if ( ( topHintEdge->csCoord - blues->zone[i].csBottomEdge ) >= - blues->blueShift ) - { - /* guarantee minimum of 1 pixel overshoot */ - dsNew = FT_MAX( - cf2_fixedRound( topHintEdge->dsCoord ), - blues->zone[i].dsFlatEdge + cf2_intToFixed( 1 ) ); - } - - else - { - /* simply round captured edge */ - dsNew = cf2_fixedRound( topHintEdge->dsCoord ); - } - - dsMove = dsNew - topHintEdge->dsCoord; - captured = TRUE; - - break; - } - } - } - - if ( captured ) - { - /* move both edges and flag them `locked' */ - if ( cf2_hint_isValid( bottomHintEdge ) ) - { - bottomHintEdge->dsCoord += dsMove; - cf2_hint_lock( bottomHintEdge ); - } - - if ( cf2_hint_isValid( topHintEdge ) ) - { - topHintEdge->dsCoord += dsMove; - cf2_hint_lock( topHintEdge ); - } - } - - return captured; - } - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2blues.h b/src/3rdparty/freetype/src/cff/cf2blues.h deleted file mode 100644 index 2f38fcad8f..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2blues.h +++ /dev/null @@ -1,185 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2blues.h */ -/* */ -/* Adobe's code for handling Blue Zones (specification). */ -/* */ -/* Copyright 2009-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - - /* - * A `CF2_Blues' object stores the blue zones (horizontal alignment - * zones) of a font. These are specified in the CFF private dictionary - * by `BlueValues', `OtherBlues', `FamilyBlues', and `FamilyOtherBlues'. - * Each zone is defined by a top and bottom edge in character space. - * Further, each zone is either a top zone or a bottom zone, as recorded - * by `bottomZone'. - * - * The maximum number of `BlueValues' and `FamilyBlues' is 7 each. - * However, these are combined to produce a total of 7 zones. - * Similarly, the maximum number of `OtherBlues' and `FamilyOtherBlues' - * is 5 and these are combined to produce an additional 5 zones. - * - * Blue zones are used to `capture' hints and force them to a common - * alignment point. This alignment is recorded in device space in - * `dsFlatEdge'. Except for this value, a `CF2_Blues' object could be - * constructed independently of scaling. Construction may occur once - * the matrix is known. Other features implemented in the Capture - * method are overshoot suppression, overshoot enforcement, and Blue - * Boost. - * - * Capture is determined by `BlueValues' and `OtherBlues', but the - * alignment point may be adjusted to the scaled flat edge of - * `FamilyBlues' or `FamilyOtherBlues'. No alignment is done to the - * curved edge of a zone. - * - */ - - -#ifndef __CF2BLUES_H__ -#define __CF2BLUES_H__ - - -#include "cf2glue.h" - - -FT_BEGIN_HEADER - - - /* - * `CF2_Hint' is shared by `cf2hints.h' and - * `cf2blues.h', but `cf2blues.h' depends on - * `cf2hints.h', so define it here. Note: The typedef is in - * `cf2glue.h'. - * - */ - enum - { - CF2_GhostBottom = 0x1, /* a single bottom edge */ - CF2_GhostTop = 0x2, /* a single top edge */ - CF2_PairBottom = 0x4, /* the bottom edge of a stem hint */ - CF2_PairTop = 0x8, /* the top edge of a stem hint */ - CF2_Locked = 0x10, /* this edge has been aligned */ - /* by a blue zone */ - CF2_Synthetic = 0x20 /* this edge was synthesized */ - }; - - - /* - * Default value for OS/2 typoAscender/Descender when their difference - * is not equal to `unitsPerEm'. The default is based on -250 and 1100 - * in `CF2_Blues', assuming 1000 units per em here. - * - */ - enum - { - CF2_ICF_Top = cf2_intToFixed( 880 ), - CF2_ICF_Bottom = cf2_intToFixed( -120 ) - }; - - - /* - * Constant used for hint adjustment and for synthetic em box hint - * placement. - */ -#define CF2_MIN_COUNTER cf2_floatToFixed( 0.5 ) - - - /* shared typedef is in cf2glue.h */ - struct CF2_HintRec_ - { - CF2_UInt flags; /* attributes of the edge */ - size_t index; /* index in original stem hint array */ - /* (if not synthetic) */ - CF2_Fixed csCoord; - CF2_Fixed dsCoord; - CF2_Fixed scale; - }; - - - typedef struct CF2_BlueRec_ - { - CF2_Fixed csBottomEdge; - CF2_Fixed csTopEdge; - CF2_Fixed csFlatEdge; /* may be from either local or Family zones */ - CF2_Fixed dsFlatEdge; /* top edge of bottom zone or bottom edge */ - /* of top zone (rounded) */ - FT_Bool bottomZone; - - } CF2_BlueRec; - - - /* max total blue zones is 12 */ - enum - { - CF2_MAX_BLUES = 7, - CF2_MAX_OTHERBLUES = 5 - }; - - - typedef struct CF2_BluesRec_ - { - CF2_Fixed scale; - CF2_UInt count; - FT_Bool suppressOvershoot; - FT_Bool doEmBoxHints; - - CF2_Fixed blueScale; - CF2_Fixed blueShift; - CF2_Fixed blueFuzz; - - CF2_Fixed boost; - - CF2_HintRec emBoxTopEdge; - CF2_HintRec emBoxBottomEdge; - - CF2_BlueRec zone[CF2_MAX_BLUES + CF2_MAX_OTHERBLUES]; - - } CF2_BluesRec, *CF2_Blues; - - - FT_LOCAL( void ) - cf2_blues_init( CF2_Blues blues, - CF2_Font font ); - FT_LOCAL( FT_Bool ) - cf2_blues_capture( const CF2_Blues blues, - CF2_Hint bottomHintEdge, - CF2_Hint topHintEdge ); - - -FT_END_HEADER - - -#endif /* __CF2BLUES_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2error.c b/src/3rdparty/freetype/src/cff/cf2error.c deleted file mode 100644 index b5595a3d1f..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2error.c +++ /dev/null @@ -1,52 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2error.c */ -/* */ -/* Adobe's code for error handling (body). */ -/* */ -/* Copyright 2006-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#include "cf2ft.h" -#include "cf2error.h" - - - FT_LOCAL_DEF( void ) - cf2_setError( FT_Error* error, - FT_Error value ) - { - if ( error && *error == 0 ) - *error = value; - } - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2error.h b/src/3rdparty/freetype/src/cff/cf2error.h deleted file mode 100644 index 6453ebcb7b..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2error.h +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2error.h */ -/* */ -/* Adobe's code for error handling (specification). */ -/* */ -/* Copyright 2006-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2ERROR_H__ -#define __CF2ERROR_H__ - - -#include FT_MODULE_ERRORS_H - -#undef __FTERRORS_H__ - -#undef FT_ERR_PREFIX -#define FT_ERR_PREFIX CF2_Err_ -#define FT_ERR_BASE FT_Mod_Err_CF2 - - -#include FT_ERRORS_H -#include "cf2ft.h" - - -FT_BEGIN_HEADER - - - /* - * A poor-man error facility. - * - * This code being written in vanilla C, doesn't have the luxury of a - * language-supported exception mechanism such as the one available in - * Java. Instead, we are stuck with using error codes that must be - * carefully managed and preserved. However, it is convenient for us to - * model our error mechanism on a Java-like exception mechanism. - * When we assign an error code we are thus `throwing' an error. - * - * The perservation of an error code is done by coding convention. - * Upon a function call if the error code is anything other than - * `FT_Err_Ok', which is guaranteed to be zero, we - * will return without altering that error. This will allow the - * error to propogate and be handled at the appropriate location in - * the code. - * - * This allows a style of code where the error code is initialized - * up front and a block of calls are made with the error code only - * being checked after the block. If a new error occurs, the original - * error will be preserved and a functional no-op should result in any - * subsequent function that has an initial error code not equal to - * `FT_Err_Ok'. - * - * Errors are encoded by calling the `FT_THROW' macro. For example, - * - * { - * FT_Error e; - * - * - * ... - * e = FT_THROW( Out_Of_Memory ); - * } - * - */ - - - /* Set error code to a particular value. */ - FT_LOCAL( void ) - cf2_setError( FT_Error* error, - FT_Error value ); - - - /* - * A macro that conditionally sets an error code. - * - * This macro will first check whether `error' is set; - * if not, it will set it to `e'. - * - */ -#define CF2_SET_ERROR( error, e ) \ - cf2_setError( error, FT_THROW( e ) ) - - -FT_END_HEADER - - -#endif /* __CF2ERROR_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2fixed.h b/src/3rdparty/freetype/src/cff/cf2fixed.h deleted file mode 100644 index d6d9faf8e5..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2fixed.h +++ /dev/null @@ -1,95 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2fixed.h */ -/* */ -/* Adobe's code for Fixed Point Mathematics (specification only). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2FIXED_H__ -#define __CF2FIXED_H__ - - -FT_BEGIN_HEADER - - - /* rasterizer integer and fixed point arithmetic must be 32-bit */ - -#define CF2_Fixed CF2_F16Dot16 - typedef FT_Int32 CF2_Frac; /* 2.30 fixed point */ - - -#define CF2_FIXED_MAX ( (CF2_Fixed)0x7FFFFFFFL ) -#define CF2_FIXED_MIN ( (CF2_Fixed)0x80000000L ) -#define CF2_FIXED_ONE 0x10000L -#define CF2_FIXED_EPSILON 0x0001 - - /* in C 89, left and right shift of negative numbers is */ - /* implementation specific behaviour in the general case */ - -#define cf2_intToFixed( i ) \ - ( (CF2_Fixed)( (FT_UInt32)(i) << 16 ) ) -#define cf2_fixedToInt( x ) \ - ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) -#define cf2_fixedRound( x ) \ - ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) ) -#define cf2_floatToFixed( f ) \ - ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) ) -#define cf2_fixedAbs( x ) \ - ( (x) < 0 ? -(x) : (x) ) -#define cf2_fixedFloor( x ) \ - ( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) ) -#define cf2_fixedFraction( x ) \ - ( (x) - cf2_fixedFloor( x ) ) -#define cf2_fracToFixed( x ) \ - ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 ) \ - : ( ( (x) + 0x2000 ) >> 14 ) ) - - - /* signed numeric types */ - typedef enum CF2_NumberType_ - { - CF2_NumberFixed, /* 16.16 */ - CF2_NumberFrac, /* 2.30 */ - CF2_NumberInt /* 32.0 */ - - } CF2_NumberType; - - -FT_END_HEADER - - -#endif /* __CF2FIXED_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2font.c b/src/3rdparty/freetype/src/cff/cf2font.c deleted file mode 100644 index 83fd348f2d..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2font.c +++ /dev/null @@ -1,512 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2font.c */ -/* */ -/* Adobe's code for font instances (body). */ -/* */ -/* Copyright 2007-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_INTERNAL_CALC_H - -#include "cf2ft.h" - -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2error.h" -#include "cf2intrp.h" - - - /* Compute a stem darkening amount in character space. */ - static void - cf2_computeDarkening( CF2_Fixed emRatio, - CF2_Fixed ppem, - CF2_Fixed stemWidth, - CF2_Fixed* darkenAmount, - CF2_Fixed boldenAmount, - FT_Bool stemDarkened, - FT_Int* darkenParams ) - { - /* - * Total darkening amount is computed in 1000 unit character space - * using the modified 5 part curve as Adobe's Avalon rasterizer. - * The darkening amount is smaller for thicker stems. - * It becomes zero when the stem is thicker than 2.333 pixels. - * - * By default, we use - * - * darkenAmount = 0.4 pixels if scaledStem <= 0.5 pixels, - * darkenAmount = 0.275 pixels if 1 <= scaledStem <= 1.667 pixels, - * darkenAmount = 0 pixel if scaledStem >= 2.333 pixels, - * - * and piecewise linear in-between: - * - * - * darkening - * ^ - * | - * | (x1,y1) - * |--------+ - * | \ - * | \ - * | \ (x3,y3) - * | +----------+ - * | (x2,y2) \ - * | \ - * | \ - * | +----------------- - * | (x4,y4) - * +---------------------------------------------> stem - * thickness - * - * - * This corresponds to the following values for the - * `darkening-parameters' property: - * - * (x1, y1) = (500, 400) - * (x2, y2) = (1000, 275) - * (x3, y3) = (1667, 275) - * (x4, y4) = (2333, 0) - * - */ - - /* Internal calculations are done in units per thousand for */ - /* convenience. The x axis is scaled stem width in */ - /* thousandths of a pixel. That is, 1000 is 1 pixel. */ - /* The y axis is darkening amount in thousandths of a pixel.*/ - /* In the code, below, dividing by ppem and */ - /* adjusting for emRatio converts darkenAmount to character */ - /* space (font units). */ - CF2_Fixed stemWidthPer1000, scaledStem; - FT_Int logBase2; - - - *darkenAmount = 0; - - if ( boldenAmount == 0 && !stemDarkened ) - return; - - /* protect against range problems and divide by zero */ - if ( emRatio < cf2_floatToFixed( .01 ) ) - return; - - if ( stemDarkened ) - { - FT_Int x1 = darkenParams[0]; - FT_Int y1 = darkenParams[1]; - FT_Int x2 = darkenParams[2]; - FT_Int y2 = darkenParams[3]; - FT_Int x3 = darkenParams[4]; - FT_Int y3 = darkenParams[5]; - FT_Int x4 = darkenParams[6]; - FT_Int y4 = darkenParams[7]; - - - /* convert from true character space to 1000 unit character space; */ - /* add synthetic emboldening effect */ - - /* `stemWidthPer1000' will not overflow for a legitimate font */ - - stemWidthPer1000 = FT_MulFix( stemWidth + boldenAmount, emRatio ); - - /* `scaledStem' can easily overflow, so we must clamp its maximum */ - /* value; the test doesn't need to be precise, but must be */ - /* conservative. The clamp value (default 2333) where */ - /* `darkenAmount' is zero is well below the overflow value of */ - /* 32767. */ - /* */ - /* FT_MSB computes the integer part of the base 2 logarithm. The */ - /* number of bits for the product is 1 or 2 more than the sum of */ - /* logarithms; remembering that the 16 lowest bits of the fraction */ - /* are dropped this is correct to within a factor of almost 4. */ - /* For example, 0x80.0000 * 0x80.0000 = 0x4000.0000 is 23+23 and */ - /* is flagged as possible overflow because 0xFF.FFFF * 0xFF.FFFF = */ - /* 0xFFFF.FE00 is also 23+23. */ - - logBase2 = FT_MSB( (FT_UInt32)stemWidthPer1000 ) + - FT_MSB( (FT_UInt32)ppem ); - - if ( logBase2 >= 46 ) - /* possible overflow */ - scaledStem = cf2_intToFixed( x4 ); - else - scaledStem = FT_MulFix( stemWidthPer1000, ppem ); - - /* now apply the darkening parameters */ - - if ( scaledStem < cf2_intToFixed( x1 ) ) - *darkenAmount = FT_DivFix( cf2_intToFixed( y1 ), ppem ); - - else if ( scaledStem < cf2_intToFixed( x2 ) ) - { - FT_Int xdelta = x2 - x1; - FT_Int ydelta = y2 - y1; - FT_Int x = stemWidthPer1000 - - FT_DivFix( cf2_intToFixed( x1 ), ppem ); - - - if ( !xdelta ) - goto Try_x3; - - *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) + - FT_DivFix( cf2_intToFixed( y1 ), ppem ); - } - - else if ( scaledStem < cf2_intToFixed( x3 ) ) - { - Try_x3: - { - FT_Int xdelta = x3 - x2; - FT_Int ydelta = y3 - y2; - FT_Int x = stemWidthPer1000 - - FT_DivFix( cf2_intToFixed( x2 ), ppem ); - - - if ( !xdelta ) - goto Try_x4; - - *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) + - FT_DivFix( cf2_intToFixed( y2 ), ppem ); - } - } - - else if ( scaledStem < cf2_intToFixed( x4 ) ) - { - Try_x4: - { - FT_Int xdelta = x4 - x3; - FT_Int ydelta = y4 - y3; - FT_Int x = stemWidthPer1000 - - FT_DivFix( cf2_intToFixed( x3 ), ppem ); - - - if ( !xdelta ) - goto Use_y4; - - *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) + - FT_DivFix( cf2_intToFixed( y3 ), ppem ); - } - } - - else - { - Use_y4: - *darkenAmount = FT_DivFix( cf2_intToFixed( y4 ), ppem ); - } - - /* use half the amount on each side and convert back to true */ - /* character space */ - *darkenAmount = FT_DivFix( *darkenAmount, 2 * emRatio ); - } - - /* add synthetic emboldening effect in character space */ - *darkenAmount += boldenAmount / 2; - } - - - /* set up values for the current FontDict and matrix */ - - /* caller's transform is adjusted for subpixel positioning */ - static void - cf2_font_setup( CF2_Font font, - const CF2_Matrix* transform ) - { - /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; - - FT_Bool needExtraSetup = FALSE; - - /* character space units */ - CF2_Fixed boldenX = font->syntheticEmboldeningAmountX; - CF2_Fixed boldenY = font->syntheticEmboldeningAmountY; - - CFF_SubFont subFont; - CF2_Fixed ppem; - - - /* clear previous error */ - font->error = FT_Err_Ok; - - /* if a CID fontDict has changed, we need to recompute some cached */ - /* data */ - subFont = cf2_getSubfont( decoder ); - if ( font->lastSubfont != subFont ) - { - font->lastSubfont = subFont; - needExtraSetup = TRUE; - } - - /* if ppem has changed, we need to recompute some cached data */ - /* note: because of CID font matrix concatenation, ppem and transform */ - /* do not necessarily track. */ - ppem = cf2_getPpemY( decoder ); - if ( font->ppem != ppem ) - { - font->ppem = ppem; - needExtraSetup = TRUE; - } - - /* copy hinted flag on each call */ - font->hinted = (FT_Bool)( font->renderingFlags & CF2_FlagsHinted ); - - /* determine if transform has changed; */ - /* include Fontmatrix but ignore translation */ - if ( ft_memcmp( transform, - &font->currentTransform, - 4 * sizeof ( CF2_Fixed ) ) != 0 ) - { - /* save `key' information for `cache of one' matrix data; */ - /* save client transform, without the translation */ - font->currentTransform = *transform; - font->currentTransform.tx = - font->currentTransform.ty = cf2_intToFixed( 0 ); - - /* TODO: FreeType transform is simple scalar; for now, use identity */ - /* for outer */ - font->innerTransform = *transform; - font->outerTransform.a = - font->outerTransform.d = cf2_intToFixed( 1 ); - font->outerTransform.b = - font->outerTransform.c = cf2_intToFixed( 0 ); - - needExtraSetup = TRUE; - } - - /* - * font->darkened is set to true if there is a stem darkening request or - * the font is synthetic emboldened. - * font->darkened controls whether to adjust blue zones, winding order, - * and hinting. - * - */ - if ( font->stemDarkened != ( font->renderingFlags & CF2_FlagsDarkened ) ) - { - font->stemDarkened = - (FT_Bool)( font->renderingFlags & CF2_FlagsDarkened ); - - /* blue zones depend on darkened flag */ - needExtraSetup = TRUE; - } - - /* recompute variables that are dependent on transform or FontDict or */ - /* darken flag */ - if ( needExtraSetup ) - { - /* StdVW is found in the private dictionary; */ - /* recompute darkening amounts whenever private dictionary or */ - /* transform change */ - /* Note: a rendering flag turns darkening on or off, so we want to */ - /* store the `on' amounts; */ - /* darkening amount is computed in character space */ - /* TODO: testing size-dependent darkening here; */ - /* what to do for rotations? */ - - CF2_Fixed emRatio; - CF2_Fixed stdHW; - CF2_Int unitsPerEm = font->unitsPerEm; - - - if ( unitsPerEm == 0 ) - unitsPerEm = 1000; - - ppem = FT_MAX( cf2_intToFixed( 4 ), - font->ppem ); /* use minimum ppem of 4 */ - -#if 0 - /* since vstem is measured in the x-direction, we use the `a' member */ - /* of the fontMatrix */ - emRatio = cf2_fixedFracMul( cf2_intToFixed( 1000 ), fontMatrix->a ); -#endif - - /* Freetype does not preserve the fontMatrix when parsing; use */ - /* unitsPerEm instead. */ - /* TODO: check precision of this */ - emRatio = cf2_intToFixed( 1000 ) / unitsPerEm; - font->stdVW = cf2_getStdVW( decoder ); - - if ( font->stdVW <= 0 ) - font->stdVW = FT_DivFix( cf2_intToFixed( 75 ), emRatio ); - - if ( boldenX > 0 ) - { - /* Ensure that boldenX is at least 1 pixel for synthetic bold font */ - /* (similar to what Avalon does) */ - boldenX = FT_MAX( boldenX, - FT_DivFix( cf2_intToFixed( unitsPerEm ), ppem ) ); - - /* Synthetic emboldening adds at least 1 pixel to darkenX, while */ - /* stem darkening adds at most half pixel. Since the purpose of */ - /* stem darkening (readability at small sizes) is met with */ - /* synthetic emboldening, no need to add stem darkening for a */ - /* synthetic bold font. */ - cf2_computeDarkening( emRatio, - ppem, - font->stdVW, - &font->darkenX, - boldenX, - FALSE, - font->darkenParams ); - } - else - cf2_computeDarkening( emRatio, - ppem, - font->stdVW, - &font->darkenX, - 0, - font->stemDarkened, - font->darkenParams ); - -#if 0 - /* since hstem is measured in the y-direction, we use the `d' member */ - /* of the fontMatrix */ - /* TODO: use the same units per em as above; check this */ - emRatio = cf2_fixedFracMul( cf2_intToFixed( 1000 ), fontMatrix->d ); -#endif - - /* set the default stem width, because it must be the same for all */ - /* family members; */ - /* choose a constant for StdHW that depends on font contrast */ - stdHW = cf2_getStdHW( decoder ); - - if ( stdHW > 0 && font->stdVW > 2 * stdHW ) - font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio ); - else - { - /* low contrast font gets less hstem darkening */ - font->stdHW = FT_DivFix( cf2_intToFixed( 110 ), emRatio ); - } - - cf2_computeDarkening( emRatio, - ppem, - font->stdHW, - &font->darkenY, - boldenY, - font->stemDarkened, - font->darkenParams ); - - if ( font->darkenX != 0 || font->darkenY != 0 ) - font->darkened = TRUE; - else - font->darkened = FALSE; - - font->reverseWinding = FALSE; /* initial expectation is CCW */ - - /* compute blue zones for this instance */ - cf2_blues_init( &font->blues, font ); - } - } - - - /* equivalent to AdobeGetOutline */ - FT_LOCAL_DEF( FT_Error ) - cf2_getGlyphOutline( CF2_Font font, - CF2_Buffer charstring, - const CF2_Matrix* transform, - CF2_F16Dot16* glyphWidth ) - { - FT_Error lastError = FT_Err_Ok; - - FT_Vector translation; - -#if 0 - FT_Vector advancePoint; -#endif - - CF2_Fixed advWidth = 0; - FT_Bool needWinding; - - - /* Note: use both integer and fraction for outlines. This allows bbox */ - /* to come out directly. */ - - translation.x = transform->tx; - translation.y = transform->ty; - - /* set up values based on transform */ - cf2_font_setup( font, transform ); - if ( font->error ) - goto exit; /* setup encountered an error */ - - /* reset darken direction */ - font->reverseWinding = FALSE; - - /* winding order only affects darkening */ - needWinding = font->darkened; - - while ( 1 ) - { - /* reset output buffer */ - cf2_outline_reset( &font->outline ); - - /* build the outline, passing the full translation */ - cf2_interpT2CharString( font, - charstring, - (CF2_OutlineCallbacks)&font->outline, - &translation, - FALSE, - 0, - 0, - &advWidth ); - - if ( font->error ) - goto exit; - - if ( !needWinding ) - break; - - /* check winding order */ - if ( font->outline.root.windingMomentum >= 0 ) /* CFF is CCW */ - break; - - /* invert darkening and render again */ - /* TODO: this should be a parameter to getOutline-computeOffset */ - font->reverseWinding = TRUE; - - needWinding = FALSE; /* exit after next iteration */ - } - - /* finish storing client outline */ - cf2_outline_close( &font->outline ); - - exit: - /* FreeType just wants the advance width; there is no translation */ - *glyphWidth = advWidth; - - /* free resources and collect errors from objects we've used */ - cf2_setError( &font->error, lastError ); - - return font->error; - } - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2font.h b/src/3rdparty/freetype/src/cff/cf2font.h deleted file mode 100644 index 86cf02f49d..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2font.h +++ /dev/null @@ -1,121 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2font.h */ -/* */ -/* Adobe's code for font instances (specification). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2FONT_H__ -#define __CF2FONT_H__ - - -#include "cf2ft.h" -#include "cf2blues.h" - - -FT_BEGIN_HEADER - - -#define CF2_OPERAND_STACK_SIZE 48 -#define CF2_MAX_SUBR 16 /* maximum subroutine nesting; */ - /* only 10 are allowed but there exist */ - /* fonts like `HiraKakuProN-W3.ttf' */ - /* (Hiragino Kaku Gothic ProN W3; */ - /* 8.2d6e1; 2014-12-19) that exceed */ - /* this limit */ - - - /* typedef is in `cf2glue.h' */ - struct CF2_FontRec_ - { - FT_Memory memory; - FT_Error error; /* shared error for this instance */ - - CF2_RenderingFlags renderingFlags; - - /* variables that depend on Transform: */ - /* the following have zero translation; */ - /* inner * outer = font * original */ - - CF2_Matrix currentTransform; /* original client matrix */ - CF2_Matrix innerTransform; /* for hinting; erect, scaled */ - CF2_Matrix outerTransform; /* post hinting; includes rotations */ - CF2_Fixed ppem; /* transform-dependent */ - - CF2_Int unitsPerEm; - - CF2_Fixed syntheticEmboldeningAmountX; /* character space units */ - CF2_Fixed syntheticEmboldeningAmountY; /* character space units */ - - /* FreeType related members */ - CF2_OutlineRec outline; /* freetype glyph outline functions */ - CFF_Decoder* decoder; - CFF_SubFont lastSubfont; /* FreeType parsed data; */ - /* top font or subfont */ - - /* these flags can vary from one call to the next */ - FT_Bool hinted; - FT_Bool darkened; /* true if stemDarkened or synthetic bold */ - /* i.e. darkenX != 0 || darkenY != 0 */ - FT_Bool stemDarkened; - - FT_Int darkenParams[8]; /* 1000 unit character space */ - - /* variables that depend on both FontDict and Transform */ - CF2_Fixed stdVW; /* in character space; depends on dict entry */ - CF2_Fixed stdHW; /* in character space; depends on dict entry */ - CF2_Fixed darkenX; /* character space units */ - CF2_Fixed darkenY; /* depends on transform */ - /* and private dict (StdVW) */ - FT_Bool reverseWinding; /* darken assuming */ - /* counterclockwise winding */ - - CF2_BluesRec blues; /* computed zone data */ - }; - - - FT_LOCAL( FT_Error ) - cf2_getGlyphOutline( CF2_Font font, - CF2_Buffer charstring, - const CF2_Matrix* transform, - CF2_F16Dot16* glyphWidth ); - - -FT_END_HEADER - - -#endif /* __CF2FONT_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2ft.c b/src/3rdparty/freetype/src/cff/cf2ft.c deleted file mode 100644 index d2544a2345..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2ft.c +++ /dev/null @@ -1,700 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2ft.c */ -/* */ -/* FreeType Glue Component to Adobe's Interpreter (body). */ -/* */ -/* Copyright 2013-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#include "cf2ft.h" -#include FT_INTERNAL_DEBUG_H - -#include "cf2font.h" -#include "cf2error.h" - - -#define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */ - - - /* - * This check should avoid most internal overflow cases. Clients should - * generally respond to `Glyph_Too_Big' by getting a glyph outline - * at EM size, scaling it and filling it as a graphics operation. - * - */ - static FT_Error - cf2_checkTransform( const CF2_Matrix* transform, - CF2_Int unitsPerEm ) - { - CF2_Fixed maxScale; - - - FT_ASSERT( unitsPerEm > 0 ); - - if ( transform->a <= 0 || transform->d <= 0 ) - return FT_THROW( Invalid_Size_Handle ); - - FT_ASSERT( transform->b == 0 && transform->c == 0 ); - FT_ASSERT( transform->tx == 0 && transform->ty == 0 ); - - if ( unitsPerEm > 0x7FFF ) - return FT_THROW( Glyph_Too_Big ); - - maxScale = FT_DivFix( CF2_MAX_SIZE, cf2_intToFixed( unitsPerEm ) ); - - if ( transform->a > maxScale || transform->d > maxScale ) - return FT_THROW( Glyph_Too_Big ); - - return FT_Err_Ok; - } - - - static void - cf2_setGlyphWidth( CF2_Outline outline, - CF2_Fixed width ) - { - CFF_Decoder* decoder = outline->decoder; - - - FT_ASSERT( decoder ); - - decoder->glyph_width = cf2_fixedToInt( width ); - } - - - /* Clean up font instance. */ - static void - cf2_free_instance( void* ptr ) - { - CF2_Font font = (CF2_Font)ptr; - - - if ( font ) - { - FT_Memory memory = font->memory; - - - (void)memory; - } - } - - - /********************************************/ - /* */ - /* functions for handling client outline; */ - /* FreeType uses coordinates in 26.6 format */ - /* */ - /********************************************/ - - static void - cf2_builder_moveTo( CF2_OutlineCallbacks callbacks, - const CF2_CallbackParams params ) - { - /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; - - (void)params; /* only used in debug mode */ - - - FT_ASSERT( outline && outline->decoder ); - FT_ASSERT( params->op == CF2_PathOpMoveTo ); - - builder = &outline->decoder->builder; - - /* note: two successive moves simply close the contour twice */ - cff_builder_close_contour( builder ); - builder->path_begun = 0; - } - - - static void - cf2_builder_lineTo( CF2_OutlineCallbacks callbacks, - const CF2_CallbackParams params ) - { - FT_Error error; - - /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; - - - FT_ASSERT( outline && outline->decoder ); - FT_ASSERT( params->op == CF2_PathOpLineTo ); - - builder = &outline->decoder->builder; - - if ( !builder->path_begun ) - { - /* record the move before the line; also check points and set */ - /* `path_begun' */ - error = cff_builder_start_point( builder, - params->pt0.x, - params->pt0.y ); - if ( error ) - { - if ( !*callbacks->error ) - *callbacks->error = error; - return; - } - } - - /* `cff_builder_add_point1' includes a check_points call for one point */ - error = cff_builder_add_point1( builder, - params->pt1.x, - params->pt1.y ); - if ( error ) - { - if ( !*callbacks->error ) - *callbacks->error = error; - return; - } - } - - - static void - cf2_builder_cubeTo( CF2_OutlineCallbacks callbacks, - const CF2_CallbackParams params ) - { - FT_Error error; - - /* downcast the object pointer */ - CF2_Outline outline = (CF2_Outline)callbacks; - CFF_Builder* builder; - - - FT_ASSERT( outline && outline->decoder ); - FT_ASSERT( params->op == CF2_PathOpCubeTo ); - - builder = &outline->decoder->builder; - - if ( !builder->path_begun ) - { - /* record the move before the line; also check points and set */ - /* `path_begun' */ - error = cff_builder_start_point( builder, - params->pt0.x, - params->pt0.y ); - if ( error ) - { - if ( !*callbacks->error ) - *callbacks->error = error; - return; - } - } - - /* prepare room for 3 points: 2 off-curve, 1 on-curve */ - error = cff_check_points( builder, 3 ); - if ( error ) - { - if ( !*callbacks->error ) - *callbacks->error = error; - return; - } - - cff_builder_add_point( builder, - params->pt1.x, - params->pt1.y, 0 ); - cff_builder_add_point( builder, - params->pt2.x, - params->pt2.y, 0 ); - cff_builder_add_point( builder, - params->pt3.x, - params->pt3.y, 1 ); - } - - - static void - cf2_outline_init( CF2_Outline outline, - FT_Memory memory, - FT_Error* error ) - { - FT_MEM_ZERO( outline, sizeof ( CF2_OutlineRec ) ); - - outline->root.memory = memory; - outline->root.error = error; - - outline->root.moveTo = cf2_builder_moveTo; - outline->root.lineTo = cf2_builder_lineTo; - outline->root.cubeTo = cf2_builder_cubeTo; - } - - - /* get scaling and hint flag from GlyphSlot */ - static void - cf2_getScaleAndHintFlag( CFF_Decoder* decoder, - CF2_Fixed* x_scale, - CF2_Fixed* y_scale, - FT_Bool* hinted, - FT_Bool* scaled ) - { - FT_ASSERT( decoder && decoder->builder.glyph ); - - /* note: FreeType scale includes a factor of 64 */ - *hinted = decoder->builder.glyph->hint; - *scaled = decoder->builder.glyph->scaled; - - if ( *hinted ) - { - *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64; - *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64; - } - else - { - /* for unhinted outlines, `cff_slot_load' does the scaling, */ - /* thus render at `unity' scale */ - - *x_scale = 0x0400; /* 1/64 as 16.16 */ - *y_scale = 0x0400; - } - } - - - /* get units per em from `FT_Face' */ - /* TODO: should handle font matrix concatenation? */ - static FT_UShort - cf2_getUnitsPerEm( CFF_Decoder* decoder ) - { - FT_ASSERT( decoder && decoder->builder.face ); - FT_ASSERT( decoder->builder.face->root.units_per_EM ); - - return decoder->builder.face->root.units_per_EM; - } - - - /* Main entry point: Render one glyph. */ - FT_LOCAL_DEF( FT_Error ) - cf2_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len ) - { - FT_Memory memory; - FT_Error error = FT_Err_Ok; - CF2_Font font; - - - FT_ASSERT( decoder && decoder->cff ); - - memory = decoder->builder.memory; - - /* CF2 data is saved here across glyphs */ - font = (CF2_Font)decoder->cff->cf2_instance.data; - - /* on first glyph, allocate instance structure */ - if ( decoder->cff->cf2_instance.data == NULL ) - { - decoder->cff->cf2_instance.finalizer = - (FT_Generic_Finalizer)cf2_free_instance; - - if ( FT_ALLOC( decoder->cff->cf2_instance.data, - sizeof ( CF2_FontRec ) ) ) - return FT_THROW( Out_Of_Memory ); - - font = (CF2_Font)decoder->cff->cf2_instance.data; - - font->memory = memory; - - /* initialize a client outline, to be shared by each glyph rendered */ - cf2_outline_init( &font->outline, font->memory, &font->error ); - } - - /* save decoder; it is a stack variable and will be different on each */ - /* call */ - font->decoder = decoder; - font->outline.decoder = decoder; - - { - /* build parameters for Adobe engine */ - - CFF_Builder* builder = &decoder->builder; - CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); - - /* local error */ - FT_Error error2 = FT_Err_Ok; - CF2_BufferRec buf; - CF2_Matrix transform; - CF2_F16Dot16 glyphWidth; - - FT_Bool hinted; - FT_Bool scaled; - - - /* FreeType has already looked up the GID; convert to */ - /* `RegionBuffer', assuming that the input has been validated */ - FT_ASSERT( charstring_base + charstring_len >= charstring_base ); - - FT_ZERO( &buf ); - buf.start = - buf.ptr = charstring_base; - buf.end = charstring_base + charstring_len; - - FT_ZERO( &transform ); - - cf2_getScaleAndHintFlag( decoder, - &transform.a, - &transform.d, - &hinted, - &scaled ); - - font->renderingFlags = 0; - if ( hinted ) - font->renderingFlags |= CF2_FlagsHinted; - if ( scaled && !driver->no_stem_darkening ) - font->renderingFlags |= CF2_FlagsDarkened; - - font->darkenParams[0] = driver->darken_params[0]; - font->darkenParams[1] = driver->darken_params[1]; - font->darkenParams[2] = driver->darken_params[2]; - font->darkenParams[3] = driver->darken_params[3]; - font->darkenParams[4] = driver->darken_params[4]; - font->darkenParams[5] = driver->darken_params[5]; - font->darkenParams[6] = driver->darken_params[6]; - font->darkenParams[7] = driver->darken_params[7]; - - /* now get an outline for this glyph; */ - /* also get units per em to validate scale */ - font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder ); - - if ( scaled ) - { - error2 = cf2_checkTransform( &transform, font->unitsPerEm ); - if ( error2 ) - return error2; - } - - error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth ); - if ( error2 ) - return FT_ERR( Invalid_File_Format ); - - cf2_setGlyphWidth( &font->outline, glyphWidth ); - - return FT_Err_Ok; - } - } - - - /* get pointer to current FreeType subfont (based on current glyphID) */ - FT_LOCAL_DEF( CFF_SubFont ) - cf2_getSubfont( CFF_Decoder* decoder ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - return decoder->current_subfont; - } - - - /* get `y_ppem' from `CFF_Size' */ - FT_LOCAL_DEF( CF2_Fixed ) - cf2_getPpemY( CFF_Decoder* decoder ) - { - FT_ASSERT( decoder && - decoder->builder.face && - decoder->builder.face->root.size ); - - /* - * Note that `y_ppem' can be zero if there wasn't a call to - * `FT_Set_Char_Size' or something similar. However, this isn't a - * problem since we come to this place in the code only if - * FT_LOAD_NO_SCALE is set (the other case gets caught by - * `cf2_checkTransform'). The ppem value is needed to compute the stem - * darkening, which is disabled for getting the unscaled outline. - * - */ - return cf2_intToFixed( - decoder->builder.face->root.size->metrics.y_ppem ); - } - - - /* get standard stem widths for the current subfont; */ - /* FreeType stores these as integer font units */ - /* (note: variable names seem swapped) */ - FT_LOCAL_DEF( CF2_Fixed ) - cf2_getStdVW( CFF_Decoder* decoder ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - return cf2_intToFixed( - decoder->current_subfont->private_dict.standard_height ); - } - - - FT_LOCAL_DEF( CF2_Fixed ) - cf2_getStdHW( CFF_Decoder* decoder ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - return cf2_intToFixed( - decoder->current_subfont->private_dict.standard_width ); - } - - - /* note: FreeType stores 1000 times the actual value for `BlueScale' */ - FT_LOCAL_DEF( void ) - cf2_getBlueMetrics( CFF_Decoder* decoder, - CF2_Fixed* blueScale, - CF2_Fixed* blueShift, - CF2_Fixed* blueFuzz ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - *blueScale = FT_DivFix( - decoder->current_subfont->private_dict.blue_scale, - cf2_intToFixed( 1000 ) ); - *blueShift = cf2_intToFixed( - decoder->current_subfont->private_dict.blue_shift ); - *blueFuzz = cf2_intToFixed( - decoder->current_subfont->private_dict.blue_fuzz ); - } - - - /* get blue values counts and arrays; the FreeType parser has validated */ - /* the counts and verified that each is an even number */ - FT_LOCAL_DEF( void ) - cf2_getBlueValues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - *count = decoder->current_subfont->private_dict.num_blue_values; - *data = (FT_Pos*) - &decoder->current_subfont->private_dict.blue_values; - } - - - FT_LOCAL_DEF( void ) - cf2_getOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - *count = decoder->current_subfont->private_dict.num_other_blues; - *data = (FT_Pos*) - &decoder->current_subfont->private_dict.other_blues; - } - - - FT_LOCAL_DEF( void ) - cf2_getFamilyBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - *count = decoder->current_subfont->private_dict.num_family_blues; - *data = (FT_Pos*) - &decoder->current_subfont->private_dict.family_blues; - } - - - FT_LOCAL_DEF( void ) - cf2_getFamilyOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - *count = decoder->current_subfont->private_dict.num_family_other_blues; - *data = (FT_Pos*) - &decoder->current_subfont->private_dict.family_other_blues; - } - - - FT_LOCAL_DEF( CF2_Int ) - cf2_getLanguageGroup( CFF_Decoder* decoder ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - return decoder->current_subfont->private_dict.language_group; - } - - - /* convert unbiased subroutine index to `CF2_Buffer' and */ - /* return 0 on success */ - FT_LOCAL_DEF( CF2_Int ) - cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, - CF2_UInt idx, - CF2_Buffer buf ) - { - FT_ASSERT( decoder ); - - FT_ZERO( buf ); - - idx += (CF2_UInt)decoder->globals_bias; - if ( idx >= decoder->num_globals ) - return TRUE; /* error */ - - FT_ASSERT( decoder->globals ); - - buf->start = - buf->ptr = decoder->globals[idx]; - buf->end = decoder->globals[idx + 1]; - - return FALSE; /* success */ - } - - - /* convert AdobeStandardEncoding code to CF2_Buffer; */ - /* used for seac component */ - FT_LOCAL_DEF( FT_Error ) - cf2_getSeacComponent( CFF_Decoder* decoder, - CF2_Int code, - CF2_Buffer buf ) - { - CF2_Int gid; - FT_Byte* charstring; - FT_ULong len; - FT_Error error; - - - FT_ASSERT( decoder ); - - FT_ZERO( buf ); - -#ifdef FT_CONFIG_OPTION_INCREMENTAL - /* Incremental fonts don't necessarily have valid charsets. */ - /* They use the character code, not the glyph index, in this case. */ - if ( decoder->builder.face->root.internal->incremental_interface ) - gid = code; - else -#endif /* FT_CONFIG_OPTION_INCREMENTAL */ - { - gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code ); - if ( gid < 0 ) - return FT_THROW( Invalid_Glyph_Format ); - } - - error = cff_get_glyph_data( decoder->builder.face, - (CF2_UInt)gid, - &charstring, - &len ); - /* TODO: for now, just pass the FreeType error through */ - if ( error ) - return error; - - /* assume input has been validated */ - FT_ASSERT( charstring + len >= charstring ); - - buf->start = charstring; - buf->end = charstring + len; - buf->ptr = buf->start; - - return FT_Err_Ok; - } - - - FT_LOCAL_DEF( void ) - cf2_freeSeacComponent( CFF_Decoder* decoder, - CF2_Buffer buf ) - { - FT_ASSERT( decoder ); - - cff_free_glyph_data( decoder->builder.face, - (FT_Byte**)&buf->start, - (FT_ULong)( buf->end - buf->start ) ); - } - - - FT_LOCAL_DEF( CF2_Int ) - cf2_initLocalRegionBuffer( CFF_Decoder* decoder, - CF2_UInt idx, - CF2_Buffer buf ) - { - FT_ASSERT( decoder ); - - FT_ZERO( buf ); - - idx += (CF2_UInt)decoder->locals_bias; - if ( idx >= decoder->num_locals ) - return TRUE; /* error */ - - FT_ASSERT( decoder->locals ); - - buf->start = - buf->ptr = decoder->locals[idx]; - buf->end = decoder->locals[idx + 1]; - - return FALSE; /* success */ - } - - - FT_LOCAL_DEF( CF2_Fixed ) - cf2_getDefaultWidthX( CFF_Decoder* decoder ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - return cf2_intToFixed( - decoder->current_subfont->private_dict.default_width ); - } - - - FT_LOCAL_DEF( CF2_Fixed ) - cf2_getNominalWidthX( CFF_Decoder* decoder ) - { - FT_ASSERT( decoder && decoder->current_subfont ); - - return cf2_intToFixed( - decoder->current_subfont->private_dict.nominal_width ); - } - - - FT_LOCAL_DEF( void ) - cf2_outline_reset( CF2_Outline outline ) - { - CFF_Decoder* decoder = outline->decoder; - - - FT_ASSERT( decoder ); - - outline->root.windingMomentum = 0; - - FT_GlyphLoader_Rewind( decoder->builder.loader ); - } - - - FT_LOCAL_DEF( void ) - cf2_outline_close( CF2_Outline outline ) - { - CFF_Decoder* decoder = outline->decoder; - - - FT_ASSERT( decoder ); - - cff_builder_close_contour( &decoder->builder ); - - FT_GlyphLoader_Add( decoder->builder.loader ); - } - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2ft.h b/src/3rdparty/freetype/src/cff/cf2ft.h deleted file mode 100644 index 3073df382f..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2ft.h +++ /dev/null @@ -1,147 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2ft.h */ -/* */ -/* FreeType Glue Component to Adobe's Interpreter (specification). */ -/* */ -/* Copyright 2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2FT_H__ -#define __CF2FT_H__ - - -#include "cf2types.h" - - - /* TODO: disable asserts for now */ -#define CF2_NDEBUG - - -#include FT_SYSTEM_H - -#include "cf2glue.h" -#include "cffgload.h" /* for CFF_Decoder */ - - -FT_BEGIN_HEADER - - - FT_LOCAL( FT_Error ) - cf2_decoder_parse_charstrings( CFF_Decoder* decoder, - FT_Byte* charstring_base, - FT_ULong charstring_len ); - - FT_LOCAL( CFF_SubFont ) - cf2_getSubfont( CFF_Decoder* decoder ); - - - FT_LOCAL( CF2_Fixed ) - cf2_getPpemY( CFF_Decoder* decoder ); - FT_LOCAL( CF2_Fixed ) - cf2_getStdVW( CFF_Decoder* decoder ); - FT_LOCAL( CF2_Fixed ) - cf2_getStdHW( CFF_Decoder* decoder ); - - FT_LOCAL( void ) - cf2_getBlueMetrics( CFF_Decoder* decoder, - CF2_Fixed* blueScale, - CF2_Fixed* blueShift, - CF2_Fixed* blueFuzz ); - FT_LOCAL( void ) - cf2_getBlueValues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); - FT_LOCAL( void ) - cf2_getOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); - FT_LOCAL( void ) - cf2_getFamilyBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); - FT_LOCAL( void ) - cf2_getFamilyOtherBlues( CFF_Decoder* decoder, - size_t* count, - FT_Pos* *data ); - - FT_LOCAL( CF2_Int ) - cf2_getLanguageGroup( CFF_Decoder* decoder ); - - FT_LOCAL( CF2_Int ) - cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, - CF2_UInt idx, - CF2_Buffer buf ); - FT_LOCAL( FT_Error ) - cf2_getSeacComponent( CFF_Decoder* decoder, - CF2_Int code, - CF2_Buffer buf ); - FT_LOCAL( void ) - cf2_freeSeacComponent( CFF_Decoder* decoder, - CF2_Buffer buf ); - FT_LOCAL( CF2_Int ) - cf2_initLocalRegionBuffer( CFF_Decoder* decoder, - CF2_UInt idx, - CF2_Buffer buf ); - - FT_LOCAL( CF2_Fixed ) - cf2_getDefaultWidthX( CFF_Decoder* decoder ); - FT_LOCAL( CF2_Fixed ) - cf2_getNominalWidthX( CFF_Decoder* decoder ); - - - /* - * FreeType client outline - * - * process output from the charstring interpreter - */ - typedef struct CF2_OutlineRec_ - { - CF2_OutlineCallbacksRec root; /* base class must be first */ - CFF_Decoder* decoder; - - } CF2_OutlineRec, *CF2_Outline; - - - FT_LOCAL( void ) - cf2_outline_reset( CF2_Outline outline ); - FT_LOCAL( void ) - cf2_outline_close( CF2_Outline outline ); - - -FT_END_HEADER - - -#endif /* __CF2FT_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2glue.h b/src/3rdparty/freetype/src/cff/cf2glue.h deleted file mode 100644 index a24da39e93..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2glue.h +++ /dev/null @@ -1,144 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2glue.h */ -/* */ -/* Adobe's code for shared stuff (specification only). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2GLUE_H__ -#define __CF2GLUE_H__ - - -/* common includes for other modules */ -#include "cf2error.h" -#include "cf2fixed.h" -#include "cf2arrst.h" -#include "cf2read.h" - - -FT_BEGIN_HEADER - - - /* rendering parameters */ - - /* apply hints to rendered glyphs */ -#define CF2_FlagsHinted 1 - /* for testing */ -#define CF2_FlagsDarkened 2 - - /* type for holding the flags */ - typedef CF2_Int CF2_RenderingFlags; - - - /* elements of a glyph outline */ - typedef enum CF2_PathOp_ - { - CF2_PathOpMoveTo = 1, /* change the current point */ - CF2_PathOpLineTo = 2, /* line */ - CF2_PathOpQuadTo = 3, /* quadratic curve */ - CF2_PathOpCubeTo = 4 /* cubic curve */ - - } CF2_PathOp; - - - /* a matrix of fixed point values */ - typedef struct CF2_Matrix_ - { - CF2_F16Dot16 a; - CF2_F16Dot16 b; - CF2_F16Dot16 c; - CF2_F16Dot16 d; - CF2_F16Dot16 tx; - CF2_F16Dot16 ty; - - } CF2_Matrix; - - - /* these typedefs are needed by more than one header file */ - /* and gcc compiler doesn't allow redefinition */ - typedef struct CF2_FontRec_ CF2_FontRec, *CF2_Font; - typedef struct CF2_HintRec_ CF2_HintRec, *CF2_Hint; - - - /* A common structure for all callback parameters. */ - /* */ - /* Some members may be unused. For example, `pt0' is not used for */ - /* `moveTo' and `pt3' is not used for `quadTo'. The initial point `pt0' */ - /* is included for each path element for generality; curve conversions */ - /* need it. The `op' parameter allows one function to handle multiple */ - /* element types. */ - - typedef struct CF2_CallbackParamsRec_ - { - FT_Vector pt0; - FT_Vector pt1; - FT_Vector pt2; - FT_Vector pt3; - - CF2_Int op; - - } CF2_CallbackParamsRec, *CF2_CallbackParams; - - - /* forward reference */ - typedef struct CF2_OutlineCallbacksRec_ CF2_OutlineCallbacksRec, - *CF2_OutlineCallbacks; - - /* callback function pointers */ - typedef void - (*CF2_Callback_Type)( CF2_OutlineCallbacks callbacks, - const CF2_CallbackParams params ); - - - struct CF2_OutlineCallbacksRec_ - { - CF2_Callback_Type moveTo; - CF2_Callback_Type lineTo; - CF2_Callback_Type quadTo; - CF2_Callback_Type cubeTo; - - CF2_Int windingMomentum; /* for winding order detection */ - - FT_Memory memory; - FT_Error* error; - }; - - -FT_END_HEADER - - -#endif /* __CF2GLUE_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2hints.c b/src/3rdparty/freetype/src/cff/cf2hints.c deleted file mode 100644 index 0e27000210..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2hints.c +++ /dev/null @@ -1,1847 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2hints.c */ -/* */ -/* Adobe's code for handling CFF hints (body). */ -/* */ -/* Copyright 2007-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#include "cf2ft.h" -#include FT_INTERNAL_DEBUG_H - -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2hints.h" -#include "cf2intrp.h" - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_cf2hints - - - typedef struct CF2_HintMoveRec_ - { - size_t j; /* index of upper hint map edge */ - CF2_Fixed moveUp; /* adjustment to optimum position */ - - } CF2_HintMoveRec, *CF2_HintMove; - - - /* Compute angular momentum for winding order detection. It is called */ - /* for all lines and curves, but not necessarily in element order. */ - static CF2_Int - cf2_getWindingMomentum( CF2_Fixed x1, - CF2_Fixed y1, - CF2_Fixed x2, - CF2_Fixed y2 ) - { - /* cross product of pt1 position from origin with pt2 position from */ - /* pt1; we reduce the precision so that the result fits into 32 bits */ - - return ( x1 >> 16 ) * ( ( y2 - y1 ) >> 16 ) - - ( y1 >> 16 ) * ( ( x2 - x1 ) >> 16 ); - } - - - /* - * Construct from a StemHint; this is used as a parameter to - * `cf2_blues_capture'. - * `hintOrigin' is the character space displacement of a seac accent. - * Adjust stem hint for darkening here. - * - */ - static void - cf2_hint_init( CF2_Hint hint, - const CF2_ArrStack stemHintArray, - size_t indexStemHint, - const CF2_Font font, - CF2_Fixed hintOrigin, - CF2_Fixed scale, - FT_Bool bottom ) - { - CF2_Fixed width; - const CF2_StemHintRec* stemHint; - - - FT_ZERO( hint ); - - stemHint = (const CF2_StemHintRec*)cf2_arrstack_getPointer( - stemHintArray, - indexStemHint ); - - width = stemHint->max - stemHint->min; - - if ( width == cf2_intToFixed( -21 ) ) - { - /* ghost bottom */ - - if ( bottom ) - { - hint->csCoord = stemHint->max; - hint->flags = CF2_GhostBottom; - } - else - hint->flags = 0; - } - - else if ( width == cf2_intToFixed( -20 ) ) - { - /* ghost top */ - - if ( bottom ) - hint->flags = 0; - else - { - hint->csCoord = stemHint->min; - hint->flags = CF2_GhostTop; - } - } - - else if ( width < 0 ) - { - /* inverted pair */ - - /* - * Hints with negative widths were produced by an early version of a - * non-Adobe font tool. The Type 2 spec allows edge (ghost) hints - * with negative widths, but says - * - * All other negative widths have undefined meaning. - * - * CoolType has a silent workaround that negates the hint width; for - * permissive mode, we do the same here. - * - * Note: Such fonts cannot use ghost hints, but should otherwise work. - * Note: Some poor hints in our faux fonts can produce negative - * widths at some blends. For example, see a light weight of - * `u' in ASerifMM. - * - */ - if ( bottom ) - { - hint->csCoord = stemHint->max; - hint->flags = CF2_PairBottom; - } - else - { - hint->csCoord = stemHint->min; - hint->flags = CF2_PairTop; - } - } - - else - { - /* normal pair */ - - if ( bottom ) - { - hint->csCoord = stemHint->min; - hint->flags = CF2_PairBottom; - } - else - { - hint->csCoord = stemHint->max; - hint->flags = CF2_PairTop; - } - } - - /* Now that ghost hints have been detected, adjust this edge for */ - /* darkening. Bottoms are not changed; tops are incremented by twice */ - /* `darkenY'. */ - if ( cf2_hint_isTop( hint ) ) - hint->csCoord += 2 * font->darkenY; - - hint->csCoord += hintOrigin; - hint->scale = scale; - hint->index = indexStemHint; /* index in original stem hint array */ - - /* if original stem hint has been used, use the same position */ - if ( hint->flags != 0 && stemHint->used ) - { - if ( cf2_hint_isTop( hint ) ) - hint->dsCoord = stemHint->maxDS; - else - hint->dsCoord = stemHint->minDS; - - cf2_hint_lock( hint ); - } - else - hint->dsCoord = FT_MulFix( hint->csCoord, scale ); - } - - - /* initialize an invalid hint map element */ - static void - cf2_hint_initZero( CF2_Hint hint ) - { - FT_ZERO( hint ); - } - - - FT_LOCAL_DEF( FT_Bool ) - cf2_hint_isValid( const CF2_Hint hint ) - { - return (FT_Bool)( hint->flags != 0 ); - } - - - static FT_Bool - cf2_hint_isPair( const CF2_Hint hint ) - { - return (FT_Bool)( ( hint->flags & - ( CF2_PairBottom | CF2_PairTop ) ) != 0 ); - } - - - static FT_Bool - cf2_hint_isPairTop( const CF2_Hint hint ) - { - return (FT_Bool)( ( hint->flags & CF2_PairTop ) != 0 ); - } - - - FT_LOCAL_DEF( FT_Bool ) - cf2_hint_isTop( const CF2_Hint hint ) - { - return (FT_Bool)( ( hint->flags & - ( CF2_PairTop | CF2_GhostTop ) ) != 0 ); - } - - - FT_LOCAL_DEF( FT_Bool ) - cf2_hint_isBottom( const CF2_Hint hint ) - { - return (FT_Bool)( ( hint->flags & - ( CF2_PairBottom | CF2_GhostBottom ) ) != 0 ); - } - - - static FT_Bool - cf2_hint_isLocked( const CF2_Hint hint ) - { - return (FT_Bool)( ( hint->flags & CF2_Locked ) != 0 ); - } - - - static FT_Bool - cf2_hint_isSynthetic( const CF2_Hint hint ) - { - return (FT_Bool)( ( hint->flags & CF2_Synthetic ) != 0 ); - } - - - FT_LOCAL_DEF( void ) - cf2_hint_lock( CF2_Hint hint ) - { - hint->flags |= CF2_Locked; - } - - - FT_LOCAL_DEF( void ) - cf2_hintmap_init( CF2_HintMap hintmap, - CF2_Font font, - CF2_HintMap initialMap, - CF2_ArrStack hintMoves, - CF2_Fixed scale ) - { - FT_ZERO( hintmap ); - - /* copy parameters from font instance */ - hintmap->hinted = font->hinted; - hintmap->scale = scale; - hintmap->font = font; - hintmap->initialHintMap = initialMap; - /* will clear in `cf2_hintmap_adjustHints' */ - hintmap->hintMoves = hintMoves; - } - - - static FT_Bool - cf2_hintmap_isValid( const CF2_HintMap hintmap ) - { - return hintmap->isValid; - } - - - /* transform character space coordinate to device space using hint map */ - static CF2_Fixed - cf2_hintmap_map( CF2_HintMap hintmap, - CF2_Fixed csCoord ) - { - if ( hintmap->count == 0 || ! hintmap->hinted ) - { - /* there are no hints; use uniform scale and zero offset */ - return FT_MulFix( csCoord, hintmap->scale ); - } - else - { - /* start linear search from last hit */ - CF2_UInt i = hintmap->lastIndex; - - FT_ASSERT( hintmap->lastIndex < CF2_MAX_HINT_EDGES ); - - /* search up */ - while ( i < hintmap->count - 1 && - csCoord >= hintmap->edge[i + 1].csCoord ) - i += 1; - - /* search down */ - while ( i > 0 && csCoord < hintmap->edge[i].csCoord ) - i -= 1; - - hintmap->lastIndex = i; - - if ( i == 0 && csCoord < hintmap->edge[0].csCoord ) - { - /* special case for points below first edge: use uniform scale */ - return FT_MulFix( csCoord - hintmap->edge[0].csCoord, - hintmap->scale ) + - hintmap->edge[0].dsCoord; - } - else - { - /* - * Note: entries with duplicate csCoord are allowed. - * Use edge[i], the highest entry where csCoord >= entry[i].csCoord - */ - return FT_MulFix( csCoord - hintmap->edge[i].csCoord, - hintmap->edge[i].scale ) + - hintmap->edge[i].dsCoord; - } - } - } - - - /* - * This hinting policy moves a hint pair in device space so that one of - * its two edges is on a device pixel boundary (its fractional part is - * zero). `cf2_hintmap_insertHint' guarantees no overlap in CS - * space. Ensure here that there is no overlap in DS. - * - * In the first pass, edges are adjusted relative to adjacent hints. - * Those that are below have already been adjusted. Those that are - * above have not yet been adjusted. If a hint above blocks an - * adjustment to an optimal position, we will try again in a second - * pass. The second pass is top-down. - * - */ - - static void - cf2_hintmap_adjustHints( CF2_HintMap hintmap ) - { - size_t i, j; - - - cf2_arrstack_clear( hintmap->hintMoves ); /* working storage */ - - /* - * First pass is bottom-up (font hint order) without look-ahead. - * Locked edges are already adjusted. - * Unlocked edges begin with dsCoord from `initialHintMap'. - * Save edges that are not optimally adjusted in `hintMoves' array, - * and process them in second pass. - */ - - for ( i = 0; i < hintmap->count; i++ ) - { - FT_Bool isPair = cf2_hint_isPair( &hintmap->edge[i] ); - - - /* index of upper edge (same value for ghost hint) */ - j = isPair ? i + 1 : i; - - FT_ASSERT( j < hintmap->count ); - FT_ASSERT( cf2_hint_isValid( &hintmap->edge[i] ) ); - FT_ASSERT( cf2_hint_isValid( &hintmap->edge[j] ) ); - FT_ASSERT( cf2_hint_isLocked( &hintmap->edge[i] ) == - cf2_hint_isLocked( &hintmap->edge[j] ) ); - - if ( !cf2_hint_isLocked( &hintmap->edge[i] ) ) - { - /* hint edge is not locked, we can adjust it */ - CF2_Fixed fracDown = cf2_fixedFraction( hintmap->edge[i].dsCoord ); - CF2_Fixed fracUp = cf2_fixedFraction( hintmap->edge[j].dsCoord ); - - /* calculate all four possibilities; moves down are negative */ - CF2_Fixed downMoveDown = 0 - fracDown; - CF2_Fixed upMoveDown = 0 - fracUp; - CF2_Fixed downMoveUp = fracDown == 0 - ? 0 - : cf2_intToFixed( 1 ) - fracDown; - CF2_Fixed upMoveUp = fracUp == 0 - ? 0 - : cf2_intToFixed( 1 ) - fracUp; - - /* smallest move up */ - CF2_Fixed moveUp = FT_MIN( downMoveUp, upMoveUp ); - /* smallest move down */ - CF2_Fixed moveDown = FT_MAX( downMoveDown, upMoveDown ); - - /* final amount to move edge or edge pair */ - CF2_Fixed move; - - CF2_Fixed downMinCounter = CF2_MIN_COUNTER; - CF2_Fixed upMinCounter = CF2_MIN_COUNTER; - FT_Bool saveEdge = FALSE; - - - /* minimum counter constraint doesn't apply when adjacent edges */ - /* are synthetic */ - /* TODO: doesn't seem a big effect; for now, reduce the code */ -#if 0 - if ( i == 0 || - cf2_hint_isSynthetic( &hintmap->edge[i - 1] ) ) - downMinCounter = 0; - - if ( j >= hintmap->count - 1 || - cf2_hint_isSynthetic( &hintmap->edge[j + 1] ) ) - upMinCounter = 0; -#endif - - /* is there room to move up? */ - /* there is if we are at top of array or the next edge is at or */ - /* beyond proposed move up? */ - if ( j >= hintmap->count - 1 || - hintmap->edge[j + 1].dsCoord >= - hintmap->edge[j].dsCoord + moveUp + upMinCounter ) - { - /* there is room to move up; is there also room to move down? */ - if ( i == 0 || - hintmap->edge[i - 1].dsCoord <= - hintmap->edge[i].dsCoord + moveDown - downMinCounter ) - { - /* move smaller absolute amount */ - move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */ - } - else - move = moveUp; - } - else - { - /* is there room to move down? */ - if ( i == 0 || - hintmap->edge[i - 1].dsCoord <= - hintmap->edge[i].dsCoord + moveDown - downMinCounter ) - { - move = moveDown; - /* true if non-optimum move */ - saveEdge = (FT_Bool)( moveUp < -moveDown ); - } - else - { - /* no room to move either way without overlapping or reducing */ - /* the counter too much */ - move = 0; - saveEdge = TRUE; - } - } - - /* Identify non-moves and moves down that aren't optimal, and save */ - /* them for second pass. */ - /* Do this only if there is an unlocked edge above (which could */ - /* possibly move). */ - if ( saveEdge && - j < hintmap->count - 1 && - !cf2_hint_isLocked( &hintmap->edge[j + 1] ) ) - { - CF2_HintMoveRec savedMove; - - - savedMove.j = j; - /* desired adjustment in second pass */ - savedMove.moveUp = moveUp - move; - - cf2_arrstack_push( hintmap->hintMoves, &savedMove ); - } - - /* move the edge(s) */ - hintmap->edge[i].dsCoord += move; - if ( isPair ) - hintmap->edge[j].dsCoord += move; - } - - /* assert there are no overlaps in device space */ - FT_ASSERT( i == 0 || - hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord ); - FT_ASSERT( i < j || - hintmap->edge[i].dsCoord <= hintmap->edge[j].dsCoord ); - - /* adjust the scales, avoiding divide by zero */ - if ( i > 0 ) - { - if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord ) - hintmap->edge[i - 1].scale = - FT_DivFix( - hintmap->edge[i].dsCoord - hintmap->edge[i - 1].dsCoord, - hintmap->edge[i].csCoord - hintmap->edge[i - 1].csCoord ); - } - - if ( isPair ) - { - if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord ) - hintmap->edge[j - 1].scale = - FT_DivFix( - hintmap->edge[j].dsCoord - hintmap->edge[j - 1].dsCoord, - hintmap->edge[j].csCoord - hintmap->edge[j - 1].csCoord ); - - i += 1; /* skip upper edge on next loop */ - } - } - - /* second pass tries to move non-optimal hints up, in case there is */ - /* room now */ - for ( i = cf2_arrstack_size( hintmap->hintMoves ); i > 0; i-- ) - { - CF2_HintMove hintMove = (CF2_HintMove) - cf2_arrstack_getPointer( hintmap->hintMoves, i - 1 ); - - - j = hintMove->j; - - /* this was tested before the push, above */ - FT_ASSERT( j < hintmap->count - 1 ); - - /* is there room to move up? */ - if ( hintmap->edge[j + 1].dsCoord >= - hintmap->edge[j].dsCoord + hintMove->moveUp + CF2_MIN_COUNTER ) - { - /* there is more room now, move edge up */ - hintmap->edge[j].dsCoord += hintMove->moveUp; - - if ( cf2_hint_isPair( &hintmap->edge[j] ) ) - { - FT_ASSERT( j > 0 ); - hintmap->edge[j - 1].dsCoord += hintMove->moveUp; - } - } - } - } - - - /* insert hint edges into map, sorted by csCoord */ - static void - cf2_hintmap_insertHint( CF2_HintMap hintmap, - CF2_Hint bottomHintEdge, - CF2_Hint topHintEdge ) - { - CF2_UInt indexInsert; - - /* set default values, then check for edge hints */ - FT_Bool isPair = TRUE; - CF2_Hint firstHintEdge = bottomHintEdge; - CF2_Hint secondHintEdge = topHintEdge; - - - /* one or none of the input params may be invalid when dealing with */ - /* edge hints; at least one edge must be valid */ - FT_ASSERT( cf2_hint_isValid( bottomHintEdge ) || - cf2_hint_isValid( topHintEdge ) ); - - /* determine how many and which edges to insert */ - if ( !cf2_hint_isValid( bottomHintEdge ) ) - { - /* insert only the top edge */ - firstHintEdge = topHintEdge; - isPair = FALSE; - } - else if ( !cf2_hint_isValid( topHintEdge ) ) - { - /* insert only the bottom edge */ - isPair = FALSE; - } - - /* paired edges must be in proper order */ - FT_ASSERT( !isPair || - topHintEdge->csCoord >= bottomHintEdge->csCoord ); - - /* linear search to find index value of insertion point */ - indexInsert = 0; - for ( ; indexInsert < hintmap->count; indexInsert++ ) - { - if ( hintmap->edge[indexInsert].csCoord >= firstHintEdge->csCoord ) - break; - } - - /* - * Discard any hints that overlap in character space. Most often, this - * is while building the initial map, where captured hints from all - * zones are combined. Define overlap to include hints that `touch' - * (overlap zero). Hiragino Sans/Gothic fonts have numerous hints that - * touch. Some fonts have non-ideographic glyphs that overlap our - * synthetic hints. - * - * Overlap also occurs when darkening stem hints that are close. - * - */ - if ( indexInsert < hintmap->count ) - { - /* we are inserting before an existing edge: */ - /* verify that an existing edge is not the same */ - if ( hintmap->edge[indexInsert].csCoord == firstHintEdge->csCoord ) - return; /* ignore overlapping stem hint */ - - /* verify that a new pair does not straddle the next edge */ - if ( isPair && - hintmap->edge[indexInsert].csCoord <= secondHintEdge->csCoord ) - return; /* ignore overlapping stem hint */ - - /* verify that we are not inserting between paired edges */ - if ( cf2_hint_isPairTop( &hintmap->edge[indexInsert] ) ) - return; /* ignore overlapping stem hint */ - } - - /* recompute device space locations using initial hint map */ - if ( cf2_hintmap_isValid( hintmap->initialHintMap ) && - !cf2_hint_isLocked( firstHintEdge ) ) - { - if ( isPair ) - { - /* Use hint map to position the center of stem, and nominal scale */ - /* to position the two edges. This preserves the stem width. */ - CF2_Fixed midpoint = cf2_hintmap_map( - hintmap->initialHintMap, - ( secondHintEdge->csCoord + - firstHintEdge->csCoord ) / 2 ); - CF2_Fixed halfWidth = FT_MulFix( - ( secondHintEdge->csCoord - - firstHintEdge->csCoord ) / 2, - hintmap->scale ); - - - firstHintEdge->dsCoord = midpoint - halfWidth; - secondHintEdge->dsCoord = midpoint + halfWidth; - } - else - firstHintEdge->dsCoord = cf2_hintmap_map( hintmap->initialHintMap, - firstHintEdge->csCoord ); - } - - /* - * Discard any hints that overlap in device space; this can occur - * because locked hints have been moved to align with blue zones. - * - * TODO: Although we might correct this later during adjustment, we - * don't currently have a way to delete a conflicting hint once it has - * been inserted. See v2.030 MinionPro-Regular, 12 ppem darkened, - * initial hint map for second path, glyph 945 (the perispomeni (tilde) - * in U+1F6E, Greek omega with psili and perispomeni). Darkening is - * 25. Pair 667,747 initially conflicts in design space with top edge - * 660. This is because 667 maps to 7.87, and the top edge was - * captured by a zone at 8.0. The pair is later successfully inserted - * in a zone without the top edge. In this zone it is adjusted to 8.0, - * and no longer conflicts with the top edge in design space. This - * means it can be included in yet a later zone which does have the top - * edge hint. This produces a small mismatch between the first and - * last points of this path, even though the hint masks are the same. - * The density map difference is tiny (1/256). - * - */ - - if ( indexInsert > 0 ) - { - /* we are inserting after an existing edge */ - if ( firstHintEdge->dsCoord < hintmap->edge[indexInsert - 1].dsCoord ) - return; - } - - if ( indexInsert < hintmap->count ) - { - /* we are inserting before an existing edge */ - if ( isPair ) - { - if ( secondHintEdge->dsCoord > hintmap->edge[indexInsert].dsCoord ) - return; - } - else - { - if ( firstHintEdge->dsCoord > hintmap->edge[indexInsert].dsCoord ) - return; - } - } - - /* make room to insert */ - { - CF2_UInt iSrc = hintmap->count - 1; - CF2_UInt iDst = isPair ? hintmap->count + 1 : hintmap->count; - - CF2_UInt count = hintmap->count - indexInsert; - - - if ( iDst >= CF2_MAX_HINT_EDGES ) - { - FT_TRACE4(( "cf2_hintmap_insertHint: too many hintmaps\n" )); - return; - } - - while ( count-- ) - hintmap->edge[iDst--] = hintmap->edge[iSrc--]; - - /* insert first edge */ - hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */ - hintmap->count += 1; - - if ( isPair ) - { - /* insert second edge */ - hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */ - hintmap->count += 1; - } - } - - return; - } - - - /* - * Build a map from hints and mask. - * - * This function may recur one level if `hintmap->initialHintMap' is not yet - * valid. - * If `initialMap' is true, simply build initial map. - * - * Synthetic hints are used in two ways. A hint at zero is inserted, if - * needed, in the initial hint map, to prevent translations from - * propagating across the origin. If synthetic em box hints are enabled - * for ideographic dictionaries, then they are inserted in all hint - * maps, including the initial one. - * - */ - FT_LOCAL_DEF( void ) - cf2_hintmap_build( CF2_HintMap hintmap, - CF2_ArrStack hStemHintArray, - CF2_ArrStack vStemHintArray, - CF2_HintMask hintMask, - CF2_Fixed hintOrigin, - FT_Bool initialMap ) - { - FT_Byte* maskPtr; - - CF2_Font font = hintmap->font; - CF2_HintMaskRec tempHintMask; - - size_t bitCount, i; - FT_Byte maskByte; - - - /* check whether initial map is constructed */ - if ( !initialMap && !cf2_hintmap_isValid( hintmap->initialHintMap ) ) - { - /* make recursive call with initialHintMap and temporary mask; */ - /* temporary mask will get all bits set, below */ - cf2_hintmask_init( &tempHintMask, hintMask->error ); - cf2_hintmap_build( hintmap->initialHintMap, - hStemHintArray, - vStemHintArray, - &tempHintMask, - hintOrigin, - TRUE ); - } - - if ( !cf2_hintmask_isValid( hintMask ) ) - { - /* without a hint mask, assume all hints are active */ - cf2_hintmask_setAll( hintMask, - cf2_arrstack_size( hStemHintArray ) + - cf2_arrstack_size( vStemHintArray ) ); - if ( !cf2_hintmask_isValid( hintMask ) ) - return; /* too many stem hints */ - } - - /* begin by clearing the map */ - hintmap->count = 0; - hintmap->lastIndex = 0; - - /* make a copy of the hint mask so we can modify it */ - tempHintMask = *hintMask; - maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask ); - - /* use the hStem hints only, which are first in the mask */ - bitCount = cf2_arrstack_size( hStemHintArray ); - - /* Defense-in-depth. Should never return here. */ - if ( bitCount > hintMask->bitCount ) - return; - - /* synthetic embox hints get highest priority */ - if ( font->blues.doEmBoxHints ) - { - CF2_HintRec dummy; - - - cf2_hint_initZero( &dummy ); /* invalid hint map element */ - - /* ghost bottom */ - cf2_hintmap_insertHint( hintmap, - &font->blues.emBoxBottomEdge, - &dummy ); - /* ghost top */ - cf2_hintmap_insertHint( hintmap, - &dummy, - &font->blues.emBoxTopEdge ); - } - - /* insert hints captured by a blue zone or already locked (higher */ - /* priority) */ - for ( i = 0, maskByte = 0x80; i < bitCount; i++ ) - { - if ( maskByte & *maskPtr ) - { - /* expand StemHint into two `CF2_Hint' elements */ - CF2_HintRec bottomHintEdge, topHintEdge; - - - cf2_hint_init( &bottomHintEdge, - hStemHintArray, - i, - font, - hintOrigin, - hintmap->scale, - TRUE /* bottom */ ); - cf2_hint_init( &topHintEdge, - hStemHintArray, - i, - font, - hintOrigin, - hintmap->scale, - FALSE /* top */ ); - - if ( cf2_hint_isLocked( &bottomHintEdge ) || - cf2_hint_isLocked( &topHintEdge ) || - cf2_blues_capture( &font->blues, - &bottomHintEdge, - &topHintEdge ) ) - { - /* insert captured hint into map */ - cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge ); - - *maskPtr &= ~maskByte; /* turn off the bit for this hint */ - } - } - - if ( ( i & 7 ) == 7 ) - { - /* move to next mask byte */ - maskPtr++; - maskByte = 0x80; - } - else - maskByte >>= 1; - } - - /* initial hint map includes only captured hints plus maybe one at 0 */ - - /* - * TODO: There is a problem here because we are trying to build a - * single hint map containing all captured hints. It is - * possible for there to be conflicts between captured hints, - * either because of darkening or because the hints are in - * separate hint zones (we are ignoring hint zones for the - * initial map). An example of the latter is MinionPro-Regular - * v2.030 glyph 883 (Greek Capital Alpha with Psili) at 15ppem. - * A stem hint for the psili conflicts with the top edge hint - * for the base character. The stem hint gets priority because - * of its sort order. In glyph 884 (Greek Capital Alpha with - * Psili and Oxia), the top of the base character gets a stem - * hint, and the psili does not. This creates different initial - * maps for the two glyphs resulting in different renderings of - * the base character. Will probably defer this either as not - * worth the cost or as a font bug. I don't think there is any - * good reason for an accent to be captured by an alignment - * zone. -darnold 2/12/10 - */ - - if ( initialMap ) - { - /* Apply a heuristic that inserts a point for (0,0), unless it's */ - /* already covered by a mapping. This locks the baseline for glyphs */ - /* that have no baseline hints. */ - - if ( hintmap->count == 0 || - hintmap->edge[0].csCoord > 0 || - hintmap->edge[hintmap->count - 1].csCoord < 0 ) - { - /* all edges are above 0 or all edges are below 0; */ - /* construct a locked edge hint at 0 */ - - CF2_HintRec edge, invalid; - - - cf2_hint_initZero( &edge ); - - edge.flags = CF2_GhostBottom | - CF2_Locked | - CF2_Synthetic; - edge.scale = hintmap->scale; - - cf2_hint_initZero( &invalid ); - cf2_hintmap_insertHint( hintmap, &edge, &invalid ); - } - } - else - { - /* insert remaining hints */ - - maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask ); - - for ( i = 0, maskByte = 0x80; i < bitCount; i++ ) - { - if ( maskByte & *maskPtr ) - { - CF2_HintRec bottomHintEdge, topHintEdge; - - - cf2_hint_init( &bottomHintEdge, - hStemHintArray, - i, - font, - hintOrigin, - hintmap->scale, - TRUE /* bottom */ ); - cf2_hint_init( &topHintEdge, - hStemHintArray, - i, - font, - hintOrigin, - hintmap->scale, - FALSE /* top */ ); - - cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge ); - } - - if ( ( i & 7 ) == 7 ) - { - /* move to next mask byte */ - maskPtr++; - maskByte = 0x80; - } - else - maskByte >>= 1; - } - } - - /* - * Note: The following line is a convenient place to break when - * debugging hinting. Examine `hintmap->edge' for the list of - * enabled hints, then step over the call to see the effect of - * adjustment. We stop here first on the recursive call that - * creates the initial map, and then on each counter group and - * hint zone. - */ - - /* adjust positions of hint edges that are not locked to blue zones */ - cf2_hintmap_adjustHints( hintmap ); - - /* save the position of all hints that were used in this hint map; */ - /* if we use them again, we'll locate them in the same position */ - if ( !initialMap ) - { - for ( i = 0; i < hintmap->count; i++ ) - { - if ( !cf2_hint_isSynthetic( &hintmap->edge[i] ) ) - { - /* Note: include both valid and invalid edges */ - /* Note: top and bottom edges are copied back separately */ - CF2_StemHint stemhint = (CF2_StemHint) - cf2_arrstack_getPointer( hStemHintArray, - hintmap->edge[i].index ); - - - if ( cf2_hint_isTop( &hintmap->edge[i] ) ) - stemhint->maxDS = hintmap->edge[i].dsCoord; - else - stemhint->minDS = hintmap->edge[i].dsCoord; - - stemhint->used = TRUE; - } - } - } - - /* hint map is ready to use */ - hintmap->isValid = TRUE; - - /* remember this mask has been used */ - cf2_hintmask_setNew( hintMask, FALSE ); - } - - - FT_LOCAL_DEF( void ) - cf2_glyphpath_init( CF2_GlyphPath glyphpath, - CF2_Font font, - CF2_OutlineCallbacks callbacks, - CF2_Fixed scaleY, - /* CF2_Fixed hShift, */ - CF2_ArrStack hStemHintArray, - CF2_ArrStack vStemHintArray, - CF2_HintMask hintMask, - CF2_Fixed hintOriginY, - const CF2_Blues blues, - const FT_Vector* fractionalTranslation ) - { - FT_ZERO( glyphpath ); - - glyphpath->font = font; - glyphpath->callbacks = callbacks; - - cf2_arrstack_init( &glyphpath->hintMoves, - font->memory, - &font->error, - sizeof ( CF2_HintMoveRec ) ); - - cf2_hintmap_init( &glyphpath->initialHintMap, - font, - &glyphpath->initialHintMap, - &glyphpath->hintMoves, - scaleY ); - cf2_hintmap_init( &glyphpath->firstHintMap, - font, - &glyphpath->initialHintMap, - &glyphpath->hintMoves, - scaleY ); - cf2_hintmap_init( &glyphpath->hintMap, - font, - &glyphpath->initialHintMap, - &glyphpath->hintMoves, - scaleY ); - - glyphpath->scaleX = font->innerTransform.a; - glyphpath->scaleC = font->innerTransform.c; - glyphpath->scaleY = font->innerTransform.d; - - glyphpath->fractionalTranslation = *fractionalTranslation; - -#if 0 - glyphpath->hShift = hShift; /* for fauxing */ -#endif - - glyphpath->hStemHintArray = hStemHintArray; - glyphpath->vStemHintArray = vStemHintArray; - glyphpath->hintMask = hintMask; /* ptr to current mask */ - glyphpath->hintOriginY = hintOriginY; - glyphpath->blues = blues; - glyphpath->darken = font->darkened; /* TODO: should we make copies? */ - glyphpath->xOffset = font->darkenX; - glyphpath->yOffset = font->darkenY; - glyphpath->miterLimit = 2 * FT_MAX( - cf2_fixedAbs( glyphpath->xOffset ), - cf2_fixedAbs( glyphpath->yOffset ) ); - - /* .1 character space unit */ - glyphpath->snapThreshold = cf2_floatToFixed( 0.1f ); - - glyphpath->moveIsPending = TRUE; - glyphpath->pathIsOpen = FALSE; - glyphpath->pathIsClosing = FALSE; - glyphpath->elemIsQueued = FALSE; - } - - - FT_LOCAL_DEF( void ) - cf2_glyphpath_finalize( CF2_GlyphPath glyphpath ) - { - cf2_arrstack_finalize( &glyphpath->hintMoves ); - } - - - /* - * Hint point in y-direction and apply outerTransform. - * Input `current' hint map (which is actually delayed by one element). - * Input x,y point in Character Space. - * Output x,y point in Device Space, including translation. - */ - static void - cf2_glyphpath_hintPoint( CF2_GlyphPath glyphpath, - CF2_HintMap hintmap, - FT_Vector* ppt, - CF2_Fixed x, - CF2_Fixed y ) - { - FT_Vector pt; /* hinted point in upright DS */ - - - pt.x = FT_MulFix( glyphpath->scaleX, x ) + - FT_MulFix( glyphpath->scaleC, y ); - pt.y = cf2_hintmap_map( hintmap, y ); - - ppt->x = FT_MulFix( glyphpath->font->outerTransform.a, pt.x ) + - FT_MulFix( glyphpath->font->outerTransform.c, pt.y ) + - glyphpath->fractionalTranslation.x; - ppt->y = FT_MulFix( glyphpath->font->outerTransform.b, pt.x ) + - FT_MulFix( glyphpath->font->outerTransform.d, pt.y ) + - glyphpath->fractionalTranslation.y; - } - - - /* - * From two line segments, (u1,u2) and (v1,v2), compute a point of - * intersection on the corresponding lines. - * Return false if no intersection is found, or if the intersection is - * too far away from the ends of the line segments, u2 and v1. - * - */ - static FT_Bool - cf2_glyphpath_computeIntersection( CF2_GlyphPath glyphpath, - const FT_Vector* u1, - const FT_Vector* u2, - const FT_Vector* v1, - const FT_Vector* v2, - FT_Vector* intersection ) - { - /* - * Let `u' be a zero-based vector from the first segment, `v' from the - * second segment. - * Let `w 'be the zero-based vector from `u1' to `v1'. - * `perp' is the `perpendicular dot product'; see - * http://mathworld.wolfram.com/PerpDotProduct.html. - * `s' is the parameter for the parametric line for the first segment - * (`u'). - * - * See notation in - * http://softsurfer.com/Archive/algorithm_0104/algorithm_0104B.htm. - * Calculations are done in 16.16, but must handle the squaring of - * line lengths in character space. We scale all vectors by 1/32 to - * avoid overflow. This allows values up to 4095 to be squared. The - * scale factor cancels in the divide. - * - * TODO: the scale factor could be computed from UnitsPerEm. - * - */ - -#define cf2_perp( a, b ) \ - ( FT_MulFix( a.x, b.y ) - FT_MulFix( a.y, b.x ) ) - - /* round and divide by 32 */ -#define CF2_CS_SCALE( x ) \ - ( ( (x) + 0x10 ) >> 5 ) - - FT_Vector u, v, w; /* scaled vectors */ - CF2_Fixed denominator, s; - - - u.x = CF2_CS_SCALE( u2->x - u1->x ); - u.y = CF2_CS_SCALE( u2->y - u1->y ); - v.x = CF2_CS_SCALE( v2->x - v1->x ); - v.y = CF2_CS_SCALE( v2->y - v1->y ); - w.x = CF2_CS_SCALE( v1->x - u1->x ); - w.y = CF2_CS_SCALE( v1->y - u1->y ); - - denominator = cf2_perp( u, v ); - - if ( denominator == 0 ) - return FALSE; /* parallel or coincident lines */ - - s = FT_DivFix( cf2_perp( w, v ), denominator ); - - intersection->x = u1->x + FT_MulFix( s, u2->x - u1->x ); - intersection->y = u1->y + FT_MulFix( s, u2->y - u1->y ); - - /* - * Special case snapping for horizontal and vertical lines. - * This cleans up intersections and reduces problems with winding - * order detection. - * Sample case is sbc cd KozGoPr6N-Medium.otf 20 16685. - * Note: these calculations are in character space. - * - */ - - if ( u1->x == u2->x && - cf2_fixedAbs( intersection->x - u1->x ) < glyphpath->snapThreshold ) - intersection->x = u1->x; - if ( u1->y == u2->y && - cf2_fixedAbs( intersection->y - u1->y ) < glyphpath->snapThreshold ) - intersection->y = u1->y; - - if ( v1->x == v2->x && - cf2_fixedAbs( intersection->x - v1->x ) < glyphpath->snapThreshold ) - intersection->x = v1->x; - if ( v1->y == v2->y && - cf2_fixedAbs( intersection->y - v1->y ) < glyphpath->snapThreshold ) - intersection->y = v1->y; - - /* limit the intersection distance from midpoint of u2 and v1 */ - if ( cf2_fixedAbs( intersection->x - ( u2->x + v1->x ) / 2 ) > - glyphpath->miterLimit || - cf2_fixedAbs( intersection->y - ( u2->y + v1->y ) / 2 ) > - glyphpath->miterLimit ) - return FALSE; - - return TRUE; - } - - - /* - * Push the cached element (glyphpath->prevElem*) to the outline - * consumer. When a darkening offset is used, the end point of the - * cached element may be adjusted to an intersection point or we may - * synthesize a connecting line to the current element. If we are - * closing a subpath, we may also generate a connecting line to the start - * point. - * - * This is where Character Space (CS) is converted to Device Space (DS) - * using a hint map. This calculation must use a HintMap that was valid - * at the time the element was saved. For the first point in a subpath, - * that is a saved HintMap. For most elements, it just means the caller - * has delayed building a HintMap from the current HintMask. - * - * Transform each point with outerTransform and call the outline - * callbacks. This is a general 3x3 transform: - * - * x' = a*x + c*y + tx, y' = b*x + d*y + ty - * - * but it uses 4 elements from CF2_Font and the translation part - * from CF2_GlyphPath. - * - */ - static void - cf2_glyphpath_pushPrevElem( CF2_GlyphPath glyphpath, - CF2_HintMap hintmap, - FT_Vector* nextP0, - FT_Vector nextP1, - FT_Bool close ) - { - CF2_CallbackParamsRec params; - - FT_Vector* prevP0; - FT_Vector* prevP1; - - FT_Vector intersection = { 0, 0 }; - FT_Bool useIntersection = FALSE; - - - FT_ASSERT( glyphpath->prevElemOp == CF2_PathOpLineTo || - glyphpath->prevElemOp == CF2_PathOpCubeTo ); - - if ( glyphpath->prevElemOp == CF2_PathOpLineTo ) - { - prevP0 = &glyphpath->prevElemP0; - prevP1 = &glyphpath->prevElemP1; - } - else - { - prevP0 = &glyphpath->prevElemP2; - prevP1 = &glyphpath->prevElemP3; - } - - /* optimization: if previous and next elements are offset by the same */ - /* amount, then there will be no gap, and no need to compute an */ - /* intersection. */ - if ( prevP1->x != nextP0->x || prevP1->y != nextP0->y ) - { - /* previous element does not join next element: */ - /* adjust end point of previous element to the intersection */ - useIntersection = cf2_glyphpath_computeIntersection( glyphpath, - prevP0, - prevP1, - nextP0, - &nextP1, - &intersection ); - if ( useIntersection ) - { - /* modify the last point of the cached element (either line or */ - /* curve) */ - *prevP1 = intersection; - } - } - - params.pt0 = glyphpath->currentDS; - - switch( glyphpath->prevElemOp ) - { - case CF2_PathOpLineTo: - params.op = CF2_PathOpLineTo; - - /* note: pt2 and pt3 are unused */ - - if ( close ) - { - /* use first hint map if closing */ - cf2_glyphpath_hintPoint( glyphpath, - &glyphpath->firstHintMap, - ¶ms.pt1, - glyphpath->prevElemP1.x, - glyphpath->prevElemP1.y ); - } - else - { - cf2_glyphpath_hintPoint( glyphpath, - hintmap, - ¶ms.pt1, - glyphpath->prevElemP1.x, - glyphpath->prevElemP1.y ); - } - - /* output only non-zero length lines */ - if ( params.pt0.x != params.pt1.x || params.pt0.y != params.pt1.y ) - { - glyphpath->callbacks->lineTo( glyphpath->callbacks, ¶ms ); - - glyphpath->currentDS = params.pt1; - } - break; - - case CF2_PathOpCubeTo: - params.op = CF2_PathOpCubeTo; - - /* TODO: should we intersect the interior joins (p1-p2 and p2-p3)? */ - cf2_glyphpath_hintPoint( glyphpath, - hintmap, - ¶ms.pt1, - glyphpath->prevElemP1.x, - glyphpath->prevElemP1.y ); - cf2_glyphpath_hintPoint( glyphpath, - hintmap, - ¶ms.pt2, - glyphpath->prevElemP2.x, - glyphpath->prevElemP2.y ); - cf2_glyphpath_hintPoint( glyphpath, - hintmap, - ¶ms.pt3, - glyphpath->prevElemP3.x, - glyphpath->prevElemP3.y ); - - glyphpath->callbacks->cubeTo( glyphpath->callbacks, ¶ms ); - - glyphpath->currentDS = params.pt3; - - break; - } - - if ( !useIntersection || close ) - { - /* insert connecting line between end of previous element and start */ - /* of current one */ - /* note: at the end of a subpath, we might do both, so use `nextP0' */ - /* before we change it, below */ - - if ( close ) - { - /* if we are closing the subpath, then nextP0 is in the first */ - /* hint zone */ - cf2_glyphpath_hintPoint( glyphpath, - &glyphpath->firstHintMap, - ¶ms.pt1, - nextP0->x, - nextP0->y ); - } - else - { - cf2_glyphpath_hintPoint( glyphpath, - hintmap, - ¶ms.pt1, - nextP0->x, - nextP0->y ); - } - - if ( params.pt1.x != glyphpath->currentDS.x || - params.pt1.y != glyphpath->currentDS.y ) - { - /* length is nonzero */ - params.op = CF2_PathOpLineTo; - params.pt0 = glyphpath->currentDS; - - /* note: pt2 and pt3 are unused */ - glyphpath->callbacks->lineTo( glyphpath->callbacks, ¶ms ); - - glyphpath->currentDS = params.pt1; - } - } - - if ( useIntersection ) - { - /* return intersection point to caller */ - *nextP0 = intersection; - } - } - - - /* push a MoveTo element based on current point and offset of current */ - /* element */ - static void - cf2_glyphpath_pushMove( CF2_GlyphPath glyphpath, - FT_Vector start ) - { - CF2_CallbackParamsRec params; - - - params.op = CF2_PathOpMoveTo; - params.pt0 = glyphpath->currentDS; - - /* Test if move has really happened yet; it would have called */ - /* `cf2_hintmap_build' to set `isValid'. */ - if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) ) - { - /* we are here iff first subpath is missing a moveto operator: */ - /* synthesize first moveTo to finish initialization of hintMap */ - cf2_glyphpath_moveTo( glyphpath, - glyphpath->start.x, - glyphpath->start.y ); - } - - cf2_glyphpath_hintPoint( glyphpath, - &glyphpath->hintMap, - ¶ms.pt1, - start.x, - start.y ); - - /* note: pt2 and pt3 are unused */ - glyphpath->callbacks->moveTo( glyphpath->callbacks, ¶ms ); - - glyphpath->currentDS = params.pt1; - glyphpath->offsetStart0 = start; - } - - - /* - * All coordinates are in character space. - * On input, (x1, y1) and (x2, y2) give line segment. - * On output, (x, y) give offset vector. - * We use a piecewise approximation to trig functions. - * - * TODO: Offset true perpendicular and proper length - * supply the y-translation for hinting here, too, - * that adds yOffset unconditionally to *y. - */ - static void - cf2_glyphpath_computeOffset( CF2_GlyphPath glyphpath, - CF2_Fixed x1, - CF2_Fixed y1, - CF2_Fixed x2, - CF2_Fixed y2, - CF2_Fixed* x, - CF2_Fixed* y ) - { - CF2_Fixed dx = x2 - x1; - CF2_Fixed dy = y2 - y1; - - - /* note: negative offsets don't work here; negate deltas to change */ - /* quadrants, below */ - if ( glyphpath->font->reverseWinding ) - { - dx = -dx; - dy = -dy; - } - - *x = *y = 0; - - if ( !glyphpath->darken ) - return; - - /* add momentum for this path element */ - glyphpath->callbacks->windingMomentum += - cf2_getWindingMomentum( x1, y1, x2, y2 ); - - /* note: allow mixed integer and fixed multiplication here */ - if ( dx >= 0 ) - { - if ( dy >= 0 ) - { - /* first quadrant, +x +y */ - - if ( dx > 2 * dy ) - { - /* +x */ - *x = 0; - *y = 0; - } - else if ( dy > 2 * dx ) - { - /* +y */ - *x = glyphpath->xOffset; - *y = glyphpath->yOffset; - } - else - { - /* +x +y */ - *x = FT_MulFix( cf2_floatToFixed( 0.7 ), - glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ), - glyphpath->yOffset ); - } - } - else - { - /* fourth quadrant, +x -y */ - - if ( dx > -2 * dy ) - { - /* +x */ - *x = 0; - *y = 0; - } - else if ( -dy > 2 * dx ) - { - /* -y */ - *x = -glyphpath->xOffset; - *y = glyphpath->yOffset; - } - else - { - /* +x -y */ - *x = FT_MulFix( cf2_floatToFixed( -0.7 ), - glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ), - glyphpath->yOffset ); - } - } - } - else - { - if ( dy >= 0 ) - { - /* second quadrant, -x +y */ - - if ( -dx > 2 * dy ) - { - /* -x */ - *x = 0; - *y = 2 * glyphpath->yOffset; - } - else if ( dy > -2 * dx ) - { - /* +y */ - *x = glyphpath->xOffset; - *y = glyphpath->yOffset; - } - else - { - /* -x +y */ - *x = FT_MulFix( cf2_floatToFixed( 0.7 ), - glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ), - glyphpath->yOffset ); - } - } - else - { - /* third quadrant, -x -y */ - - if ( -dx > -2 * dy ) - { - /* -x */ - *x = 0; - *y = 2 * glyphpath->yOffset; - } - else if ( -dy > -2 * dx ) - { - /* -y */ - *x = -glyphpath->xOffset; - *y = glyphpath->yOffset; - } - else - { - /* -x -y */ - *x = FT_MulFix( cf2_floatToFixed( -0.7 ), - glyphpath->xOffset ); - *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ), - glyphpath->yOffset ); - } - } - } - } - - - /* - * The functions cf2_glyphpath_{moveTo,lineTo,curveTo,closeOpenPath} are - * called by the interpreter with Character Space (CS) coordinates. Each - * path element is placed into a queue of length one to await the - * calculation of the following element. At that time, the darkening - * offset of the following element is known and joins can be computed, - * including possible modification of this element, before mapping to - * Device Space (DS) and passing it on to the outline consumer. - * - */ - FT_LOCAL_DEF( void ) - cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath, - CF2_Fixed x, - CF2_Fixed y ) - { - cf2_glyphpath_closeOpenPath( glyphpath ); - - /* save the parameters of the move for later, when we'll know how to */ - /* offset it; */ - /* also save last move point */ - glyphpath->currentCS.x = glyphpath->start.x = x; - glyphpath->currentCS.y = glyphpath->start.y = y; - - glyphpath->moveIsPending = TRUE; - - /* ensure we have a valid map with current mask */ - if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) || - cf2_hintmask_isNew( glyphpath->hintMask ) ) - cf2_hintmap_build( &glyphpath->hintMap, - glyphpath->hStemHintArray, - glyphpath->vStemHintArray, - glyphpath->hintMask, - glyphpath->hintOriginY, - FALSE ); - - /* save a copy of current HintMap to use when drawing initial point */ - glyphpath->firstHintMap = glyphpath->hintMap; /* structure copy */ - } - - - FT_LOCAL_DEF( void ) - cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath, - CF2_Fixed x, - CF2_Fixed y ) - { - CF2_Fixed xOffset, yOffset; - FT_Vector P0, P1; - FT_Bool newHintMap; - - /* - * New hints will be applied after cf2_glyphpath_pushPrevElem has run. - * In case this is a synthesized closing line, any new hints should be - * delayed until this path is closed (`cf2_hintmask_isNew' will be - * called again before the next line or curve). - */ - - /* true if new hint map not on close */ - newHintMap = cf2_hintmask_isNew( glyphpath->hintMask ) && - !glyphpath->pathIsClosing; - - /* - * Zero-length lines may occur in the charstring. Because we cannot - * compute darkening offsets or intersections from zero-length lines, - * it is best to remove them and avoid artifacts. However, zero-length - * lines in CS at the start of a new hint map can generate non-zero - * lines in DS due to hint substitution. We detect a change in hint - * map here and pass those zero-length lines along. - */ - - /* - * Note: Find explicitly closed paths here with a conditional - * breakpoint using - * - * !gp->pathIsClosing && gp->start.x == x && gp->start.y == y - * - */ - - if ( glyphpath->currentCS.x == x && - glyphpath->currentCS.y == y && - !newHintMap ) - /* - * Ignore zero-length lines in CS where the hint map is the same - * because the line in DS will also be zero length. - * - * Ignore zero-length lines when we synthesize a closing line because - * the close will be handled in cf2_glyphPath_pushPrevElem. - */ - return; - - cf2_glyphpath_computeOffset( glyphpath, - glyphpath->currentCS.x, - glyphpath->currentCS.y, - x, - y, - &xOffset, - &yOffset ); - - /* construct offset points */ - P0.x = glyphpath->currentCS.x + xOffset; - P0.y = glyphpath->currentCS.y + yOffset; - P1.x = x + xOffset; - P1.y = y + yOffset; - - if ( glyphpath->moveIsPending ) - { - /* emit offset 1st point as MoveTo */ - cf2_glyphpath_pushMove( glyphpath, P0 ); - - glyphpath->moveIsPending = FALSE; /* adjust state machine */ - glyphpath->pathIsOpen = TRUE; - - glyphpath->offsetStart1 = P1; /* record second point */ - } - - if ( glyphpath->elemIsQueued ) - { - FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) || - glyphpath->hintMap.count == 0 ); - - cf2_glyphpath_pushPrevElem( glyphpath, - &glyphpath->hintMap, - &P0, - P1, - FALSE ); - } - - /* queue the current element with offset points */ - glyphpath->elemIsQueued = TRUE; - glyphpath->prevElemOp = CF2_PathOpLineTo; - glyphpath->prevElemP0 = P0; - glyphpath->prevElemP1 = P1; - - /* update current map */ - if ( newHintMap ) - cf2_hintmap_build( &glyphpath->hintMap, - glyphpath->hStemHintArray, - glyphpath->vStemHintArray, - glyphpath->hintMask, - glyphpath->hintOriginY, - FALSE ); - - glyphpath->currentCS.x = x; /* pre-offset current point */ - glyphpath->currentCS.y = y; - } - - - FT_LOCAL_DEF( void ) - cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath, - CF2_Fixed x1, - CF2_Fixed y1, - CF2_Fixed x2, - CF2_Fixed y2, - CF2_Fixed x3, - CF2_Fixed y3 ) - { - CF2_Fixed xOffset1, yOffset1, xOffset3, yOffset3; - FT_Vector P0, P1, P2, P3; - - - /* TODO: ignore zero length portions of curve?? */ - cf2_glyphpath_computeOffset( glyphpath, - glyphpath->currentCS.x, - glyphpath->currentCS.y, - x1, - y1, - &xOffset1, - &yOffset1 ); - cf2_glyphpath_computeOffset( glyphpath, - x2, - y2, - x3, - y3, - &xOffset3, - &yOffset3 ); - - /* add momentum from the middle segment */ - glyphpath->callbacks->windingMomentum += - cf2_getWindingMomentum( x1, y1, x2, y2 ); - - /* construct offset points */ - P0.x = glyphpath->currentCS.x + xOffset1; - P0.y = glyphpath->currentCS.y + yOffset1; - P1.x = x1 + xOffset1; - P1.y = y1 + yOffset1; - /* note: preserve angle of final segment by using offset3 at both ends */ - P2.x = x2 + xOffset3; - P2.y = y2 + yOffset3; - P3.x = x3 + xOffset3; - P3.y = y3 + yOffset3; - - if ( glyphpath->moveIsPending ) - { - /* emit offset 1st point as MoveTo */ - cf2_glyphpath_pushMove( glyphpath, P0 ); - - glyphpath->moveIsPending = FALSE; - glyphpath->pathIsOpen = TRUE; - - glyphpath->offsetStart1 = P1; /* record second point */ - } - - if ( glyphpath->elemIsQueued ) - { - FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) || - glyphpath->hintMap.count == 0 ); - - cf2_glyphpath_pushPrevElem( glyphpath, - &glyphpath->hintMap, - &P0, - P1, - FALSE ); - } - - /* queue the current element with offset points */ - glyphpath->elemIsQueued = TRUE; - glyphpath->prevElemOp = CF2_PathOpCubeTo; - glyphpath->prevElemP0 = P0; - glyphpath->prevElemP1 = P1; - glyphpath->prevElemP2 = P2; - glyphpath->prevElemP3 = P3; - - /* update current map */ - if ( cf2_hintmask_isNew( glyphpath->hintMask ) ) - cf2_hintmap_build( &glyphpath->hintMap, - glyphpath->hStemHintArray, - glyphpath->vStemHintArray, - glyphpath->hintMask, - glyphpath->hintOriginY, - FALSE ); - - glyphpath->currentCS.x = x3; /* pre-offset current point */ - glyphpath->currentCS.y = y3; - } - - - FT_LOCAL_DEF( void ) - cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath ) - { - if ( glyphpath->pathIsOpen ) - { - /* - * A closing line in Character Space line is always generated below - * with `cf2_glyphPath_lineTo'. It may be ignored later if it turns - * out to be zero length in Device Space. - */ - glyphpath->pathIsClosing = TRUE; - - cf2_glyphpath_lineTo( glyphpath, - glyphpath->start.x, - glyphpath->start.y ); - - /* empty the final element from the queue and close the path */ - if ( glyphpath->elemIsQueued ) - cf2_glyphpath_pushPrevElem( glyphpath, - &glyphpath->hintMap, - &glyphpath->offsetStart0, - glyphpath->offsetStart1, - TRUE ); - - /* reset state machine */ - glyphpath->moveIsPending = TRUE; - glyphpath->pathIsOpen = FALSE; - glyphpath->pathIsClosing = FALSE; - glyphpath->elemIsQueued = FALSE; - } - } - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2hints.h b/src/3rdparty/freetype/src/cff/cf2hints.h deleted file mode 100644 index f25d91bf89..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2hints.h +++ /dev/null @@ -1,289 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2hints.h */ -/* */ -/* Adobe's code for handling CFF hints (body). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2HINTS_H__ -#define __CF2HINTS_H__ - - -FT_BEGIN_HEADER - - - enum - { - CF2_MAX_HINTS = 96 /* maximum # of hints */ - }; - - - /* - * A HintMask object stores a bit mask that specifies which hints in the - * charstring are active at a given time. Hints in CFF must be declared - * at the start, before any drawing operators, with horizontal hints - * preceding vertical hints. The HintMask is ordered the same way, with - * horizontal hints immediately followed by vertical hints. Clients are - * responsible for knowing how many of each type are present. - * - * The maximum total number of hints is 96, as specified by the CFF - * specification. - * - * A HintMask is built 0 or more times while interpreting a charstring, by - * the HintMask operator. There is only one HintMask, but it is built or - * rebuilt each time there is a hint substitution (HintMask operator) in - * the charstring. A default HintMask with all bits set is built if there - * has been no HintMask operator prior to the first drawing operator. - * - */ - - typedef struct CF2_HintMaskRec_ - { - FT_Error* error; - - FT_Bool isValid; - FT_Bool isNew; - - size_t bitCount; - size_t byteCount; - - FT_Byte mask[( CF2_MAX_HINTS + 7 ) / 8]; - - } CF2_HintMaskRec, *CF2_HintMask; - - - typedef struct CF2_StemHintRec_ - { - FT_Bool used; /* DS positions are valid */ - - CF2_Fixed min; /* original character space value */ - CF2_Fixed max; - - CF2_Fixed minDS; /* DS position after first use */ - CF2_Fixed maxDS; - - } CF2_StemHintRec, *CF2_StemHint; - - - /* - * A HintMap object stores a piecewise linear function for mapping - * y-coordinates from character space to device space, providing - * appropriate pixel alignment to stem edges. - * - * The map is implemented as an array of `CF2_Hint' elements, each - * representing an edge. When edges are paired, as from stem hints, the - * bottom edge must immediately precede the top edge in the array. - * Element character space AND device space positions must both increase - * monotonically in the array. `CF2_Hint' elements are also used as - * parameters to `cf2_blues_capture'. - * - * The `cf2_hintmap_build' method must be called before any drawing - * operation (beginning with a Move operator) and at each hint - * substitution (HintMask operator). - * - * The `cf2_hintmap_map' method is called to transform y-coordinates at - * each drawing operation (move, line, curve). - * - */ - - /* TODO: make this a CF2_ArrStack and add a deep copy method */ - enum - { - CF2_MAX_HINT_EDGES = CF2_MAX_HINTS * 2 - }; - - - typedef struct CF2_HintMapRec_ - { - CF2_Font font; - - /* initial map based on blue zones */ - struct CF2_HintMapRec_* initialHintMap; - - /* working storage for 2nd pass adjustHints */ - CF2_ArrStack hintMoves; - - FT_Bool isValid; - FT_Bool hinted; - - CF2_Fixed scale; - CF2_UInt count; - - /* start search from this index */ - CF2_UInt lastIndex; - - CF2_HintRec edge[CF2_MAX_HINT_EDGES]; /* 192 */ - - } CF2_HintMapRec, *CF2_HintMap; - - - FT_LOCAL( FT_Bool ) - cf2_hint_isValid( const CF2_Hint hint ); - FT_LOCAL( FT_Bool ) - cf2_hint_isTop( const CF2_Hint hint ); - FT_LOCAL( FT_Bool ) - cf2_hint_isBottom( const CF2_Hint hint ); - FT_LOCAL( void ) - cf2_hint_lock( CF2_Hint hint ); - - - FT_LOCAL( void ) - cf2_hintmap_init( CF2_HintMap hintmap, - CF2_Font font, - CF2_HintMap initialMap, - CF2_ArrStack hintMoves, - CF2_Fixed scale ); - FT_LOCAL( void ) - cf2_hintmap_build( CF2_HintMap hintmap, - CF2_ArrStack hStemHintArray, - CF2_ArrStack vStemHintArray, - CF2_HintMask hintMask, - CF2_Fixed hintOrigin, - FT_Bool initialMap ); - - - /* - * GlyphPath is a wrapper for drawing operations that scales the - * coordinates according to the render matrix and HintMap. It also tracks - * open paths to control ClosePath and to insert MoveTo for broken fonts. - * - */ - typedef struct CF2_GlyphPathRec_ - { - /* TODO: gather some of these into a hinting context */ - - CF2_Font font; /* font instance */ - CF2_OutlineCallbacks callbacks; /* outline consumer */ - - - CF2_HintMapRec hintMap; /* current hint map */ - CF2_HintMapRec firstHintMap; /* saved copy */ - CF2_HintMapRec initialHintMap; /* based on all captured hints */ - - CF2_ArrStackRec hintMoves; /* list of hint moves for 2nd pass */ - - CF2_Fixed scaleX; /* matrix a */ - CF2_Fixed scaleC; /* matrix c */ - CF2_Fixed scaleY; /* matrix d */ - - FT_Vector fractionalTranslation; /* including deviceXScale */ -#if 0 - CF2_Fixed hShift; /* character space horizontal shift */ - /* (for fauxing) */ -#endif - - FT_Bool pathIsOpen; /* true after MoveTo */ - FT_Bool pathIsClosing; /* true when synthesizing closepath line */ - FT_Bool darken; /* true if stem darkening */ - FT_Bool moveIsPending; /* true between MoveTo and offset MoveTo */ - - /* references used to call `cf2_hintmap_build', if necessary */ - CF2_ArrStack hStemHintArray; - CF2_ArrStack vStemHintArray; - CF2_HintMask hintMask; /* ptr to the current mask */ - CF2_Fixed hintOriginY; /* copy of current origin */ - const CF2_BluesRec* blues; - - CF2_Fixed xOffset; /* character space offsets */ - CF2_Fixed yOffset; - - /* character space miter limit threshold */ - CF2_Fixed miterLimit; - /* vertical/horzizontal snap distance in character space */ - CF2_Fixed snapThreshold; - - FT_Vector offsetStart0; /* first and second points of first */ - FT_Vector offsetStart1; /* element with offset applied */ - - /* current point, character space, before offset */ - FT_Vector currentCS; - /* current point, device space */ - FT_Vector currentDS; - /* start point of subpath, character space */ - FT_Vector start; - - /* the following members constitute the `queue' of one element */ - FT_Bool elemIsQueued; - CF2_Int prevElemOp; - - FT_Vector prevElemP0; - FT_Vector prevElemP1; - FT_Vector prevElemP2; - FT_Vector prevElemP3; - - } CF2_GlyphPathRec, *CF2_GlyphPath; - - - FT_LOCAL( void ) - cf2_glyphpath_init( CF2_GlyphPath glyphpath, - CF2_Font font, - CF2_OutlineCallbacks callbacks, - CF2_Fixed scaleY, - /* CF2_Fixed hShift, */ - CF2_ArrStack hStemHintArray, - CF2_ArrStack vStemHintArray, - CF2_HintMask hintMask, - CF2_Fixed hintOrigin, - const CF2_Blues blues, - const FT_Vector* fractionalTranslation ); - FT_LOCAL( void ) - cf2_glyphpath_finalize( CF2_GlyphPath glyphpath ); - - FT_LOCAL( void ) - cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath, - CF2_Fixed x, - CF2_Fixed y ); - FT_LOCAL( void ) - cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath, - CF2_Fixed x, - CF2_Fixed y ); - FT_LOCAL( void ) - cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath, - CF2_Fixed x1, - CF2_Fixed y1, - CF2_Fixed x2, - CF2_Fixed y2, - CF2_Fixed x3, - CF2_Fixed y3 ); - FT_LOCAL( void ) - cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath ); - - -FT_END_HEADER - - -#endif /* __CF2HINTS_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2intrp.c b/src/3rdparty/freetype/src/cff/cf2intrp.c deleted file mode 100644 index ff3fa9aaaa..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2intrp.c +++ /dev/null @@ -1,1571 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2intrp.c */ -/* */ -/* Adobe's CFF Interpreter (body). */ -/* */ -/* Copyright 2007-2014 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#include "cf2ft.h" -#include FT_INTERNAL_DEBUG_H - -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2stack.h" -#include "cf2hints.h" -#include "cf2intrp.h" - -#include "cf2error.h" - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_cf2interp - - - /* some operators are not implemented yet */ -#define CF2_FIXME FT_TRACE4(( "cf2_interpT2CharString:" \ - " operator not implemented yet\n" )) - - - - FT_LOCAL_DEF( void ) - cf2_hintmask_init( CF2_HintMask hintmask, - FT_Error* error ) - { - FT_ZERO( hintmask ); - - hintmask->error = error; - } - - - FT_LOCAL_DEF( FT_Bool ) - cf2_hintmask_isValid( const CF2_HintMask hintmask ) - { - return hintmask->isValid; - } - - - FT_LOCAL_DEF( FT_Bool ) - cf2_hintmask_isNew( const CF2_HintMask hintmask ) - { - return hintmask->isNew; - } - - - FT_LOCAL_DEF( void ) - cf2_hintmask_setNew( CF2_HintMask hintmask, - FT_Bool val ) - { - hintmask->isNew = val; - } - - - /* clients call `getMaskPtr' in order to iterate */ - /* through hint mask */ - - FT_LOCAL_DEF( FT_Byte* ) - cf2_hintmask_getMaskPtr( CF2_HintMask hintmask ) - { - return hintmask->mask; - } - - - static size_t - cf2_hintmask_setCounts( CF2_HintMask hintmask, - size_t bitCount ) - { - if ( bitCount > CF2_MAX_HINTS ) - { - /* total of h and v stems must be <= 96 */ - CF2_SET_ERROR( hintmask->error, Invalid_Glyph_Format ); - return 0; - } - - hintmask->bitCount = bitCount; - hintmask->byteCount = ( hintmask->bitCount + 7 ) / 8; - - hintmask->isValid = TRUE; - hintmask->isNew = TRUE; - - return bitCount; - } - - - /* consume the hintmask bytes from the charstring, advancing the src */ - /* pointer */ - static void - cf2_hintmask_read( CF2_HintMask hintmask, - CF2_Buffer charstring, - size_t bitCount ) - { - size_t i; - -#ifndef CF2_NDEBUG - /* these are the bits in the final mask byte that should be zero */ - /* Note: this variable is only used in an assert expression below */ - /* and then only if CF2_NDEBUG is not defined */ - CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1; -#endif - - - /* initialize counts and isValid */ - if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 ) - return; - - FT_ASSERT( hintmask->byteCount > 0 ); - - FT_TRACE4(( " (maskbytes:" )); - - /* set mask and advance interpreter's charstring pointer */ - for ( i = 0; i < hintmask->byteCount; i++ ) - { - hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring ); - FT_TRACE4(( " 0x%02X", hintmask->mask[i] )); - } - - FT_TRACE4(( ")\n" )); - - /* assert any unused bits in last byte are zero unless there's a prior */ - /* error */ - /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */ -#ifndef CF2_NDEBUG - FT_ASSERT( ( hintmask->mask[hintmask->byteCount - 1] & mask ) == 0 || - *hintmask->error ); -#endif - } - - - FT_LOCAL_DEF( void ) - cf2_hintmask_setAll( CF2_HintMask hintmask, - size_t bitCount ) - { - size_t i; - CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1; - - - /* initialize counts and isValid */ - if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 ) - return; - - FT_ASSERT( hintmask->byteCount > 0 ); - FT_ASSERT( hintmask->byteCount < - sizeof ( hintmask->mask ) / sizeof ( hintmask->mask[0] ) ); - - /* set mask to all ones */ - for ( i = 0; i < hintmask->byteCount; i++ ) - hintmask->mask[i] = 0xFF; - - /* clear unused bits */ - /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */ - hintmask->mask[hintmask->byteCount - 1] &= ~mask; - } - - - /* Type2 charstring opcodes */ - enum - { - cf2_cmdRESERVED_0, /* 0 */ - cf2_cmdHSTEM, /* 1 */ - cf2_cmdRESERVED_2, /* 2 */ - cf2_cmdVSTEM, /* 3 */ - cf2_cmdVMOVETO, /* 4 */ - cf2_cmdRLINETO, /* 5 */ - cf2_cmdHLINETO, /* 6 */ - cf2_cmdVLINETO, /* 7 */ - cf2_cmdRRCURVETO, /* 8 */ - cf2_cmdRESERVED_9, /* 9 */ - cf2_cmdCALLSUBR, /* 10 */ - cf2_cmdRETURN, /* 11 */ - cf2_cmdESC, /* 12 */ - cf2_cmdRESERVED_13, /* 13 */ - cf2_cmdENDCHAR, /* 14 */ - cf2_cmdRESERVED_15, /* 15 */ - cf2_cmdRESERVED_16, /* 16 */ - cf2_cmdRESERVED_17, /* 17 */ - cf2_cmdHSTEMHM, /* 18 */ - cf2_cmdHINTMASK, /* 19 */ - cf2_cmdCNTRMASK, /* 20 */ - cf2_cmdRMOVETO, /* 21 */ - cf2_cmdHMOVETO, /* 22 */ - cf2_cmdVSTEMHM, /* 23 */ - cf2_cmdRCURVELINE, /* 24 */ - cf2_cmdRLINECURVE, /* 25 */ - cf2_cmdVVCURVETO, /* 26 */ - cf2_cmdHHCURVETO, /* 27 */ - cf2_cmdEXTENDEDNMBR, /* 28 */ - cf2_cmdCALLGSUBR, /* 29 */ - cf2_cmdVHCURVETO, /* 30 */ - cf2_cmdHVCURVETO /* 31 */ - }; - - enum - { - cf2_escDOTSECTION, /* 0 */ - cf2_escRESERVED_1, /* 1 */ - cf2_escRESERVED_2, /* 2 */ - cf2_escAND, /* 3 */ - cf2_escOR, /* 4 */ - cf2_escNOT, /* 5 */ - cf2_escRESERVED_6, /* 6 */ - cf2_escRESERVED_7, /* 7 */ - cf2_escRESERVED_8, /* 8 */ - cf2_escABS, /* 9 */ - cf2_escADD, /* 10 like otherADD */ - cf2_escSUB, /* 11 like otherSUB */ - cf2_escDIV, /* 12 */ - cf2_escRESERVED_13, /* 13 */ - cf2_escNEG, /* 14 */ - cf2_escEQ, /* 15 */ - cf2_escRESERVED_16, /* 16 */ - cf2_escRESERVED_17, /* 17 */ - cf2_escDROP, /* 18 */ - cf2_escRESERVED_19, /* 19 */ - cf2_escPUT, /* 20 like otherPUT */ - cf2_escGET, /* 21 like otherGET */ - cf2_escIFELSE, /* 22 like otherIFELSE */ - cf2_escRANDOM, /* 23 like otherRANDOM */ - cf2_escMUL, /* 24 like otherMUL */ - cf2_escRESERVED_25, /* 25 */ - cf2_escSQRT, /* 26 */ - cf2_escDUP, /* 27 like otherDUP */ - cf2_escEXCH, /* 28 like otherEXCH */ - cf2_escINDEX, /* 29 */ - cf2_escROLL, /* 30 */ - cf2_escRESERVED_31, /* 31 */ - cf2_escRESERVED_32, /* 32 */ - cf2_escRESERVED_33, /* 33 */ - cf2_escHFLEX, /* 34 */ - cf2_escFLEX, /* 35 */ - cf2_escHFLEX1, /* 36 */ - cf2_escFLEX1 /* 37 */ - }; - - - /* `stemHintArray' does not change once we start drawing the outline. */ - static void - cf2_doStems( const CF2_Font font, - CF2_Stack opStack, - CF2_ArrStack stemHintArray, - CF2_Fixed* width, - FT_Bool* haveWidth, - CF2_Fixed hintOffset ) - { - CF2_UInt i; - CF2_UInt count = cf2_stack_count( opStack ); - FT_Bool hasWidthArg = (FT_Bool)( count & 1 ); - - /* variable accumulates delta values from operand stack */ - CF2_Fixed position = hintOffset; - - if ( hasWidthArg && ! *haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + - cf2_getNominalWidthX( font->decoder ); - - if ( font->decoder->width_only ) - goto exit; - - for ( i = hasWidthArg ? 1 : 0; i < count; i += 2 ) - { - /* construct a CF2_StemHint and push it onto the list */ - CF2_StemHintRec stemhint; - - - stemhint.min = - position += cf2_stack_getReal( opStack, i ); - stemhint.max = - position += cf2_stack_getReal( opStack, i + 1 ); - - stemhint.used = FALSE; - stemhint.maxDS = - stemhint.minDS = 0; - - cf2_arrstack_push( stemHintArray, &stemhint ); /* defer error check */ - } - - cf2_stack_clear( opStack ); - - exit: - /* cf2_doStems must define a width (may be default) */ - *haveWidth = TRUE; - } - - - static void - cf2_doFlex( CF2_Stack opStack, - CF2_Fixed* curX, - CF2_Fixed* curY, - CF2_GlyphPath glyphPath, - const FT_Bool* readFromStack, - FT_Bool doConditionalLastRead ) - { - CF2_Fixed vals[14]; - CF2_UInt index; - FT_Bool isHFlex; - CF2_Int top, i, j; - - - vals[0] = *curX; - vals[1] = *curY; - index = 0; - isHFlex = readFromStack[9] == FALSE; - top = isHFlex ? 9 : 10; - - for ( i = 0; i < top; i++ ) - { - vals[i + 2] = vals[i]; - if ( readFromStack[i] ) - vals[i + 2] += cf2_stack_getReal( opStack, index++ ); - } - - if ( isHFlex ) - vals[9 + 2] = *curY; - - if ( doConditionalLastRead ) - { - FT_Bool lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) > - cf2_fixedAbs( vals[11] - *curY ) ); - CF2_Fixed lastVal = cf2_stack_getReal( opStack, index ); - - - if ( lastIsX ) - { - vals[12] = vals[10] + lastVal; - vals[13] = *curY; - } - else - { - vals[12] = *curX; - vals[13] = vals[11] + lastVal; - } - } - else - { - if ( readFromStack[10] ) - vals[12] = vals[10] + cf2_stack_getReal( opStack, index++ ); - else - vals[12] = *curX; - - if ( readFromStack[11] ) - vals[13] = vals[11] + cf2_stack_getReal( opStack, index ); - else - vals[13] = *curY; - } - - for ( j = 0; j < 2; j++ ) - cf2_glyphpath_curveTo( glyphPath, vals[j * 6 + 2], - vals[j * 6 + 3], - vals[j * 6 + 4], - vals[j * 6 + 5], - vals[j * 6 + 6], - vals[j * 6 + 7] ); - - cf2_stack_clear( opStack ); - - *curX = vals[12]; - *curY = vals[13]; - } - - - /* - * `error' is a shared error code used by many objects in this - * routine. Before the code continues from an error, it must check and - * record the error in `*error'. The idea is that this shared - * error code will record the first error encountered. If testing - * for an error anyway, the cost of `goto exit' is small, so we do it, - * even if continuing would be safe. In this case, `lastError' is - * set, so the testing and storing can be done in one place, at `exit'. - * - * Continuing after an error is intended for objects which do their own - * testing of `*error', e.g., array stack functions. This allows us to - * avoid an extra test after the call. - * - * Unimplemented opcodes are ignored. - * - */ - FT_LOCAL_DEF( void ) - cf2_interpT2CharString( CF2_Font font, - CF2_Buffer buf, - CF2_OutlineCallbacks callbacks, - const FT_Vector* translation, - FT_Bool doingSeac, - CF2_Fixed curX, - CF2_Fixed curY, - CF2_Fixed* width ) - { - /* lastError is used for errors that are immediately tested */ - FT_Error lastError = FT_Err_Ok; - - /* pointer to parsed font object */ - CFF_Decoder* decoder = font->decoder; - - FT_Error* error = &font->error; - FT_Memory memory = font->memory; - - CF2_Fixed scaleY = font->innerTransform.d; - CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder ); - - /* save this for hinting seac accents */ - CF2_Fixed hintOriginY = curY; - - CF2_Stack opStack = NULL; - FT_Byte op1; /* first opcode byte */ - - /* instruction limit; 20,000,000 matches Avalon */ - FT_UInt32 instructionLimit = 20000000UL; - - CF2_ArrStackRec subrStack; - - FT_Bool haveWidth; - CF2_Buffer charstring = NULL; - - CF2_Int charstringIndex = -1; /* initialize to empty */ - - /* TODO: placeholders for hint structures */ - - /* objects used for hinting */ - CF2_ArrStackRec hStemHintArray; - CF2_ArrStackRec vStemHintArray; - - CF2_HintMaskRec hintMask; - CF2_GlyphPathRec glyphPath; - - - /* initialize the remaining objects */ - cf2_arrstack_init( &subrStack, - memory, - error, - sizeof ( CF2_BufferRec ) ); - cf2_arrstack_init( &hStemHintArray, - memory, - error, - sizeof ( CF2_StemHintRec ) ); - cf2_arrstack_init( &vStemHintArray, - memory, - error, - sizeof ( CF2_StemHintRec ) ); - - /* initialize CF2_StemHint arrays */ - cf2_hintmask_init( &hintMask, error ); - - /* initialize path map to manage drawing operations */ - - /* Note: last 4 params are used to handle `MoveToPermissive', which */ - /* may need to call `hintMap.Build' */ - /* TODO: MoveToPermissive is gone; are these still needed? */ - cf2_glyphpath_init( &glyphPath, - font, - callbacks, - scaleY, - /* hShift, */ - &hStemHintArray, - &vStemHintArray, - &hintMask, - hintOriginY, - &font->blues, - translation ); - - /* - * Initialize state for width parsing. From the CFF Spec: - * - * The first stack-clearing operator, which must be one of hstem, - * hstemhm, vstem, vstemhm, cntrmask, hintmask, hmoveto, vmoveto, - * rmoveto, or endchar, takes an additional argument - the width (as - * described earlier), which may be expressed as zero or one numeric - * argument. - * - * What we implement here uses the first validly specified width, but - * does not detect errors for specifying more than one width. - * - * If one of the above operators occurs without explicitly specifying - * a width, we assume the default width. - * - */ - haveWidth = FALSE; - *width = cf2_getDefaultWidthX( decoder ); - - /* - * Note: at this point, all pointers to resources must be NULL - * and all local objects must be initialized. - * There must be no branches to exit: above this point. - * - */ - - /* allocate an operand stack */ - opStack = cf2_stack_init( memory, error ); - if ( !opStack ) - { - lastError = FT_THROW( Out_Of_Memory ); - goto exit; - } - - /* initialize subroutine stack by placing top level charstring as */ - /* first element (max depth plus one for the charstring) */ - /* Note: Caller owns and must finalize the first charstring. */ - /* Our copy of it does not change that requirement. */ - cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 ); - - charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack ); - *charstring = *buf; /* structure copy */ - - charstringIndex = 0; /* entry is valid now */ - - /* catch errors so far */ - if ( *error ) - goto exit; - - /* main interpreter loop */ - while ( 1 ) - { - if ( cf2_buf_isEnd( charstring ) ) - { - /* If we've reached the end of the charstring, simulate a */ - /* cf2_cmdRETURN or cf2_cmdENDCHAR. */ - if ( charstringIndex ) - op1 = cf2_cmdRETURN; /* end of buffer for subroutine */ - else - op1 = cf2_cmdENDCHAR; /* end of buffer for top level charstring */ - } - else - op1 = (FT_Byte)cf2_buf_readByte( charstring ); - - /* check for errors once per loop */ - if ( *error ) - goto exit; - - instructionLimit--; - if ( instructionLimit == 0 ) - { - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; - } - - switch( op1 ) - { - case cf2_cmdRESERVED_0: - case cf2_cmdRESERVED_2: - case cf2_cmdRESERVED_9: - case cf2_cmdRESERVED_13: - case cf2_cmdRESERVED_15: - case cf2_cmdRESERVED_16: - case cf2_cmdRESERVED_17: - /* we may get here if we have a prior error */ - FT_TRACE4(( " unknown op (%d)\n", op1 )); - break; - - case cf2_cmdHSTEMHM: - case cf2_cmdHSTEM: - FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" )); - - /* never add hints after the mask is computed */ - if ( cf2_hintmask_isValid( &hintMask ) ) - { - FT_TRACE4(( "cf2_interpT2CharString:" - " invalid horizontal hint mask\n" )); - break; - } - - cf2_doStems( font, - opStack, - &hStemHintArray, - width, - &haveWidth, - 0 ); - - if ( font->decoder->width_only ) - goto exit; - - break; - - case cf2_cmdVSTEMHM: - case cf2_cmdVSTEM: - FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" )); - - /* never add hints after the mask is computed */ - if ( cf2_hintmask_isValid( &hintMask ) ) - { - FT_TRACE4(( "cf2_interpT2CharString:" - " invalid vertical hint mask\n" )); - break; - } - - cf2_doStems( font, - opStack, - &vStemHintArray, - width, - &haveWidth, - 0 ); - - if ( font->decoder->width_only ) - goto exit; - - break; - - case cf2_cmdVMOVETO: - FT_TRACE4(( " vmoveto\n" )); - - if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; - - /* width is defined or default after this */ - haveWidth = TRUE; - - if ( font->decoder->width_only ) - goto exit; - - curY += cf2_stack_popFixed( opStack ); - - cf2_glyphpath_moveTo( &glyphPath, curX, curY ); - - break; - - case cf2_cmdRLINETO: - { - CF2_UInt index; - CF2_UInt count = cf2_stack_count( opStack ); - - - FT_TRACE4(( " rlineto\n" )); - - for ( index = 0; index < count; index += 2 ) - { - curX += cf2_stack_getReal( opStack, index + 0 ); - curY += cf2_stack_getReal( opStack, index + 1 ); - - cf2_glyphpath_lineTo( &glyphPath, curX, curY ); - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdHLINETO: - case cf2_cmdVLINETO: - { - CF2_UInt index; - CF2_UInt count = cf2_stack_count( opStack ); - - FT_Bool isX = op1 == cf2_cmdHLINETO; - - - FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" )); - - for ( index = 0; index < count; index++ ) - { - CF2_Fixed v = cf2_stack_getReal( opStack, index ); - - - if ( isX ) - curX += v; - else - curY += v; - - isX = !isX; - - cf2_glyphpath_lineTo( &glyphPath, curX, curY ); - } - - cf2_stack_clear( opStack ); - } - continue; - - case cf2_cmdRCURVELINE: - case cf2_cmdRRCURVETO: - { - CF2_UInt count = cf2_stack_count( opStack ); - CF2_UInt index = 0; - - - FT_TRACE4(( op1 == cf2_cmdRCURVELINE ? " rcurveline\n" - : " rrcurveto\n" )); - - while ( index + 6 <= count ) - { - CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY; - CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1; - CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1; - CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; - CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2; - - - cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - - curX = x3; - curY = y3; - index += 6; - } - - if ( op1 == cf2_cmdRCURVELINE ) - { - curX += cf2_stack_getReal( opStack, index + 0 ); - curY += cf2_stack_getReal( opStack, index + 1 ); - - cf2_glyphpath_lineTo( &glyphPath, curX, curY ); - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdCALLGSUBR: - case cf2_cmdCALLSUBR: - { - CF2_UInt subrIndex; - - - FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr" - : " callsubr" )); - - if ( charstringIndex > CF2_MAX_SUBR ) - { - /* max subr plus one for charstring */ - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* overflow of stack */ - } - - /* push our current CFF charstring region on subrStack */ - charstring = (CF2_Buffer) - cf2_arrstack_getPointer( - &subrStack, - (size_t)charstringIndex + 1 ); - - /* set up the new CFF region and pointer */ - subrIndex = (CF2_UInt)cf2_stack_popInt( opStack ); - - switch ( op1 ) - { - case cf2_cmdCALLGSUBR: - FT_TRACE4(( " (idx %d, entering level %d)\n", - subrIndex + (CF2_UInt)decoder->globals_bias, - charstringIndex + 1 )); - - if ( cf2_initGlobalRegionBuffer( decoder, - subrIndex, - charstring ) ) - { - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* subroutine lookup or stream error */ - } - break; - - default: - /* cf2_cmdCALLSUBR */ - FT_TRACE4(( " (idx %d, entering level %d)\n", - subrIndex + (CF2_UInt)decoder->locals_bias, - charstringIndex + 1 )); - - if ( cf2_initLocalRegionBuffer( decoder, - subrIndex, - charstring ) ) - { - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* subroutine lookup or stream error */ - } - } - - charstringIndex += 1; /* entry is valid now */ - } - continue; /* do not clear the stack */ - - case cf2_cmdRETURN: - FT_TRACE4(( " return (leaving level %d)\n", charstringIndex )); - - if ( charstringIndex < 1 ) - { - /* Note: cannot return from top charstring */ - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* underflow of stack */ - } - - /* restore position in previous charstring */ - charstring = (CF2_Buffer) - cf2_arrstack_getPointer( - &subrStack, - (CF2_UInt)--charstringIndex ); - continue; /* do not clear the stack */ - - case cf2_cmdESC: - { - FT_Byte op2 = (FT_Byte)cf2_buf_readByte( charstring ); - - - switch ( op2 ) - { - case cf2_escDOTSECTION: - /* something about `flip type of locking' -- ignore it */ - FT_TRACE4(( " dotsection\n" )); - - break; - - /* TODO: should these operators be supported? */ - case cf2_escAND: /* in spec */ - FT_TRACE4(( " and\n" )); - - CF2_FIXME; - break; - - case cf2_escOR: /* in spec */ - FT_TRACE4(( " or\n" )); - - CF2_FIXME; - break; - - case cf2_escNOT: /* in spec */ - FT_TRACE4(( " not\n" )); - - CF2_FIXME; - break; - - case cf2_escABS: /* in spec */ - FT_TRACE4(( " abs\n" )); - - CF2_FIXME; - break; - - case cf2_escADD: /* in spec */ - FT_TRACE4(( " add\n" )); - - CF2_FIXME; - break; - - case cf2_escSUB: /* in spec */ - FT_TRACE4(( " sub\n" )); - - CF2_FIXME; - break; - - case cf2_escDIV: /* in spec */ - FT_TRACE4(( " div\n" )); - - CF2_FIXME; - break; - - case cf2_escNEG: /* in spec */ - FT_TRACE4(( " neg\n" )); - - CF2_FIXME; - break; - - case cf2_escEQ: /* in spec */ - FT_TRACE4(( " eq\n" )); - - CF2_FIXME; - break; - - case cf2_escDROP: /* in spec */ - FT_TRACE4(( " drop\n" )); - - CF2_FIXME; - break; - - case cf2_escPUT: /* in spec */ - FT_TRACE4(( " put\n" )); - - CF2_FIXME; - break; - - case cf2_escGET: /* in spec */ - FT_TRACE4(( " get\n" )); - - CF2_FIXME; - break; - - case cf2_escIFELSE: /* in spec */ - FT_TRACE4(( " ifelse\n" )); - - CF2_FIXME; - break; - - case cf2_escRANDOM: /* in spec */ - FT_TRACE4(( " random\n" )); - - CF2_FIXME; - break; - - case cf2_escMUL: /* in spec */ - FT_TRACE4(( " mul\n" )); - - CF2_FIXME; - break; - - case cf2_escSQRT: /* in spec */ - FT_TRACE4(( " sqrt\n" )); - - CF2_FIXME; - break; - - case cf2_escDUP: /* in spec */ - FT_TRACE4(( " dup\n" )); - - CF2_FIXME; - break; - - case cf2_escEXCH: /* in spec */ - FT_TRACE4(( " exch\n" )); - - CF2_FIXME; - break; - - case cf2_escINDEX: /* in spec */ - FT_TRACE4(( " index\n" )); - - CF2_FIXME; - break; - - case cf2_escROLL: /* in spec */ - FT_TRACE4(( " roll\n" )); - - CF2_FIXME; - break; - - case cf2_escHFLEX: - { - static const FT_Bool readFromStack[12] = - { - TRUE /* dx1 */, FALSE /* dy1 */, - TRUE /* dx2 */, TRUE /* dy2 */, - TRUE /* dx3 */, FALSE /* dy3 */, - TRUE /* dx4 */, FALSE /* dy4 */, - TRUE /* dx5 */, FALSE /* dy5 */, - TRUE /* dx6 */, FALSE /* dy6 */ - }; - - - FT_TRACE4(( " hflex\n" )); - - cf2_doFlex( opStack, - &curX, - &curY, - &glyphPath, - readFromStack, - FALSE /* doConditionalLastRead */ ); - } - continue; - - case cf2_escFLEX: - { - static const FT_Bool readFromStack[12] = - { - TRUE /* dx1 */, TRUE /* dy1 */, - TRUE /* dx2 */, TRUE /* dy2 */, - TRUE /* dx3 */, TRUE /* dy3 */, - TRUE /* dx4 */, TRUE /* dy4 */, - TRUE /* dx5 */, TRUE /* dy5 */, - TRUE /* dx6 */, TRUE /* dy6 */ - }; - - - FT_TRACE4(( " flex\n" )); - - cf2_doFlex( opStack, - &curX, - &curY, - &glyphPath, - readFromStack, - FALSE /* doConditionalLastRead */ ); - } - break; /* TODO: why is this not a continue? */ - - case cf2_escHFLEX1: - { - static const FT_Bool readFromStack[12] = - { - TRUE /* dx1 */, TRUE /* dy1 */, - TRUE /* dx2 */, TRUE /* dy2 */, - TRUE /* dx3 */, FALSE /* dy3 */, - TRUE /* dx4 */, FALSE /* dy4 */, - TRUE /* dx5 */, TRUE /* dy5 */, - TRUE /* dx6 */, FALSE /* dy6 */ - }; - - - FT_TRACE4(( " hflex1\n" )); - - cf2_doFlex( opStack, - &curX, - &curY, - &glyphPath, - readFromStack, - FALSE /* doConditionalLastRead */ ); - } - continue; - - case cf2_escFLEX1: - { - static const FT_Bool readFromStack[12] = - { - TRUE /* dx1 */, TRUE /* dy1 */, - TRUE /* dx2 */, TRUE /* dy2 */, - TRUE /* dx3 */, TRUE /* dy3 */, - TRUE /* dx4 */, TRUE /* dy4 */, - TRUE /* dx5 */, TRUE /* dy5 */, - FALSE /* dx6 */, FALSE /* dy6 */ - }; - - - FT_TRACE4(( " flex1\n" )); - - cf2_doFlex( opStack, - &curX, - &curY, - &glyphPath, - readFromStack, - TRUE /* doConditionalLastRead */ ); - } - continue; - - case cf2_escRESERVED_1: - case cf2_escRESERVED_2: - case cf2_escRESERVED_6: - case cf2_escRESERVED_7: - case cf2_escRESERVED_8: - case cf2_escRESERVED_13: - case cf2_escRESERVED_16: - case cf2_escRESERVED_17: - case cf2_escRESERVED_19: - case cf2_escRESERVED_25: - case cf2_escRESERVED_31: - case cf2_escRESERVED_32: - case cf2_escRESERVED_33: - default: - FT_TRACE4(( " unknown op (12, %d)\n", op2 )); - - }; /* end of switch statement checking `op2' */ - - } /* case cf2_cmdESC */ - break; - - case cf2_cmdENDCHAR: - FT_TRACE4(( " endchar\n" )); - - if ( cf2_stack_count( opStack ) == 1 || - cf2_stack_count( opStack ) == 5 ) - { - if ( !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; - } - - /* width is defined or default after this */ - haveWidth = TRUE; - - if ( font->decoder->width_only ) - goto exit; - - /* close path if still open */ - cf2_glyphpath_closeOpenPath( &glyphPath ); - - if ( cf2_stack_count( opStack ) > 1 ) - { - /* must be either 4 or 5 -- */ - /* this is a (deprecated) implied `seac' operator */ - - CF2_Int achar; - CF2_Int bchar; - CF2_BufferRec component; - CF2_Fixed dummyWidth; /* ignore component width */ - FT_Error error2; - - - if ( doingSeac ) - { - lastError = FT_THROW( Invalid_Glyph_Format ); - goto exit; /* nested seac */ - } - - achar = cf2_stack_popInt( opStack ); - bchar = cf2_stack_popInt( opStack ); - - curY = cf2_stack_popFixed( opStack ); - curX = cf2_stack_popFixed( opStack ); - - error2 = cf2_getSeacComponent( decoder, achar, &component ); - if ( error2 ) - { - lastError = error2; /* pass FreeType error through */ - goto exit; - } - cf2_interpT2CharString( font, - &component, - callbacks, - translation, - TRUE, - curX, - curY, - &dummyWidth ); - cf2_freeSeacComponent( decoder, &component ); - - error2 = cf2_getSeacComponent( decoder, bchar, &component ); - if ( error2 ) - { - lastError = error2; /* pass FreeType error through */ - goto exit; - } - cf2_interpT2CharString( font, - &component, - callbacks, - translation, - TRUE, - 0, - 0, - &dummyWidth ); - cf2_freeSeacComponent( decoder, &component ); - } - goto exit; - - case cf2_cmdCNTRMASK: - case cf2_cmdHINTMASK: - /* the final \n in the tracing message gets added in */ - /* `cf2_hintmask_read' (which also traces the mask bytes) */ - FT_TRACE4(( op1 == cf2_cmdCNTRMASK ? " cntrmask" : " hintmask" )); - - /* never add hints after the mask is computed */ - if ( cf2_stack_count( opStack ) > 1 && - cf2_hintmask_isValid( &hintMask ) ) - { - FT_TRACE4(( "cf2_interpT2CharString: invalid hint mask\n" )); - break; - } - - /* if there are arguments on the stack, there this is an */ - /* implied cf2_cmdVSTEMHM */ - cf2_doStems( font, - opStack, - &vStemHintArray, - width, - &haveWidth, - 0 ); - - if ( font->decoder->width_only ) - goto exit; - - if ( op1 == cf2_cmdHINTMASK ) - { - /* consume the hint mask bytes which follow the operator */ - cf2_hintmask_read( &hintMask, - charstring, - cf2_arrstack_size( &hStemHintArray ) + - cf2_arrstack_size( &vStemHintArray ) ); - } - else - { - /* - * Consume the counter mask bytes which follow the operator: - * Build a temporary hint map, just to place and lock those - * stems participating in the counter mask. These are most - * likely the dominant hstems, and are grouped together in a - * few counter groups, not necessarily in correspondence - * with the hint groups. This reduces the chances of - * conflicts between hstems that are initially placed in - * separate hint groups and then brought together. The - * positions are copied back to `hStemHintArray', so we can - * discard `counterMask' and `counterHintMap'. - * - */ - CF2_HintMapRec counterHintMap; - CF2_HintMaskRec counterMask; - - - cf2_hintmap_init( &counterHintMap, - font, - &glyphPath.initialHintMap, - &glyphPath.hintMoves, - scaleY ); - cf2_hintmask_init( &counterMask, error ); - - cf2_hintmask_read( &counterMask, - charstring, - cf2_arrstack_size( &hStemHintArray ) + - cf2_arrstack_size( &vStemHintArray ) ); - cf2_hintmap_build( &counterHintMap, - &hStemHintArray, - &vStemHintArray, - &counterMask, - 0, - FALSE ); - } - break; - - case cf2_cmdRMOVETO: - FT_TRACE4(( " rmoveto\n" )); - - if ( cf2_stack_count( opStack ) > 2 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; - - /* width is defined or default after this */ - haveWidth = TRUE; - - if ( font->decoder->width_only ) - goto exit; - - curY += cf2_stack_popFixed( opStack ); - curX += cf2_stack_popFixed( opStack ); - - cf2_glyphpath_moveTo( &glyphPath, curX, curY ); - - break; - - case cf2_cmdHMOVETO: - FT_TRACE4(( " hmoveto\n" )); - - if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) - *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; - - /* width is defined or default after this */ - haveWidth = TRUE; - - if ( font->decoder->width_only ) - goto exit; - - curX += cf2_stack_popFixed( opStack ); - - cf2_glyphpath_moveTo( &glyphPath, curX, curY ); - - break; - - case cf2_cmdRLINECURVE: - { - CF2_UInt count = cf2_stack_count( opStack ); - CF2_UInt index = 0; - - - FT_TRACE4(( " rlinecurve\n" )); - - while ( index + 6 < count ) - { - curX += cf2_stack_getReal( opStack, index + 0 ); - curY += cf2_stack_getReal( opStack, index + 1 ); - - cf2_glyphpath_lineTo( &glyphPath, curX, curY ); - index += 2; - } - - while ( index < count ) - { - CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY; - CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1; - CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1; - CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; - CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2; - - - cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - - curX = x3; - curY = y3; - index += 6; - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdVVCURVETO: - { - CF2_UInt count, count1 = cf2_stack_count( opStack ); - CF2_UInt index = 0; - - - /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */ - /* we enforce it by clearing the second bit */ - /* (and sorting the stack indexing to suit) */ - count = count1 & ~2U; - index += count1 - count; - - FT_TRACE4(( " vvcurveto\n" )); - - while ( index < count ) - { - CF2_Fixed x1, y1, x2, y2, x3, y3; - - - if ( ( count - index ) & 1 ) - { - x1 = cf2_stack_getReal( opStack, index ) + curX; - - ++index; - } - else - x1 = curX; - - y1 = cf2_stack_getReal( opStack, index + 0 ) + curY; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - x3 = x2; - y3 = cf2_stack_getReal( opStack, index + 3 ) + y2; - - cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - - curX = x3; - curY = y3; - index += 4; - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdHHCURVETO: - { - CF2_UInt count, count1 = cf2_stack_count( opStack ); - CF2_UInt index = 0; - - - /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */ - /* we enforce it by clearing the second bit */ - /* (and sorting the stack indexing to suit) */ - count = count1 & ~2U; - index += count1 - count; - - FT_TRACE4(( " hhcurveto\n" )); - - while ( index < count ) - { - CF2_Fixed x1, y1, x2, y2, x3, y3; - - - if ( ( count - index ) & 1 ) - { - y1 = cf2_stack_getReal( opStack, index ) + curY; - - ++index; - } - else - y1 = curY; - - x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - x3 = cf2_stack_getReal( opStack, index + 3 ) + x2; - y3 = y2; - - cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - - curX = x3; - curY = y3; - index += 4; - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdVHCURVETO: - case cf2_cmdHVCURVETO: - { - CF2_UInt count, count1 = cf2_stack_count( opStack ); - CF2_UInt index = 0; - - FT_Bool alternate = op1 == cf2_cmdHVCURVETO; - - - /* if `cf2_stack_count' isn't of the form 8n, 8n+1, */ - /* 8n+4, or 8n+5, we enforce it by clearing the */ - /* second bit */ - /* (and sorting the stack indexing to suit) */ - count = count1 & ~2U; - index += count1 - count; - - FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" )); - - while ( index < count ) - { - CF2_Fixed x1, x2, x3, y1, y2, y3; - - - if ( alternate ) - { - x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; - y1 = curY; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - y3 = cf2_stack_getReal( opStack, index + 3 ) + y2; - - if ( count - index == 5 ) - { - x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; - - ++index; - } - else - x3 = x2; - - alternate = FALSE; - } - else - { - x1 = curX; - y1 = cf2_stack_getReal( opStack, index + 0 ) + curY; - x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; - y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; - x3 = cf2_stack_getReal( opStack, index + 3 ) + x2; - - if ( count - index == 5 ) - { - y3 = cf2_stack_getReal( opStack, index + 4 ) + y2; - - ++index; - } - else - y3 = y2; - - alternate = TRUE; - } - - cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); - - curX = x3; - curY = y3; - index += 4; - } - - cf2_stack_clear( opStack ); - } - continue; /* no need to clear stack again */ - - case cf2_cmdEXTENDEDNMBR: - { - CF2_Int v; - - - v = (FT_Short)( ( cf2_buf_readByte( charstring ) << 8 ) | - cf2_buf_readByte( charstring ) ); - - FT_TRACE4(( " %d", v )); - - cf2_stack_pushInt( opStack, v ); - } - continue; - - default: - /* numbers */ - { - if ( /* op1 >= 32 && */ op1 <= 246 ) - { - CF2_Int v; - - - v = op1 - 139; - - FT_TRACE4(( " %d", v )); - - /* -107 .. 107 */ - cf2_stack_pushInt( opStack, v ); - } - - else if ( /* op1 >= 247 && */ op1 <= 250 ) - { - CF2_Int v; - - - v = op1; - v -= 247; - v *= 256; - v += cf2_buf_readByte( charstring ); - v += 108; - - FT_TRACE4(( " %d", v )); - - /* 108 .. 1131 */ - cf2_stack_pushInt( opStack, v ); - } - - else if ( /* op1 >= 251 && */ op1 <= 254 ) - { - CF2_Int v; - - - v = op1; - v -= 251; - v *= 256; - v += cf2_buf_readByte( charstring ); - v = -v - 108; - - FT_TRACE4(( " %d", v )); - - /* -1131 .. -108 */ - cf2_stack_pushInt( opStack, v ); - } - - else /* op1 == 255 */ - { - CF2_Fixed v; - - - v = (CF2_Fixed) - ( ( (FT_UInt32)cf2_buf_readByte( charstring ) << 24 ) | - ( (FT_UInt32)cf2_buf_readByte( charstring ) << 16 ) | - ( (FT_UInt32)cf2_buf_readByte( charstring ) << 8 ) | - (FT_UInt32)cf2_buf_readByte( charstring ) ); - - FT_TRACE4(( " %.2f", v / 65536.0 )); - - cf2_stack_pushFixed( opStack, v ); - } - } - continue; /* don't clear stack */ - - } /* end of switch statement checking `op1' */ - - cf2_stack_clear( opStack ); - - } /* end of main interpreter loop */ - - /* we get here if the charstring ends without cf2_cmdENDCHAR */ - FT_TRACE4(( "cf2_interpT2CharString:" - " charstring ends without ENDCHAR\n" )); - - exit: - /* check whether last error seen is also the first one */ - cf2_setError( error, lastError ); - - /* free resources from objects we've used */ - cf2_glyphpath_finalize( &glyphPath ); - cf2_arrstack_finalize( &vStemHintArray ); - cf2_arrstack_finalize( &hStemHintArray ); - cf2_arrstack_finalize( &subrStack ); - cf2_stack_free( opStack ); - - FT_TRACE4(( "\n" )); - - return; - } - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2intrp.h b/src/3rdparty/freetype/src/cff/cf2intrp.h deleted file mode 100644 index b5d8947838..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2intrp.h +++ /dev/null @@ -1,83 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2font.h */ -/* */ -/* Adobe's CFF Interpreter (specification). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2INTRP_H__ -#define __CF2INTRP_H__ - - -#include "cf2ft.h" -#include "cf2hints.h" - - -FT_BEGIN_HEADER - - - FT_LOCAL( void ) - cf2_hintmask_init( CF2_HintMask hintmask, - FT_Error* error ); - FT_LOCAL( FT_Bool ) - cf2_hintmask_isValid( const CF2_HintMask hintmask ); - FT_LOCAL( FT_Bool ) - cf2_hintmask_isNew( const CF2_HintMask hintmask ); - FT_LOCAL( void ) - cf2_hintmask_setNew( CF2_HintMask hintmask, - FT_Bool val ); - FT_LOCAL( FT_Byte* ) - cf2_hintmask_getMaskPtr( CF2_HintMask hintmask ); - FT_LOCAL( void ) - cf2_hintmask_setAll( CF2_HintMask hintmask, - size_t bitCount ); - - FT_LOCAL( void ) - cf2_interpT2CharString( CF2_Font font, - CF2_Buffer charstring, - CF2_OutlineCallbacks callbacks, - const FT_Vector* translation, - FT_Bool doingSeac, - CF2_Fixed curX, - CF2_Fixed curY, - CF2_Fixed* width ); - - -FT_END_HEADER - - -#endif /* __CF2INTRP_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2read.c b/src/3rdparty/freetype/src/cff/cf2read.c deleted file mode 100644 index 2b429e3eeb..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2read.c +++ /dev/null @@ -1,112 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2read.c */ -/* */ -/* Adobe's code for stream handling (body). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#include "cf2ft.h" -#include FT_INTERNAL_DEBUG_H - -#include "cf2glue.h" - -#include "cf2error.h" - - - /* Define CF2_IO_FAIL as 1 to enable random errors and random */ - /* value errors in I/O. */ -#define CF2_IO_FAIL 0 - - -#if CF2_IO_FAIL - - /* set the .00 value to a nonzero probability */ - static int - randomError2( void ) - { - /* for region buffer ReadByte (interp) function */ - return (double)rand() / RAND_MAX < .00; - } - - /* set the .00 value to a nonzero probability */ - static CF2_Int - randomValue() - { - return (double)rand() / RAND_MAX < .00 ? rand() : 0; - } - -#endif /* CF2_IO_FAIL */ - - - /* Region Buffer */ - /* */ - /* Can be constructed from a copied buffer managed by */ - /* `FCM_getDatablock'. */ - /* Reads bytes with check for end of buffer. */ - - /* reading past the end of the buffer sets error and returns zero */ - FT_LOCAL_DEF( CF2_Int ) - cf2_buf_readByte( CF2_Buffer buf ) - { - if ( buf->ptr < buf->end ) - { -#if CF2_IO_FAIL - if ( randomError2() ) - { - CF2_SET_ERROR( buf->error, Invalid_Stream_Operation ); - return 0; - } - - return *(buf->ptr)++ + randomValue(); -#else - return *(buf->ptr)++; -#endif - } - else - { - CF2_SET_ERROR( buf->error, Invalid_Stream_Operation ); - return 0; - } - } - - - /* note: end condition can occur without error */ - FT_LOCAL_DEF( FT_Bool ) - cf2_buf_isEnd( CF2_Buffer buf ) - { - return (FT_Bool)( buf->ptr >= buf->end ); - } - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2read.h b/src/3rdparty/freetype/src/cff/cf2read.h deleted file mode 100644 index 7ef7c8c149..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2read.h +++ /dev/null @@ -1,68 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2read.h */ -/* */ -/* Adobe's code for stream handling (specification). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2READ_H__ -#define __CF2READ_H__ - - -FT_BEGIN_HEADER - - - typedef struct CF2_BufferRec_ - { - FT_Error* error; - const FT_Byte* start; - const FT_Byte* end; - const FT_Byte* ptr; - - } CF2_BufferRec, *CF2_Buffer; - - - FT_LOCAL( CF2_Int ) - cf2_buf_readByte( CF2_Buffer buf ); - FT_LOCAL( FT_Bool ) - cf2_buf_isEnd( CF2_Buffer buf ); - - -FT_END_HEADER - - -#endif /* __CF2READ_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2stack.c b/src/3rdparty/freetype/src/cff/cf2stack.c deleted file mode 100644 index 8332b5d91a..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2stack.c +++ /dev/null @@ -1,205 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2stack.c */ -/* */ -/* Adobe's code for emulating a CFF stack (body). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#include "cf2ft.h" -#include FT_INTERNAL_DEBUG_H - -#include "cf2glue.h" -#include "cf2font.h" -#include "cf2stack.h" - -#include "cf2error.h" - - - /* Allocate and initialize an instance of CF2_Stack. */ - /* Note: This function returns NULL on error (does not set */ - /* `error'). */ - FT_LOCAL_DEF( CF2_Stack ) - cf2_stack_init( FT_Memory memory, - FT_Error* e ) - { - FT_Error error = FT_Err_Ok; /* for FT_QNEW */ - - CF2_Stack stack = NULL; - - - if ( !FT_QNEW( stack ) ) - { - /* initialize the structure; FT_QNEW zeroes it */ - stack->memory = memory; - stack->error = e; - stack->top = &stack->buffer[0]; /* empty stack */ - } - - return stack; - } - - - FT_LOCAL_DEF( void ) - cf2_stack_free( CF2_Stack stack ) - { - if ( stack ) - { - FT_Memory memory = stack->memory; - - - /* free the main structure */ - FT_FREE( stack ); - } - } - - - FT_LOCAL_DEF( CF2_UInt ) - cf2_stack_count( CF2_Stack stack ) - { - return (CF2_UInt)( stack->top - &stack->buffer[0] ); - } - - - FT_LOCAL_DEF( void ) - cf2_stack_pushInt( CF2_Stack stack, - CF2_Int val ) - { - if ( stack->top == &stack->buffer[CF2_OPERAND_STACK_SIZE] ) - { - CF2_SET_ERROR( stack->error, Stack_Overflow ); - return; /* stack overflow */ - } - - stack->top->u.i = val; - stack->top->type = CF2_NumberInt; - ++stack->top; - } - - - FT_LOCAL_DEF( void ) - cf2_stack_pushFixed( CF2_Stack stack, - CF2_Fixed val ) - { - if ( stack->top == &stack->buffer[CF2_OPERAND_STACK_SIZE] ) - { - CF2_SET_ERROR( stack->error, Stack_Overflow ); - return; /* stack overflow */ - } - - stack->top->u.r = val; - stack->top->type = CF2_NumberFixed; - ++stack->top; - } - - - /* this function is only allowed to pop an integer type */ - FT_LOCAL_DEF( CF2_Int ) - cf2_stack_popInt( CF2_Stack stack ) - { - if ( stack->top == &stack->buffer[0] ) - { - CF2_SET_ERROR( stack->error, Stack_Underflow ); - return 0; /* underflow */ - } - if ( stack->top[-1].type != CF2_NumberInt ) - { - CF2_SET_ERROR( stack->error, Syntax_Error ); - return 0; /* type mismatch */ - } - - --stack->top; - - return stack->top->u.i; - } - - - /* Note: type mismatch is silently cast */ - /* TODO: check this */ - FT_LOCAL_DEF( CF2_Fixed ) - cf2_stack_popFixed( CF2_Stack stack ) - { - if ( stack->top == &stack->buffer[0] ) - { - CF2_SET_ERROR( stack->error, Stack_Underflow ); - return cf2_intToFixed( 0 ); /* underflow */ - } - - --stack->top; - - switch ( stack->top->type ) - { - case CF2_NumberInt: - return cf2_intToFixed( stack->top->u.i ); - case CF2_NumberFrac: - return cf2_fracToFixed( stack->top->u.f ); - default: - return stack->top->u.r; - } - } - - - /* Note: type mismatch is silently cast */ - /* TODO: check this */ - FT_LOCAL_DEF( CF2_Fixed ) - cf2_stack_getReal( CF2_Stack stack, - CF2_UInt idx ) - { - FT_ASSERT( cf2_stack_count( stack ) <= CF2_OPERAND_STACK_SIZE ); - - if ( idx >= cf2_stack_count( stack ) ) - { - CF2_SET_ERROR( stack->error, Stack_Overflow ); - return cf2_intToFixed( 0 ); /* bounds error */ - } - - switch ( stack->buffer[idx].type ) - { - case CF2_NumberInt: - return cf2_intToFixed( stack->buffer[idx].u.i ); - case CF2_NumberFrac: - return cf2_fracToFixed( stack->buffer[idx].u.f ); - default: - return stack->buffer[idx].u.r; - } - } - - - FT_LOCAL_DEF( void ) - cf2_stack_clear( CF2_Stack stack ) - { - stack->top = &stack->buffer[0]; - } - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2stack.h b/src/3rdparty/freetype/src/cff/cf2stack.h deleted file mode 100644 index 7d6d1961fe..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2stack.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2stack.h */ -/* */ -/* Adobe's code for emulating a CFF stack (specification). */ -/* */ -/* Copyright 2007-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2STACK_H__ -#define __CF2STACK_H__ - - -FT_BEGIN_HEADER - - - /* CFF operand stack; specified maximum of 48 or 192 values */ - typedef struct CF2_StackNumber_ - { - union - { - CF2_Fixed r; /* 16.16 fixed point */ - CF2_Frac f; /* 2.30 fixed point (for font matrix) */ - CF2_Int i; - } u; - - CF2_NumberType type; - - } CF2_StackNumber; - - - typedef struct CF2_StackRec_ - { - FT_Memory memory; - FT_Error* error; - CF2_StackNumber buffer[CF2_OPERAND_STACK_SIZE]; - CF2_StackNumber* top; - - } CF2_StackRec, *CF2_Stack; - - - FT_LOCAL( CF2_Stack ) - cf2_stack_init( FT_Memory memory, - FT_Error* error ); - FT_LOCAL( void ) - cf2_stack_free( CF2_Stack stack ); - - FT_LOCAL( CF2_UInt ) - cf2_stack_count( CF2_Stack stack ); - - FT_LOCAL( void ) - cf2_stack_pushInt( CF2_Stack stack, - CF2_Int val ); - FT_LOCAL( void ) - cf2_stack_pushFixed( CF2_Stack stack, - CF2_Fixed val ); - - FT_LOCAL( CF2_Int ) - cf2_stack_popInt( CF2_Stack stack ); - FT_LOCAL( CF2_Fixed ) - cf2_stack_popFixed( CF2_Stack stack ); - - FT_LOCAL( CF2_Fixed ) - cf2_stack_getReal( CF2_Stack stack, - CF2_UInt idx ); - - FT_LOCAL( void ) - cf2_stack_clear( CF2_Stack stack ); - - -FT_END_HEADER - - -#endif /* __CF2STACK_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cf2types.h b/src/3rdparty/freetype/src/cff/cf2types.h deleted file mode 100644 index ac6a02266e..0000000000 --- a/src/3rdparty/freetype/src/cff/cf2types.h +++ /dev/null @@ -1,78 +0,0 @@ -/***************************************************************************/ -/* */ -/* cf2types.h */ -/* */ -/* Adobe's code for defining data types (specification only). */ -/* */ -/* Copyright 2011-2013 Adobe Systems Incorporated. */ -/* */ -/* This software, and all works of authorship, whether in source or */ -/* object code form as indicated by the copyright notice(s) included */ -/* herein (collectively, the "Work") is made available, and may only be */ -/* used, modified, and distributed under the FreeType Project License, */ -/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ -/* FreeType Project License, each contributor to the Work hereby grants */ -/* to any individual or legal entity exercising permissions granted by */ -/* the FreeType Project License and this section (hereafter, "You" or */ -/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ -/* royalty-free, irrevocable (except as stated in this section) patent */ -/* license to make, have made, use, offer to sell, sell, import, and */ -/* otherwise transfer the Work, where such license applies only to those */ -/* patent claims licensable by such contributor that are necessarily */ -/* infringed by their contribution(s) alone or by combination of their */ -/* contribution(s) with the Work to which such contribution(s) was */ -/* submitted. If You institute patent litigation against any entity */ -/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ -/* the Work or a contribution incorporated within the Work constitutes */ -/* direct or contributory patent infringement, then any patent licenses */ -/* granted to You under this License for that Work shall terminate as of */ -/* the date such litigation is filed. */ -/* */ -/* By using, modifying, or distributing the Work you indicate that you */ -/* have read and understood the terms and conditions of the */ -/* FreeType Project License as well as those provided in this section, */ -/* and you accept them fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CF2TYPES_H__ -#define __CF2TYPES_H__ - -#include <ft2build.h> -#include FT_FREETYPE_H - - -FT_BEGIN_HEADER - - - /* - * The data models that we expect to support are as follows: - * - * name char short int long long-long pointer example - * ----------------------------------------------------- - * ILP32 8 16 32 32 64* 32 32-bit MacOS, x86 - * LLP64 8 16 32 32 64 64 x64 - * LP64 8 16 32 64 64 64 64-bit MacOS - * - * *) type may be supported by emulation on a 32-bit architecture - * - */ - - - /* integers at least 32 bits wide */ -#define CF2_UInt FT_UFast -#define CF2_Int FT_Fast - - - /* fixed-float numbers */ - typedef FT_Int32 CF2_F16Dot16; - - -FT_END_HEADER - - -#endif /* __CF2TYPES_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cff.c b/src/3rdparty/freetype/src/cff/cff.c index a34ba9b710..0fa6c87870 100644 --- a/src/3rdparty/freetype/src/cff/cff.c +++ b/src/3rdparty/freetype/src/cff/cff.c @@ -4,7 +4,7 @@ * * FreeType OpenType driver component (body only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "cffcmap.c" #include "cffdrivr.c" diff --git a/src/3rdparty/freetype/src/cff/cffcmap.c b/src/3rdparty/freetype/src/cff/cffcmap.c index 15cc94cafb..6d16ed4226 100644 --- a/src/3rdparty/freetype/src/cff/cffcmap.c +++ b/src/3rdparty/freetype/src/cff/cffcmap.c @@ -4,7 +4,7 @@ * * CFF character mapping table (cmap) support (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,8 +16,7 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include "cffcmap.h" #include "cffload.h" diff --git a/src/3rdparty/freetype/src/cff/cffcmap.h b/src/3rdparty/freetype/src/cff/cffcmap.h index 07366bc748..69fab8dc6c 100644 --- a/src/3rdparty/freetype/src/cff/cffcmap.h +++ b/src/3rdparty/freetype/src/cff/cffcmap.h @@ -4,7 +4,7 @@ * * CFF character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,7 +19,7 @@ #ifndef CFFCMAP_H_ #define CFFCMAP_H_ -#include FT_INTERNAL_CFF_OBJECTS_TYPES_H +#include <freetype/internal/cffotypes.h> FT_BEGIN_HEADER @@ -43,7 +43,7 @@ FT_BEGIN_HEADER } CFF_CMapStdRec; - FT_DECLARE_CMAP_CLASS(cff_cmap_encoding_class_rec) + FT_DECLARE_CMAP_CLASS( cff_cmap_encoding_class_rec ) /*************************************************************************/ @@ -56,7 +56,7 @@ FT_BEGIN_HEADER /* unicode (synthetic) cmaps */ - FT_DECLARE_CMAP_CLASS(cff_cmap_unicode_class_rec) + FT_DECLARE_CMAP_CLASS( cff_cmap_unicode_class_rec ) FT_END_HEADER diff --git a/src/3rdparty/freetype/src/cff/cffdrivr.c b/src/3rdparty/freetype/src/cff/cffdrivr.c index 2324989811..486ab24235 100644 --- a/src/3rdparty/freetype/src/cff/cffdrivr.c +++ b/src/3rdparty/freetype/src/cff/cffdrivr.c @@ -4,7 +4,7 @@ * * OpenType font driver implementation (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,18 +16,17 @@ */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_POSTSCRIPT_PROPS_H -#include FT_SERVICE_CID_H -#include FT_SERVICE_POSTSCRIPT_INFO_H -#include FT_SERVICE_POSTSCRIPT_NAME_H -#include FT_SERVICE_TT_CMAP_H -#include FT_SERVICE_CFF_TABLE_LOAD_H +#include <freetype/freetype.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/sfnt.h> +#include <freetype/internal/psaux.h> +#include <freetype/internal/ftpsprop.h> +#include <freetype/internal/services/svcid.h> +#include <freetype/internal/services/svpsinfo.h> +#include <freetype/internal/services/svpostnm.h> +#include <freetype/internal/services/svttcmap.h> +#include <freetype/internal/services/svcfftl.h> #include "cffdrivr.h" #include "cffgload.h" @@ -37,16 +36,16 @@ #include "cffobjs.h" #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_SERVICE_MULTIPLE_MASTERS_H -#include FT_SERVICE_METRICS_VARIATIONS_H +#include <freetype/internal/services/svmm.h> +#include <freetype/internal/services/svmetric.h> #endif #include "cfferrs.h" -#include FT_SERVICE_FONT_FORMAT_H -#include FT_SERVICE_GLYPH_DICT_H -#include FT_SERVICE_PROPERTIES_H -#include FT_DRIVER_H +#include <freetype/internal/services/svfntfmt.h> +#include <freetype/internal/services/svgldict.h> +#include <freetype/internal/services/svprop.h> +#include <freetype/ftdriver.h> /************************************************************************** @@ -738,7 +737,7 @@ { if ( dict->cid_supplement < FT_INT_MIN || dict->cid_supplement > FT_INT_MAX ) - FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n", + FT_TRACE1(( "cff_get_ros: too large supplement %ld is truncated\n", dict->cid_supplement )); *supplement = (FT_Int)dict->cid_supplement; } diff --git a/src/3rdparty/freetype/src/cff/cffdrivr.h b/src/3rdparty/freetype/src/cff/cffdrivr.h index f2bbcfe4f1..d198dd35cb 100644 --- a/src/3rdparty/freetype/src/cff/cffdrivr.h +++ b/src/3rdparty/freetype/src/cff/cffdrivr.h @@ -4,7 +4,7 @@ * * High-level OpenType driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define CFFDRIVER_H_ -#include <ft2build.h> -#include FT_INTERNAL_DRIVER_H +#include <freetype/internal/ftdrv.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/cff/cfferrs.h b/src/3rdparty/freetype/src/cff/cfferrs.h index 78d47a156d..5b00a3f0a2 100644 --- a/src/3rdparty/freetype/src/cff/cfferrs.h +++ b/src/3rdparty/freetype/src/cff/cfferrs.h @@ -4,7 +4,7 @@ * * CFF error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 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 @@ #ifndef CFFERRS_H_ #define CFFERRS_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -34,7 +34,7 @@ #define FT_ERR_BASE FT_Mod_Err_CFF -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* CFFERRS_H_ */ diff --git a/src/3rdparty/freetype/src/cff/cffgload.c b/src/3rdparty/freetype/src/cff/cffgload.c index 36aa7d1b9c..feee38a413 100644 --- a/src/3rdparty/freetype/src/cff/cffgload.c +++ b/src/3rdparty/freetype/src/cff/cffgload.c @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,14 +16,13 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_OUTLINE_H -#include FT_DRIVER_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/sfnt.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/psaux.h> +#include <freetype/ftoutln.h> +#include <freetype/ftdriver.h> #include "cffload.h" #include "cffgload.h" @@ -207,8 +206,8 @@ PSAux_Service psaux = (PSAux_Service)face->psaux; const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs; - FT_Matrix font_matrix; - FT_Vector font_offset; + FT_Matrix font_matrix; + FT_Vector font_offset; force_scaling = FALSE; @@ -364,7 +363,6 @@ top_upm = (FT_Long)cff->top_font.font_dict.units_per_em; sub_upm = (FT_Long)cff->subfonts[fd_index]->font_dict.units_per_em; - font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix; font_offset = cff->subfonts[fd_index]->font_dict.font_offset; @@ -399,7 +397,6 @@ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face ); #endif - FT_Byte* charstring; FT_ULong charstring_len; @@ -665,8 +662,12 @@ metrics->horiBearingY = cbox.yMax; if ( has_vertical_info ) + { metrics->vertBearingX = metrics->horiBearingX - metrics->horiAdvance / 2; + metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, + glyph->y_scale ); + } else { if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) diff --git a/src/3rdparty/freetype/src/cff/cffgload.h b/src/3rdparty/freetype/src/cff/cffgload.h index 754c55acf9..3b312f452e 100644 --- a/src/3rdparty/freetype/src/cff/cffgload.h +++ b/src/3rdparty/freetype/src/cff/cffgload.h @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define CFFGLOAD_H_ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_CFF_OBJECTS_TYPES_H +#include <freetype/freetype.h> +#include <freetype/internal/cffotypes.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/cff/cffload.c b/src/3rdparty/freetype/src/cff/cffload.c index 12efd18dc4..73d3eecd31 100644 --- a/src/3rdparty/freetype/src/cff/cffload.c +++ b/src/3rdparty/freetype/src/cff/cffload.c @@ -4,7 +4,7 @@ * * OpenType and CFF data/program tables loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,17 +16,16 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H -#include FT_TYPE1_TABLES_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> +#include <freetype/t1tables.h> +#include <freetype/internal/psaux.h> #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_MULTIPLE_MASTERS_H -#include FT_SERVICE_MULTIPLE_MASTERS_H +#include <freetype/ftmm.h> +#include <freetype/internal/services/svmm.h> #endif #include "cffload.h" @@ -411,7 +410,7 @@ FT_Error error = FT_Err_Ok; FT_Memory memory = idx->stream->memory; - FT_Byte** t = NULL; + FT_Byte** tbl = NULL; FT_Byte* new_bytes = NULL; FT_ULong new_size; @@ -428,11 +427,11 @@ new_size = idx->data_size + idx->count; if ( idx->count > 0 && - !FT_NEW_ARRAY( t, idx->count + 1 ) && + !FT_NEW_ARRAY( tbl, idx->count + 1 ) && ( !pool || !FT_ALLOC( new_bytes, new_size ) ) ) { FT_ULong n, cur_offset; - FT_ULong extra = 0; + FT_ULong extra = 0; FT_Byte* org_bytes = idx->bytes; @@ -443,15 +442,15 @@ if ( cur_offset != 0 ) { FT_TRACE0(( "cff_index_get_pointers:" - " invalid first offset value %d set to zero\n", + " invalid first offset value %ld set to zero\n", cur_offset )); cur_offset = 0; } if ( !pool ) - t[0] = org_bytes + cur_offset; + tbl[0] = org_bytes + cur_offset; else - t[0] = new_bytes + cur_offset; + tbl[0] = new_bytes + cur_offset; for ( n = 1; n <= idx->count; n++ ) { @@ -465,23 +464,25 @@ next_offset = idx->data_size; if ( !pool ) - t[n] = org_bytes + next_offset; + tbl[n] = org_bytes + next_offset; else { - t[n] = new_bytes + next_offset + extra; + tbl[n] = new_bytes + next_offset + extra; if ( next_offset != cur_offset ) { - FT_MEM_COPY( t[n - 1], org_bytes + cur_offset, t[n] - t[n - 1] ); - t[n][0] = '\0'; - t[n] += 1; + FT_MEM_COPY( tbl[n - 1], + org_bytes + cur_offset, + tbl[n] - tbl[n - 1] ); + tbl[n][0] = '\0'; + tbl[n] += 1; extra++; } } cur_offset = next_offset; } - *table = t; + *table = tbl; if ( pool ) *pool = new_bytes; @@ -490,6 +491,11 @@ } Exit: + if ( error && new_bytes ) + FT_FREE( new_bytes ); + if ( error && tbl ) + FT_FREE( tbl ); + return error; } @@ -553,8 +559,8 @@ idx->data_offset > stream->size - off2 + 1 ) { FT_ERROR(( "cff_index_access_element:" - " offset to next entry (%d)" - " exceeds the end of stream (%d)\n", + " offset to next entry (%ld)" + " exceeds the end of stream (%ld)\n", off2, stream->size - idx->data_offset + 1 )); off2 = stream->size - idx->data_offset + 1; } @@ -978,7 +984,7 @@ if ( glyph_sid > 0xFFFFL - nleft ) { FT_ERROR(( "cff_charset_load: invalid SID range trimmed" - " nleft=%d -> %d\n", nleft, 0xFFFFL - glyph_sid )); + " nleft=%d -> %ld\n", nleft, 0xFFFFL - glyph_sid )); nleft = ( FT_UInt )( 0xFFFFL - glyph_sid ); } @@ -1945,7 +1951,7 @@ if ( priv->blue_shift > 1000 || priv->blue_shift < 0 ) { FT_TRACE2(( "cff_load_private_dict:" - " setting unlikely BlueShift value %d to default (7)\n", + " setting unlikely BlueShift value %ld to default (7)\n", priv->blue_shift )); priv->blue_shift = 7; } @@ -1953,7 +1959,7 @@ if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 ) { FT_TRACE2(( "cff_load_private_dict:" - " setting unlikely BlueFuzz value %d to default (1)\n", + " setting unlikely BlueFuzz value %ld to default (1)\n", priv->blue_fuzz )); priv->blue_fuzz = 1; } @@ -2057,7 +2063,7 @@ if ( !error ) { FT_TRACE4(( " top dictionary:\n" )); - error = cff_parser_run( &parser, dict, dict + dict_len ); + error = cff_parser_run( &parser, dict, FT_OFFSET( dict, dict_len ) ); } /* clean up regardless of error */ diff --git a/src/3rdparty/freetype/src/cff/cffload.h b/src/3rdparty/freetype/src/cff/cffload.h index 42d2696f33..fc998db2db 100644 --- a/src/3rdparty/freetype/src/cff/cffload.h +++ b/src/3rdparty/freetype/src/cff/cffload.h @@ -4,7 +4,7 @@ * * OpenType & CFF data/program tables loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,10 +20,9 @@ #define CFFLOAD_H_ -#include <ft2build.h> -#include FT_INTERNAL_CFF_TYPES_H +#include <freetype/internal/cfftypes.h> #include "cffparse.h" -#include FT_INTERNAL_CFF_OBJECTS_TYPES_H /* for CFF_Face */ +#include <freetype/internal/cffotypes.h> /* for CFF_Face */ FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/cff/cffobjs.c b/src/3rdparty/freetype/src/cff/cffobjs.c index f76245f30b..d555d52358 100644 --- a/src/3rdparty/freetype/src/cff/cffobjs.c +++ b/src/3rdparty/freetype/src/cff/cffobjs.c @@ -4,7 +4,7 @@ * * OpenType objects manager (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,32 +16,31 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_STREAM_H -#include FT_ERRORS_H -#include FT_TRUETYPE_IDS_H -#include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_SFNT_H -#include FT_DRIVER_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/ftstream.h> +#include <freetype/fterrors.h> +#include <freetype/ttnameid.h> +#include <freetype/tttags.h> +#include <freetype/internal/sfnt.h> +#include <freetype/ftdriver.h> #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_MULTIPLE_MASTERS_H -#include FT_SERVICE_MULTIPLE_MASTERS_H -#include FT_SERVICE_METRICS_VARIATIONS_H +#include <freetype/ftmm.h> +#include <freetype/internal/services/svmm.h> +#include <freetype/internal/services/svmetric.h> #endif -#include FT_INTERNAL_CFF_OBJECTS_TYPES_H +#include <freetype/internal/cffotypes.h> #include "cffobjs.h" #include "cffload.h" #include "cffcmap.h" #include "cfferrs.h" -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_SERVICE_CFF_TABLE_LOAD_H +#include <freetype/internal/psaux.h> +#include <freetype/internal/services/svcfftl.h> /************************************************************************** @@ -167,46 +166,56 @@ FT_Error error = FT_Err_Ok; PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size ); + FT_Memory memory = cffsize->face->memory; + CFF_Internal internal = NULL; + CFF_Face face = (CFF_Face)cffsize->face; + CFF_Font font = (CFF_Font)face->extra.data; - if ( funcs ) - { - CFF_Face face = (CFF_Face)cffsize->face; - CFF_Font font = (CFF_Font)face->extra.data; - CFF_Internal internal = NULL; + PS_PrivateRec priv; - PS_PrivateRec priv; - FT_Memory memory = cffsize->face->memory; + FT_UInt i; - FT_UInt i; + if ( !funcs ) + goto Exit; + + if ( FT_NEW( internal ) ) + goto Exit; + cff_make_private_dict( &font->top_font, &priv ); + error = funcs->create( cffsize->face->memory, &priv, + &internal->topfont ); + if ( error ) + goto Exit; + + for ( i = font->num_subfonts; i > 0; i-- ) + { + CFF_SubFont sub = font->subfonts[i - 1]; - if ( FT_NEW( internal ) ) - goto Exit; - cff_make_private_dict( &font->top_font, &priv ); + cff_make_private_dict( sub, &priv ); error = funcs->create( cffsize->face->memory, &priv, - &internal->topfont ); + &internal->subfonts[i - 1] ); if ( error ) goto Exit; + } - for ( i = font->num_subfonts; i > 0; i-- ) - { - CFF_SubFont sub = font->subfonts[i - 1]; + cffsize->internal->module_data = internal; + size->strike_index = 0xFFFFFFFFUL; - cff_make_private_dict( sub, &priv ); - error = funcs->create( cffsize->face->memory, &priv, - &internal->subfonts[i - 1] ); - if ( error ) - goto Exit; + Exit: + if ( error ) + { + if ( internal ) + { + for ( i = font->num_subfonts; i > 0; i-- ) + FT_FREE( internal->subfonts[i - 1] ); + FT_FREE( internal->topfont ); } - cffsize->internal->module_data = internal; + FT_FREE( internal ); } - size->strike_index = 0xFFFFFFFFUL; - - Exit: return error; } @@ -349,7 +358,8 @@ FT_LOCAL_DEF( void ) cff_slot_done( FT_GlyphSlot slot ) { - slot->internal->glyph_hints = NULL; + if ( slot->internal ) + slot->internal->glyph_hints = NULL; } @@ -940,7 +950,8 @@ style_name = cff_strcpy( memory, fullp ); /* remove the style part from the family name (if present) */ - remove_style( cffface->family_name, style_name ); + if ( style_name ) + remove_style( cffface->family_name, style_name ); } break; } @@ -1018,9 +1029,9 @@ } #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES - /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */ - /* has unset this flag because of the 3.0 `post' table. */ - if ( dict->cid_registry == 0xFFFFU ) + /* CID-keyed CFF or CFF2 fonts don't have glyph names -- the SFNT */ + /* loader has unset this flag because of the 3.0 `post' table. */ + if ( dict->cid_registry == 0xFFFFU && !cff2 ) cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES; #endif diff --git a/src/3rdparty/freetype/src/cff/cffobjs.h b/src/3rdparty/freetype/src/cff/cffobjs.h index 03bc78a67f..845bd90941 100644 --- a/src/3rdparty/freetype/src/cff/cffobjs.h +++ b/src/3rdparty/freetype/src/cff/cffobjs.h @@ -4,7 +4,7 @@ * * OpenType objects manager (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,7 +20,6 @@ #define CFFOBJS_H_ -#include <ft2build.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/cff/cffparse.c b/src/3rdparty/freetype/src/cff/cffparse.c index 008752c3ae..69bcd5d957 100644 --- a/src/3rdparty/freetype/src/cff/cffparse.c +++ b/src/3rdparty/freetype/src/cff/cffparse.c @@ -4,7 +4,7 @@ * * CFF token stream parser (body) * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,13 +16,12 @@ */ -#include <ft2build.h> #include "cffparse.h" -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_LIST_H +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/psaux.h> +#include <freetype/ftlist.h> #include "cfferrs.h" #include "cffload.h" @@ -714,7 +713,7 @@ ( max_scaling - min_scaling ) > 9 ) { FT_TRACE1(( "cff_parse_font_matrix:" - " strange scaling values (minimum %d, maximum %d),\n" + " strange scaling values (minimum %ld, maximum %ld),\n" " " " using default matrix\n", min_scaling, max_scaling )); goto Unlikely; @@ -811,7 +810,7 @@ bbox->yMax = FT_RoundFix( cff_parse_fixed( parser, data ) ); error = FT_Err_Ok; - FT_TRACE4(( " [%d %d %d %d]\n", + FT_TRACE4(( " [%ld %ld %ld %ld]\n", bbox->xMin / 65536, bbox->yMin / 65536, bbox->xMax / 65536, @@ -934,11 +933,11 @@ FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" )); dict->cid_supplement = cff_parse_num( parser, data ); if ( dict->cid_supplement < 0 ) - FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n", + FT_TRACE1(( "cff_parse_cid_ros: negative supplement %ld is found\n", dict->cid_supplement )); error = FT_Err_Ok; - FT_TRACE4(( " %d %d %d\n", + FT_TRACE4(( " %d %d %ld\n", dict->cid_registry, dict->cid_ordering, dict->cid_supplement )); @@ -1264,11 +1263,11 @@ FT_Byte* charstring_base; FT_ULong charstring_len; - FT_Fixed* stack; - FT_ListNode node; - CFF_T2_String t2; - size_t t2_size; - FT_Byte* q; + FT_Fixed* stack; + FT_ListNode node; + CFF_T2_String t2; + FT_Fixed t2_size; + FT_Byte* q; charstring_base = ++p; diff --git a/src/3rdparty/freetype/src/cff/cffparse.h b/src/3rdparty/freetype/src/cff/cffparse.h index 4e74709a2d..6f3fbb37d6 100644 --- a/src/3rdparty/freetype/src/cff/cffparse.h +++ b/src/3rdparty/freetype/src/cff/cffparse.h @@ -4,7 +4,7 @@ * * CFF token stream parser (specification) * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define CFFPARSE_H_ -#include <ft2build.h> -#include FT_INTERNAL_CFF_TYPES_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/cfftypes.h> +#include <freetype/internal/ftobjs.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/cff/cffpic.c b/src/3rdparty/freetype/src/cff/cffpic.c deleted file mode 100644 index 08b74c7cf2..0000000000 --- a/src/3rdparty/freetype/src/cff/cffpic.c +++ /dev/null @@ -1,138 +0,0 @@ -/***************************************************************************/ -/* */ -/* cffpic.c */ -/* */ -/* The FreeType position independent code services for cff module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include "cffcmap.h" -#include "cffpic.h" -#include "cfferrs.h" - - -#ifdef FT_CONFIG_OPTION_PIC - - /* forward declaration of PIC init functions from cffdrivr.c */ - FT_Error - FT_Create_Class_cff_services( FT_Library library, - FT_ServiceDescRec** output_class ); - void - FT_Destroy_Class_cff_services( FT_Library library, - FT_ServiceDescRec* clazz ); - void - FT_Init_Class_cff_service_ps_info( FT_Library library, - FT_Service_PsInfoRec* clazz ); - void - FT_Init_Class_cff_service_glyph_dict( FT_Library library, - FT_Service_GlyphDictRec* clazz ); - void - FT_Init_Class_cff_service_ps_name( FT_Library library, - FT_Service_PsFontNameRec* clazz ); - void - FT_Init_Class_cff_service_get_cmap_info( FT_Library library, - FT_Service_TTCMapsRec* clazz ); - void - FT_Init_Class_cff_service_cid_info( FT_Library library, - FT_Service_CIDRec* clazz ); - - /* forward declaration of PIC init functions from cffparse.c */ - FT_Error - FT_Create_Class_cff_field_handlers( FT_Library library, - CFF_Field_Handler** output_class ); - void - FT_Destroy_Class_cff_field_handlers( FT_Library library, - CFF_Field_Handler* clazz ); - - - void - cff_driver_class_pic_free( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - - - if ( pic_container->cff ) - { - CffModulePIC* container = (CffModulePIC*)pic_container->cff; - - - if ( container->cff_services ) - FT_Destroy_Class_cff_services( library, - container->cff_services ); - container->cff_services = NULL; - if ( container->cff_field_handlers ) - FT_Destroy_Class_cff_field_handlers( - library, container->cff_field_handlers ); - container->cff_field_handlers = NULL; - FT_FREE( container ); - pic_container->cff = NULL; - } - } - - - FT_Error - cff_driver_class_pic_init( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - CffModulePIC* container = NULL; - FT_Memory memory = library->memory; - - - /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) - return error; - FT_MEM_SET( container, 0, sizeof ( *container ) ); - pic_container->cff = container; - - /* initialize pointer table - */ - /* this is how the module usually expects this data */ - error = FT_Create_Class_cff_services( library, - &container->cff_services ); - if ( error ) - goto Exit; - - error = FT_Create_Class_cff_field_handlers( - library, &container->cff_field_handlers ); - if ( error ) - goto Exit; - - FT_Init_Class_cff_service_ps_info( - library, &container->cff_service_ps_info ); - FT_Init_Class_cff_service_glyph_dict( - library, &container->cff_service_glyph_dict ); - FT_Init_Class_cff_service_ps_name( - library, &container->cff_service_ps_name ); - FT_Init_Class_cff_service_get_cmap_info( - library, &container->cff_service_get_cmap_info ); - FT_Init_Class_cff_service_cid_info( - library, &container->cff_service_cid_info ); - FT_Init_Class_cff_cmap_encoding_class_rec( - library, &container->cff_cmap_encoding_class_rec ); - FT_Init_Class_cff_cmap_unicode_class_rec( - library, &container->cff_cmap_unicode_class_rec ); - - Exit: - if ( error ) - cff_driver_class_pic_free( library ); - return error; - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cffpic.h b/src/3rdparty/freetype/src/cff/cffpic.h deleted file mode 100644 index 8ba4203a8d..0000000000 --- a/src/3rdparty/freetype/src/cff/cffpic.h +++ /dev/null @@ -1,121 +0,0 @@ -/***************************************************************************/ -/* */ -/* cffpic.h */ -/* */ -/* The FreeType position independent code services for cff module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef CFFPIC_H_ -#define CFFPIC_H_ - - -#include FT_INTERNAL_PIC_H - -#ifndef FT_CONFIG_OPTION_PIC - -#define CFF_SERVICE_PS_INFO_GET cff_service_ps_info -#define CFF_SERVICE_GLYPH_DICT_GET cff_service_glyph_dict -#define CFF_SERVICE_PS_NAME_GET cff_service_ps_name -#define CFF_SERVICE_GET_CMAP_INFO_GET cff_service_get_cmap_info -#define CFF_SERVICE_CID_INFO_GET cff_service_cid_info -#define CFF_SERVICE_PROPERTIES_GET cff_service_properties -#define CFF_SERVICES_GET cff_services -#define CFF_SERVICE_MULTI_MASTERS_GET cff_service_multi_masters -#define CFF_SERVICE_METRICS_VAR_GET cff_service_metrics_variations -#define CFF_SERVICE_CFF_LOAD_GET cff_service_cff_load -#define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec -#define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec -#define CFF_FIELD_HANDLERS_GET cff_field_handlers - -#else /* FT_CONFIG_OPTION_PIC */ - -#include FT_SERVICE_GLYPH_DICT_H -#include "cffparse.h" -#include FT_SERVICE_POSTSCRIPT_INFO_H -#include FT_SERVICE_POSTSCRIPT_NAME_H -#include FT_SERVICE_TT_CMAP_H -#include FT_SERVICE_CID_H -#include FT_SERVICE_PROPERTIES_H -#include FT_SERVICE_MULTIPLE_MASTERS_H -#include FT_SERVICE_METRICS_VARIATIONS_H - - -FT_BEGIN_HEADER - - typedef struct CffModulePIC_ - { - FT_ServiceDescRec* cff_services; - CFF_Field_Handler* cff_field_handlers; - FT_Service_PsInfoRec cff_service_ps_info; - FT_Service_GlyphDictRec cff_service_glyph_dict; - FT_Service_PsFontNameRec cff_service_ps_name; - FT_Service_TTCMapsRec cff_service_get_cmap_info; - FT_Service_CIDRec cff_service_cid_info; - FT_Service_PropertiesRec cff_service_properties; - FT_Service_MultiMastersRec cff_service_multi_masters; - FT_Service_MetricsVariationsRec cff_service_metrics_variations; - FT_Service_CFFLoadRec cff_service_cff_load; - FT_CMap_ClassRec cff_cmap_encoding_class_rec; - FT_CMap_ClassRec cff_cmap_unicode_class_rec; - - } CffModulePIC; - - -#define GET_PIC( lib ) \ - ( (CffModulePIC*)( (lib)->pic_container.cff ) ) - -#define CFF_SERVICE_PS_INFO_GET \ - ( GET_PIC( library )->cff_service_ps_info ) -#define CFF_SERVICE_GLYPH_DICT_GET \ - ( GET_PIC( library )->cff_service_glyph_dict ) -#define CFF_SERVICE_PS_NAME_GET \ - ( GET_PIC( library )->cff_service_ps_name ) -#define CFF_SERVICE_GET_CMAP_INFO_GET \ - ( GET_PIC( library )->cff_service_get_cmap_info ) -#define CFF_SERVICE_CID_INFO_GET \ - ( GET_PIC( library )->cff_service_cid_info ) -#define CFF_SERVICE_PROPERTIES_GET \ - ( GET_PIC( library )->cff_service_properties ) -#define CFF_SERVICES_GET \ - ( GET_PIC( library )->cff_services ) -#define CFF_SERVICE_MULTI_MASTERS_GET \ - ( GET_PIC( library )->cff_service_multi_masters ) -#define CFF_SERVICE_METRICS_VAR_GET \ - ( GET_PIC( library )->cff_service_metrics_variations ) -#define CFF_SERVICE_CFF_LOAD_GET \ - ( GET_PIC( library )->cff_service_cff_load ) -#define CFF_CMAP_ENCODING_CLASS_REC_GET \ - ( GET_PIC( library )->cff_cmap_encoding_class_rec ) -#define CFF_CMAP_UNICODE_CLASS_REC_GET \ - ( GET_PIC( library )->cff_cmap_unicode_class_rec ) -#define CFF_FIELD_HANDLERS_GET \ - ( GET_PIC( library )->cff_field_handlers ) - - /* see cffpic.c for the implementation */ - void - cff_driver_class_pic_free( FT_Library library ); - - FT_Error - cff_driver_class_pic_init( FT_Library library ); - -FT_END_HEADER - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - -#endif /* CFFPIC_H_ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/cfftoken.h b/src/3rdparty/freetype/src/cff/cfftoken.h index 063a7b3be0..4c6a53eec1 100644 --- a/src/3rdparty/freetype/src/cff/cfftoken.h +++ b/src/3rdparty/freetype/src/cff/cfftoken.h @@ -4,7 +4,7 @@ * * CFF token definitions (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 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/cff/cfftypes.h b/src/3rdparty/freetype/src/cff/cfftypes.h deleted file mode 100644 index de8a5ee9b4..0000000000 --- a/src/3rdparty/freetype/src/cff/cfftypes.h +++ /dev/null @@ -1,284 +0,0 @@ -/***************************************************************************/ -/* */ -/* cfftypes.h */ -/* */ -/* Basic OpenType/CFF type definitions and interface (specification */ -/* only). */ -/* */ -/* Copyright 1996-2015 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __CFFTYPES_H__ -#define __CFFTYPES_H__ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_TYPE1_TABLES_H -#include FT_INTERNAL_SERVICE_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* CFF_IndexRec */ - /* */ - /* <Description> */ - /* A structure used to model a CFF Index table. */ - /* */ - /* <Fields> */ - /* stream :: The source input stream. */ - /* */ - /* start :: The position of the first index byte in the */ - /* input stream. */ - /* */ - /* count :: The number of elements in the index. */ - /* */ - /* off_size :: The size in bytes of object offsets in index. */ - /* */ - /* data_offset :: The position of first data byte in the index's */ - /* bytes. */ - /* */ - /* data_size :: The size of the data table in this index. */ - /* */ - /* offsets :: A table of element offsets in the index. Must be */ - /* loaded explicitly. */ - /* */ - /* bytes :: If the index is loaded in memory, its bytes. */ - /* */ - typedef struct CFF_IndexRec_ - { - FT_Stream stream; - FT_ULong start; - FT_UInt count; - FT_Byte off_size; - FT_ULong data_offset; - FT_ULong data_size; - - FT_ULong* offsets; - FT_Byte* bytes; - - } CFF_IndexRec, *CFF_Index; - - - typedef struct CFF_EncodingRec_ - { - FT_UInt format; - FT_ULong offset; - - FT_UInt count; - FT_UShort sids [256]; /* avoid dynamic allocations */ - FT_UShort codes[256]; - - } CFF_EncodingRec, *CFF_Encoding; - - - typedef struct CFF_CharsetRec_ - { - - FT_UInt format; - FT_ULong offset; - - FT_UShort* sids; - FT_UShort* cids; /* the inverse mapping of `sids'; only needed */ - /* for CID-keyed fonts */ - FT_UInt max_cid; - FT_UInt num_glyphs; - - } CFF_CharsetRec, *CFF_Charset; - - - typedef struct CFF_FontRecDictRec_ - { - FT_UInt version; - FT_UInt notice; - FT_UInt copyright; - FT_UInt full_name; - FT_UInt family_name; - FT_UInt weight; - FT_Bool is_fixed_pitch; - FT_Fixed italic_angle; - FT_Fixed underline_position; - FT_Fixed underline_thickness; - FT_Int paint_type; - FT_Int charstring_type; - FT_Matrix font_matrix; - FT_Bool has_font_matrix; - FT_ULong units_per_em; /* temporarily used as scaling value also */ - FT_Vector font_offset; - FT_ULong unique_id; - FT_BBox font_bbox; - FT_Pos stroke_width; - FT_ULong charset_offset; - FT_ULong encoding_offset; - FT_ULong charstrings_offset; - FT_ULong private_offset; - FT_ULong private_size; - FT_Long synthetic_base; - FT_UInt embedded_postscript; - - /* these should only be used for the top-level font dictionary */ - FT_UInt cid_registry; - FT_UInt cid_ordering; - FT_Long cid_supplement; - - FT_Long cid_font_version; - FT_Long cid_font_revision; - FT_Long cid_font_type; - FT_ULong cid_count; - FT_ULong cid_uid_base; - FT_ULong cid_fd_array_offset; - FT_ULong cid_fd_select_offset; - FT_UInt cid_font_name; - - } CFF_FontRecDictRec, *CFF_FontRecDict; - - - typedef struct CFF_PrivateRec_ - { - FT_Byte num_blue_values; - FT_Byte num_other_blues; - FT_Byte num_family_blues; - FT_Byte num_family_other_blues; - - FT_Pos blue_values[14]; - FT_Pos other_blues[10]; - FT_Pos family_blues[14]; - FT_Pos family_other_blues[10]; - - FT_Fixed blue_scale; - FT_Pos blue_shift; - FT_Pos blue_fuzz; - FT_Pos standard_width; - FT_Pos standard_height; - - FT_Byte num_snap_widths; - FT_Byte num_snap_heights; - FT_Pos snap_widths[13]; - FT_Pos snap_heights[13]; - FT_Bool force_bold; - FT_Fixed force_bold_threshold; - FT_Int lenIV; - FT_Int language_group; - FT_Fixed expansion_factor; - FT_Long initial_random_seed; - FT_ULong local_subrs_offset; - FT_Pos default_width; - FT_Pos nominal_width; - - } CFF_PrivateRec, *CFF_Private; - - - typedef struct CFF_FDSelectRec_ - { - FT_Byte format; - FT_UInt range_count; - - /* that's the table, taken from the file `as is' */ - FT_Byte* data; - FT_UInt data_size; - - /* small cache for format 3 only */ - FT_UInt cache_first; - FT_UInt cache_count; - FT_Byte cache_fd; - - } CFF_FDSelectRec, *CFF_FDSelect; - - - /* A SubFont packs a font dict and a private dict together. They are */ - /* needed to support CID-keyed CFF fonts. */ - typedef struct CFF_SubFontRec_ - { - CFF_FontRecDictRec font_dict; - CFF_PrivateRec private_dict; - - CFF_IndexRec local_subrs_index; - FT_Byte** local_subrs; /* array of pointers into Local Subrs INDEX data */ - - } CFF_SubFontRec, *CFF_SubFont; - - -#define CFF_MAX_CID_FONTS 256 - - - typedef struct CFF_FontRec_ - { - FT_Stream stream; - FT_Memory memory; - FT_UInt num_faces; - FT_UInt num_glyphs; - - FT_Byte version_major; - FT_Byte version_minor; - FT_Byte header_size; - FT_Byte absolute_offsize; - - - CFF_IndexRec name_index; - CFF_IndexRec top_dict_index; - CFF_IndexRec global_subrs_index; - - CFF_EncodingRec encoding; - CFF_CharsetRec charset; - - CFF_IndexRec charstrings_index; - CFF_IndexRec font_dict_index; - CFF_IndexRec private_index; - CFF_IndexRec local_subrs_index; - - FT_String* font_name; - - /* array of pointers into Global Subrs INDEX data */ - FT_Byte** global_subrs; - - /* array of pointers into String INDEX data stored at string_pool */ - FT_UInt num_strings; - FT_Byte** strings; - FT_Byte* string_pool; - - CFF_SubFontRec top_font; - FT_UInt num_subfonts; - CFF_SubFont subfonts[CFF_MAX_CID_FONTS]; - - CFF_FDSelectRec fd_select; - - /* interface to PostScript hinter */ - PSHinter_Service pshinter; - - /* interface to Postscript Names service */ - FT_Service_PsCMaps psnames; - - /* since version 2.3.0 */ - PS_FontInfoRec* font_info; /* font info dictionary */ - - /* since version 2.3.6 */ - FT_String* registry; - FT_String* ordering; - - /* since version 2.4.12 */ - FT_Generic cf2_instance; - - } CFF_FontRec, *CFF_Font; - - -FT_END_HEADER - -#endif /* __CFFTYPES_H__ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/cff/module.mk b/src/3rdparty/freetype/src/cff/module.mk index 8c610959d3..bd728c6a34 100644 --- a/src/3rdparty/freetype/src/cff/module.mk +++ b/src/3rdparty/freetype/src/cff/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/cff/rules.mk b/src/3rdparty/freetype/src/cff/rules.mk index 6e2dc476ef..70bb92d506 100644 --- a/src/3rdparty/freetype/src/cff/rules.mk +++ b/src/3rdparty/freetype/src/cff/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/cid/Jamfile b/src/3rdparty/freetype/src/cid/Jamfile deleted file mode 100644 index 1cfb702574..0000000000 --- a/src/3rdparty/freetype/src/cid/Jamfile +++ /dev/null @@ -1,34 +0,0 @@ -# FreeType 2 src/cid Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) cid ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = cidgload - cidload - cidobjs - cidparse - cidriver - ; - } - else - { - _sources = type1cid ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/cid Jamfile diff --git a/src/3rdparty/freetype/src/cid/ciderrs.h b/src/3rdparty/freetype/src/cid/ciderrs.h index be80bed3be..f698bb2293 100644 --- a/src/3rdparty/freetype/src/cid/ciderrs.h +++ b/src/3rdparty/freetype/src/cid/ciderrs.h @@ -4,7 +4,7 @@ * * CID error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 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 @@ #ifndef CIDERRS_H_ #define CIDERRS_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -33,7 +33,7 @@ #define FT_ERR_PREFIX CID_Err_ #define FT_ERR_BASE FT_Mod_Err_CID -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* CIDERRS_H_ */ diff --git a/src/3rdparty/freetype/src/cid/cidgload.c b/src/3rdparty/freetype/src/cid/cidgload.c index f59f2880f0..54aa62f810 100644 --- a/src/3rdparty/freetype/src/cid/cidgload.c +++ b/src/3rdparty/freetype/src/cid/cidgload.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 Glyph Loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,17 +16,16 @@ */ -#include <ft2build.h> #include "cidload.h" #include "cidgload.h" -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_OUTLINE_H -#include FT_INTERNAL_CALC_H - -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_CFF_TYPES_H -#include FT_DRIVER_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/ftoutln.h> +#include <freetype/internal/ftcalc.h> + +#include <freetype/internal/psaux.h> +#include <freetype/internal/cfftypes.h> +#include <freetype/ftdriver.h> #include "ciderrs.h" diff --git a/src/3rdparty/freetype/src/cid/cidgload.h b/src/3rdparty/freetype/src/cid/cidgload.h index 37eba7ca7b..da36e37e06 100644 --- a/src/3rdparty/freetype/src/cid/cidgload.h +++ b/src/3rdparty/freetype/src/cid/cidgload.h @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,7 +20,6 @@ #define CIDGLOAD_H_ -#include <ft2build.h> #include "cidobjs.h" diff --git a/src/3rdparty/freetype/src/cid/cidload.c b/src/3rdparty/freetype/src/cid/cidload.c index fce3e37da7..bb9136a3df 100644 --- a/src/3rdparty/freetype/src/cid/cidload.c +++ b/src/3rdparty/freetype/src/cid/cidload.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 font loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,11 +17,11 @@ #include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include FT_CONFIG_CONFIG_H -#include FT_MULTIPLE_MASTERS_H -#include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/ftmm.h> +#include <freetype/internal/t1types.h> +#include <freetype/internal/psaux.h> #include "cidload.h" @@ -254,7 +254,7 @@ goto Exit; } - FT_TRACE4(( " %d\n", num_dicts )); + FT_TRACE4(( " %ld\n", num_dicts )); /* * A single entry in the FDArray must (at least) contain the following @@ -275,7 +275,7 @@ if ( (FT_ULong)num_dicts > stream->size / 100 ) { FT_TRACE0(( "parse_fd_array: adjusting FDArray size" - " (from %d to %d)\n", + " (from %ld to %ld)\n", num_dicts, stream->size / 100 )); num_dicts = (FT_Long)( stream->size / 100 ); @@ -329,7 +329,7 @@ dict->expansion_factor = cid_parser_to_fixed( parser, 0 ); dict->private_dict.expansion_factor = dict->expansion_factor; - FT_TRACE4(( "%d\n", dict->expansion_factor )); + FT_TRACE4(( "%ld\n", dict->expansion_factor )); } return; @@ -715,7 +715,7 @@ if ( ft_isdigit( *p ) ) val = (FT_Byte)( *p - '0' ); else if ( *p >= 'a' && *p <= 'f' ) - val = (FT_Byte)( *p - 'a' ); + val = (FT_Byte)( *p - 'a' + 10 ); else if ( *p >= 'A' && *p <= 'F' ) val = (FT_Byte)( *p - 'A' + 10 ); else if ( *p == ' ' || @@ -804,7 +804,7 @@ face->root.stream->size - parser->data_offset ) { FT_TRACE0(( "cid_face_open: adjusting length of binary data\n" - " (from %d to %d bytes)\n", + " (from %ld to %ld bytes)\n", parser->binary_length, face->root.stream->size - parser->data_offset )); parser->binary_length = face->root.stream->size - diff --git a/src/3rdparty/freetype/src/cid/cidload.h b/src/3rdparty/freetype/src/cid/cidload.h index fb9d46216d..06fb9ef476 100644 --- a/src/3rdparty/freetype/src/cid/cidload.h +++ b/src/3rdparty/freetype/src/cid/cidload.h @@ -4,7 +4,7 @@ * * CID-keyed Type1 font loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define CIDLOAD_H_ -#include <ft2build.h> -#include FT_INTERNAL_STREAM_H +#include <freetype/internal/ftstream.h> #include "cidparse.h" diff --git a/src/3rdparty/freetype/src/cid/cidobjs.c b/src/3rdparty/freetype/src/cid/cidobjs.c index 4e9728719b..04b295eb8f 100644 --- a/src/3rdparty/freetype/src/cid/cidobjs.c +++ b/src/3rdparty/freetype/src/cid/cidobjs.c @@ -4,7 +4,7 @@ * * CID objects manager (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,17 +16,16 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> #include "cidgload.h" #include "cidload.h" -#include FT_SERVICE_POSTSCRIPT_CMAPS_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H -#include FT_DRIVER_H +#include <freetype/internal/services/svpscmap.h> +#include <freetype/internal/psaux.h> +#include <freetype/internal/pshints.h> +#include <freetype/ftdriver.h> #include "ciderrs.h" @@ -50,7 +49,8 @@ FT_LOCAL_DEF( void ) cid_slot_done( FT_GlyphSlot slot ) { - slot->internal->glyph_hints = NULL; + if ( slot->internal ) + slot->internal->glyph_hints = NULL; } diff --git a/src/3rdparty/freetype/src/cid/cidobjs.h b/src/3rdparty/freetype/src/cid/cidobjs.h index 89c9aa74ab..6ae3061379 100644 --- a/src/3rdparty/freetype/src/cid/cidobjs.h +++ b/src/3rdparty/freetype/src/cid/cidobjs.h @@ -4,7 +4,7 @@ * * CID objects manager (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -21,9 +21,9 @@ #include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/ftobjs.h> #include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_TYPE1_TYPES_H +#include <freetype/internal/t1types.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/cid/cidparse.c b/src/3rdparty/freetype/src/cid/cidparse.c index 1be46ec328..1fc098b448 100644 --- a/src/3rdparty/freetype/src/cid/cidparse.c +++ b/src/3rdparty/freetype/src/cid/cidparse.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 parser (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,10 +16,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_STREAM_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftstream.h> #include "cidparse.h" diff --git a/src/3rdparty/freetype/src/cid/cidparse.h b/src/3rdparty/freetype/src/cid/cidparse.h index ec1f6a346d..0b49bebf48 100644 --- a/src/3rdparty/freetype/src/cid/cidparse.h +++ b/src/3rdparty/freetype/src/cid/cidparse.h @@ -4,7 +4,7 @@ * * CID-keyed Type1 parser (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,10 +20,9 @@ #define CIDPARSE_H_ -#include <ft2build.h> -#include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/t1types.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/psaux.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/cid/cidriver.c b/src/3rdparty/freetype/src/cid/cidriver.c index 4d91e87529..d08cea1d7e 100644 --- a/src/3rdparty/freetype/src/cid/cidriver.c +++ b/src/3rdparty/freetype/src/cid/cidriver.c @@ -4,7 +4,7 @@ * * CID driver interface (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,22 +16,21 @@ */ -#include <ft2build.h> #include "cidriver.h" #include "cidgload.h" -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_POSTSCRIPT_PROPS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftpsprop.h> #include "ciderrs.h" -#include FT_SERVICE_POSTSCRIPT_NAME_H -#include FT_SERVICE_FONT_FORMAT_H -#include FT_SERVICE_POSTSCRIPT_INFO_H -#include FT_SERVICE_CID_H -#include FT_SERVICE_PROPERTIES_H -#include FT_DRIVER_H +#include <freetype/internal/services/svpostnm.h> +#include <freetype/internal/services/svfntfmt.h> +#include <freetype/internal/services/svpsinfo.h> +#include <freetype/internal/services/svcid.h> +#include <freetype/internal/services/svprop.h> +#include <freetype/ftdriver.h> -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/psaux.h> /************************************************************************** diff --git a/src/3rdparty/freetype/src/cid/cidriver.h b/src/3rdparty/freetype/src/cid/cidriver.h index 3402fd7e99..0fc8ed37bf 100644 --- a/src/3rdparty/freetype/src/cid/cidriver.h +++ b/src/3rdparty/freetype/src/cid/cidriver.h @@ -4,7 +4,7 @@ * * High-level CID driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define CIDRIVER_H_ -#include <ft2build.h> -#include FT_INTERNAL_DRIVER_H +#include <freetype/internal/ftdrv.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/cid/cidtoken.h b/src/3rdparty/freetype/src/cid/cidtoken.h index f505c9e166..e9f068bb50 100644 --- a/src/3rdparty/freetype/src/cid/cidtoken.h +++ b/src/3rdparty/freetype/src/cid/cidtoken.h @@ -4,7 +4,7 @@ * * CID token definitions (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 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/cid/module.mk b/src/3rdparty/freetype/src/cid/module.mk index 875c683c72..9fb02235e6 100644 --- a/src/3rdparty/freetype/src/cid/module.mk +++ b/src/3rdparty/freetype/src/cid/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/cid/rules.mk b/src/3rdparty/freetype/src/cid/rules.mk index 2b68dd48a0..94f663c80e 100644 --- a/src/3rdparty/freetype/src/cid/rules.mk +++ b/src/3rdparty/freetype/src/cid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/cid/type1cid.c b/src/3rdparty/freetype/src/cid/type1cid.c index d21801cec1..082e8bfe5b 100644 --- a/src/3rdparty/freetype/src/cid/type1cid.c +++ b/src/3rdparty/freetype/src/cid/type1cid.c @@ -4,7 +4,7 @@ * * FreeType OpenType driver component (body only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "cidgload.c" #include "cidload.c" diff --git a/src/3rdparty/freetype/src/gxvalid/Jamfile b/src/3rdparty/freetype/src/gxvalid/Jamfile deleted file mode 100644 index a08e7a998d..0000000000 --- a/src/3rdparty/freetype/src/gxvalid/Jamfile +++ /dev/null @@ -1,52 +0,0 @@ -# FreeType 2 src/gxvalid Jamfile -# -# Copyright (C) 2005-2019 by -# suzuki toshiya, Masatake YAMATO and Red Hat K.K. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) gxvalid ; - - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = gxvbsln - gxvcommn - gxvfeat - gxvjust - gxvkern - gxvlcar - gxvmod - gxvmort - gxvmort0 - gxvmort1 - gxvmort2 - gxvmort4 - gxvmort5 - gxvmorx - gxvmorx0 - gxvmorx1 - gxvmorx2 - gxvmorx4 - gxvmorx5 - gxvopbd - gxvprop - gxvtrak - ; - } - else - { - _sources = gxvalid ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/gxvalid Jamfile diff --git a/src/3rdparty/freetype/src/gxvalid/README b/src/3rdparty/freetype/src/gxvalid/README index d493587842..2a32bab204 100644 --- a/src/3rdparty/freetype/src/gxvalid/README +++ b/src/3rdparty/freetype/src/gxvalid/README @@ -518,7 +518,7 @@ gxvalid: TrueType GX validator ------------------------------------------------------------------------ -Copyright (C) 2004-2019 by +Copyright (C) 2004-2020 by suzuki toshiya, Masatake YAMATO, Red hat K.K., David Turner, Robert Wilhelm, and Werner Lemberg. diff --git a/src/3rdparty/freetype/src/gxvalid/gxvalid.c b/src/3rdparty/freetype/src/gxvalid/gxvalid.c index 462e461bf2..683b8a6972 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvalid.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvalid.c @@ -4,7 +4,7 @@ * * FreeType validator for TrueTypeGX/AAT tables (body only). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -18,7 +18,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "gxvbsln.c" #include "gxvcommn.c" diff --git a/src/3rdparty/freetype/src/gxvalid/gxvalid.h b/src/3rdparty/freetype/src/gxvalid/gxvalid.h index 969cd0927a..ff2812da20 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvalid.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvalid.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT table validation (specification only). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -28,13 +28,12 @@ #ifndef GXVALID_H_ #define GXVALID_H_ -#include <ft2build.h> -#include FT_FREETYPE_H +#include <freetype/freetype.h> -#include "gxverror.h" /* must come before FT_INTERNAL_VALIDATE_H */ +#include "gxverror.h" /* must come before `ftvalid.h' */ -#include FT_INTERNAL_VALIDATE_H -#include FT_INTERNAL_STREAM_H +#include <freetype/internal/ftvalid.h> +#include <freetype/internal/ftstream.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/gxvalid/gxvbsln.c b/src/3rdparty/freetype/src/gxvalid/gxvbsln.c index f22f2545fa..ac58d4615c 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvbsln.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvbsln.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT bsln table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvcommn.c b/src/3rdparty/freetype/src/gxvalid/gxvcommn.c index c5cb8ebe8b..ead0f24cd3 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvcommn.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvcommn.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common tables validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvcommn.h b/src/3rdparty/freetype/src/gxvalid/gxvcommn.h index 334dc9dfb3..59d149215c 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvcommn.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvcommn.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common tables validation (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -43,10 +43,9 @@ #define GXVCOMMN_H_ -#include <ft2build.h> #include "gxvalid.h" -#include FT_INTERNAL_DEBUG_H -#include FT_SFNT_NAMES_H +#include <freetype/internal/ftdebug.h> +#include <freetype/ftsnames.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/gxvalid/gxverror.h b/src/3rdparty/freetype/src/gxvalid/gxverror.h index da0edb35f9..5d8f0b6806 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxverror.h +++ b/src/3rdparty/freetype/src/gxvalid/gxverror.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT validation module error codes (specification only). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -35,7 +35,7 @@ #ifndef GXVERROR_H_ #define GXVERROR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -43,7 +43,7 @@ #define FT_ERR_PREFIX GXV_Err_ #define FT_ERR_BASE FT_Mod_Err_GXvalid -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* GXVERROR_H_ */ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvfeat.c b/src/3rdparty/freetype/src/gxvalid/gxvfeat.c index e1a12a18ed..400ec8a3fb 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvfeat.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvfeat.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT feat table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvfeat.h b/src/3rdparty/freetype/src/gxvalid/gxvfeat.h index 6c9892910c..435dcefb09 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvfeat.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvfeat.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT feat table validation (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvfgen.c b/src/3rdparty/freetype/src/gxvalid/gxvfgen.c index 5ecb9443c3..fe05a6f3a1 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvfgen.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvfgen.c @@ -5,7 +5,7 @@ * Generate feature registry data for gxv `feat' validator. * This program is derived from gxfeatreg.c in gxlayout. * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * Masatake YAMATO and Redhat K.K. * * This file may only be used, diff --git a/src/3rdparty/freetype/src/gxvalid/gxvjust.c b/src/3rdparty/freetype/src/gxvalid/gxvjust.c index a582377859..3c7f1f9534 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvjust.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvjust.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT just table validation (body). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -28,7 +28,7 @@ #include "gxvalid.h" #include "gxvcommn.h" -#include FT_SFNT_NAMES_H +#include <freetype/ftsnames.h> /************************************************************************** diff --git a/src/3rdparty/freetype/src/gxvalid/gxvkern.c b/src/3rdparty/freetype/src/gxvalid/gxvkern.c index a7532335a5..cc0b3dfcb4 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvkern.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvkern.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT kern table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -28,8 +28,8 @@ #include "gxvalid.h" #include "gxvcommn.h" -#include FT_SFNT_NAMES_H -#include FT_SERVICE_GX_VALIDATE_H +#include <freetype/ftsnames.h> +#include <freetype/internal/services/svgxval.h> /************************************************************************** diff --git a/src/3rdparty/freetype/src/gxvalid/gxvlcar.c b/src/3rdparty/freetype/src/gxvalid/gxvlcar.c index 13b3de3eaa..82ac1907ab 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvlcar.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvlcar.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT lcar table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmod.c b/src/3rdparty/freetype/src/gxvalid/gxvmod.c index eeadeb3e1d..a467e87131 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmod.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmod.c @@ -4,7 +4,7 @@ * * FreeType's TrueTypeGX/AAT validation module implementation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -25,12 +25,11 @@ */ -#include <ft2build.h> -#include FT_TRUETYPE_TABLES_H -#include FT_TRUETYPE_TAGS_H -#include FT_GX_VALIDATE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_GX_VALIDATE_H +#include <freetype/tttables.h> +#include <freetype/tttags.h> +#include <freetype/ftgxval.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svgxval.h> #include "gxvmod.h" #include "gxvalid.h" diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmod.h b/src/3rdparty/freetype/src/gxvalid/gxvmod.h index 6ecd7312c9..f2982c96c2 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmod.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvmod.h @@ -5,7 +5,7 @@ * FreeType's TrueTypeGX/AAT validation module implementation * (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -29,8 +29,7 @@ #ifndef GXVMOD_H_ #define GXVMOD_H_ -#include <ft2build.h> -#include FT_MODULE_H +#include <freetype/ftmodapi.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort.c b/src/3rdparty/freetype/src/gxvalid/gxvmort.c index 288ef6988b..aae7f01a89 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT mort table validation (body). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort.h b/src/3rdparty/freetype/src/gxvalid/gxvmort.h index 0619e24fb9..7237c58254 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common definition for mort table (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -31,7 +31,10 @@ #include "gxvalid.h" #include "gxvcommn.h" -#include FT_SFNT_NAMES_H +#include <freetype/ftsnames.h> + + +FT_BEGIN_HEADER typedef struct GXV_mort_featureRec_ @@ -88,6 +91,8 @@ GXV_Validator gxvalid ); +FT_END_HEADER + #endif /* GXVMORT_H_ */ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort0.c b/src/3rdparty/freetype/src/gxvalid/gxvmort0.c index 2c01bf95ec..d452c1ccaa 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort0.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort0.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type0 (Indic Script Rearrangement) subtable. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort1.c b/src/3rdparty/freetype/src/gxvalid/gxvmort1.c index c71ba13351..d743f89f6e 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort1.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort1.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type1 (Contextual Substitution) subtable. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort2.c b/src/3rdparty/freetype/src/gxvalid/gxvmort2.c index 889d3bd582..9e69e1269d 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort2.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort2.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type2 (Ligature Substitution) subtable. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort4.c b/src/3rdparty/freetype/src/gxvalid/gxvmort4.c index f8ce6cf789..4584d204cf 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort4.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort4.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type4 (Non-Contextual Glyph Substitution) subtable. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort5.c b/src/3rdparty/freetype/src/gxvalid/gxvmort5.c index 1ba1e5ded0..a15a24fe65 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort5.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort5.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT mort table validation * body for type5 (Contextual Glyph Insertion) subtable. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx.c index 8bd45c27e6..754d9f8bf1 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT morx table validation (body). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx.h b/src/3rdparty/freetype/src/gxvalid/gxvmorx.h index e257270342..f747b1d636 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx.h +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx.h @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT common definition for morx table (specification). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * @@ -33,7 +33,10 @@ #include "gxvcommn.h" #include "gxvmort.h" -#include FT_SFNT_NAMES_H +#include <freetype/ftsnames.h> + + +FT_BEGIN_HEADER FT_LOCAL( void ) @@ -62,6 +65,8 @@ GXV_Validator gxvalid ); +FT_END_HEADER + #endif /* GXVMORX_H_ */ diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx0.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx0.c index d7764a0ae8..5a42e552e2 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx0.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx0.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type0 (Indic Script Rearrangement) subtable. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx1.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx1.c index 5b41b3605f..9f8b69067e 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx1.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx1.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type1 (Contextual Substitution) subtable. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx2.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx2.c index ec4c81299d..98b5c49c26 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx2.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx2.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type2 (Ligature Substitution) subtable. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx4.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx4.c index 7b041534c0..857e4d4eb8 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx4.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx4.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for "morx" type4 (Non-Contextual Glyph Substitution) subtable. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmorx5.c b/src/3rdparty/freetype/src/gxvalid/gxvmorx5.c index 70a4623656..7ceba077af 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmorx5.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmorx5.c @@ -5,7 +5,7 @@ * TrueTypeGX/AAT morx table validation * body for type5 (Contextual Glyph Insertion) subtable. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvopbd.c b/src/3rdparty/freetype/src/gxvalid/gxvopbd.c index f055a22054..a398fe0977 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvopbd.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvopbd.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT opbd table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvprop.c b/src/3rdparty/freetype/src/gxvalid/gxvprop.c index e1911edd48..bee8bab97b 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvprop.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvprop.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT prop table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/gxvtrak.c b/src/3rdparty/freetype/src/gxvalid/gxvtrak.c index b7794b7af4..58a631c9e5 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvtrak.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvtrak.c @@ -4,7 +4,7 @@ * * TrueTypeGX/AAT trak table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/3rdparty/freetype/src/gxvalid/module.mk b/src/3rdparty/freetype/src/gxvalid/module.mk index 04067ce617..e7d408df9d 100644 --- a/src/3rdparty/freetype/src/gxvalid/module.mk +++ b/src/3rdparty/freetype/src/gxvalid/module.mk @@ -2,7 +2,7 @@ # FreeType 2 gxvalid module definition # -# Copyright (C) 2004-2019 by +# Copyright (C) 2004-2020 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/src/3rdparty/freetype/src/gxvalid/rules.mk b/src/3rdparty/freetype/src/gxvalid/rules.mk index 4ef463bc21..d55a4935e2 100644 --- a/src/3rdparty/freetype/src/gxvalid/rules.mk +++ b/src/3rdparty/freetype/src/gxvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2019 by +# Copyright (C) 2004-2020 by # suzuki toshiya, Masatake YAMATO, Red Hat K.K., # David Turner, Robert Wilhelm, and Werner Lemberg. # diff --git a/src/3rdparty/freetype/src/gzip/Jamfile b/src/3rdparty/freetype/src/gzip/Jamfile deleted file mode 100644 index 2c808b74a5..0000000000 --- a/src/3rdparty/freetype/src/gzip/Jamfile +++ /dev/null @@ -1,16 +0,0 @@ -# FreeType 2 src/gzip Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) gzip ; - -Library $(FT2_LIB) : ftgzip.c ; - -# end of src/pcf Jamfile diff --git a/src/3rdparty/freetype/src/gzip/ftgzip.c b/src/3rdparty/freetype/src/gzip/ftgzip.c index 5e78bc6f8d..de7d0fdd5b 100644 --- a/src/3rdparty/freetype/src/gzip/ftgzip.c +++ b/src/3rdparty/freetype/src/gzip/ftgzip.c @@ -8,7 +8,7 @@ * parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,15 +20,14 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_DEBUG_H -#include FT_GZIP_H +#include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/ftgzip.h> #include FT_CONFIG_STANDARD_LIBRARY_H -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -36,7 +35,7 @@ #define FT_ERR_PREFIX Gzip_Err_ #define FT_ERR_BASE FT_Mod_Err_Gzip -#include FT_ERRORS_H +#include <freetype/fterrors.h> #ifdef FT_CONFIG_OPTION_USE_ZLIB @@ -746,7 +745,17 @@ stream.zfree = (free_func) ft_gzip_free; stream.opaque = memory; + /* This is a temporary fix and will be removed once the internal + * copy of zlib is updated to the newest version. The `|32' flag + * is only supported in the new versions of zlib to enable gzip + * encoded header. + */ +#ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB err = inflateInit2( &stream, MAX_WBITS|32 ); +#else + err = inflateInit2( &stream, MAX_WBITS ); +#endif + if ( err != Z_OK ) return FT_THROW( Invalid_Argument ); diff --git a/src/3rdparty/freetype/src/gzip/infutil.h b/src/3rdparty/freetype/src/gzip/infutil.h index 7174b6dd0f..cdf18b4f90 100644 --- a/src/3rdparty/freetype/src/gzip/infutil.h +++ b/src/3rdparty/freetype/src/gzip/infutil.h @@ -86,7 +86,7 @@ struct inflate_blocks_state { /* masks for lower bits (size given to avoid silly warnings with Visual C++) */ #ifndef NO_INFLATE_MASK -local uInt inflate_mask[17]; +local const uInt inflate_mask[17]; #endif /* copy as much as possible from the sliding window to the output area */ diff --git a/src/3rdparty/freetype/src/gzip/rules.mk b/src/3rdparty/freetype/src/gzip/rules.mk index 44206a1dae..4ea823f8d3 100644 --- a/src/3rdparty/freetype/src/gzip/rules.mk +++ b/src/3rdparty/freetype/src/gzip/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2019 by +# Copyright (C) 2002-2020 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/gzip/zconf.h b/src/3rdparty/freetype/src/gzip/zconf.h deleted file mode 100644 index 3abf0ba03b..0000000000 --- a/src/3rdparty/freetype/src/gzip/zconf.h +++ /dev/null @@ -1,284 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef _ZCONF_H -#define _ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateReset z_inflateReset -# define compress z_compress -# define compress2 z_compress2 -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table - -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) -# define WIN32 -#endif -#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) -# ifndef __32BIT__ -# define __32BIT__ -# endif -#endif -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif - -/* WinCE doesn't have errno.h */ -#ifdef _WIN32_WCE -# define NO_ERRNO_H -#endif - - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#if defined(MSDOS) && !defined(__32BIT__) -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) -# define STDC -#endif -#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) -# ifndef STDC -# define STDC -# endif -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Old Borland C and LCC incorrectly complains about missing returns: */ -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) -# define NEED_DUMMY_RETURN -#endif - -#if defined(__LCC__) -# define NEED_DUMMY_RETURN -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -#endif -#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) -# ifndef __32BIT__ -# define SMALL_MEDIUM -# define FAR _far -# endif -#endif - -/* Compile with -DZLIB_DLL for Windows DLL support */ -#if defined(ZLIB_DLL) -# if defined(_WINDOWS) || defined(WINDOWS) -# ifdef FAR -# undef FAR -# endif -# include <windows.h> -# define ZEXPORT(x) x WINAPI -# ifdef WIN32 -# define ZEXPORTVA(x) x WINAPIV -# else -# define ZEXPORTVA(x) x FAR _cdecl _export -# endif -# endif -# if defined (__BORLANDC__) -# if (__BORLANDC__ >= 0x0500) && defined (WIN32) -# include <windows.h> -# define ZEXPORT(x) x __declspec(dllexport) WINAPI -# define ZEXPORTRVA(x) x __declspec(dllexport) WINAPIV -# else -# if defined (_Windows) && defined (__DLL__) -# define ZEXPORT(x) x _export -# define ZEXPORTVA(x) x _export -# endif -# endif -# endif -#endif - - -#ifndef ZEXPORT -# define ZEXPORT(x) static x -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA(x) static x -#endif -#ifndef ZEXTERN -# define ZEXTERN(x) static x -#endif -#ifndef ZEXTERNDEF -# define ZEXTERNDEF(x) static x -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(MACOS) && !defined(TARGET_OS_MAC) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#ifdef HAVE_UNISTD_H -# include <sys/types.h> /* for off_t */ -# include <unistd.h> /* for SEEK_* and off_t */ -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(inflate_blocks,"INBL") -# pragma map(inflate_blocks_new,"INBLNE") -# pragma map(inflate_blocks_free,"INBLFR") -# pragma map(inflate_blocks_reset,"INBLRE") -# pragma map(inflate_codes_free,"INCOFR") -# pragma map(inflate_codes,"INCO") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_flush,"INFLU") -# pragma map(inflate_mask,"INMA") -# pragma map(inflate_set_dictionary,"INSEDI2") -# pragma map(inflate_copyright,"INCOPY") -# pragma map(inflate_trees_bits,"INTRBI") -# pragma map(inflate_trees_dynamic,"INTRDY") -# pragma map(inflate_trees_fixed,"INTRFI") -# pragma map(inflate_trees_free,"INTRFR") -#endif - -#endif /* _ZCONF_H */ diff --git a/src/3rdparty/freetype/src/lzw/Jamfile b/src/3rdparty/freetype/src/lzw/Jamfile deleted file mode 100644 index ba2d6ebb45..0000000000 --- a/src/3rdparty/freetype/src/lzw/Jamfile +++ /dev/null @@ -1,16 +0,0 @@ -# FreeType 2 src/lzw Jamfile -# -# Copyright (C) 2004-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) lzw ; - -Library $(FT2_LIB) : ftlzw.c ; - -# end of src/lzw Jamfile diff --git a/src/3rdparty/freetype/src/lzw/ftlzw.c b/src/3rdparty/freetype/src/lzw/ftlzw.c index 9805a1e3bd..ddb81e6e97 100644 --- a/src/3rdparty/freetype/src/lzw/ftlzw.c +++ b/src/3rdparty/freetype/src/lzw/ftlzw.c @@ -8,7 +8,7 @@ * be used to parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * Albert Chin-A-Young. * * based on code in `src/gzip/ftgzip.c' @@ -21,15 +21,14 @@ * */ -#include <ft2build.h> -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_DEBUG_H -#include FT_LZW_H +#include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/ftlzw.h> #include FT_CONFIG_STANDARD_LIBRARY_H -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -37,7 +36,7 @@ #define FT_ERR_PREFIX LZW_Err_ #define FT_ERR_BASE FT_Mod_Err_LZW -#include FT_ERRORS_H +#include <freetype/fterrors.h> #ifdef FT_CONFIG_OPTION_USE_LZW diff --git a/src/3rdparty/freetype/src/lzw/ftzopen.c b/src/3rdparty/freetype/src/lzw/ftzopen.c index 67e6760f95..884d2ec74e 100644 --- a/src/3rdparty/freetype/src/lzw/ftzopen.c +++ b/src/3rdparty/freetype/src/lzw/ftzopen.c @@ -8,7 +8,7 @@ * be used to parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * David Turner. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,9 @@ */ #include "ftzopen.h" -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftmemory.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftdebug.h> static int diff --git a/src/3rdparty/freetype/src/lzw/ftzopen.h b/src/3rdparty/freetype/src/lzw/ftzopen.h index 44fe36d6c5..d8768f7b47 100644 --- a/src/3rdparty/freetype/src/lzw/ftzopen.h +++ b/src/3rdparty/freetype/src/lzw/ftzopen.h @@ -8,7 +8,7 @@ * be used to parse compressed PCF fonts, as found with many X11 server * distributions. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * David Turner. * * This file is part of the FreeType project, and may only be used, @@ -22,9 +22,9 @@ #ifndef FTZOPEN_H_ #define FTZOPEN_H_ -#include <ft2build.h> -#include FT_FREETYPE_H +#include <freetype/freetype.h> +FT_BEGIN_HEADER /* * This is a complete re-implementation of the LZW file reader, @@ -166,6 +166,8 @@ /* */ +FT_END_HEADER + #endif /* FTZOPEN_H_ */ diff --git a/src/3rdparty/freetype/src/lzw/rules.mk b/src/3rdparty/freetype/src/lzw/rules.mk index 930b32e6b1..3468ee024d 100644 --- a/src/3rdparty/freetype/src/lzw/rules.mk +++ b/src/3rdparty/freetype/src/lzw/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2019 by +# Copyright (C) 2004-2020 by # Albert Chin-A-Young. # # based on `src/lzw/rules.mk' diff --git a/src/3rdparty/freetype/src/otvalid/Jamfile b/src/3rdparty/freetype/src/otvalid/Jamfile deleted file mode 100644 index 36db0e1f83..0000000000 --- a/src/3rdparty/freetype/src/otvalid/Jamfile +++ /dev/null @@ -1,37 +0,0 @@ -# FreeType 2 src/otvalid Jamfile -# -# Copyright (C) 2004-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) otvalid ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = otvbase - otvcommn - otvgdef - otvgpos - otvgsub - otvjstf - otvmath - otvmod - ; - } - else - { - _sources = otvalid ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/otvalid Jamfile diff --git a/src/3rdparty/freetype/src/otvalid/module.mk b/src/3rdparty/freetype/src/otvalid/module.mk index 5ea5b7b57b..67b9820d84 100644 --- a/src/3rdparty/freetype/src/otvalid/module.mk +++ b/src/3rdparty/freetype/src/otvalid/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2019 by +# Copyright (C) 2004-2020 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/otvalid/otvalid.c b/src/3rdparty/freetype/src/otvalid/otvalid.c index e3964b99ae..d640209f68 100644 --- a/src/3rdparty/freetype/src/otvalid/otvalid.c +++ b/src/3rdparty/freetype/src/otvalid/otvalid.c @@ -4,7 +4,7 @@ * * FreeType validator for OpenType tables (body only). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "otvbase.c" #include "otvcommn.c" diff --git a/src/3rdparty/freetype/src/otvalid/otvalid.h b/src/3rdparty/freetype/src/otvalid/otvalid.h index 5ca819f261..8208ff0112 100644 --- a/src/3rdparty/freetype/src/otvalid/otvalid.h +++ b/src/3rdparty/freetype/src/otvalid/otvalid.h @@ -4,7 +4,7 @@ * * OpenType table validation (specification only). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 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 OTVALID_H_ -#include <ft2build.h> -#include FT_FREETYPE_H +#include <freetype/freetype.h> -#include "otverror.h" /* must come before FT_INTERNAL_VALIDATE_H */ +#include "otverror.h" /* must come before `ftvalid.h' */ -#include FT_INTERNAL_VALIDATE_H -#include FT_INTERNAL_STREAM_H +#include <freetype/internal/ftvalid.h> +#include <freetype/internal/ftstream.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/otvalid/otvbase.c b/src/3rdparty/freetype/src/otvalid/otvbase.c index be69d7ca31..250ae98ab5 100644 --- a/src/3rdparty/freetype/src/otvalid/otvbase.c +++ b/src/3rdparty/freetype/src/otvalid/otvbase.c @@ -4,7 +4,7 @@ * * OpenType BASE table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 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/otvalid/otvcommn.c b/src/3rdparty/freetype/src/otvalid/otvcommn.c index 5ed1723506..faaa846871 100644 --- a/src/3rdparty/freetype/src/otvalid/otvcommn.c +++ b/src/3rdparty/freetype/src/otvalid/otvcommn.c @@ -4,7 +4,7 @@ * * OpenType common tables validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -151,6 +151,9 @@ FT_UInt result = 0; + if ( !count ) + return result; + switch ( CoverageFormat ) { case 1: diff --git a/src/3rdparty/freetype/src/otvalid/otvcommn.h b/src/3rdparty/freetype/src/otvalid/otvcommn.h index bfcc5b974a..f9926034a9 100644 --- a/src/3rdparty/freetype/src/otvalid/otvcommn.h +++ b/src/3rdparty/freetype/src/otvalid/otvcommn.h @@ -4,7 +4,7 @@ * * OpenType common tables validation (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define OTVCOMMN_H_ -#include <ft2build.h> #include "otvalid.h" -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/otvalid/otverror.h b/src/3rdparty/freetype/src/otvalid/otverror.h index a7d35acf1a..979e9cbd9c 100644 --- a/src/3rdparty/freetype/src/otvalid/otverror.h +++ b/src/3rdparty/freetype/src/otvalid/otverror.h @@ -4,7 +4,7 @@ * * OpenType validation module error codes (specification only). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -26,7 +26,7 @@ #ifndef OTVERROR_H_ #define OTVERROR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -34,7 +34,7 @@ #define FT_ERR_PREFIX OTV_Err_ #define FT_ERR_BASE FT_Mod_Err_OTvalid -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* OTVERROR_H_ */ diff --git a/src/3rdparty/freetype/src/otvalid/otvgdef.c b/src/3rdparty/freetype/src/otvalid/otvgdef.c index 2529b544d2..88874b8474 100644 --- a/src/3rdparty/freetype/src/otvalid/otvgdef.c +++ b/src/3rdparty/freetype/src/otvalid/otvgdef.c @@ -4,7 +4,7 @@ * * OpenType GDEF table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 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/otvalid/otvgpos.c b/src/3rdparty/freetype/src/otvalid/otvgpos.c index f3bddeac6c..29d56f91e8 100644 --- a/src/3rdparty/freetype/src/otvalid/otvgpos.c +++ b/src/3rdparty/freetype/src/otvalid/otvgpos.c @@ -4,7 +4,7 @@ * * OpenType GPOS table validation (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 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/otvalid/otvgpos.h b/src/3rdparty/freetype/src/otvalid/otvgpos.h index b3154312eb..06a03a0e6c 100644 --- a/src/3rdparty/freetype/src/otvalid/otvgpos.h +++ b/src/3rdparty/freetype/src/otvalid/otvgpos.h @@ -4,7 +4,7 @@ * * OpenType GPOS table validator (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 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/otvalid/otvgsub.c b/src/3rdparty/freetype/src/otvalid/otvgsub.c index 97da997d3d..f0d563ba92 100644 --- a/src/3rdparty/freetype/src/otvalid/otvgsub.c +++ b/src/3rdparty/freetype/src/otvalid/otvgsub.c @@ -4,7 +4,7 @@ * * OpenType GSUB table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 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/otvalid/otvjstf.c b/src/3rdparty/freetype/src/otvalid/otvjstf.c index d4e6d87178..79de7b809d 100644 --- a/src/3rdparty/freetype/src/otvalid/otvjstf.c +++ b/src/3rdparty/freetype/src/otvalid/otvjstf.c @@ -4,7 +4,7 @@ * * OpenType JSTF table validation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 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/otvalid/otvmath.c b/src/3rdparty/freetype/src/otvalid/otvmath.c index 3aaf0ec0ec..dfdeaaba7e 100644 --- a/src/3rdparty/freetype/src/otvalid/otvmath.c +++ b/src/3rdparty/freetype/src/otvalid/otvmath.c @@ -4,7 +4,7 @@ * * OpenType MATH table validation (body). * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by George Williams. diff --git a/src/3rdparty/freetype/src/otvalid/otvmod.c b/src/3rdparty/freetype/src/otvalid/otvmod.c index f417bd220f..0188b27018 100644 --- a/src/3rdparty/freetype/src/otvalid/otvmod.c +++ b/src/3rdparty/freetype/src/otvalid/otvmod.c @@ -4,7 +4,7 @@ * * FreeType's OpenType validation module implementation (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> -#include FT_TRUETYPE_TABLES_H -#include FT_TRUETYPE_TAGS_H -#include FT_OPENTYPE_VALIDATE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_OPENTYPE_VALIDATE_H +#include <freetype/tttables.h> +#include <freetype/tttags.h> +#include <freetype/ftotval.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svotval.h> #include "otvmod.h" #include "otvalid.h" diff --git a/src/3rdparty/freetype/src/otvalid/otvmod.h b/src/3rdparty/freetype/src/otvalid/otvmod.h index 5539de7ec6..efd6da035f 100644 --- a/src/3rdparty/freetype/src/otvalid/otvmod.h +++ b/src/3rdparty/freetype/src/otvalid/otvmod.h @@ -5,7 +5,7 @@ * FreeType's OpenType validation module implementation * (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -21,8 +21,7 @@ #define OTVMOD_H_ -#include <ft2build.h> -#include FT_MODULE_H +#include <freetype/ftmodapi.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/otvalid/rules.mk b/src/3rdparty/freetype/src/otvalid/rules.mk index 3c6ece1c19..7f0169fd89 100644 --- a/src/3rdparty/freetype/src/otvalid/rules.mk +++ b/src/3rdparty/freetype/src/otvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2004-2019 by +# Copyright (C) 2004-2020 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/pcf/Jamfile b/src/3rdparty/freetype/src/pcf/Jamfile deleted file mode 100644 index fd17d53f0d..0000000000 --- a/src/3rdparty/freetype/src/pcf/Jamfile +++ /dev/null @@ -1,32 +0,0 @@ -# FreeType 2 src/pcf Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) pcf ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = pcfdrivr - pcfread - pcfutil - ; - } - else - { - _sources = pcf ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/pcf Jamfile diff --git a/src/3rdparty/freetype/src/pcf/pcf.c b/src/3rdparty/freetype/src/pcf/pcf.c index 8ffd6e280b..6b30fb249a 100644 --- a/src/3rdparty/freetype/src/pcf/pcf.c +++ b/src/3rdparty/freetype/src/pcf/pcf.c @@ -26,7 +26,6 @@ THE SOFTWARE. #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "pcfdrivr.c" #include "pcfread.c" diff --git a/src/3rdparty/freetype/src/pcf/pcf.h b/src/3rdparty/freetype/src/pcf/pcf.h index 33be4bcd85..3134cc355b 100644 --- a/src/3rdparty/freetype/src/pcf/pcf.h +++ b/src/3rdparty/freetype/src/pcf/pcf.h @@ -29,9 +29,8 @@ THE SOFTWARE. #define PCF_H_ -#include <ft2build.h> -#include FT_INTERNAL_DRIVER_H -#include FT_INTERNAL_STREAM_H +#include <freetype/internal/ftdrv.h> +#include <freetype/internal/ftstream.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/pcf/pcfdrivr.c b/src/3rdparty/freetype/src/pcf/pcfdrivr.c index b39592c794..e9dd51752e 100644 --- a/src/3rdparty/freetype/src/pcf/pcfdrivr.c +++ b/src/3rdparty/freetype/src/pcf/pcfdrivr.c @@ -25,17 +25,16 @@ THE SOFTWARE. */ -#include <ft2build.h> - -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_OBJECTS_H -#include FT_GZIP_H -#include FT_LZW_H -#include FT_BZIP2_H -#include FT_ERRORS_H -#include FT_BDF_H -#include FT_TRUETYPE_IDS_H + +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/ftgzip.h> +#include <freetype/ftlzw.h> +#include <freetype/ftbzip2.h> +#include <freetype/fterrors.h> +#include <freetype/ftbdf.h> +#include <freetype/ttnameid.h> #include "pcf.h" #include "pcfdrivr.h" @@ -47,10 +46,10 @@ THE SOFTWARE. #undef FT_COMPONENT #define FT_COMPONENT pcfread -#include FT_SERVICE_BDF_H -#include FT_SERVICE_FONT_FORMAT_H -#include FT_SERVICE_PROPERTIES_H -#include FT_DRIVER_H +#include <freetype/internal/services/svbdf.h> +#include <freetype/internal/services/svfntfmt.h> +#include <freetype/internal/services/svprop.h> +#include <freetype/ftdriver.h> /************************************************************************** @@ -137,7 +136,7 @@ THE SOFTWARE. FT_UInt32 charcode = *acharcode; FT_UShort charcodeRow; FT_UShort charcodeCol; - FT_Int result = 0; + FT_UInt result = 0; while ( charcode < (FT_UInt32)( enc->lastRow * 256 + enc->lastCol ) ) @@ -607,8 +606,9 @@ THE SOFTWARE. if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) ) { - FT_TRACE1(( "pcf_get_bdf_property:" )); - FT_TRACE1(( " too large integer 0x%x is truncated\n" )); + FT_TRACE1(( "pcf_get_bdf_property:" + " too large integer 0x%lx is truncated\n", + prop->value.l )); } /* diff --git a/src/3rdparty/freetype/src/pcf/pcfdrivr.h b/src/3rdparty/freetype/src/pcf/pcfdrivr.h index 73db0823d2..d465393743 100644 --- a/src/3rdparty/freetype/src/pcf/pcfdrivr.h +++ b/src/3rdparty/freetype/src/pcf/pcfdrivr.h @@ -28,8 +28,7 @@ THE SOFTWARE. #ifndef PCFDRIVR_H_ #define PCFDRIVR_H_ -#include <ft2build.h> -#include FT_INTERNAL_DRIVER_H +#include <freetype/internal/ftdrv.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/pcf/pcferror.h b/src/3rdparty/freetype/src/pcf/pcferror.h index 2e69d1d219..8b9e9902a3 100644 --- a/src/3rdparty/freetype/src/pcf/pcferror.h +++ b/src/3rdparty/freetype/src/pcf/pcferror.h @@ -25,7 +25,7 @@ #ifndef PCFERROR_H_ #define PCFERROR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -33,7 +33,7 @@ #define FT_ERR_PREFIX PCF_Err_ #define FT_ERR_BASE FT_Mod_Err_PCF -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* PCFERROR_H_ */ diff --git a/src/3rdparty/freetype/src/pcf/pcfread.c b/src/3rdparty/freetype/src/pcf/pcfread.c index 2ffe22d71c..8817682cdf 100644 --- a/src/3rdparty/freetype/src/pcf/pcfread.c +++ b/src/3rdparty/freetype/src/pcf/pcfread.c @@ -25,11 +25,10 @@ THE SOFTWARE. */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftobjs.h> #include "pcf.h" #include "pcfread.h" @@ -122,7 +121,7 @@ THE SOFTWARE. toc->count > 9 ) { FT_TRACE0(( "pcf_read_TOC: adjusting number of tables" - " (from %d to %d)\n", + " (from %ld to %ld)\n", toc->count, FT_MIN( stream->size >> 4, 9 ) )); toc->count = FT_MIN( stream->size >> 4, 9 ); @@ -242,7 +241,7 @@ THE SOFTWARE. if ( tables[i].type == (FT_UInt)( 1 << j ) ) name = tableNames[j]; - FT_TRACE4(( " %d: type=%s, format=0x%X," + FT_TRACE4(( " %d: type=%s, format=0x%lX," " size=%ld (0x%lX), offset=%ld (0x%lX)\n", i, name, tables[i].format, @@ -661,7 +660,7 @@ THE SOFTWARE. { properties[i].value.l = props[i].value; - FT_TRACE4(( " %d\n", properties[i].value.l )); + FT_TRACE4(( " %ld\n", properties[i].value.l )); } } @@ -798,7 +797,7 @@ THE SOFTWARE. metrics->descent = 0; FT_TRACE0(( "pcf_get_metrics:" - " invalid metrics for glyph %d\n", i )); + " invalid metrics for glyph %ld\n", i )); } } @@ -918,11 +917,11 @@ THE SOFTWARE. sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )]; - FT_TRACE4(( " %ld-bit padding implies a size of %lu\n", + FT_TRACE4(( " %d-bit padding implies a size of %lu\n", 8 << i, bitmapSizes[i] )); } - FT_TRACE4(( " %lu bitmaps, using %ld-bit padding\n", + FT_TRACE4(( " %lu bitmaps, using %d-bit padding\n", nbitmaps, 8 << PCF_GLYPH_PAD_INDEX( format ) )); FT_TRACE4(( " bitmap size: %lu\n", sizebitmaps )); @@ -1252,13 +1251,13 @@ THE SOFTWARE. if ( FT_ABS( accel->fontAscent ) > 0x7FFF ) { accel->fontAscent = accel->fontAscent < 0 ? -0x7FFF : 0x7FFF; - FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %d\n", + FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %ld\n", accel->fontAscent )); } if ( FT_ABS( accel->fontDescent ) > 0x7FFF ) { accel->fontDescent = accel->fontDescent < 0 ? -0x7FFF : 0x7FFF; - FT_TRACE0(( "pfc_get_accel: clamping font descent to value %d\n", + FT_TRACE0(( "pfc_get_accel: clamping font descent to value %ld\n", accel->fontDescent )); } @@ -1631,7 +1630,7 @@ THE SOFTWARE. if ( FT_ABS( prop->value.l ) > 0x504C2L ) /* 0x7FFF * 72270/7200 */ { bsize->size = 0x7FFF; - FT_TRACE0(( "pcf_load_font: clamping point size to value %d\n", + FT_TRACE0(( "pcf_load_font: clamping point size to value %ld\n", bsize->size )); } else @@ -1650,7 +1649,7 @@ THE SOFTWARE. if ( FT_ABS( prop->value.l ) > 0x7FFF ) { bsize->y_ppem = 0x7FFF << 6; - FT_TRACE0(( "pcf_load_font: clamping pixel size to value %d\n", + FT_TRACE0(( "pcf_load_font: clamping pixel size to value %ld\n", bsize->y_ppem )); } else diff --git a/src/3rdparty/freetype/src/pcf/pcfread.h b/src/3rdparty/freetype/src/pcf/pcfread.h index bed30e5030..a54648fbf9 100644 --- a/src/3rdparty/freetype/src/pcf/pcfread.h +++ b/src/3rdparty/freetype/src/pcf/pcfread.h @@ -29,7 +29,6 @@ THE SOFTWARE. #define PCFREAD_H_ -#include <ft2build.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/pcf/pcfutil.c b/src/3rdparty/freetype/src/pcf/pcfutil.c index 045c42d60f..5d3c00791f 100644 --- a/src/3rdparty/freetype/src/pcf/pcfutil.c +++ b/src/3rdparty/freetype/src/pcf/pcfutil.c @@ -32,7 +32,6 @@ in this Software without prior written authorization from The Open Group. /* Modified for use with FreeType */ -#include <ft2build.h> #include "pcfutil.h" diff --git a/src/3rdparty/freetype/src/pcf/pcfutil.h b/src/3rdparty/freetype/src/pcf/pcfutil.h index be986e756b..a197c15595 100644 --- a/src/3rdparty/freetype/src/pcf/pcfutil.h +++ b/src/3rdparty/freetype/src/pcf/pcfutil.h @@ -31,7 +31,7 @@ THE SOFTWARE. #include <ft2build.h> #include FT_CONFIG_CONFIG_H - +#include <freetype/internal/compiler-macros.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/pfr/Jamfile b/src/3rdparty/freetype/src/pfr/Jamfile deleted file mode 100644 index fbca8065c4..0000000000 --- a/src/3rdparty/freetype/src/pfr/Jamfile +++ /dev/null @@ -1,35 +0,0 @@ -# FreeType 2 src/pfr Jamfile -# -# Copyright (C) 2002-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) pfr ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = pfrcmap - pfrdrivr - pfrgload - pfrload - pfrobjs - pfrsbit - ; - } - else - { - _sources = pfr ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/pfr Jamfile diff --git a/src/3rdparty/freetype/src/pfr/module.mk b/src/3rdparty/freetype/src/pfr/module.mk index 30d876d4c8..762353dda2 100644 --- a/src/3rdparty/freetype/src/pfr/module.mk +++ b/src/3rdparty/freetype/src/pfr/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2019 by +# Copyright (C) 2002-2020 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/pfr/pfr.c b/src/3rdparty/freetype/src/pfr/pfr.c index 6d885ea47f..9264c77df2 100644 --- a/src/3rdparty/freetype/src/pfr/pfr.c +++ b/src/3rdparty/freetype/src/pfr/pfr.c @@ -4,7 +4,7 @@ * * FreeType PFR driver component. * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "pfrcmap.c" #include "pfrdrivr.c" diff --git a/src/3rdparty/freetype/src/pfr/pfrcmap.c b/src/3rdparty/freetype/src/pfr/pfrcmap.c index bfa1b9ea05..ebc7b84393 100644 --- a/src/3rdparty/freetype/src/pfr/pfrcmap.c +++ b/src/3rdparty/freetype/src/pfr/pfrcmap.c @@ -4,7 +4,7 @@ * * FreeType PFR cmap handling (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,8 +16,7 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include "pfrcmap.h" #include "pfrobjs.h" diff --git a/src/3rdparty/freetype/src/pfr/pfrcmap.h b/src/3rdparty/freetype/src/pfr/pfrcmap.h index 1e203a0514..a6d920c30b 100644 --- a/src/3rdparty/freetype/src/pfr/pfrcmap.h +++ b/src/3rdparty/freetype/src/pfr/pfrcmap.h @@ -4,7 +4,7 @@ * * FreeType PFR cmap handling (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,8 +19,7 @@ #ifndef PFRCMAP_H_ #define PFRCMAP_H_ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/ftobjs.h> #include "pfrtypes.h" diff --git a/src/3rdparty/freetype/src/pfr/pfrdrivr.c b/src/3rdparty/freetype/src/pfr/pfrdrivr.c index f67eebf118..b14320875a 100644 --- a/src/3rdparty/freetype/src/pfr/pfrdrivr.c +++ b/src/3rdparty/freetype/src/pfr/pfrdrivr.c @@ -4,7 +4,7 @@ * * FreeType PFR driver interface (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_SERVICE_PFR_H -#include FT_SERVICE_FONT_FORMAT_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/services/svpfr.h> +#include <freetype/internal/services/svfntfmt.h> #include "pfrdrivr.h" #include "pfrobjs.h" diff --git a/src/3rdparty/freetype/src/pfr/pfrdrivr.h b/src/3rdparty/freetype/src/pfr/pfrdrivr.h index 33b7b9413f..7646b4d1bd 100644 --- a/src/3rdparty/freetype/src/pfr/pfrdrivr.h +++ b/src/3rdparty/freetype/src/pfr/pfrdrivr.h @@ -4,7 +4,7 @@ * * High-level Type PFR driver interface (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define PFRDRIVR_H_ -#include <ft2build.h> -#include FT_INTERNAL_DRIVER_H +#include <freetype/internal/ftdrv.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/pfr/pfrerror.h b/src/3rdparty/freetype/src/pfr/pfrerror.h index 4829cfc000..33460ef4fd 100644 --- a/src/3rdparty/freetype/src/pfr/pfrerror.h +++ b/src/3rdparty/freetype/src/pfr/pfrerror.h @@ -4,7 +4,7 @@ * * PFR error codes (specification only). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 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 @@ #ifndef PFRERROR_H_ #define PFRERROR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -33,7 +33,7 @@ #define FT_ERR_PREFIX PFR_Err_ #define FT_ERR_BASE FT_Mod_Err_PFR -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* PFRERROR_H_ */ diff --git a/src/3rdparty/freetype/src/pfr/pfrgload.c b/src/3rdparty/freetype/src/pfr/pfrgload.c index 6ef5856a8d..aa640c3b07 100644 --- a/src/3rdparty/freetype/src/pfr/pfrgload.c +++ b/src/3rdparty/freetype/src/pfr/pfrgload.c @@ -4,7 +4,7 @@ * * FreeType PFR glyph loader (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,7 +19,7 @@ #include "pfrgload.h" #include "pfrsbit.h" #include "pfrload.h" /* for macro definitions */ -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include "pfrerror.h" @@ -451,7 +451,7 @@ case 1: /* 16-bit absolute value */ PFR_CHECK( 2 ); cur->x = PFR_NEXT_SHORT( p ); - FT_TRACE7(( " x.%d", cur->x )); + FT_TRACE7(( " x.%ld", cur->x )); break; case 2: /* 8-bit delta */ @@ -481,7 +481,7 @@ case 1: /* 16-bit absolute value */ PFR_CHECK( 2 ); cur->y = PFR_NEXT_SHORT( p ); - FT_TRACE7(( " y.%d", cur->y )); + FT_TRACE7(( " y.%ld", cur->y )); break; case 2: /* 8-bit delta */ diff --git a/src/3rdparty/freetype/src/pfr/pfrgload.h b/src/3rdparty/freetype/src/pfr/pfrgload.h index d0e1420b67..f356b4c75b 100644 --- a/src/3rdparty/freetype/src/pfr/pfrgload.h +++ b/src/3rdparty/freetype/src/pfr/pfrgload.h @@ -4,7 +4,7 @@ * * FreeType PFR glyph loader (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 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/pfr/pfrload.c b/src/3rdparty/freetype/src/pfr/pfrload.c index ccf0b7e1f8..a2832e55c7 100644 --- a/src/3rdparty/freetype/src/pfr/pfrload.c +++ b/src/3rdparty/freetype/src/pfr/pfrload.c @@ -4,7 +4,7 @@ * * FreeType PFR loader (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,8 +17,8 @@ #include "pfrload.h" -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> #include "pfrerror.h" diff --git a/src/3rdparty/freetype/src/pfr/pfrload.h b/src/3rdparty/freetype/src/pfr/pfrload.h index 2e7ffd0127..7615b9ce14 100644 --- a/src/3rdparty/freetype/src/pfr/pfrload.h +++ b/src/3rdparty/freetype/src/pfr/pfrload.h @@ -4,7 +4,7 @@ * * FreeType PFR loader (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,7 +20,7 @@ #define PFRLOAD_H_ #include "pfrobjs.h" -#include FT_INTERNAL_STREAM_H +#include <freetype/internal/ftstream.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/pfr/pfrobjs.c b/src/3rdparty/freetype/src/pfr/pfrobjs.c index 9765f95c2f..918e7fd496 100644 --- a/src/3rdparty/freetype/src/pfr/pfrobjs.c +++ b/src/3rdparty/freetype/src/pfr/pfrobjs.c @@ -4,7 +4,7 @@ * * FreeType PFR object methods (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -21,10 +21,10 @@ #include "pfrgload.h" #include "pfrcmap.h" #include "pfrsbit.h" -#include FT_OUTLINE_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H -#include FT_TRUETYPE_IDS_H +#include <freetype/ftoutln.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/ttnameid.h> #include "pfrerror.h" diff --git a/src/3rdparty/freetype/src/pfr/pfrobjs.h b/src/3rdparty/freetype/src/pfr/pfrobjs.h index 39cffd07c5..808822f1c4 100644 --- a/src/3rdparty/freetype/src/pfr/pfrobjs.h +++ b/src/3rdparty/freetype/src/pfr/pfrobjs.h @@ -4,7 +4,7 @@ * * FreeType PFR object methods (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 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/pfr/pfrsbit.c b/src/3rdparty/freetype/src/pfr/pfrsbit.c index 00a9616455..a6691e6d18 100644 --- a/src/3rdparty/freetype/src/pfr/pfrsbit.c +++ b/src/3rdparty/freetype/src/pfr/pfrsbit.c @@ -4,7 +4,7 @@ * * FreeType PFR bitmap loader (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -18,8 +18,8 @@ #include "pfrsbit.h" #include "pfrload.h" -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> #include "pfrerror.h" @@ -745,7 +745,7 @@ ypos + (FT_Long)ysize < FT_INT_MIN ) { FT_TRACE1(( "pfr_slot_load_bitmap:" )); - FT_TRACE1(( "huge bitmap glyph %dx%d over FT_GlyphSlot\n", + FT_TRACE1(( "huge bitmap glyph %ldx%ld over FT_GlyphSlot\n", xpos, ypos )); error = FT_THROW( Invalid_Pixel_Size ); } diff --git a/src/3rdparty/freetype/src/pfr/pfrsbit.h b/src/3rdparty/freetype/src/pfr/pfrsbit.h index 6568b90943..8cb0de0d25 100644 --- a/src/3rdparty/freetype/src/pfr/pfrsbit.h +++ b/src/3rdparty/freetype/src/pfr/pfrsbit.h @@ -4,7 +4,7 @@ * * FreeType PFR bitmap loader (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 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/pfr/pfrtypes.h b/src/3rdparty/freetype/src/pfr/pfrtypes.h index 6a5f9d571b..06fb82d51a 100644 --- a/src/3rdparty/freetype/src/pfr/pfrtypes.h +++ b/src/3rdparty/freetype/src/pfr/pfrtypes.h @@ -4,7 +4,7 @@ * * FreeType PFR data structures (specification only). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,8 +19,7 @@ #ifndef PFRTYPES_H_ #define PFRTYPES_H_ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/ftobjs.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/pfr/rules.mk b/src/3rdparty/freetype/src/pfr/rules.mk index f14ca699e2..a1fe82baff 100644 --- a/src/3rdparty/freetype/src/pfr/rules.mk +++ b/src/3rdparty/freetype/src/pfr/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2019 by +# Copyright (C) 2002-2020 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/psaux/Jamfile b/src/3rdparty/freetype/src/psaux/Jamfile deleted file mode 100644 index 30bcc1c097..0000000000 --- a/src/3rdparty/freetype/src/psaux/Jamfile +++ /dev/null @@ -1,45 +0,0 @@ -# FreeType 2 src/psaux Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) psaux ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = afmparse - psauxmod - psconv - psobjs - t1cmap - t1decode - cffdecode - psarrst - psblues - pserror - psfont - psft - pshints - psintrp - psread - psstack - ; - } - else - { - _sources = psaux ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/psaux Jamfile diff --git a/src/3rdparty/freetype/src/psaux/afmparse.c b/src/3rdparty/freetype/src/psaux/afmparse.c index f78adbba3d..2d6a0d9a12 100644 --- a/src/3rdparty/freetype/src/psaux/afmparse.c +++ b/src/3rdparty/freetype/src/psaux/afmparse.c @@ -4,7 +4,7 @@ * * AFM parser (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -15,10 +15,9 @@ * */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/freetype.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/psaux.h> #ifndef T1_CONFIG_OPTION_NO_AFM diff --git a/src/3rdparty/freetype/src/psaux/afmparse.h b/src/3rdparty/freetype/src/psaux/afmparse.h index 2ceb77553b..16a3a3e902 100644 --- a/src/3rdparty/freetype/src/psaux/afmparse.h +++ b/src/3rdparty/freetype/src/psaux/afmparse.h @@ -4,7 +4,7 @@ * * AFM parser (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define AFMPARSE_H_ -#include <ft2build.h> -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/psaux.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/psaux/cffdecode.c b/src/3rdparty/freetype/src/psaux/cffdecode.c index 17cccf818b..3d2da1e03c 100644 --- a/src/3rdparty/freetype/src/psaux/cffdecode.c +++ b/src/3rdparty/freetype/src/psaux/cffdecode.c @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (body). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_SERVICE_H -#include FT_SERVICE_CFF_TABLE_LOAD_H +#include <freetype/freetype.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftserv.h> +#include <freetype/internal/services/svcfftl.h> #include "cffdecode.h" #include "psobjs.h" @@ -330,7 +329,7 @@ builder->left_bearing.x = 0; builder->left_bearing.y = 0; - builder->pos_x = adx - asb; + builder->pos_x = SUB_LONG( adx, asb ); builder->pos_y = ady; /* Now load `achar' on top of the base outline. */ @@ -530,6 +529,9 @@ builder->path_begun = 0; + if ( !charstring_base ) + return FT_Err_Ok; + zone->base = charstring_base; limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; diff --git a/src/3rdparty/freetype/src/psaux/cffdecode.h b/src/3rdparty/freetype/src/psaux/cffdecode.h index a6691979f0..77a4962698 100644 --- a/src/3rdparty/freetype/src/psaux/cffdecode.h +++ b/src/3rdparty/freetype/src/psaux/cffdecode.h @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (specification). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define CFFDECODE_H_ -#include <ft2build.h> -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/psaux.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/psaux/module.mk b/src/3rdparty/freetype/src/psaux/module.mk index bb0886abdf..651db01426 100644 --- a/src/3rdparty/freetype/src/psaux/module.mk +++ b/src/3rdparty/freetype/src/psaux/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/psaux/psarrst.c b/src/3rdparty/freetype/src/psaux/psarrst.c index 011803b416..8751d275fb 100644 --- a/src/3rdparty/freetype/src/psaux/psarrst.c +++ b/src/3rdparty/freetype/src/psaux/psarrst.c @@ -37,7 +37,7 @@ #include "psft.h" -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include "psglue.h" #include "psarrst.h" diff --git a/src/3rdparty/freetype/src/psaux/psaux.c b/src/3rdparty/freetype/src/psaux/psaux.c index 1db0462551..f4282222a6 100644 --- a/src/3rdparty/freetype/src/psaux/psaux.c +++ b/src/3rdparty/freetype/src/psaux/psaux.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript driver component (body only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "afmparse.c" #include "psauxmod.c" diff --git a/src/3rdparty/freetype/src/psaux/psauxerr.h b/src/3rdparty/freetype/src/psaux/psauxerr.h index 523e1886c2..8b9a958aec 100644 --- a/src/3rdparty/freetype/src/psaux/psauxerr.h +++ b/src/3rdparty/freetype/src/psaux/psauxerr.h @@ -4,7 +4,7 @@ * * PS auxiliary module error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -26,7 +26,7 @@ #ifndef PSAUXERR_H_ #define PSAUXERR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -34,7 +34,7 @@ #define FT_ERR_PREFIX PSaux_Err_ #define FT_ERR_BASE FT_Mod_Err_PSaux -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* PSAUXERR_H_ */ diff --git a/src/3rdparty/freetype/src/psaux/psauxmod.c b/src/3rdparty/freetype/src/psaux/psauxmod.c index 5df8e69056..e73ba22451 100644 --- a/src/3rdparty/freetype/src/psaux/psauxmod.c +++ b/src/3rdparty/freetype/src/psaux/psauxmod.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,7 +16,6 @@ */ -#include <ft2build.h> #include "psauxmod.h" #include "psobjs.h" #include "t1decode.h" @@ -171,9 +170,9 @@ }; - FT_CALLBACK_TABLE_DEF - const FT_Module_Class psaux_module_class = - { + FT_DEFINE_MODULE( + psaux_module_class, + 0, sizeof ( FT_ModuleRec ), "psaux", @@ -185,7 +184,7 @@ (FT_Module_Constructor)NULL, /* module_init */ (FT_Module_Destructor) NULL, /* module_done */ (FT_Module_Requester) NULL /* get_interface */ - }; + ) /* END */ diff --git a/src/3rdparty/freetype/src/psaux/psauxmod.h b/src/3rdparty/freetype/src/psaux/psauxmod.h index a0eda0bfc0..a6bebe4b94 100644 --- a/src/3rdparty/freetype/src/psaux/psauxmod.h +++ b/src/3rdparty/freetype/src/psaux/psauxmod.h @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,10 +20,9 @@ #define PSAUXMOD_H_ -#include <ft2build.h> -#include FT_MODULE_H +#include <freetype/ftmodapi.h> -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/psaux.h> FT_BEGIN_HEADER @@ -35,10 +34,24 @@ FT_BEGIN_HEADER FT_CALLBACK_TABLE const PS_Builder_FuncsRec ps_builder_funcs; +#ifndef T1_CONFIG_OPTION_NO_AFM + FT_CALLBACK_TABLE + const AFM_Parser_FuncsRec afm_parser_funcs; +#endif + + FT_CALLBACK_TABLE + const T1_CMap_ClassesRec t1_cmap_classes; + + FT_CALLBACK_TABLE + const CFF_Decoder_FuncsRec cff_decoder_funcs; + FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class; + FT_DECLARE_MODULE( psaux_module_class ) + + FT_END_HEADER #endif /* PSAUXMOD_H_ */ diff --git a/src/3rdparty/freetype/src/psaux/psblues.c b/src/3rdparty/freetype/src/psaux/psblues.c index 89738ce474..3878e9bde0 100644 --- a/src/3rdparty/freetype/src/psaux/psblues.c +++ b/src/3rdparty/freetype/src/psaux/psblues.c @@ -37,7 +37,7 @@ #include "psft.h" -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include "psblues.h" #include "pshints.h" diff --git a/src/3rdparty/freetype/src/psaux/psconv.c b/src/3rdparty/freetype/src/psaux/psconv.c index c88761681c..4cf5cd5d88 100644 --- a/src/3rdparty/freetype/src/psaux/psconv.c +++ b/src/3rdparty/freetype/src/psaux/psconv.c @@ -4,7 +4,7 @@ * * Some convenience conversions (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,9 +16,8 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/psaux.h> +#include <freetype/internal/ftdebug.h> #include "psconv.h" #include "psauxerr.h" diff --git a/src/3rdparty/freetype/src/psaux/psconv.h b/src/3rdparty/freetype/src/psaux/psconv.h index 6b24bf6fc9..833e827364 100644 --- a/src/3rdparty/freetype/src/psaux/psconv.h +++ b/src/3rdparty/freetype/src/psaux/psconv.h @@ -4,7 +4,7 @@ * * Some convenience conversions (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define PSCONV_H_ -#include <ft2build.h> -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/psaux.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/psaux/pserror.h b/src/3rdparty/freetype/src/psaux/pserror.h index b2156b3318..5738853fac 100644 --- a/src/3rdparty/freetype/src/psaux/pserror.h +++ b/src/3rdparty/freetype/src/psaux/pserror.h @@ -40,7 +40,7 @@ #define PSERROR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -49,7 +49,8 @@ #define FT_ERR_BASE FT_Mod_Err_CF2 -#include FT_ERRORS_H +#include <freetype/fterrors.h> +#include <freetype/internal/compiler-macros.h> #include "psft.h" diff --git a/src/3rdparty/freetype/src/psaux/psfont.c b/src/3rdparty/freetype/src/psaux/psfont.c index 00e4210819..0db1f0c5bc 100644 --- a/src/3rdparty/freetype/src/psaux/psfont.c +++ b/src/3rdparty/freetype/src/psaux/psfont.c @@ -36,8 +36,7 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_CALC_H +#include <freetype/internal/ftcalc.h> #include "psft.h" diff --git a/src/3rdparty/freetype/src/psaux/psfont.h b/src/3rdparty/freetype/src/psaux/psfont.h index 8fbacbb6e3..836fce4e4d 100644 --- a/src/3rdparty/freetype/src/psaux/psfont.h +++ b/src/3rdparty/freetype/src/psaux/psfont.h @@ -40,7 +40,7 @@ #define PSFONT_H_ -#include FT_SERVICE_CFF_TABLE_LOAD_H +#include <freetype/internal/services/svcfftl.h> #include "psft.h" #include "psblues.h" diff --git a/src/3rdparty/freetype/src/psaux/psft.c b/src/3rdparty/freetype/src/psaux/psft.c index 54be468343..41c16542c1 100644 --- a/src/3rdparty/freetype/src/psaux/psft.c +++ b/src/3rdparty/freetype/src/psaux/psft.c @@ -37,7 +37,7 @@ #include "psft.h" -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include "psfont.h" #include "pserror.h" @@ -45,11 +45,11 @@ #include "cffdecode.h" #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_MULTIPLE_MASTERS_H -#include FT_SERVICE_MULTIPLE_MASTERS_H +#include <freetype/ftmm.h> +#include <freetype/internal/services/svmm.h> #endif -#include FT_SERVICE_CFF_TABLE_LOAD_H +#include <freetype/internal/services/svcfftl.h> #define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */ @@ -313,7 +313,7 @@ FT_Error error = FT_Err_Ok; CF2_Font font; - FT_Bool is_t1 = decoder->builder.is_t1; + FT_Bool is_t1 = decoder->builder.is_t1; FT_ASSERT( decoder && @@ -385,7 +385,7 @@ FT_ZERO( &buf ); buf.start = buf.ptr = charstring_base; - buf.end = charstring_base + charstring_len; + buf.end = FT_OFFSET( charstring_base, charstring_len ); FT_ZERO( &transform ); @@ -697,7 +697,7 @@ FT_ASSERT( charstring + len >= charstring ); buf->start = charstring; - buf->end = charstring + len; + buf->end = FT_OFFSET( charstring, len ); buf->ptr = buf->start; return FT_Err_Ok; @@ -820,7 +820,7 @@ /* The CID driver stores subroutines with seed bytes. This */ /* case is taken care of when decoder->subrs_len == 0. */ if ( decoder->locals_len ) - buf->end = buf->start + decoder->locals_len[idx]; + buf->end = FT_OFFSET( buf->start, decoder->locals_len[idx] ); else { /* We are using subroutines from a CID font. We must adjust */ diff --git a/src/3rdparty/freetype/src/psaux/psft.h b/src/3rdparty/freetype/src/psaux/psft.h index 4c930f0d73..3da454e601 100644 --- a/src/3rdparty/freetype/src/psaux/psft.h +++ b/src/3rdparty/freetype/src/psaux/psft.h @@ -40,17 +40,17 @@ #define PSFT_H_ +#include <freetype/internal/compiler-macros.h> #include "pstypes.h" - /* TODO: disable asserts for now */ #define CF2_NDEBUG -#include FT_SYSTEM_H +#include <freetype/ftsystem.h> #include "psglue.h" -#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Decoder */ +#include <freetype/internal/psaux.h> /* for PS_Decoder */ FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/psaux/pshints.c b/src/3rdparty/freetype/src/psaux/pshints.c index 1cbecd2b19..ce8cfca715 100644 --- a/src/3rdparty/freetype/src/psaux/pshints.c +++ b/src/3rdparty/freetype/src/psaux/pshints.c @@ -37,7 +37,7 @@ #include "psft.h" -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include "psglue.h" #include "psfont.h" @@ -310,7 +310,7 @@ CF2_Hint hint = &hintmap->edge[i]; - FT_TRACE6(( " %3d %7.2f %7.2f %5d %s%s%s%s\n", + FT_TRACE6(( " %3ld %7.2f %7.2f %5d %s%s%s%s\n", hint->index, hint->csCoord / 65536.0, hint->dsCoord / ( hint->scale * 1.0 ), diff --git a/src/3rdparty/freetype/src/psaux/psintrp.c b/src/3rdparty/freetype/src/psaux/psintrp.c index e2f3accdd5..519c694447 100644 --- a/src/3rdparty/freetype/src/psaux/psintrp.c +++ b/src/3rdparty/freetype/src/psaux/psintrp.c @@ -37,8 +37,8 @@ #include "psft.h" -#include FT_INTERNAL_DEBUG_H -#include FT_SERVICE_CFF_TABLE_LOAD_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/services/svcfftl.h> #include "psglue.h" #include "psfont.h" @@ -1433,6 +1433,13 @@ lastError = error2; /* pass FreeType error through */ goto exit; } + + /* save the left bearing and width of the SEAC */ + /* glyph as they will be erased by the next load */ + + left_bearing = *decoder->builder.left_bearing; + advance = *decoder->builder.advance; + cf2_interpT2CharString( font, &component, callbacks, @@ -1443,11 +1450,14 @@ &dummyWidth ); cf2_freeT1SeacComponent( decoder, &component ); - /* save the left bearing and width of the base */ - /* character as they will be erased by the next load */ + /* If the SEAC glyph doesn't have a (H)SBW of its */ + /* own use the values from the base glyph. */ - left_bearing = *decoder->builder.left_bearing; - advance = *decoder->builder.advance; + if ( !haveWidth ) + { + left_bearing = *decoder->builder.left_bearing; + advance = *decoder->builder.advance; + } decoder->builder.left_bearing->x = 0; decoder->builder.left_bearing->y = 0; @@ -1473,8 +1483,8 @@ &dummyWidth ); cf2_freeT1SeacComponent( decoder, &component ); - /* restore the left side bearing and */ - /* advance width of the base character */ + /* restore the left side bearing and advance width */ + /* of the SEAC glyph or base character (saved above) */ *decoder->builder.left_bearing = left_bearing; *decoder->builder.advance = advance; diff --git a/src/3rdparty/freetype/src/psaux/psobjs.c b/src/3rdparty/freetype/src/psaux/psobjs.c index 8bfdb92332..defc4d4fce 100644 --- a/src/3rdparty/freetype/src/psaux/psobjs.c +++ b/src/3rdparty/freetype/src/psaux/psobjs.c @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H -#include FT_DRIVER_H +#include <freetype/internal/psaux.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/ftdriver.h> #include "psobjs.h" #include "psconv.h" @@ -214,7 +213,7 @@ } /* add the object to the base block and adjust offset */ - table->elements[idx] = table->block + table->cursor; + table->elements[idx] = FT_OFFSET( table->block, table->cursor ); table->lengths [idx] = length; FT_MEM_COPY( table->block + table->cursor, object, length ); @@ -1233,7 +1232,7 @@ bbox->xMax = FT_RoundFix( temp[2] ); bbox->yMax = FT_RoundFix( temp[3] ); - FT_TRACE4(( " [%d %d %d %d]", + FT_TRACE4(( " [%ld %ld %ld %ld]", bbox->xMin / 65536, bbox->yMin / 65536, bbox->xMax / 65536, @@ -1287,7 +1286,7 @@ bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] ); bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] ); - FT_TRACE4(( " [%d %d %d %d]", + FT_TRACE4(( " [%ld %ld %ld %ld]", bbox->xMin / 65536, bbox->yMin / 65536, bbox->xMax / 65536, @@ -2577,7 +2576,7 @@ FT_UShort seed ) { PS_Conv_EexecDecode( &buffer, - buffer + length, + FT_OFFSET( buffer, length ), buffer, length, &seed ); diff --git a/src/3rdparty/freetype/src/psaux/psobjs.h b/src/3rdparty/freetype/src/psaux/psobjs.h index c44dc450ec..fdad672b6d 100644 --- a/src/3rdparty/freetype/src/psaux/psobjs.h +++ b/src/3rdparty/freetype/src/psaux/psobjs.h @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define PSOBJS_H_ -#include <ft2build.h> -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_CFF_OBJECTS_TYPES_H +#include <freetype/internal/psaux.h> +#include <freetype/internal/cffotypes.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/psaux/psread.c b/src/3rdparty/freetype/src/psaux/psread.c index 86bfc03c6e..7f657f2cdc 100644 --- a/src/3rdparty/freetype/src/psaux/psread.c +++ b/src/3rdparty/freetype/src/psaux/psread.c @@ -37,7 +37,7 @@ #include "psft.h" -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include "psglue.h" diff --git a/src/3rdparty/freetype/src/psaux/psstack.c b/src/3rdparty/freetype/src/psaux/psstack.c index 6659068001..7ae5256ef1 100644 --- a/src/3rdparty/freetype/src/psaux/psstack.c +++ b/src/3rdparty/freetype/src/psaux/psstack.c @@ -37,7 +37,7 @@ #include "psft.h" -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include "psglue.h" #include "psfont.h" @@ -59,12 +59,12 @@ CF2_Stack stack = NULL; - if ( !FT_NEW( stack ) ) - { - /* initialize the structure; FT_NEW zeroes it */ - stack->memory = memory; - stack->error = e; - } + if ( FT_NEW( stack ) ) + return NULL; + + /* initialize the structure; FT_NEW zeroes it */ + stack->memory = memory; + stack->error = e; /* allocate the stack buffer */ if ( FT_NEW_ARRAY( stack->buffer, stackSize ) ) diff --git a/src/3rdparty/freetype/src/psaux/psstack.h b/src/3rdparty/freetype/src/psaux/psstack.h index 18cd39bc6a..b9ef9edf1b 100644 --- a/src/3rdparty/freetype/src/psaux/psstack.h +++ b/src/3rdparty/freetype/src/psaux/psstack.h @@ -39,6 +39,7 @@ #ifndef PSSTACK_H_ #define PSSTACK_H_ +#include <freetype/internal/compiler-macros.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/psaux/pstypes.h b/src/3rdparty/freetype/src/psaux/pstypes.h index 041287e8d5..435ef7e1fe 100644 --- a/src/3rdparty/freetype/src/psaux/pstypes.h +++ b/src/3rdparty/freetype/src/psaux/pstypes.h @@ -39,8 +39,7 @@ #ifndef PSTYPES_H_ #define PSTYPES_H_ -#include <ft2build.h> -#include FT_FREETYPE_H +#include <freetype/freetype.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/psaux/rules.mk b/src/3rdparty/freetype/src/psaux/rules.mk index 2de734d547..f49aecbc79 100644 --- a/src/3rdparty/freetype/src/psaux/rules.mk +++ b/src/3rdparty/freetype/src/psaux/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/psaux/t1cmap.c b/src/3rdparty/freetype/src/psaux/t1cmap.c index d62d2d5c81..e21e93ca26 100644 --- a/src/3rdparty/freetype/src/psaux/t1cmap.c +++ b/src/3rdparty/freetype/src/psaux/t1cmap.c @@ -4,7 +4,7 @@ * * Type 1 character map support (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -18,7 +18,7 @@ #include "t1cmap.h" -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include "psauxerr.h" diff --git a/src/3rdparty/freetype/src/psaux/t1cmap.h b/src/3rdparty/freetype/src/psaux/t1cmap.h index d325e7b5a6..031796510f 100644 --- a/src/3rdparty/freetype/src/psaux/t1cmap.h +++ b/src/3rdparty/freetype/src/psaux/t1cmap.h @@ -4,7 +4,7 @@ * * Type 1 character map support (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,9 +19,8 @@ #ifndef T1CMAP_H_ #define T1CMAP_H_ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_TYPE1_TYPES_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/t1types.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/psaux/t1decode.c b/src/3rdparty/freetype/src/psaux/t1decode.c index c2b3729b53..2ed27ca19e 100644 --- a/src/3rdparty/freetype/src/psaux/t1decode.c +++ b/src/3rdparty/freetype/src/psaux/t1decode.c @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H -#include FT_INTERNAL_HASH_H -#include FT_OUTLINE_H +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/pshints.h> +#include <freetype/internal/fthash.h> +#include <freetype/ftoutln.h> #include "t1decode.h" #include "psobjs.h" @@ -367,6 +366,12 @@ FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */ + /* save the left bearing and width of the SEAC */ + /* glyph as they will be erased by the next load */ + + left_bearing = decoder->builder.left_bearing; + advance = decoder->builder.advance; + /* the seac operator must not be nested */ decoder->seac = TRUE; error = t1_decoder_parse_glyph( decoder, (FT_UInt)bchar_index ); @@ -374,11 +379,14 @@ if ( error ) goto Exit; - /* save the left bearing and width of the base character */ - /* as they will be erased by the next load. */ + /* If the SEAC glyph doesn't have a (H)SBW of its */ + /* own use the values from the base glyph. */ - left_bearing = decoder->builder.left_bearing; - advance = decoder->builder.advance; + if ( decoder->builder.parse_state != T1_Parse_Have_Width ) + { + left_bearing = decoder->builder.left_bearing; + advance = decoder->builder.advance; + } decoder->builder.left_bearing.x = 0; decoder->builder.left_bearing.y = 0; @@ -396,8 +404,8 @@ if ( error ) goto Exit; - /* restore the left side bearing and */ - /* advance width of the base character */ + /* restore the left side bearing and advance width */ + /* of the SEAC glyph or base character (saved above) */ decoder->builder.left_bearing = left_bearing; decoder->builder.advance = advance; @@ -650,10 +658,8 @@ if ( value > 32000 || value < -32000 ) { if ( large_int ) - { FT_ERROR(( "t1_decoder_parse_charstrings:" " no `div' after large integer\n" )); - } else large_int = TRUE; } @@ -1231,8 +1237,8 @@ FT_UNUSED( orig_y ); - /* the `metrics_only' indicates that we only want to compute */ - /* the glyph's metrics (lsb + advance width), not load the */ + /* `metrics_only' indicates that we only want to compute the */ + /* glyph's metrics (lsb + advance width) without loading the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) { @@ -1266,8 +1272,8 @@ x = ADD_LONG( builder->pos_x, top[0] ); y = ADD_LONG( builder->pos_y, top[1] ); - /* the `metrics_only' indicates that we only want to compute */ - /* the glyph's metrics (lsb + advance width), not load the */ + /* `metrics_only' indicates that we only want to compute the */ + /* glyph's metrics (lsb + advance width) without loading the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) { @@ -1690,6 +1696,7 @@ FT_Byte* ip; FT_Byte* limit; T1_Builder builder = &decoder->builder; + FT_Bool large_int; #ifdef FT_DEBUG_LEVEL_TRACE FT_Bool bol = TRUE; @@ -1707,6 +1714,8 @@ limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; + large_int = FALSE; + /* now, execute loop */ while ( ip < limit ) { @@ -1718,7 +1727,7 @@ #ifdef FT_DEBUG_LEVEL_TRACE if ( bol ) { - FT_TRACE5(( " (%d)", decoder->top - decoder->stack )); + FT_TRACE5(( " (%ld)", decoder->top - decoder->stack )); bol = FALSE; } #endif @@ -1740,8 +1749,6 @@ case 7: case 8: case 9: - case 10: - case 11: case 14: case 15: case 21: @@ -1750,6 +1757,13 @@ case 31: goto No_Width; + case 10: + op = op_callsubr; + break; + case 11: + op = op_return; + break; + case 13: op = op_hsbw; break; @@ -1767,6 +1781,9 @@ case 7: op = op_sbw; break; + case 12: + op = op_div; + break; default: goto No_Width; @@ -1796,13 +1813,19 @@ /* anyway. */ if ( value > 32000 || value < -32000 ) { - FT_ERROR(( "t1_decoder_parse_metrics:" - " large integer found for width\n" )); - goto Syntax_Error; + if ( large_int ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " no `div' after large integer\n" )); + goto Syntax_Error; + } + else + large_int = TRUE; } else { - value = (FT_Int32)( (FT_UInt32)value << 16 ); + if ( !large_int ) + value = (FT_Int32)( (FT_UInt32)value << 16 ); } break; @@ -1827,7 +1850,8 @@ value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 ); } - value = (FT_Int32)( (FT_UInt32)value << 16 ); + if ( !large_int ) + value = (FT_Int32)( (FT_UInt32)value << 16 ); } else { @@ -1837,6 +1861,13 @@ } } + if ( large_int && !( op == op_none || op == op_div ) ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " no `div' after large integer\n" )); + goto Syntax_Error; + } + /********************************************************************** * * Push value on stack, or process operator @@ -1851,6 +1882,9 @@ } #ifdef FT_DEBUG_LEVEL_TRACE + if ( large_int ) + FT_TRACE4(( " %d", value )); + else FT_TRACE4(( " %d", value / 65536 )); #endif @@ -1869,11 +1903,21 @@ #ifdef FT_DEBUG_LEVEL_TRACE - if ( top - decoder->stack != num_args ) - FT_TRACE0(( "t1_decoder_parse_metrics:" - " too much operands on the stack" - " (seen %d, expected %d)\n", - top - decoder->stack, num_args )); + switch ( op ) + { + case op_callsubr: + case op_div: + case op_return: + break; + + default: + if ( top - decoder->stack != num_args ) + FT_TRACE0(( "t1_decoder_parse_metrics:" + " too much operands on the stack" + " (seen %ld, expected %d)\n", + top - decoder->stack, num_args )); + break; + } #endif /* FT_DEBUG_LEVEL_TRACE */ @@ -1893,8 +1937,8 @@ builder->advance.y = 0; /* we only want to compute the glyph's metrics */ - /* (lsb + advance width), not load the rest of */ - /* it; so exit immediately */ + /* (lsb + advance width) without loading the */ + /* rest of it; so exit immediately */ FT_TRACE4(( "\n" )); return FT_Err_Ok; @@ -1912,17 +1956,116 @@ builder->advance.y = top[3]; /* we only want to compute the glyph's metrics */ - /* (lsb + advance width), not load the rest of */ - /* it; so exit immediately */ + /* (lsb + advance width), without loading the */ + /* rest of it; so exit immediately */ FT_TRACE4(( "\n" )); return FT_Err_Ok; + case op_div: + FT_TRACE4(( " div" )); + + /* if `large_int' is set, we divide unscaled numbers; */ + /* otherwise, we divide numbers in 16.16 format -- */ + /* in both cases, it is the same operation */ + *top = FT_DivFix( top[0], top[1] ); + top++; + + large_int = FALSE; + break; + + case op_callsubr: + { + FT_Int idx; + + + FT_TRACE4(( " callsubr" )); + + idx = Fix2Int( top[0] ); + + if ( decoder->subrs_hash ) + { + size_t* val = ft_hash_num_lookup( idx, + decoder->subrs_hash ); + + + if ( val ) + idx = *val; + else + idx = -1; + } + + if ( idx < 0 || idx >= decoder->num_subrs ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " invalid subrs index\n" )); + goto Syntax_Error; + } + + if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " too many nested subrs\n" )); + goto Syntax_Error; + } + + zone->cursor = ip; /* save current instruction pointer */ + + zone++; + + /* The Type 1 driver stores subroutines without the seed bytes. */ + /* The CID driver stores subroutines with seed bytes. This */ + /* case is taken care of when decoder->subrs_len == 0. */ + zone->base = decoder->subrs[idx]; + + if ( decoder->subrs_len ) + zone->limit = zone->base + decoder->subrs_len[idx]; + else + { + /* We are using subroutines from a CID font. We must adjust */ + /* for the seed bytes. */ + zone->base += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 ); + zone->limit = decoder->subrs[idx + 1]; + } + + zone->cursor = zone->base; + + if ( !zone->base ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " invoking empty subrs\n" )); + goto Syntax_Error; + } + + decoder->zone = zone; + ip = zone->base; + limit = zone->limit; + break; + } + + case op_return: + FT_TRACE4(( " return" )); + + if ( zone <= decoder->zones ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " unexpected return\n" )); + goto Syntax_Error; + } + + zone--; + ip = zone->cursor; + limit = zone->limit; + decoder->zone = zone; + break; + default: FT_ERROR(( "t1_decoder_parse_metrics:" " unhandled opcode %d\n", op )); goto Syntax_Error; } + decoder->top = top; + } /* general operator processing */ } /* while ip < limit */ diff --git a/src/3rdparty/freetype/src/psaux/t1decode.h b/src/3rdparty/freetype/src/psaux/t1decode.h index 1b5d6263d3..b793504ac6 100644 --- a/src/3rdparty/freetype/src/psaux/t1decode.h +++ b/src/3rdparty/freetype/src/psaux/t1decode.h @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define T1DECODE_H_ -#include <ft2build.h> -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_TYPE1_TYPES_H +#include <freetype/internal/psaux.h> +#include <freetype/internal/t1types.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/pshinter/Jamfile b/src/3rdparty/freetype/src/pshinter/Jamfile deleted file mode 100644 index 0e44c19148..0000000000 --- a/src/3rdparty/freetype/src/pshinter/Jamfile +++ /dev/null @@ -1,34 +0,0 @@ -# FreeType 2 src/pshinter Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = pshalgo - pshglob - pshmod - pshpic - pshrec - ; - } - else - { - _sources = pshinter ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/pshinter Jamfile diff --git a/src/3rdparty/freetype/src/pshinter/module.mk b/src/3rdparty/freetype/src/pshinter/module.mk index 0a12a260e1..b440d2e76a 100644 --- a/src/3rdparty/freetype/src/pshinter/module.mk +++ b/src/3rdparty/freetype/src/pshinter/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/pshinter/pshalgo.c b/src/3rdparty/freetype/src/pshinter/pshalgo.c index 0c5ae62699..920b9a74b5 100644 --- a/src/3rdparty/freetype/src/pshinter/pshalgo.c +++ b/src/3rdparty/freetype/src/pshinter/pshalgo.c @@ -4,7 +4,7 @@ * * PostScript hinting algorithm (body). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used @@ -16,10 +16,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftcalc.h> #include "pshalgo.h" #include "pshnterr.h" diff --git a/src/3rdparty/freetype/src/pshinter/pshalgo.h b/src/3rdparty/freetype/src/pshinter/pshalgo.h index 6859e95cd2..5367a5d164 100644 --- a/src/3rdparty/freetype/src/pshinter/pshalgo.h +++ b/src/3rdparty/freetype/src/pshinter/pshalgo.h @@ -4,7 +4,7 @@ * * PostScript hinting algorithm (specification). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 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/pshinter/pshglob.c b/src/3rdparty/freetype/src/pshinter/pshglob.c index b021e6e42a..cdc1c3af0e 100644 --- a/src/3rdparty/freetype/src/pshinter/pshglob.c +++ b/src/3rdparty/freetype/src/pshinter/pshglob.c @@ -5,7 +5,7 @@ * PostScript hinter global hinting management (body). * Inspired by the new auto-hinter module. * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used @@ -17,10 +17,9 @@ */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_CALC_H +#include <freetype/freetype.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftcalc.h> #include "pshglob.h" #ifdef DEBUG_HINTER diff --git a/src/3rdparty/freetype/src/pshinter/pshglob.h b/src/3rdparty/freetype/src/pshinter/pshglob.h index 0049d4c0bc..8181324e5e 100644 --- a/src/3rdparty/freetype/src/pshinter/pshglob.h +++ b/src/3rdparty/freetype/src/pshinter/pshglob.h @@ -4,7 +4,7 @@ * * PostScript hinter global hinting management. * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,8 @@ #define PSHGLOB_H_ -#include FT_FREETYPE_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include <freetype/freetype.h> +#include <freetype/internal/pshints.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/pshinter/pshinter.c b/src/3rdparty/freetype/src/pshinter/pshinter.c index 16c3a0a117..3cca0ad7c2 100644 --- a/src/3rdparty/freetype/src/pshinter/pshinter.c +++ b/src/3rdparty/freetype/src/pshinter/pshinter.c @@ -4,7 +4,7 @@ * * FreeType PostScript Hinting module * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "pshalgo.c" #include "pshglob.c" diff --git a/src/3rdparty/freetype/src/pshinter/pshmod.c b/src/3rdparty/freetype/src/pshinter/pshmod.c index 2d36ea2a6a..e0abd386f9 100644 --- a/src/3rdparty/freetype/src/pshinter/pshmod.c +++ b/src/3rdparty/freetype/src/pshinter/pshmod.c @@ -4,7 +4,7 @@ * * FreeType PostScript hinter module implementation (body). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,10 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/ftobjs.h> #include "pshrec.h" #include "pshalgo.h" +#include "pshmod.h" /* the Postscript Hinter module structure */ diff --git a/src/3rdparty/freetype/src/pshinter/pshmod.h b/src/3rdparty/freetype/src/pshinter/pshmod.h index ea8771308a..2a6eb1c469 100644 --- a/src/3rdparty/freetype/src/pshinter/pshmod.h +++ b/src/3rdparty/freetype/src/pshinter/pshmod.h @@ -4,7 +4,7 @@ * * PostScript hinter module interface (specification). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define PSHMOD_H_ -#include <ft2build.h> -#include FT_MODULE_H +#include <freetype/ftmodapi.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/pshinter/pshnterr.h b/src/3rdparty/freetype/src/pshinter/pshnterr.h index fb9dbca2b1..d67955c410 100644 --- a/src/3rdparty/freetype/src/pshinter/pshnterr.h +++ b/src/3rdparty/freetype/src/pshinter/pshnterr.h @@ -4,7 +4,7 @@ * * PS Hinter error codes (specification only). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 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 @@ #ifndef PSHNTERR_H_ #define PSHNTERR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -33,7 +33,7 @@ #define FT_ERR_PREFIX PSH_Err_ #define FT_ERR_BASE FT_Mod_Err_PShinter -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* PSHNTERR_H_ */ diff --git a/src/3rdparty/freetype/src/pshinter/pshpic.c b/src/3rdparty/freetype/src/pshinter/pshpic.c deleted file mode 100644 index 465ad31885..0000000000 --- a/src/3rdparty/freetype/src/pshinter/pshpic.c +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************/ -/* */ -/* pshpic.c */ -/* */ -/* The FreeType position independent code services for pshinter module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include "pshpic.h" -#include "pshnterr.h" - - -#ifdef FT_CONFIG_OPTION_PIC - - /* forward declaration of PIC init functions from pshmod.c */ - void - FT_Init_Class_pshinter_interface( FT_Library library, - PSHinter_Interface* clazz ); - - void - pshinter_module_class_pic_free( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - - - if ( pic_container->pshinter ) - { - FT_FREE( pic_container->pshinter ); - pic_container->pshinter = NULL; - } - } - - - FT_Error - pshinter_module_class_pic_init( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - PSHinterPIC* container = NULL; - FT_Memory memory = library->memory; - - - /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC( container, sizeof ( *container ) ) ) - return error; - FT_MEM_SET( container, 0, sizeof ( *container ) ); - pic_container->pshinter = container; - - /* add call to initialization function when you add new scripts */ - FT_Init_Class_pshinter_interface( - library, &container->pshinter_interface ); - - if ( error ) - pshinter_module_class_pic_free( library ); - - return error; - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/pshinter/pshpic.h b/src/3rdparty/freetype/src/pshinter/pshpic.h deleted file mode 100644 index 4469ba87c8..0000000000 --- a/src/3rdparty/freetype/src/pshinter/pshpic.h +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************/ -/* */ -/* pshpic.h */ -/* */ -/* The FreeType position independent code services for pshinter module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef PSHPIC_H_ -#define PSHPIC_H_ - - -#include FT_INTERNAL_PIC_H - - -#ifndef FT_CONFIG_OPTION_PIC - -#define PSHINTER_INTERFACE_GET pshinter_interface - -#else /* FT_CONFIG_OPTION_PIC */ - -#include FT_INTERNAL_POSTSCRIPT_HINTS_H - -FT_BEGIN_HEADER - - typedef struct PSHinterPIC_ - { - PSHinter_Interface pshinter_interface; - - } PSHinterPIC; - - -#define GET_PIC( lib ) ( (PSHinterPIC*)( (lib)->pic_container.pshinter ) ) - -#define PSHINTER_INTERFACE_GET ( GET_PIC( library )->pshinter_interface ) - - /* see pshpic.c for the implementation */ - void - pshinter_module_class_pic_free( FT_Library library ); - - FT_Error - pshinter_module_class_pic_init( FT_Library library ); - -FT_END_HEADER - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - -#endif /* PSHPIC_H_ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/pshinter/pshrec.c b/src/3rdparty/freetype/src/pshinter/pshrec.c index 9dd09efe4c..bddccf2a6e 100644 --- a/src/3rdparty/freetype/src/pshinter/pshrec.c +++ b/src/3rdparty/freetype/src/pshinter/pshrec.c @@ -4,7 +4,7 @@ * * FreeType PostScript hints recorder (body). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H +#include <freetype/freetype.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftcalc.h> #include "pshrec.h" #include "pshalgo.h" @@ -875,7 +874,7 @@ if ( error ) { FT_ERROR(( "ps_hints_stem: could not add stem" - " (%d,%d) to hints table\n", stems[0], stems[1] )); + " (%ld,%ld) to hints table\n", stems[0], stems[1] )); hints->error = error; return; diff --git a/src/3rdparty/freetype/src/pshinter/pshrec.h b/src/3rdparty/freetype/src/pshinter/pshrec.h index 02cc2102ec..b13c7be13c 100644 --- a/src/3rdparty/freetype/src/pshinter/pshrec.h +++ b/src/3rdparty/freetype/src/pshinter/pshrec.h @@ -4,7 +4,7 @@ * * Postscript (Type1/Type2) hints recorder (specification). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -32,8 +32,7 @@ #define PSHREC_H_ -#include <ft2build.h> -#include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include <freetype/internal/pshints.h> #include "pshglob.h" diff --git a/src/3rdparty/freetype/src/pshinter/rules.mk b/src/3rdparty/freetype/src/pshinter/rules.mk index 58227d10f2..c845c255cd 100644 --- a/src/3rdparty/freetype/src/pshinter/rules.mk +++ b/src/3rdparty/freetype/src/pshinter/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2001-2019 by +# Copyright (C) 2001-2020 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/psnames/Jamfile b/src/3rdparty/freetype/src/psnames/Jamfile deleted file mode 100644 index 75978a8787..0000000000 --- a/src/3rdparty/freetype/src/psnames/Jamfile +++ /dev/null @@ -1,31 +0,0 @@ -# FreeType 2 src/psnames Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) psnames ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = psmodule - pspic - ; - } - else - { - _sources = psnames ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/psnames Jamfile diff --git a/src/3rdparty/freetype/src/psnames/module.mk b/src/3rdparty/freetype/src/psnames/module.mk index 0806a318a7..675bb37131 100644 --- a/src/3rdparty/freetype/src/psnames/module.mk +++ b/src/3rdparty/freetype/src/psnames/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/psnames/psmodule.c b/src/3rdparty/freetype/src/psnames/psmodule.c index 0ec440e67b..b38f9d3b1c 100644 --- a/src/3rdparty/freetype/src/psnames/psmodule.c +++ b/src/3rdparty/freetype/src/psnames/psmodule.c @@ -4,7 +4,7 @@ * * psnames module implementation (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,10 +16,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/services/svpscmap.h> #include "psmodule.h" diff --git a/src/3rdparty/freetype/src/psnames/psmodule.h b/src/3rdparty/freetype/src/psnames/psmodule.h index 0df9a7d889..c85a9ecad7 100644 --- a/src/3rdparty/freetype/src/psnames/psmodule.h +++ b/src/3rdparty/freetype/src/psnames/psmodule.h @@ -4,7 +4,7 @@ * * High-level psnames module interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define PSMODULE_H_ -#include <ft2build.h> -#include FT_MODULE_H +#include <freetype/ftmodapi.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/psnames/psnamerr.h b/src/3rdparty/freetype/src/psnames/psnamerr.h index 67ab1765d3..154c701d04 100644 --- a/src/3rdparty/freetype/src/psnames/psnamerr.h +++ b/src/3rdparty/freetype/src/psnames/psnamerr.h @@ -4,7 +4,7 @@ * * PS names module error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -26,7 +26,7 @@ #ifndef PSNAMERR_H_ #define PSNAMERR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -34,7 +34,7 @@ #define FT_ERR_PREFIX PSnames_Err_ #define FT_ERR_BASE FT_Mod_Err_PSnames -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* PSNAMERR_H_ */ diff --git a/src/3rdparty/freetype/src/psnames/psnames.c b/src/3rdparty/freetype/src/psnames/psnames.c index 4722f98831..cff36851ba 100644 --- a/src/3rdparty/freetype/src/psnames/psnames.c +++ b/src/3rdparty/freetype/src/psnames/psnames.c @@ -4,7 +4,7 @@ * * FreeType psnames module component (body only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "psmodule.c" diff --git a/src/3rdparty/freetype/src/psnames/pspic.c b/src/3rdparty/freetype/src/psnames/pspic.c deleted file mode 100644 index 85a06f3603..0000000000 --- a/src/3rdparty/freetype/src/psnames/pspic.c +++ /dev/null @@ -1,97 +0,0 @@ -/***************************************************************************/ -/* */ -/* pspic.c */ -/* */ -/* The FreeType position independent code services for psnames module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include "pspic.h" -#include "psnamerr.h" - - -#ifdef FT_CONFIG_OPTION_PIC - - /* forward declaration of PIC init functions from psmodule.c */ - FT_Error - FT_Create_Class_pscmaps_services( FT_Library library, - FT_ServiceDescRec** output_class ); - void - FT_Destroy_Class_pscmaps_services( FT_Library library, - FT_ServiceDescRec* clazz ); - - void - FT_Init_Class_pscmaps_interface( FT_Library library, - FT_Service_PsCMapsRec* clazz ); - - - void - psnames_module_class_pic_free( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - - - if ( pic_container->psnames ) - { - PSModulePIC* container = (PSModulePIC*)pic_container->psnames; - - - if ( container->pscmaps_services ) - FT_Destroy_Class_pscmaps_services( library, - container->pscmaps_services ); - container->pscmaps_services = NULL; - FT_FREE( container ); - pic_container->psnames = NULL; - } - } - - - FT_Error - psnames_module_class_pic_init( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - PSModulePIC* container = NULL; - FT_Memory memory = library->memory; - - - /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC( container, sizeof ( *container ) ) ) - return error; - FT_MEM_SET( container, 0, sizeof ( *container ) ); - pic_container->psnames = container; - - /* initialize pointer table - */ - /* this is how the module usually expects this data */ - error = FT_Create_Class_pscmaps_services( - library, &container->pscmaps_services ); - if ( error ) - goto Exit; - FT_Init_Class_pscmaps_interface( library, - &container->pscmaps_interface ); - - Exit: - if ( error ) - psnames_module_class_pic_free( library ); - return error; - } - - -#endif /* FT_CONFIG_OPTION_PIC */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/psnames/pspic.h b/src/3rdparty/freetype/src/psnames/pspic.h deleted file mode 100644 index 889780cc03..0000000000 --- a/src/3rdparty/freetype/src/psnames/pspic.h +++ /dev/null @@ -1,68 +0,0 @@ -/***************************************************************************/ -/* */ -/* pspic.h */ -/* */ -/* The FreeType position independent code services for psnames module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef PSPIC_H_ -#define PSPIC_H_ - - -#include FT_INTERNAL_PIC_H - - -#ifndef FT_CONFIG_OPTION_PIC - -#define PSCMAPS_SERVICES_GET pscmaps_services -#define PSCMAPS_INTERFACE_GET pscmaps_interface - -#else /* FT_CONFIG_OPTION_PIC */ - -#include FT_SERVICE_POSTSCRIPT_CMAPS_H - - -FT_BEGIN_HEADER - - typedef struct PSModulePIC_ - { - FT_ServiceDescRec* pscmaps_services; - FT_Service_PsCMapsRec pscmaps_interface; - - } PSModulePIC; - - -#define GET_PIC( lib ) \ - ( (PSModulePIC*)((lib)->pic_container.psnames) ) -#define PSCMAPS_SERVICES_GET ( GET_PIC( library )->pscmaps_services ) -#define PSCMAPS_INTERFACE_GET ( GET_PIC( library )->pscmaps_interface ) - - - /* see pspic.c for the implementation */ - void - psnames_module_class_pic_free( FT_Library library ); - - FT_Error - psnames_module_class_pic_init( FT_Library library ); - -FT_END_HEADER - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - -#endif /* PSPIC_H_ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/psnames/pstables.h b/src/3rdparty/freetype/src/psnames/pstables.h index c0139bbc60..c215f16ffc 100644 --- a/src/3rdparty/freetype/src/psnames/pstables.h +++ b/src/3rdparty/freetype/src/psnames/pstables.h @@ -4,7 +4,7 @@ * * PostScript glyph names. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 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/psnames/rules.mk b/src/3rdparty/freetype/src/psnames/rules.mk index dcc203e391..14cdda3ad1 100644 --- a/src/3rdparty/freetype/src/psnames/rules.mk +++ b/src/3rdparty/freetype/src/psnames/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/raster/Jamfile b/src/3rdparty/freetype/src/raster/Jamfile deleted file mode 100644 index 3990c05cd8..0000000000 --- a/src/3rdparty/freetype/src/raster/Jamfile +++ /dev/null @@ -1,32 +0,0 @@ -# FreeType 2 src/raster Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) raster ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = ftraster - ftrend1 - rastpic - ; - } - else - { - _sources = raster ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/raster Jamfile diff --git a/src/3rdparty/freetype/src/raster/ftmisc.h b/src/3rdparty/freetype/src/raster/ftmisc.h index a246569e3b..6efe4a9a5a 100644 --- a/src/3rdparty/freetype/src/raster/ftmisc.h +++ b/src/3rdparty/freetype/src/raster/ftmisc.h @@ -5,7 +5,7 @@ * Miscellaneous macros for stand-alone rasterizer (specification * only). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 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/raster/ftraster.c b/src/3rdparty/freetype/src/raster/ftraster.c index 023b6c1eff..9f0a7976fa 100644 --- a/src/3rdparty/freetype/src/raster/ftraster.c +++ b/src/3rdparty/freetype/src/raster/ftraster.c @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -62,10 +62,9 @@ #else /* !STANDALONE_ */ -#include <ft2build.h> #include "ftraster.h" -#include FT_INTERNAL_CALC_H /* for FT_MulDiv and FT_MulDiv_No_Round */ -#include FT_OUTLINE_H /* for FT_Outline_Get_CBox */ +#include <freetype/internal/ftcalc.h> /* for FT_MulDiv and FT_MulDiv_No_Round */ +#include <freetype/ftoutln.h> /* for FT_Outline_Get_CBox */ #endif /* !STANDALONE_ */ @@ -226,8 +225,8 @@ #else /* !STANDALONE_ */ -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H /* for FT_TRACE, FT_ERROR, and FT_THROW */ +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> /* for FT_TRACE, FT_ERROR, and FT_THROW */ #include "rasterrs.h" @@ -460,6 +459,11 @@ #define IS_TOP_OVERSHOOT( x ) \ (Bool)( x - FLOOR( x ) >= ras.precision_half ) + /* Smart dropout rounding to find which pixel is closer to span ends. */ + /* To mimick Windows, symmetric cases break down indepenently of the */ + /* precision. */ +#define SMART( p, q ) FLOOR( ( (p) + (q) + ras.precision * 63 / 64 ) >> 1 ) + #if FT_RENDER_POOL_SIZE > 2048 #define FT_MAX_BLACK_POOL ( FT_RENDER_POOL_SIZE / sizeof ( Long ) ) #else @@ -674,13 +678,13 @@ if ( overshoot ) ras.cProfile->flags |= Overshoot_Bottom; - FT_TRACE6(( " new ascending profile = %p\n", ras.cProfile )); + FT_TRACE6(( " new ascending profile = %p\n", (void *)ras.cProfile )); break; case Descending_State: if ( overshoot ) ras.cProfile->flags |= Overshoot_Top; - FT_TRACE6(( " new descending profile = %p\n", ras.cProfile )); + FT_TRACE6(( " new descending profile = %p\n", (void *)ras.cProfile )); break; default: @@ -737,7 +741,7 @@ FT_TRACE6(( " ending profile %p, start = %ld, height = %ld\n", - ras.cProfile, ras.cProfile->start, h )); + (void *)ras.cProfile, ras.cProfile->start, h )); ras.cProfile->height = h; if ( overshoot ) @@ -2242,11 +2246,10 @@ /* in high-precision mode, we need 12 digits after the comma to */ /* represent multiples of 1/(1<<12) = 1/4096 */ - FT_TRACE7(( " y=%d x=[%.12f;%.12f], drop-out=%d", + FT_TRACE7(( " y=%d x=[% .12f;% .12f]", y, x1 / (double)ras.precision, - x2 / (double)ras.precision, - dropOutControl )); + x2 / (double)ras.precision )); /* Drop-out control */ @@ -2274,7 +2277,7 @@ if ( e2 >= ras.bWidth ) e2 = ras.bWidth - 1; - FT_TRACE7(( " -> x=[%d;%d]", e1, e2 )); + FT_TRACE7(( " -> x=[%ld;%ld]", e1, e2 )); c1 = (Short)( e1 >> 3 ); c2 = (Short)( e2 >> 3 ); @@ -2316,7 +2319,7 @@ Short c1, f1; - FT_TRACE7(( " y=%d x=[%.12f;%.12f]", + FT_TRACE7(( " y=%d x=[% .12f;% .12f]", y, x1 / (double)ras.precision, x2 / (double)ras.precision )); @@ -2353,8 +2356,6 @@ Int dropOutControl = left->flags & 7; - FT_TRACE7(( ", drop-out=%d", dropOutControl )); - if ( e1 == e2 + ras.precision ) { switch ( dropOutControl ) @@ -2364,7 +2365,7 @@ break; case 4: /* smart drop-outs including stubs */ - pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half ); + pxl = SMART( x1, x2 ); break; case 1: /* simple drop-outs excluding stubs */ @@ -2413,7 +2414,7 @@ if ( dropOutControl == 1 ) pxl = e2; else - pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half ); + pxl = SMART( x1, x2 ); break; default: /* modes 2, 3, 6, 7 */ @@ -2448,7 +2449,7 @@ if ( e1 >= 0 && e1 < ras.bWidth ) { - FT_TRACE7(( " -> x=%d (drop-out)", e1 )); + FT_TRACE7(( " -> x=%ld", e1 )); c1 = (Short)( e1 >> 3 ); f1 = (Short)( e1 & 7 ); @@ -2457,7 +2458,7 @@ } Exit: - FT_TRACE7(( "\n" )); + FT_TRACE7(( " dropout=%d\n", left->flags & 7 )); } @@ -2495,44 +2496,68 @@ PProfile left, PProfile right ) { + Long e1, e2; + FT_UNUSED( left ); FT_UNUSED( right ); - if ( x2 - x1 < ras.precision ) - { - Long e1, e2; + FT_TRACE7(( " x=%d y=[% .12f;% .12f]", + y, + x1 / (double)ras.precision, + x2 / (double)ras.precision )); + /* We should not need this procedure but the vertical sweep */ + /* mishandles horizontal lines through pixel centers. So we */ + /* have to check perfectly aligned span edges here. */ + /* */ + /* XXX: Can we handle horizontal lines better and drop this? */ - FT_TRACE7(( " x=%d y=[%.12f;%.12f]", - y, - x1 / (double)ras.precision, - x2 / (double)ras.precision )); + e1 = CEILING( x1 ); - e1 = CEILING( x1 ); - e2 = FLOOR ( x2 ); + if ( x1 == e1 ) + { + e1 = TRUNC( e1 ); - if ( e1 == e2 ) + if ( e1 >= 0 && (ULong)e1 < ras.target.rows ) { - e1 = TRUNC( e1 ); - - if ( e1 >= 0 && (ULong)e1 < ras.target.rows ) - { - Byte f1; - PByte bits; + Byte f1; + PByte bits; - FT_TRACE7(( " -> y=%d (drop-out)", e1 )); + bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch; + f1 = (Byte)( 0x80 >> ( y & 7 ) ); - bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch; - f1 = (Byte)( 0x80 >> ( y & 7 ) ); + FT_TRACE7(( bits[0] & f1 ? " redundant" + : " -> y=%ld edge", e1 )); - bits[0] |= f1; - } + bits[0] |= f1; } + } + + e2 = FLOOR ( x2 ); + + if ( x2 == e2 ) + { + e2 = TRUNC( e2 ); + + if ( e2 >= 0 && (ULong)e2 < ras.target.rows ) + { + Byte f1; + PByte bits; + - FT_TRACE7(( "\n" )); + bits = ras.bOrigin + ( y >> 3 ) - e2 * ras.target.pitch; + f1 = (Byte)( 0x80 >> ( y & 7 ) ); + + FT_TRACE7(( bits[0] & f1 ? " redundant" + : " -> y=%ld edge", e2 )); + + bits[0] |= f1; + } } + + FT_TRACE7(( "\n" )); } @@ -2548,7 +2573,7 @@ Byte f1; - FT_TRACE7(( " x=%d y=[%.12f;%.12f]", + FT_TRACE7(( " x=%d y=[% .12f;% .12f]", y, x1 / (double)ras.precision, x2 / (double)ras.precision )); @@ -2574,8 +2599,6 @@ Int dropOutControl = left->flags & 7; - FT_TRACE7(( ", dropout=%d", dropOutControl )); - if ( e1 == e2 + ras.precision ) { switch ( dropOutControl ) @@ -2585,7 +2608,7 @@ break; case 4: /* smart drop-outs including stubs */ - pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half ); + pxl = SMART( x1, x2 ); break; case 1: /* simple drop-outs excluding stubs */ @@ -2609,7 +2632,7 @@ if ( dropOutControl == 1 ) pxl = e2; else - pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half ); + pxl = SMART( x1, x2 ); break; default: /* modes 2, 3, 6, 7 */ @@ -2645,7 +2668,7 @@ if ( e1 >= 0 && (ULong)e1 < ras.target.rows ) { - FT_TRACE7(( " -> y=%d (drop-out)", e1 )); + FT_TRACE7(( " -> y=%ld", e1 )); bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch; f1 = (Byte)( 0x80 >> ( y & 7 ) ); @@ -2654,7 +2677,7 @@ } Exit: - FT_TRACE7(( "\n" )); + FT_TRACE7(( " dropout=%d\n", left->flags & 7 )); } diff --git a/src/3rdparty/freetype/src/raster/ftraster.h b/src/3rdparty/freetype/src/raster/ftraster.h index 50d34201a1..1b2ee3c016 100644 --- a/src/3rdparty/freetype/src/raster/ftraster.h +++ b/src/3rdparty/freetype/src/raster/ftraster.h @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used @@ -22,8 +22,9 @@ #include <ft2build.h> #include FT_CONFIG_CONFIG_H -#include FT_IMAGE_H +#include <freetype/ftimage.h> +#include <freetype/internal/compiler-macros.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/raster/ftrend1.c b/src/3rdparty/freetype/src/raster/ftrend1.c index 62c727182a..57fed9bc14 100644 --- a/src/3rdparty/freetype/src/raster/ftrend1.c +++ b/src/3rdparty/freetype/src/raster/ftrend1.c @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer interface (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,10 +16,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H -#include FT_OUTLINE_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/ftoutln.h> #include "ftrend1.h" #include "ftraster.h" diff --git a/src/3rdparty/freetype/src/raster/ftrend1.h b/src/3rdparty/freetype/src/raster/ftrend1.h index 82ecac686c..3f6be53675 100644 --- a/src/3rdparty/freetype/src/raster/ftrend1.h +++ b/src/3rdparty/freetype/src/raster/ftrend1.h @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define FTREND1_H_ -#include <ft2build.h> -#include FT_RENDER_H +#include <freetype/ftrender.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/raster/module.mk b/src/3rdparty/freetype/src/raster/module.mk index 0a6d4b09d9..3600732b16 100644 --- a/src/3rdparty/freetype/src/raster/module.mk +++ b/src/3rdparty/freetype/src/raster/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/raster/raster.c b/src/3rdparty/freetype/src/raster/raster.c index e3ac9e566a..cd37943bf6 100644 --- a/src/3rdparty/freetype/src/raster/raster.c +++ b/src/3rdparty/freetype/src/raster/raster.c @@ -4,7 +4,7 @@ * * FreeType monochrome rasterer module component (body only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "ftraster.c" #include "ftrend1.c" diff --git a/src/3rdparty/freetype/src/raster/rasterrs.h b/src/3rdparty/freetype/src/raster/rasterrs.h index 7266407365..a29651a6c5 100644 --- a/src/3rdparty/freetype/src/raster/rasterrs.h +++ b/src/3rdparty/freetype/src/raster/rasterrs.h @@ -4,7 +4,7 @@ * * monochrome renderer error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -26,7 +26,7 @@ #ifndef RASTERRS_H_ #define RASTERRS_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -34,7 +34,7 @@ #define FT_ERR_PREFIX Raster_Err_ #define FT_ERR_BASE FT_Mod_Err_Raster -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* RASTERRS_H_ */ diff --git a/src/3rdparty/freetype/src/raster/rastpic.c b/src/3rdparty/freetype/src/raster/rastpic.c deleted file mode 100644 index 1dc8981b8a..0000000000 --- a/src/3rdparty/freetype/src/raster/rastpic.c +++ /dev/null @@ -1,89 +0,0 @@ -/***************************************************************************/ -/* */ -/* rastpic.c */ -/* */ -/* The FreeType position independent code services for raster module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include "rastpic.h" -#include "rasterrs.h" - - -#ifdef FT_CONFIG_OPTION_PIC - - /* forward declaration of PIC init functions from ftraster.c */ - void - FT_Init_Class_ft_standard_raster( FT_Raster_Funcs* funcs ); - - - void - ft_raster1_renderer_class_pic_free( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - - - if ( pic_container->raster ) - { - RasterPIC* container = (RasterPIC*)pic_container->raster; - - - if ( --container->ref_count ) - return; - FT_FREE( container ); - pic_container->raster = NULL; - } - } - - - FT_Error - ft_raster1_renderer_class_pic_init( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - RasterPIC* container = NULL; - FT_Memory memory = library->memory; - - - /* XXX: since this function also served the no longer available */ - /* raster5 renderer it uses reference counting, which could */ - /* be removed now */ - if ( pic_container->raster ) - { - ((RasterPIC*)pic_container->raster)->ref_count++; - return error; - } - - /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC( container, sizeof ( *container ) ) ) - return error; - FT_MEM_SET( container, 0, sizeof ( *container ) ); - pic_container->raster = container; - - container->ref_count = 1; - - /* initialize pointer table - */ - /* this is how the module usually expects this data */ - FT_Init_Class_ft_standard_raster( &container->ft_standard_raster ); - - return error; - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/raster/rastpic.h b/src/3rdparty/freetype/src/raster/rastpic.h deleted file mode 100644 index 6d0877c423..0000000000 --- a/src/3rdparty/freetype/src/raster/rastpic.h +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************/ -/* */ -/* rastpic.h */ -/* */ -/* The FreeType position independent code services for raster module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef RASTPIC_H_ -#define RASTPIC_H_ - - -#include FT_INTERNAL_PIC_H - - -FT_BEGIN_HEADER - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_STANDARD_RASTER_GET ft_standard_raster - -#else /* FT_CONFIG_OPTION_PIC */ - - typedef struct RasterPIC_ - { - int ref_count; - FT_Raster_Funcs ft_standard_raster; - - } RasterPIC; - - -#define GET_PIC( lib ) \ - ( (RasterPIC*)( (lib)->pic_container.raster ) ) -#define FT_STANDARD_RASTER_GET ( GET_PIC( library )->ft_standard_raster ) - - - /* see rastpic.c for the implementation */ - void - ft_raster1_renderer_class_pic_free( FT_Library library ); - - FT_Error - ft_raster1_renderer_class_pic_init( FT_Library library ); - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - -FT_END_HEADER - -#endif /* RASTPIC_H_ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/raster/rules.mk b/src/3rdparty/freetype/src/raster/rules.mk index 7664671e80..3e949d7741 100644 --- a/src/3rdparty/freetype/src/raster/rules.mk +++ b/src/3rdparty/freetype/src/raster/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/sfnt/Jamfile b/src/3rdparty/freetype/src/sfnt/Jamfile deleted file mode 100644 index f646b3526e..0000000000 --- a/src/3rdparty/freetype/src/sfnt/Jamfile +++ /dev/null @@ -1,42 +0,0 @@ -# FreeType 2 src/sfnt Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = pngshim - sfdriver - sfntpic - sfobjs - ttbdf - ttcmap - ttcolr - ttcpal - ttkern - ttload - ttmtx - ttpost - ttsbit - ; - } - else - { - _sources = sfnt ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/sfnt Jamfile diff --git a/src/3rdparty/freetype/src/sfnt/module.mk b/src/3rdparty/freetype/src/sfnt/module.mk index 8c3b44fec7..0f459d8421 100644 --- a/src/3rdparty/freetype/src/sfnt/module.mk +++ b/src/3rdparty/freetype/src/sfnt/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/sfnt/pngshim.c b/src/3rdparty/freetype/src/sfnt/pngshim.c index 2e0904ffd2..1bd3a7eeb5 100644 --- a/src/3rdparty/freetype/src/sfnt/pngshim.c +++ b/src/3rdparty/freetype/src/sfnt/pngshim.c @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * @@ -17,10 +17,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> #include FT_CONFIG_STANDARD_LIBRARY_H @@ -61,7 +60,12 @@ /* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */ /* introduced in gcc 4.6 and clang 3.2, respectively. */ /* `__builtin_shuffle' for gcc was introduced in gcc 4.7.0. */ -#if ( ( defined( __GNUC__ ) && \ + /* */ + /* Intel compilers do not currently support __builtin_shuffle; */ + + /* The Intel check must be first. */ +#if !defined( __INTEL_COMPILER ) && \ + ( ( defined( __GNUC__ ) && \ ( ( __GNUC__ >= 5 ) || \ ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 7 ) ) ) ) || \ ( defined( __clang__ ) && \ @@ -69,6 +73,7 @@ ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \ defined( __OPTIMIZE__ ) && \ !defined( __EMSCRIPTEN__ ) && \ + defined( __SSE__ ) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #ifdef __clang__ diff --git a/src/3rdparty/freetype/src/sfnt/pngshim.h b/src/3rdparty/freetype/src/sfnt/pngshim.h index 06c6f6b20e..2d6e83d69b 100644 --- a/src/3rdparty/freetype/src/sfnt/pngshim.h +++ b/src/3rdparty/freetype/src/sfnt/pngshim.h @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * @@ -21,7 +21,6 @@ #define PNGSHIM_H_ -#include <ft2build.h> #include "ttload.h" diff --git a/src/3rdparty/freetype/src/sfnt/rules.mk b/src/3rdparty/freetype/src/sfnt/rules.mk index ee3314eac3..f56ef060ed 100644 --- a/src/3rdparty/freetype/src/sfnt/rules.mk +++ b/src/3rdparty/freetype/src/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -28,19 +28,21 @@ SFNT_COMPILE := $(CC) $(ANSIFLAGS) \ # SFNT driver sources (i.e., C files) # -SFNT_DRV_SRC := $(SFNT_DIR)/pngshim.c \ - $(SFNT_DIR)/sfdriver.c \ - $(SFNT_DIR)/sfobjs.c \ - $(SFNT_DIR)/sfwoff.c \ - $(SFNT_DIR)/ttbdf.c \ - $(SFNT_DIR)/ttcmap.c \ - $(SFNT_DIR)/ttcolr.c \ - $(SFNT_DIR)/ttcpal.c \ - $(SFNT_DIR)/ttkern.c \ - $(SFNT_DIR)/ttload.c \ - $(SFNT_DIR)/ttmtx.c \ - $(SFNT_DIR)/ttpost.c \ - $(SFNT_DIR)/ttsbit.c +SFNT_DRV_SRC := $(SFNT_DIR)/pngshim.c \ + $(SFNT_DIR)/sfdriver.c \ + $(SFNT_DIR)/sfobjs.c \ + $(SFNT_DIR)/sfwoff.c \ + $(SFNT_DIR)/sfwoff2.c \ + $(SFNT_DIR)/ttbdf.c \ + $(SFNT_DIR)/ttcmap.c \ + $(SFNT_DIR)/ttcolr.c \ + $(SFNT_DIR)/ttcpal.c \ + $(SFNT_DIR)/ttkern.c \ + $(SFNT_DIR)/ttload.c \ + $(SFNT_DIR)/ttmtx.c \ + $(SFNT_DIR)/ttpost.c \ + $(SFNT_DIR)/ttsbit.c \ + $(SFNT_DIR)/woff2tags.c # SFNT driver headers # diff --git a/src/3rdparty/freetype/src/sfnt/sfdriver.c b/src/3rdparty/freetype/src/sfnt/sfdriver.c index 2611685284..0460339a74 100644 --- a/src/3rdparty/freetype/src/sfnt/sfdriver.c +++ b/src/3rdparty/freetype/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_OBJECTS_H -#include FT_TRUETYPE_IDS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/sfnt.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/ttnameid.h> #include "sfdriver.h" #include "ttload.h" @@ -43,21 +42,21 @@ #ifdef TT_CONFIG_OPTION_BDF #include "ttbdf.h" -#include FT_SERVICE_BDF_H +#include <freetype/internal/services/svbdf.h> #endif #include "ttcmap.h" #include "ttkern.h" #include "ttmtx.h" -#include FT_SERVICE_GLYPH_DICT_H -#include FT_SERVICE_POSTSCRIPT_NAME_H -#include FT_SERVICE_SFNT_H -#include FT_SERVICE_TT_CMAP_H +#include <freetype/internal/services/svgldict.h> +#include <freetype/internal/services/svpostnm.h> +#include <freetype/internal/services/svsfnt.h> +#include <freetype/internal/services/svttcmap.h> #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_MULTIPLE_MASTERS_H -#include FT_SERVICE_MULTIPLE_MASTERS_H +#include <freetype/ftmm.h> +#include <freetype/internal/services/svmm.h> #endif @@ -195,7 +194,7 @@ else if ( (FT_ULong)face->num_glyphs < FT_UINT_MAX ) max_gid = (FT_UInt)face->num_glyphs; else - FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n", + FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08lx\n", FT_UINT_MAX, face->num_glyphs )); for ( i = 0; i < max_gid; i++ ) diff --git a/src/3rdparty/freetype/src/sfnt/sfdriver.h b/src/3rdparty/freetype/src/sfnt/sfdriver.h index 8c174634b3..1ac2706325 100644 --- a/src/3rdparty/freetype/src/sfnt/sfdriver.h +++ b/src/3rdparty/freetype/src/sfnt/sfdriver.h @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define SFDRIVER_H_ -#include <ft2build.h> -#include FT_MODULE_H +#include <freetype/ftmodapi.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/sfnt/sferrors.h b/src/3rdparty/freetype/src/sfnt/sferrors.h index 43e148d295..55c3e76b66 100644 --- a/src/3rdparty/freetype/src/sfnt/sferrors.h +++ b/src/3rdparty/freetype/src/sfnt/sferrors.h @@ -4,7 +4,7 @@ * * SFNT error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 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 @@ #ifndef SFERRORS_H_ #define SFERRORS_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -33,7 +33,7 @@ #define FT_ERR_PREFIX SFNT_Err_ #define FT_ERR_BASE FT_Mod_Err_SFNT -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* SFERRORS_H_ */ diff --git a/src/3rdparty/freetype/src/sfnt/sfnt.c b/src/3rdparty/freetype/src/sfnt/sfnt.c index b4faf34a3a..471239ff0b 100644 --- a/src/3rdparty/freetype/src/sfnt/sfnt.c +++ b/src/3rdparty/freetype/src/sfnt/sfnt.c @@ -4,7 +4,7 @@ * * Single object library component. * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,12 +17,12 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "pngshim.c" #include "sfdriver.c" #include "sfobjs.c" #include "sfwoff.c" +#include "sfwoff2.c" #include "ttbdf.c" #include "ttcmap.c" #include "ttcolr.c" @@ -33,6 +33,7 @@ #include "ttmtx.c" #include "ttpost.c" #include "ttsbit.c" +#include "woff2tags.c" /* END */ diff --git a/src/3rdparty/freetype/src/sfnt/sfntpic.c b/src/3rdparty/freetype/src/sfnt/sfntpic.c deleted file mode 100644 index db2d816ce6..0000000000 --- a/src/3rdparty/freetype/src/sfnt/sfntpic.c +++ /dev/null @@ -1,143 +0,0 @@ -/***************************************************************************/ -/* */ -/* sfntpic.c */ -/* */ -/* The FreeType position independent code services for sfnt module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include "sfntpic.h" -#include "sferrors.h" - - -#ifdef FT_CONFIG_OPTION_PIC - - /* forward declaration of PIC init functions from sfdriver.c */ - FT_Error - FT_Create_Class_sfnt_services( FT_Library library, - FT_ServiceDescRec** output_class ); - void - FT_Destroy_Class_sfnt_services( FT_Library library, - FT_ServiceDescRec* clazz ); - void - FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec* clazz ); - void - FT_Init_Class_sfnt_interface( FT_Library library, - SFNT_Interface* clazz ); - void - FT_Init_Class_sfnt_service_glyph_dict( - FT_Library library, - FT_Service_GlyphDictRec* clazz ); - void - FT_Init_Class_sfnt_service_ps_name( - FT_Library library, - FT_Service_PsFontNameRec* clazz ); - void - FT_Init_Class_tt_service_get_cmap_info( - FT_Library library, - FT_Service_TTCMapsRec* clazz ); - void - FT_Init_Class_sfnt_service_sfnt_table( - FT_Service_SFNT_TableRec* clazz ); - - - /* forward declaration of PIC init functions from ttcmap.c */ - FT_Error - FT_Create_Class_tt_cmap_classes( FT_Library library, - TT_CMap_Class** output_class ); - void - FT_Destroy_Class_tt_cmap_classes( FT_Library library, - TT_CMap_Class* clazz ); - - - void - sfnt_module_class_pic_free( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - - - if ( pic_container->sfnt ) - { - sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt; - - - if ( container->sfnt_services ) - FT_Destroy_Class_sfnt_services( library, - container->sfnt_services ); - container->sfnt_services = NULL; - - if ( container->tt_cmap_classes ) - FT_Destroy_Class_tt_cmap_classes( library, - container->tt_cmap_classes ); - container->tt_cmap_classes = NULL; - - FT_FREE( container ); - pic_container->sfnt = NULL; - } - } - - - FT_Error - sfnt_module_class_pic_init( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - sfntModulePIC* container = NULL; - FT_Memory memory = library->memory; - - - /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC( container, sizeof ( *container ) ) ) - return error; - FT_MEM_SET( container, 0, sizeof ( *container ) ); - pic_container->sfnt = container; - - /* initialize pointer table - */ - /* this is how the module usually expects this data */ - error = FT_Create_Class_sfnt_services( library, - &container->sfnt_services ); - if ( error ) - goto Exit; - - error = FT_Create_Class_tt_cmap_classes( library, - &container->tt_cmap_classes ); - if ( error ) - goto Exit; - - FT_Init_Class_sfnt_service_glyph_dict( - library, &container->sfnt_service_glyph_dict ); - FT_Init_Class_sfnt_service_ps_name( - library, &container->sfnt_service_ps_name ); - FT_Init_Class_tt_service_get_cmap_info( - library, &container->tt_service_get_cmap_info ); - FT_Init_Class_sfnt_service_sfnt_table( - &container->sfnt_service_sfnt_table ); -#ifdef TT_CONFIG_OPTION_BDF - FT_Init_Class_sfnt_service_bdf( &container->sfnt_service_bdf ); -#endif - FT_Init_Class_sfnt_interface( library, &container->sfnt_interface ); - - Exit: - if ( error ) - sfnt_module_class_pic_free( library ); - return error; - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/sfnt/sfntpic.h b/src/3rdparty/freetype/src/sfnt/sfntpic.h deleted file mode 100644 index 8f43122d81..0000000000 --- a/src/3rdparty/freetype/src/sfnt/sfntpic.h +++ /dev/null @@ -1,112 +0,0 @@ -/***************************************************************************/ -/* */ -/* sfntpic.h */ -/* */ -/* The FreeType position independent code services for sfnt module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef SFNTPIC_H_ -#define SFNTPIC_H_ - - -#include FT_INTERNAL_PIC_H - - -#ifndef FT_CONFIG_OPTION_PIC - -#define SFNT_SERVICES_GET sfnt_services -#define SFNT_SERVICE_GLYPH_DICT_GET sfnt_service_glyph_dict -#define SFNT_SERVICE_PS_NAME_GET sfnt_service_ps_name -#define TT_SERVICE_CMAP_INFO_GET tt_service_get_cmap_info -#define TT_CMAP_CLASSES_GET tt_cmap_classes -#define SFNT_SERVICE_SFNT_TABLE_GET sfnt_service_sfnt_table -#define SFNT_SERVICE_BDF_GET sfnt_service_bdf -#define SFNT_INTERFACE_GET sfnt_interface - -#else /* FT_CONFIG_OPTION_PIC */ - - /* some include files required for members of sfntModulePIC */ -#include FT_SERVICE_GLYPH_DICT_H -#include FT_SERVICE_POSTSCRIPT_NAME_H -#include FT_SERVICE_SFNT_H -#include FT_SERVICE_TT_CMAP_H - -#ifdef TT_CONFIG_OPTION_BDF -#include "ttbdf.h" -#include FT_SERVICE_BDF_H -#endif - -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H -#include "ttcmap.h" - - -FT_BEGIN_HEADER - - typedef struct sfntModulePIC_ - { - FT_ServiceDescRec* sfnt_services; - FT_Service_GlyphDictRec sfnt_service_glyph_dict; - FT_Service_PsFontNameRec sfnt_service_ps_name; - FT_Service_TTCMapsRec tt_service_get_cmap_info; - TT_CMap_Class* tt_cmap_classes; - FT_Service_SFNT_TableRec sfnt_service_sfnt_table; -#ifdef TT_CONFIG_OPTION_BDF - FT_Service_BDFRec sfnt_service_bdf; -#endif - SFNT_Interface sfnt_interface; - - } sfntModulePIC; - - -#define GET_PIC( lib ) \ - ( (sfntModulePIC*)( (lib)->pic_container.sfnt ) ) - -#define SFNT_SERVICES_GET \ - ( GET_PIC( library )->sfnt_services ) -#define SFNT_SERVICE_GLYPH_DICT_GET \ - ( GET_PIC( library )->sfnt_service_glyph_dict ) -#define SFNT_SERVICE_PS_NAME_GET \ - ( GET_PIC( library )->sfnt_service_ps_name ) -#define TT_SERVICE_CMAP_INFO_GET \ - ( GET_PIC( library )->tt_service_get_cmap_info ) -#define TT_CMAP_CLASSES_GET \ - ( GET_PIC( library )->tt_cmap_classes ) -#define SFNT_SERVICE_SFNT_TABLE_GET \ - ( GET_PIC( library )->sfnt_service_sfnt_table ) -#define SFNT_SERVICE_BDF_GET \ - ( GET_PIC( library )->sfnt_service_bdf ) -#define SFNT_INTERFACE_GET \ - ( GET_PIC( library )->sfnt_interface ) - - - /* see sfntpic.c for the implementation */ - void - sfnt_module_class_pic_free( FT_Library library ); - - FT_Error - sfnt_module_class_pic_init( FT_Library library ); - - -FT_END_HEADER - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - -#endif /* SFNTPIC_H_ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/sfnt/sfobjs.c b/src/3rdparty/freetype/src/sfnt/sfobjs.c index 6edf3ae1de..39460be2e6 100644 --- a/src/3rdparty/freetype/src/sfnt/sfobjs.c +++ b/src/3rdparty/freetype/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ * * SFNT object management (base). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,22 +16,22 @@ */ -#include <ft2build.h> #include "sfobjs.h" #include "ttload.h" #include "ttcmap.h" #include "ttkern.h" #include "sfwoff.h" -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_DEBUG_H -#include FT_TRUETYPE_IDS_H -#include FT_TRUETYPE_TAGS_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H -#include FT_SFNT_NAMES_H +#include "sfwoff2.h" +#include <freetype/internal/sfnt.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/ttnameid.h> +#include <freetype/tttags.h> +#include <freetype/internal/services/svpscmap.h> +#include <freetype/ftsnames.h> #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_SERVICE_MULTIPLE_MASTERS_H -#include FT_SERVICE_METRICS_VARIATIONS_H +#include <freetype/internal/services/svmm.h> +#include <freetype/internal/services/svmetric.h> #endif #include "sferrors.h" @@ -341,7 +341,9 @@ /* synthesized into a TTC with one offset table. */ static FT_Error sfnt_open_font( FT_Stream stream, - TT_Face face ) + TT_Face face, + FT_Int* face_instance_index, + FT_Long* woff2_num_faces ) { FT_Memory memory = stream->memory; FT_Error error; @@ -385,6 +387,25 @@ goto retry; } + if ( tag == TTAG_wOF2 ) + { + FT_TRACE2(( "sfnt_open_font: file is a WOFF2; synthesizing SFNT\n" )); + + if ( FT_STREAM_SEEK( offset ) ) + return error; + + error = woff2_open_font( stream, + face, + face_instance_index, + woff2_num_faces ); + if ( error ) + return error; + + /* Swap out stream and retry! */ + stream = face->root.stream; + goto retry; + } + if ( tag != 0x00010000UL && tag != TTAG_ttcf && tag != TTAG_OTTO && @@ -461,9 +482,10 @@ FT_Parameter* params ) { FT_Error error; - FT_Library library = face->root.driver->root.library; + FT_Library library = face->root.driver->root.library; SFNT_Service sfnt; FT_Int face_index; + FT_Long woff2_num_faces = 0; /* for now, parameters are unused */ @@ -514,15 +536,18 @@ FT_TRACE2(( "SFNT driver\n" )); - error = sfnt_open_font( stream, face ); + error = sfnt_open_font( stream, + face, + &face_instance_index, + &woff2_num_faces ); if ( error ) return error; /* Stream may have changed in sfnt_open_font. */ stream = face->root.stream; - FT_TRACE2(( "sfnt_init_face: %08p (index %d)\n", - face, + FT_TRACE2(( "sfnt_init_face: %p (index %d)\n", + (void *)face, face_instance_index )); face_index = FT_ABS( face_instance_index ) & 0xFFFF; @@ -689,6 +714,10 @@ face->root.num_faces = face->ttc_header.count; face->root.face_index = face_instance_index; + /* `num_faces' for a WOFF2 needs to be handled separately. */ + if ( woff2_num_faces ) + face->root.num_faces = woff2_num_faces; + return error; } @@ -791,7 +820,7 @@ /* it doesn't contain outlines. */ /* */ - FT_TRACE2(( "sfnt_load_face: %08p\n\n", face )); + FT_TRACE2(( "sfnt_load_face: %p\n\n", (void *)face )); /* do we have outlines in there? */ #ifdef FT_CONFIG_OPTION_INCREMENTAL diff --git a/src/3rdparty/freetype/src/sfnt/sfobjs.h b/src/3rdparty/freetype/src/sfnt/sfobjs.h index 3fbf2dd6bd..e8e3042083 100644 --- a/src/3rdparty/freetype/src/sfnt/sfobjs.h +++ b/src/3rdparty/freetype/src/sfnt/sfobjs.h @@ -4,7 +4,7 @@ * * SFNT object management (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define SFOBJS_H_ -#include <ft2build.h> -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/sfnt.h> +#include <freetype/internal/ftobjs.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/sfnt/sfwoff.c b/src/3rdparty/freetype/src/sfnt/sfwoff.c index ca4821a20a..f0a32e1e06 100644 --- a/src/3rdparty/freetype/src/sfnt/sfwoff.c +++ b/src/3rdparty/freetype/src/sfnt/sfwoff.c @@ -4,7 +4,7 @@ * * WOFF format management (base). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> #include "sfwoff.h" -#include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_GZIP_H +#include <freetype/tttags.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/ftgzip.h> /************************************************************************** @@ -371,18 +370,18 @@ sfnt + table->OrigOffset, &output_len, stream->cursor, table->CompLength ); if ( error ) - goto Exit; + goto Exit1; if ( output_len != table->OrigLength ) { FT_ERROR(( "woff_font_open: compressed table length mismatch\n" )); error = FT_THROW( Invalid_Table ); - goto Exit; + goto Exit1; } #else /* !FT_CONFIG_OPTION_USE_ZLIB */ error = FT_THROW( Unimplemented_Feature ); - goto Exit; + goto Exit1; #endif /* !FT_CONFIG_OPTION_USE_ZLIB */ } @@ -424,6 +423,10 @@ } return error; + + Exit1: + FT_FRAME_EXIT(); + goto Exit; } diff --git a/src/3rdparty/freetype/src/sfnt/sfwoff.h b/src/3rdparty/freetype/src/sfnt/sfwoff.h index 15495c32a2..d177ab1160 100644 --- a/src/3rdparty/freetype/src/sfnt/sfwoff.h +++ b/src/3rdparty/freetype/src/sfnt/sfwoff.h @@ -4,7 +4,7 @@ * * WOFFF format management (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define SFWOFF_H_ -#include <ft2build.h> -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/sfnt.h> +#include <freetype/internal/ftobjs.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/sfnt/sfwoff2.c b/src/3rdparty/freetype/src/sfnt/sfwoff2.c new file mode 100644 index 0000000000..5c8202f823 --- /dev/null +++ b/src/3rdparty/freetype/src/sfnt/sfwoff2.c @@ -0,0 +1,2337 @@ +/**************************************************************************** + * + * sfwoff2.c + * + * WOFF2 format management (base). + * + * Copyright (C) 2019-2020 by + * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + +#include "sfwoff2.h" +#include "woff2tags.h" +#include <freetype/tttags.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> + + +#ifdef FT_CONFIG_OPTION_USE_BROTLI + +#include <brotli/decode.h> + +#endif + + + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ +#undef FT_COMPONENT +#define FT_COMPONENT sfwoff2 + + +#define READ_255USHORT( var ) FT_SET_ERROR( Read255UShort( stream, &var ) ) + +#define READ_BASE128( var ) FT_SET_ERROR( ReadBase128( stream, &var ) ) + + /* `var' should be FT_ULong */ +#define ROUND4( var ) ( ( var + 3 ) & ~3UL ) + +#define WRITE_USHORT( p, v ) \ + do \ + { \ + *(p)++ = (FT_Byte)( (v) >> 8 ); \ + *(p)++ = (FT_Byte)( (v) >> 0 ); \ + \ + } while ( 0 ) + +#define WRITE_ULONG( p, v ) \ + do \ + { \ + *(p)++ = (FT_Byte)( (v) >> 24 ); \ + *(p)++ = (FT_Byte)( (v) >> 16 ); \ + *(p)++ = (FT_Byte)( (v) >> 8 ); \ + *(p)++ = (FT_Byte)( (v) >> 0 ); \ + \ + } while ( 0 ) + +#define WRITE_SHORT( p, v ) \ + do \ + { \ + *(p)++ = (FT_Byte)( (v) >> 8 ); \ + *(p)++ = (FT_Byte)( (v) >> 0 ); \ + \ + } while ( 0 ) + +#define WRITE_SFNT_BUF( buf, s ) \ + write_buf( &sfnt, sfnt_size, &dest_offset, buf, s, memory ) + +#define WRITE_SFNT_BUF_AT( offset, buf, s ) \ + write_buf( &sfnt, sfnt_size, &offset, buf, s, memory ) + +#define N_CONTOUR_STREAM 0 +#define N_POINTS_STREAM 1 +#define FLAG_STREAM 2 +#define GLYPH_STREAM 3 +#define COMPOSITE_STREAM 4 +#define BBOX_STREAM 5 +#define INSTRUCTION_STREAM 6 + + + static void + stream_close( FT_Stream stream ) + { + FT_Memory memory = stream->memory; + + + FT_FREE( stream->base ); + + stream->size = 0; + stream->base = NULL; + stream->close = NULL; + } + + + FT_CALLBACK_DEF( int ) + compare_tags( const void* a, + const void* b ) + { + WOFF2_Table table1 = *(WOFF2_Table*)a; + WOFF2_Table table2 = *(WOFF2_Table*)b; + + FT_ULong tag1 = table1->Tag; + FT_ULong tag2 = table2->Tag; + + + if ( tag1 > tag2 ) + return 1; + else if ( tag1 < tag2 ) + return -1; + else + return 0; + } + + + static FT_Error + Read255UShort( FT_Stream stream, + FT_UShort* value ) + { + const FT_Byte oneMoreByteCode1 = 255; + const FT_Byte oneMoreByteCode2 = 254; + const FT_Byte wordCode = 253; + const FT_UShort lowestUCode = 253; + + FT_Error error = FT_Err_Ok; + FT_Byte code; + FT_Byte result_byte = 0; + FT_UShort result_short = 0; + + + if ( FT_READ_BYTE( code ) ) + return error; + if ( code == wordCode ) + { + /* Read next two bytes and store `FT_UShort' value. */ + if ( FT_READ_USHORT( result_short ) ) + return error; + *value = result_short; + return FT_Err_Ok; + } + else if ( code == oneMoreByteCode1 ) + { + if ( FT_READ_BYTE( result_byte ) ) + return error; + *value = result_byte + lowestUCode; + return FT_Err_Ok; + } + else if ( code == oneMoreByteCode2 ) + { + if ( FT_READ_BYTE( result_byte ) ) + return error; + *value = result_byte + lowestUCode * 2; + return FT_Err_Ok; + } + else + { + *value = code; + return FT_Err_Ok; + } + } + + + static FT_Error + ReadBase128( FT_Stream stream, + FT_ULong* value ) + { + FT_ULong result = 0; + FT_Int i; + FT_Byte code; + FT_Error error = FT_Err_Ok; + + + for ( i = 0; i < 5; ++i ) + { + code = 0; + if ( FT_READ_BYTE( code ) ) + return error; + + /* Leading zeros are invalid. */ + if ( i == 0 && code == 0x80 ) + return FT_THROW( Invalid_Table ); + + /* If any of top seven bits are set then we're about to overflow. */ + if ( result & 0xfe000000 ) + return FT_THROW( Invalid_Table ); + + result = ( result << 7 ) | ( code & 0x7f ); + + /* Spin until most significant bit of data byte is false. */ + if ( ( code & 0x80 ) == 0 ) + { + *value = result; + return FT_Err_Ok; + } + } + + /* Make sure not to exceed the size bound. */ + return FT_THROW( Invalid_Table ); + } + + + /* Extend memory of `dst_bytes' buffer and copy data from `src'. */ + static FT_Error + write_buf( FT_Byte** dst_bytes, + FT_ULong* dst_size, + FT_ULong* offset, + FT_Byte* src, + FT_ULong size, + FT_Memory memory ) + { + FT_Error error = FT_Err_Ok; + /* We are reallocating memory for `dst', so its pointer may change. */ + FT_Byte* dst = *dst_bytes; + + + /* Check whether we are within limits. */ + if ( ( *offset + size ) > WOFF2_DEFAULT_MAX_SIZE ) + return FT_THROW( Array_Too_Large ); + + /* Reallocate `dst'. */ + if ( ( *offset + size ) > *dst_size ) + { + FT_TRACE6(( "Reallocating %lu to %lu.\n", + *dst_size, (*offset + size) )); + if ( FT_REALLOC( dst, + (FT_ULong)( *dst_size ), + (FT_ULong)( *offset + size ) ) ) + goto Exit; + + *dst_size = *offset + size; + } + + /* Copy data. */ + ft_memcpy( dst + *offset, src, size ); + + *offset += size; + /* Set pointer of `dst' to its correct value. */ + *dst_bytes = dst; + + Exit: + return error; + } + + + /* Pad buffer to closest multiple of 4. */ + static FT_Error + pad4( FT_Byte** sfnt_bytes, + FT_ULong* sfnt_size, + FT_ULong* out_offset, + FT_Memory memory ) + { + FT_Byte* sfnt = *sfnt_bytes; + FT_ULong dest_offset = *out_offset; + + FT_Byte zeroes[] = { 0, 0, 0 }; + FT_ULong pad_bytes; + + + if ( dest_offset + 3 < dest_offset ) + return FT_THROW( Invalid_Table ); + + pad_bytes = ROUND4( dest_offset ) - dest_offset; + if ( pad_bytes > 0 ) + { + if ( WRITE_SFNT_BUF( &zeroes[0], pad_bytes ) ) + return FT_THROW( Invalid_Table ); + } + + *sfnt_bytes = sfnt; + *out_offset = dest_offset; + return FT_Err_Ok; + } + + + /* Calculate table checksum of `buf'. */ + static FT_ULong + compute_ULong_sum( FT_Byte* buf, + FT_ULong size ) + { + FT_ULong checksum = 0; + FT_ULong aligned_size = size & ~3UL; + FT_ULong i; + FT_ULong v; + + + for ( i = 0; i < aligned_size; i += 4 ) + checksum += ( (FT_ULong)buf[i ] << 24 ) | + ( (FT_ULong)buf[i + 1] << 16 ) | + ( (FT_ULong)buf[i + 2] << 8 ) | + ( (FT_ULong)buf[i + 3] << 0 ); + + /* If size is not aligned to 4, treat as if it is padded with 0s. */ + if ( size != aligned_size ) + { + v = 0; + for ( i = aligned_size ; i < size; ++i ) + v |= (FT_ULong)buf[i] << ( 24 - 8 * ( i & 3 ) ); + checksum += v; + } + + return checksum; + } + + + static FT_Error + woff2_decompress( FT_Byte* dst, + FT_ULong dst_size, + const FT_Byte* src, + FT_ULong src_size ) + { +#ifdef FT_CONFIG_OPTION_USE_BROTLI + + /* this cast is only of importance on 32bit systems; */ + /* we don't validate it */ + FT_Offset uncompressed_size = (FT_Offset)dst_size; + BrotliDecoderResult result; + + + result = BrotliDecoderDecompress( src_size, + src, + &uncompressed_size, + dst ); + + if ( result != BROTLI_DECODER_RESULT_SUCCESS || + uncompressed_size != dst_size ) + { + FT_ERROR(( "woff2_decompress: Stream length mismatch.\n" )); + return FT_THROW( Invalid_Table ); + } + + FT_TRACE2(( "woff2_decompress: Brotli stream decompressed.\n" )); + return FT_Err_Ok; + +#else /* !FT_CONFIG_OPTION_USE_BROTLI */ + + FT_ERROR(( "woff2_decompress: Brotli support not available.\n" )); + return FT_THROW( Unimplemented_Feature ); + +#endif /* !FT_CONFIG_OPTION_USE_BROTLI */ + } + + + static WOFF2_Table + find_table( WOFF2_Table* tables, + FT_UShort num_tables, + FT_ULong tag ) + { + FT_Int i; + + + for ( i = 0; i < num_tables; i++ ) + { + if ( tables[i]->Tag == tag ) + return tables[i]; + } + return NULL; + } + + + /* Read `numberOfHMetrics' field from `hhea' table. */ + static FT_Error + read_num_hmetrics( FT_Stream stream, + FT_UShort* num_hmetrics ) + { + FT_Error error = FT_Err_Ok; + FT_UShort num_metrics; + + + if ( FT_STREAM_SKIP( 34 ) ) + return FT_THROW( Invalid_Table ); + + if ( FT_READ_USHORT( num_metrics ) ) + return FT_THROW( Invalid_Table ); + + *num_hmetrics = num_metrics; + + return error; + } + + + /* An auxiliary function for overflow-safe addition. */ + static FT_Int + with_sign( FT_Byte flag, + FT_Int base_val ) + { + /* Precondition: 0 <= base_val < 65536 (to avoid overflow). */ + return ( flag & 1 ) ? base_val : -base_val; + } + + + /* An auxiliary function for overflow-safe addition. */ + static FT_Int + safe_int_addition( FT_Int a, + FT_Int b, + FT_Int* result ) + { + if ( ( ( a > 0 ) && ( b > FT_INT_MAX - a ) ) || + ( ( a < 0 ) && ( b < FT_INT_MIN - a ) ) ) + return FT_THROW( Invalid_Table ); + + *result = a + b; + return FT_Err_Ok; + } + + + /* + * Decode variable-length (flag, xCoordinate, yCoordinate) triplet for a + * simple glyph. See + * + * https://www.w3.org/TR/WOFF2/#triplet_decoding + */ + static FT_Error + triplet_decode( const FT_Byte* flags_in, + const FT_Byte* in, + FT_ULong in_size, + FT_ULong n_points, + WOFF2_Point result, + FT_ULong* in_bytes_used ) + { + FT_Int x = 0; + FT_Int y = 0; + FT_Int dx; + FT_Int dy; + FT_Int b0, b1, b2; + + FT_ULong triplet_index = 0; + FT_ULong data_bytes; + + FT_UInt i; + + + if ( n_points > in_size ) + return FT_THROW( Invalid_Table ); + + for ( i = 0; i < n_points; ++i ) + { + FT_Byte flag = flags_in[i]; + FT_Bool on_curve = !( flag >> 7 ); + + + flag &= 0x7f; + if ( flag < 84 ) + data_bytes = 1; + else if ( flag < 120 ) + data_bytes = 2; + else if ( flag < 124 ) + data_bytes = 3; + else + data_bytes = 4; + + /* Overflow checks */ + if ( triplet_index + data_bytes > in_size || + triplet_index + data_bytes < triplet_index ) + return FT_THROW( Invalid_Table ); + + if ( flag < 10 ) + { + dx = 0; + dy = with_sign( flag, + ( ( flag & 14 ) << 7 ) + in[triplet_index] ); + } + else if ( flag < 20 ) + { + dx = with_sign( flag, + ( ( ( flag - 10 ) & 14 ) << 7 ) + + in[triplet_index] ); + dy = 0; + } + else if ( flag < 84 ) + { + b0 = flag - 20; + b1 = in[triplet_index]; + dx = with_sign( flag, + 1 + ( b0 & 0x30 ) + ( b1 >> 4 ) ); + dy = with_sign( flag >> 1, + 1 + ( ( b0 & 0x0c ) << 2 ) + ( b1 & 0x0f ) ); + } + else if ( flag < 120 ) + { + b0 = flag - 84; + dx = with_sign( flag, + 1 + ( ( b0 / 12 ) << 8 ) + in[triplet_index] ); + dy = with_sign( flag >> 1, + 1 + ( ( ( b0 % 12 ) >> 2 ) << 8 ) + + in[triplet_index + 1] ); + } + else if ( flag < 124 ) + { + b2 = in[triplet_index + 1]; + dx = with_sign( flag, + ( in[triplet_index] << 4 ) + ( b2 >> 4 ) ); + dy = with_sign( flag >> 1, + ( ( b2 & 0x0f ) << 8 ) + in[triplet_index + 2] ); + } + else + { + dx = with_sign( flag, + ( in[triplet_index] << 8 ) + + in[triplet_index + 1] ); + dy = with_sign( flag >> 1, + ( in[triplet_index + 2] << 8 ) + + in[triplet_index + 3] ); + } + + triplet_index += data_bytes; + + if ( safe_int_addition( x, dx, &x ) ) + return FT_THROW( Invalid_Table ); + + if ( safe_int_addition( y, dy, &y ) ) + return FT_THROW( Invalid_Table ); + + result[i].x = x; + result[i].y = y; + result[i].on_curve = on_curve; + } + + *in_bytes_used = triplet_index; + return FT_Err_Ok; + } + + + /* Store decoded points in glyph buffer. */ + static FT_Error + store_points( FT_ULong n_points, + const WOFF2_Point points, + FT_UShort n_contours, + FT_UShort instruction_len, + FT_Byte* dst, + FT_ULong dst_size, + FT_ULong* glyph_size ) + { + FT_UInt flag_offset = 10 + ( 2 * n_contours ) + 2 + instruction_len; + FT_Byte last_flag = 0xFFU; + FT_Byte repeat_count = 0; + FT_Int last_x = 0; + FT_Int last_y = 0; + FT_UInt x_bytes = 0; + FT_UInt y_bytes = 0; + FT_UInt xy_bytes; + FT_UInt i; + FT_UInt x_offset; + FT_UInt y_offset; + FT_Byte* pointer; + + + for ( i = 0; i < n_points; ++i ) + { + const WOFF2_PointRec point = points[i]; + + FT_Byte flag = point.on_curve ? GLYF_ON_CURVE : 0; + FT_Int dx = point.x - last_x; + FT_Int dy = point.y - last_y; + + + if ( dx == 0 ) + flag |= GLYF_THIS_X_IS_SAME; + else if ( dx > -256 && dx < 256 ) + { + flag |= GLYF_X_SHORT | ( dx > 0 ? GLYF_THIS_X_IS_SAME : 0 ); + x_bytes += 1; + } + else + x_bytes += 2; + + if ( dy == 0 ) + flag |= GLYF_THIS_Y_IS_SAME; + else if ( dy > -256 && dy < 256 ) + { + flag |= GLYF_Y_SHORT | ( dy > 0 ? GLYF_THIS_Y_IS_SAME : 0 ); + y_bytes += 1; + } + else + y_bytes += 2; + + if ( flag == last_flag && repeat_count != 255 ) + { + dst[flag_offset - 1] |= GLYF_REPEAT; + repeat_count++; + } + else + { + if ( repeat_count != 0 ) + { + if ( flag_offset >= dst_size ) + return FT_THROW( Invalid_Table ); + + dst[flag_offset++] = repeat_count; + } + if ( flag_offset >= dst_size ) + return FT_THROW( Invalid_Table ); + + dst[flag_offset++] = flag; + repeat_count = 0; + } + + last_x = point.x; + last_y = point.y; + last_flag = flag; + } + + if ( repeat_count != 0 ) + { + if ( flag_offset >= dst_size ) + return FT_THROW( Invalid_Table ); + + dst[flag_offset++] = repeat_count; + } + + xy_bytes = x_bytes + y_bytes; + if ( xy_bytes < x_bytes || + flag_offset + xy_bytes < flag_offset || + flag_offset + xy_bytes > dst_size ) + return FT_THROW( Invalid_Table ); + + x_offset = flag_offset; + y_offset = flag_offset + x_bytes; + last_x = 0; + last_y = 0; + + for ( i = 0; i < n_points; ++i ) + { + FT_Int dx = points[i].x - last_x; + FT_Int dy = points[i].y - last_y; + + + if ( dx == 0 ) + ; + else if ( dx > -256 && dx < 256 ) + dst[x_offset++] = (FT_Byte)FT_ABS( dx ); + else + { + pointer = dst + x_offset; + WRITE_SHORT( pointer, dx ); + x_offset += 2; + } + + last_x += dx; + + if ( dy == 0 ) + ; + else if ( dy > -256 && dy < 256 ) + dst[y_offset++] = (FT_Byte)FT_ABS( dy ); + else + { + pointer = dst + y_offset; + WRITE_SHORT( pointer, dy ); + y_offset += 2; + } + + last_y += dy; + } + + *glyph_size = y_offset; + return FT_Err_Ok; + } + + + static void + compute_bbox( FT_ULong n_points, + const WOFF2_Point points, + FT_Byte* dst, + FT_UShort* src_x_min ) + { + FT_Int x_min = 0; + FT_Int y_min = 0; + FT_Int x_max = 0; + FT_Int y_max = 0; + + FT_UInt i; + + FT_ULong offset; + FT_Byte* pointer; + + + if ( n_points > 0 ) + { + x_min = points[0].x; + y_min = points[0].y; + x_max = points[0].x; + y_max = points[0].y; + } + + for ( i = 1; i < n_points; ++i ) + { + FT_Int x = points[i].x; + FT_Int y = points[i].y; + + + x_min = FT_MIN( x, x_min ); + y_min = FT_MIN( y, y_min ); + x_max = FT_MAX( x, x_max ); + y_max = FT_MAX( y, y_max ); + } + + /* Write values to `glyf' record. */ + offset = 2; + pointer = dst + offset; + + WRITE_SHORT( pointer, x_min ); + WRITE_SHORT( pointer, y_min ); + WRITE_SHORT( pointer, x_max ); + WRITE_SHORT( pointer, y_max ); + + *src_x_min = (FT_UShort)x_min; + } + + + static FT_Error + compositeGlyph_size( FT_Stream stream, + FT_ULong offset, + FT_ULong* size, + FT_Bool* have_instructions ) + { + FT_Error error = FT_Err_Ok; + FT_ULong start_offset = offset; + FT_Bool we_have_inst = FALSE; + FT_UShort flags = FLAG_MORE_COMPONENTS; + + + if ( FT_STREAM_SEEK( start_offset ) ) + goto Exit; + while ( flags & FLAG_MORE_COMPONENTS ) + { + FT_ULong arg_size; + + + if ( FT_READ_USHORT( flags ) ) + goto Exit; + we_have_inst |= ( flags & FLAG_WE_HAVE_INSTRUCTIONS ) != 0; + /* glyph index */ + arg_size = 2; + if ( flags & FLAG_ARG_1_AND_2_ARE_WORDS ) + arg_size += 4; + else + arg_size += 2; + + if ( flags & FLAG_WE_HAVE_A_SCALE ) + arg_size += 2; + else if ( flags & FLAG_WE_HAVE_AN_X_AND_Y_SCALE ) + arg_size += 4; + else if ( flags & FLAG_WE_HAVE_A_TWO_BY_TWO ) + arg_size += 8; + + if ( FT_STREAM_SKIP( arg_size ) ) + goto Exit; + } + + *size = FT_STREAM_POS() - start_offset; + *have_instructions = we_have_inst; + + Exit: + return error; + } + + + /* Store loca values (provided by `reconstruct_glyf') to output stream. */ + static FT_Error + store_loca( FT_ULong* loca_values, + FT_ULong loca_values_size, + FT_UShort index_format, + FT_ULong* checksum, + FT_Byte** sfnt_bytes, + FT_ULong* sfnt_size, + FT_ULong* out_offset, + FT_Memory memory ) + { + FT_Error error = FT_Err_Ok; + FT_Byte* sfnt = *sfnt_bytes; + FT_ULong dest_offset = *out_offset; + + FT_Byte* loca_buf = NULL; + FT_Byte* dst = NULL; + + FT_UInt i = 0; + FT_ULong loca_buf_size; + + const FT_ULong offset_size = index_format ? 4 : 2; + + + if ( ( loca_values_size << 2 ) >> 2 != loca_values_size ) + goto Fail; + + loca_buf_size = loca_values_size * offset_size; + if ( FT_NEW_ARRAY( loca_buf, loca_buf_size ) ) + goto Fail; + + dst = loca_buf; + for ( i = 0; i < loca_values_size; i++ ) + { + FT_ULong value = loca_values[i]; + + + if ( index_format ) + WRITE_ULONG( dst, value ); + else + WRITE_USHORT( dst, ( value >> 1 ) ); + } + + *checksum = compute_ULong_sum( loca_buf, loca_buf_size ); + /* Write `loca' table to sfnt buffer. */ + if ( WRITE_SFNT_BUF( loca_buf, loca_buf_size ) ) + goto Fail; + + /* Set pointer `sfnt_bytes' to its correct value. */ + *sfnt_bytes = sfnt; + *out_offset = dest_offset; + + FT_FREE( loca_buf ); + return error; + + Fail: + if ( !error ) + error = FT_THROW( Invalid_Table ); + + FT_FREE( loca_buf ); + + return error; + } + + + static FT_Error + reconstruct_glyf( FT_Stream stream, + FT_ULong* glyf_checksum, + FT_ULong* loca_checksum, + FT_Byte** sfnt_bytes, + FT_ULong* sfnt_size, + FT_ULong* out_offset, + WOFF2_Info info, + FT_Memory memory ) + { + FT_Error error = FT_Err_Ok; + FT_Byte* sfnt = *sfnt_bytes; + + /* current position in stream */ + const FT_ULong pos = FT_STREAM_POS(); + + FT_UInt num_substreams = 7; + + FT_UShort num_glyphs; + FT_UShort index_format; + FT_ULong expected_loca_length; + FT_UInt offset; + FT_UInt i; + FT_ULong points_size; + FT_ULong bitmap_length; + FT_ULong glyph_buf_size; + FT_ULong bbox_bitmap_offset; + + const FT_ULong glyf_start = *out_offset; + FT_ULong dest_offset = *out_offset; + + WOFF2_Substream substreams = NULL; + + FT_ULong* loca_values = NULL; + FT_UShort* n_points_arr = NULL; + FT_Byte* glyph_buf = NULL; + WOFF2_Point points = NULL; + + + if ( FT_NEW_ARRAY( substreams, num_substreams ) ) + goto Fail; + + if ( FT_STREAM_SKIP( 4 ) ) + goto Fail; + if ( FT_READ_USHORT( num_glyphs ) ) + goto Fail; + if ( FT_READ_USHORT( index_format ) ) + goto Fail; + + FT_TRACE4(( "num_glyphs = %u; index_format = %u\n", + num_glyphs, index_format )); + + info->num_glyphs = num_glyphs; + + /* Calculate expected length of loca and compare. */ + /* See https://www.w3.org/TR/WOFF2/#conform-mustRejectLoca */ + /* index_format = 0 => Short version `loca'. */ + /* index_format = 1 => Long version `loca'. */ + expected_loca_length = ( index_format ? 4 : 2 ) * + ( (FT_ULong)num_glyphs + 1 ); + if ( info->loca_table->dst_length != expected_loca_length ) + goto Fail; + + offset = ( 2 + num_substreams ) * 4; + if ( offset > info->glyf_table->TransformLength ) + goto Fail; + + for ( i = 0; i < num_substreams; ++i ) + { + FT_ULong substream_size; + + + if ( FT_READ_ULONG( substream_size ) ) + goto Fail; + if ( substream_size > info->glyf_table->TransformLength - offset ) + goto Fail; + + substreams[i].start = pos + offset; + substreams[i].offset = pos + offset; + substreams[i].size = substream_size; + + FT_TRACE5(( " Substream %d: offset = %lu; size = %lu;\n", + i, substreams[i].offset, substreams[i].size )); + offset += substream_size; + } + + if ( FT_NEW_ARRAY( loca_values, num_glyphs + 1 ) ) + goto Fail; + + points_size = 0; + bbox_bitmap_offset = substreams[BBOX_STREAM].offset; + + /* Size of bboxBitmap = 4 * floor((numGlyphs + 31) / 32) */ + bitmap_length = ( ( num_glyphs + 31U ) >> 5 ) << 2; + substreams[BBOX_STREAM].offset += bitmap_length; + + glyph_buf_size = WOFF2_DEFAULT_GLYPH_BUF; + if ( FT_NEW_ARRAY( glyph_buf, glyph_buf_size ) ) + goto Fail; + + if ( FT_NEW_ARRAY( info->x_mins, num_glyphs ) ) + goto Fail; + + for ( i = 0; i < num_glyphs; ++i ) + { + FT_ULong glyph_size = 0; + FT_UShort n_contours = 0; + FT_Bool have_bbox = FALSE; + FT_Byte bbox_bitmap; + FT_ULong bbox_offset; + FT_UShort x_min = 0; + + + /* Set `have_bbox'. */ + bbox_offset = bbox_bitmap_offset + ( i >> 3 ); + if ( FT_STREAM_SEEK( bbox_offset ) || + FT_READ_BYTE( bbox_bitmap ) ) + goto Fail; + if ( bbox_bitmap & ( 0x80 >> ( i & 7 ) ) ) + have_bbox = TRUE; + + /* Read value from `nContourStream'. */ + if ( FT_STREAM_SEEK( substreams[N_CONTOUR_STREAM].offset ) || + FT_READ_USHORT( n_contours ) ) + goto Fail; + substreams[N_CONTOUR_STREAM].offset += 2; + + if ( n_contours == 0xffff ) + { + /* composite glyph */ + FT_Bool have_instructions = FALSE; + FT_UShort instruction_size = 0; + FT_ULong composite_size; + FT_ULong size_needed; + FT_Byte* pointer = NULL; + + + /* Composite glyphs must have explicit bbox. */ + if ( !have_bbox ) + goto Fail; + + if ( compositeGlyph_size( stream, + substreams[COMPOSITE_STREAM].offset, + &composite_size, + &have_instructions) ) + goto Fail; + + if ( have_instructions ) + { + if ( FT_STREAM_SEEK( substreams[GLYPH_STREAM].offset ) || + READ_255USHORT( instruction_size ) ) + goto Fail; + substreams[GLYPH_STREAM].offset = FT_STREAM_POS(); + } + + size_needed = 12 + composite_size + instruction_size; + if ( glyph_buf_size < size_needed ) + { + if ( FT_RENEW_ARRAY( glyph_buf, glyph_buf_size, size_needed ) ) + goto Fail; + glyph_buf_size = size_needed; + } + + pointer = glyph_buf + glyph_size; + WRITE_USHORT( pointer, n_contours ); + glyph_size += 2; + + /* Read x_min for current glyph. */ + if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) || + FT_READ_USHORT( x_min ) ) + goto Fail; + /* No increment here because we read again. */ + + if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) || + FT_STREAM_READ( glyph_buf + glyph_size, 8 ) ) + goto Fail; + + substreams[BBOX_STREAM].offset += 8; + glyph_size += 8; + + if ( FT_STREAM_SEEK( substreams[COMPOSITE_STREAM].offset ) || + FT_STREAM_READ( glyph_buf + glyph_size, composite_size ) ) + goto Fail; + + substreams[COMPOSITE_STREAM].offset += composite_size; + glyph_size += composite_size; + + if ( have_instructions ) + { + pointer = glyph_buf + glyph_size; + WRITE_USHORT( pointer, instruction_size ); + glyph_size += 2; + + if ( FT_STREAM_SEEK( substreams[INSTRUCTION_STREAM].offset ) || + FT_STREAM_READ( glyph_buf + glyph_size, instruction_size ) ) + goto Fail; + + substreams[INSTRUCTION_STREAM].offset += instruction_size; + glyph_size += instruction_size; + } + } + else if ( n_contours > 0 ) + { + /* simple glyph */ + FT_ULong total_n_points = 0; + FT_UShort n_points_contour; + FT_UInt j; + FT_ULong flag_size; + FT_ULong triplet_size; + FT_ULong triplet_bytes_used; + FT_Byte* flags_buf = NULL; + FT_Byte* triplet_buf = NULL; + FT_UShort instruction_size; + FT_ULong size_needed; + FT_Int end_point; + FT_UInt contour_ix; + + FT_Byte* pointer = NULL; + + + if ( FT_NEW_ARRAY( n_points_arr, n_contours ) ) + goto Fail; + + if ( FT_STREAM_SEEK( substreams[N_POINTS_STREAM].offset ) ) + goto Fail; + + for ( j = 0; j < n_contours; ++j ) + { + if ( READ_255USHORT( n_points_contour ) ) + goto Fail; + n_points_arr[j] = n_points_contour; + /* Prevent negative/overflow. */ + if ( total_n_points + n_points_contour < total_n_points ) + goto Fail; + total_n_points += n_points_contour; + } + substreams[N_POINTS_STREAM].offset = FT_STREAM_POS(); + + flag_size = total_n_points; + if ( flag_size > substreams[FLAG_STREAM].size ) + goto Fail; + + flags_buf = stream->base + substreams[FLAG_STREAM].offset; + triplet_buf = stream->base + substreams[GLYPH_STREAM].offset; + + if ( substreams[GLYPH_STREAM].size < + ( substreams[GLYPH_STREAM].offset - + substreams[GLYPH_STREAM].start ) ) + goto Fail; + + triplet_size = substreams[GLYPH_STREAM].size - + ( substreams[GLYPH_STREAM].offset - + substreams[GLYPH_STREAM].start ); + triplet_bytes_used = 0; + + /* Create array to store point information. */ + points_size = total_n_points; + if ( FT_NEW_ARRAY( points, points_size ) ) + goto Fail; + + if ( triplet_decode( flags_buf, + triplet_buf, + triplet_size, + total_n_points, + points, + &triplet_bytes_used ) ) + goto Fail; + + substreams[FLAG_STREAM].offset += flag_size; + substreams[GLYPH_STREAM].offset += triplet_bytes_used; + + if ( FT_STREAM_SEEK( substreams[GLYPH_STREAM].offset ) || + READ_255USHORT( instruction_size ) ) + goto Fail; + + substreams[GLYPH_STREAM].offset = FT_STREAM_POS(); + + if ( total_n_points >= ( 1 << 27 ) ) + goto Fail; + + size_needed = 12 + + ( 2 * n_contours ) + + ( 5 * total_n_points ) + + instruction_size; + if ( glyph_buf_size < size_needed ) + { + if ( FT_RENEW_ARRAY( glyph_buf, glyph_buf_size, size_needed ) ) + goto Fail; + glyph_buf_size = size_needed; + } + + pointer = glyph_buf + glyph_size; + WRITE_USHORT( pointer, n_contours ); + glyph_size += 2; + + if ( have_bbox ) + { + /* Read x_min for current glyph. */ + if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) || + FT_READ_USHORT( x_min ) ) + goto Fail; + /* No increment here because we read again. */ + + if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) || + FT_STREAM_READ( glyph_buf + glyph_size, 8 ) ) + goto Fail; + substreams[BBOX_STREAM].offset += 8; + } + else + compute_bbox( total_n_points, points, glyph_buf, &x_min ); + + glyph_size = CONTOUR_OFFSET_END_POINT; + + pointer = glyph_buf + glyph_size; + end_point = -1; + + for ( contour_ix = 0; contour_ix < n_contours; ++contour_ix ) + { + end_point += n_points_arr[contour_ix]; + if ( end_point >= 65536 ) + goto Fail; + + WRITE_SHORT( pointer, end_point ); + glyph_size += 2; + } + + WRITE_USHORT( pointer, instruction_size ); + glyph_size += 2; + + if ( FT_STREAM_SEEK( substreams[INSTRUCTION_STREAM].offset ) || + FT_STREAM_READ( glyph_buf + glyph_size, instruction_size ) ) + goto Fail; + + substreams[INSTRUCTION_STREAM].offset += instruction_size; + glyph_size += instruction_size; + + if ( store_points( total_n_points, + points, + n_contours, + instruction_size, + glyph_buf, + glyph_buf_size, + &glyph_size ) ) + goto Fail; + + FT_FREE( points ); + FT_FREE( n_points_arr ); + } + else + { + /* Empty glyph. */ + /* Must not have a bbox. */ + if ( have_bbox ) + { + FT_ERROR(( "Empty glyph has a bbox.\n" )); + goto Fail; + } + } + + loca_values[i] = dest_offset - glyf_start; + + if ( WRITE_SFNT_BUF( glyph_buf, glyph_size ) ) + goto Fail; + + if ( pad4( &sfnt, sfnt_size, &dest_offset, memory ) ) + goto Fail; + + *glyf_checksum += compute_ULong_sum( glyph_buf, glyph_size ); + + /* Store x_mins, may be required to reconstruct `hmtx'. */ + if ( n_contours > 0 ) + info->x_mins[i] = (FT_Short)x_min; + } + + info->glyf_table->dst_length = dest_offset - info->glyf_table->dst_offset; + info->loca_table->dst_offset = dest_offset; + + /* `loca[n]' will be equal to the length of the `glyf' table. */ + loca_values[num_glyphs] = info->glyf_table->dst_length; + + if ( store_loca( loca_values, + num_glyphs + 1, + index_format, + loca_checksum, + &sfnt, + sfnt_size, + &dest_offset, + memory ) ) + goto Fail; + + info->loca_table->dst_length = dest_offset - info->loca_table->dst_offset; + + FT_TRACE4(( " loca table info:\n" )); + FT_TRACE4(( " dst_offset = %lu\n", info->loca_table->dst_offset )); + FT_TRACE4(( " dst_length = %lu\n", info->loca_table->dst_length )); + FT_TRACE4(( " checksum = %09lx\n", *loca_checksum )); + + /* Set pointer `sfnt_bytes' to its correct value. */ + *sfnt_bytes = sfnt; + *out_offset = dest_offset; + + FT_FREE( substreams ); + FT_FREE( loca_values ); + FT_FREE( n_points_arr ); + FT_FREE( glyph_buf ); + FT_FREE( points ); + + return error; + + Fail: + if ( !error ) + error = FT_THROW( Invalid_Table ); + + /* Set pointer `sfnt_bytes' to its correct value. */ + *sfnt_bytes = sfnt; + + FT_FREE( substreams ); + FT_FREE( loca_values ); + FT_FREE( n_points_arr ); + FT_FREE( glyph_buf ); + FT_FREE( points ); + + return error; + } + + + /* Get `x_mins' for untransformed `glyf' table. */ + static FT_Error + get_x_mins( FT_Stream stream, + WOFF2_Table* tables, + FT_UShort num_tables, + WOFF2_Info info, + FT_Memory memory ) + { + FT_UShort num_glyphs; + FT_UShort index_format; + FT_ULong glyf_offset; + FT_UShort glyf_offset_short; + FT_ULong loca_offset; + FT_Int i; + FT_Error error = FT_Err_Ok; + FT_ULong offset_size; + + /* At this point of time those tables might not have been read yet. */ + const WOFF2_Table maxp_table = find_table( tables, num_tables, + TTAG_maxp ); + const WOFF2_Table head_table = find_table( tables, num_tables, + TTAG_head ); + + + if ( !maxp_table ) + { + FT_ERROR(( "`maxp' table is missing.\n" )); + return FT_THROW( Invalid_Table ); + } + + if ( !head_table ) + { + FT_ERROR(( "`head' table is missing.\n" )); + return FT_THROW( Invalid_Table ); + } + + if ( !info->loca_table ) + { + FT_ERROR(( "`loca' table is missing.\n" )); + return FT_THROW( Invalid_Table ); + } + + /* Read `numGlyphs' field from `maxp' table. */ + if ( FT_STREAM_SEEK( maxp_table->src_offset ) || FT_STREAM_SKIP( 8 ) ) + return error; + + if ( FT_READ_USHORT( num_glyphs ) ) + return error; + + info->num_glyphs = num_glyphs; + + /* Read `indexToLocFormat' field from `head' table. */ + if ( FT_STREAM_SEEK( head_table->src_offset ) || + FT_STREAM_SKIP( 50 ) ) + return error; + + if ( FT_READ_USHORT( index_format ) ) + return error; + + offset_size = index_format ? 4 : 2; + + /* Create `x_mins' array. */ + if ( FT_NEW_ARRAY( info->x_mins, num_glyphs ) ) + return error; + + loca_offset = info->loca_table->src_offset; + + for ( i = 0; i < num_glyphs; ++i ) + { + if ( FT_STREAM_SEEK( loca_offset ) ) + return error; + + loca_offset += offset_size; + + if ( index_format ) + { + if ( FT_READ_ULONG( glyf_offset ) ) + return error; + } + else + { + if ( FT_READ_USHORT( glyf_offset_short ) ) + return error; + + glyf_offset = (FT_ULong)( glyf_offset_short ); + glyf_offset = glyf_offset << 1; + } + + glyf_offset += info->glyf_table->src_offset; + + if ( FT_STREAM_SEEK( glyf_offset ) || FT_STREAM_SKIP( 2 ) ) + return error; + + if ( FT_READ_SHORT( info->x_mins[i] ) ) + return error; + } + + return error; + } + + + static FT_Error + reconstruct_hmtx( FT_Stream stream, + FT_UShort num_glyphs, + FT_UShort num_hmetrics, + FT_Short* x_mins, + FT_ULong* checksum, + FT_Byte** sfnt_bytes, + FT_ULong* sfnt_size, + FT_ULong* out_offset, + FT_Memory memory ) + { + FT_Error error = FT_Err_Ok; + FT_Byte* sfnt = *sfnt_bytes; + FT_ULong dest_offset = *out_offset; + + FT_Byte hmtx_flags; + FT_Bool has_proportional_lsbs, has_monospace_lsbs; + FT_ULong hmtx_table_size; + FT_Int i; + + FT_UShort* advance_widths = NULL; + FT_Short* lsbs = NULL; + FT_Byte* hmtx_table = NULL; + FT_Byte* dst = NULL; + + + if ( FT_READ_BYTE( hmtx_flags ) ) + goto Fail; + + has_proportional_lsbs = ( hmtx_flags & 1 ) == 0; + has_monospace_lsbs = ( hmtx_flags & 2 ) == 0; + + /* Bits 2-7 are reserved and MUST be zero. */ + if ( ( hmtx_flags & 0xFC ) != 0 ) + goto Fail; + + /* Are you REALLY transformed? */ + if ( has_proportional_lsbs && has_monospace_lsbs ) + goto Fail; + + /* Cannot have a transformed `hmtx' without `glyf'. */ + if ( ( num_hmetrics > num_glyphs ) || + ( num_hmetrics < 1 ) ) + goto Fail; + + /* Must have at least one entry. */ + if ( num_hmetrics < 1 ) + goto Fail; + + if ( FT_NEW_ARRAY( advance_widths, num_hmetrics ) || + FT_NEW_ARRAY( lsbs, num_glyphs ) ) + goto Fail; + + /* Read `advanceWidth' stream. Always present. */ + for ( i = 0; i < num_hmetrics; i++ ) + { + FT_UShort advance_width; + + + if ( FT_READ_USHORT( advance_width ) ) + goto Fail; + + advance_widths[i] = advance_width; + } + + /* lsb values for proportional glyphs. */ + for ( i = 0; i < num_hmetrics; i++ ) + { + FT_Short lsb; + + + if ( has_proportional_lsbs ) + { + if ( FT_READ_SHORT( lsb ) ) + goto Fail; + } + else + lsb = x_mins[i]; + + lsbs[i] = lsb; + } + + /* lsb values for monospaced glyphs. */ + for ( i = num_hmetrics; i < num_glyphs; i++ ) + { + FT_Short lsb; + + + if ( has_monospace_lsbs ) + { + if ( FT_READ_SHORT( lsb ) ) + goto Fail; + } + else + lsb = x_mins[i]; + + lsbs[i] = lsb; + } + + /* Build the hmtx table. */ + hmtx_table_size = 2 * num_hmetrics + 2 * num_glyphs; + if ( FT_NEW_ARRAY( hmtx_table, hmtx_table_size ) ) + goto Fail; + + dst = hmtx_table; + FT_TRACE6(( "hmtx values: \n" )); + for ( i = 0; i < num_glyphs; i++ ) + { + if ( i < num_hmetrics ) + { + WRITE_SHORT( dst, advance_widths[i] ); + FT_TRACE6(( "%d ", advance_widths[i] )); + } + + WRITE_SHORT( dst, lsbs[i] ); + FT_TRACE6(( "%d ", lsbs[i] )); + } + FT_TRACE6(( "\n" )); + + *checksum = compute_ULong_sum( hmtx_table, hmtx_table_size ); + /* Write `hmtx' table to sfnt buffer. */ + if ( WRITE_SFNT_BUF( hmtx_table, hmtx_table_size ) ) + goto Fail; + + /* Set pointer `sfnt_bytes' to its correct value. */ + *sfnt_bytes = sfnt; + *out_offset = dest_offset; + + FT_FREE( advance_widths ); + FT_FREE( lsbs ); + FT_FREE( hmtx_table ); + + return error; + + Fail: + FT_FREE( advance_widths ); + FT_FREE( lsbs ); + FT_FREE( hmtx_table ); + + if ( !error ) + error = FT_THROW( Invalid_Table ); + + return error; + } + + + static FT_Error + reconstruct_font( FT_Byte* transformed_buf, + FT_ULong transformed_buf_size, + WOFF2_Table* indices, + WOFF2_Header woff2, + WOFF2_Info info, + FT_Byte** sfnt_bytes, + FT_ULong* sfnt_size, + FT_Memory memory ) + { + /* Memory management of `transformed_buf' is handled by the caller. */ + + FT_Error error = FT_Err_Ok; + FT_Stream stream = NULL; + FT_Byte* buf_cursor = NULL; + FT_Byte* table_entry = NULL; + + /* We are reallocating memory for `sfnt', so its pointer may change. */ + FT_Byte* sfnt = *sfnt_bytes; + + FT_UShort num_tables = woff2->num_tables; + FT_ULong dest_offset = 12 + num_tables * 16UL; + + FT_ULong checksum = 0; + FT_ULong loca_checksum = 0; + FT_Int nn = 0; + FT_UShort num_hmetrics = 0; + FT_ULong font_checksum = info->header_checksum; + FT_Bool is_glyf_xform = FALSE; + + FT_ULong table_entry_offset = 12; + + + /* A few table checks before reconstruction. */ + /* `glyf' must be present with `loca'. */ + info->glyf_table = find_table( indices, num_tables, TTAG_glyf ); + info->loca_table = find_table( indices, num_tables, TTAG_loca ); + + if ( ( info->glyf_table == NULL ) ^ ( info->loca_table == NULL ) ) + { + FT_ERROR(( "One of `glyf'/`loca' tables missing.\n" )); + return FT_THROW( Invalid_Table ); + } + + /* Both `glyf' and `loca' must have same transformation. */ + if ( info->glyf_table != NULL ) + { + if ( ( info->glyf_table->flags & WOFF2_FLAGS_TRANSFORM ) != + ( info->loca_table->flags & WOFF2_FLAGS_TRANSFORM ) ) + { + FT_ERROR(( "Transformation mismatch" + " between `glyf' and `loca' table." )); + return FT_THROW( Invalid_Table ); + } + } + + /* Create buffer for table entries. */ + if ( FT_NEW_ARRAY( table_entry, 16 ) ) + goto Fail; + + /* Create a stream for the uncompressed buffer. */ + if ( FT_NEW( stream ) ) + goto Fail; + FT_Stream_OpenMemory( stream, transformed_buf, transformed_buf_size ); + + FT_ASSERT( FT_STREAM_POS() == 0 ); + + /* Reconstruct/copy tables to output stream. */ + for ( nn = 0; nn < num_tables; nn++ ) + { + WOFF2_TableRec table = *( indices[nn] ); + + + FT_TRACE3(( "Seeking to %ld with table size %ld.\n", + table.src_offset, table.src_length )); + FT_TRACE3(( "Table tag: %c%c%c%c.\n", + (FT_Char)( table.Tag >> 24 ), + (FT_Char)( table.Tag >> 16 ), + (FT_Char)( table.Tag >> 8 ), + (FT_Char)( table.Tag ) )); + + if ( FT_STREAM_SEEK( table.src_offset ) ) + goto Fail; + + if ( table.src_offset + table.src_length > transformed_buf_size ) + goto Fail; + + /* Get stream size for fields of `hmtx' table. */ + if ( table.Tag == TTAG_hhea ) + { + if ( read_num_hmetrics( stream, &num_hmetrics ) ) + goto Fail; + } + + info->num_hmetrics = num_hmetrics; + + checksum = 0; + if ( ( table.flags & WOFF2_FLAGS_TRANSFORM ) != WOFF2_FLAGS_TRANSFORM ) + { + /* Check whether `head' is at least 12 bytes. */ + if ( table.Tag == TTAG_head ) + { + if ( table.src_length < 12 ) + goto Fail; + + buf_cursor = transformed_buf + table.src_offset + 8; + /* Set checkSumAdjustment = 0 */ + WRITE_ULONG( buf_cursor, 0 ); + } + + table.dst_offset = dest_offset; + + checksum = compute_ULong_sum( transformed_buf + table.src_offset, + table.src_length ); + FT_TRACE4(( "Checksum = %09lx.\n", checksum )); + + if ( WRITE_SFNT_BUF( transformed_buf + table.src_offset, + table.src_length ) ) + goto Fail; + } + else + { + FT_TRACE3(( "This table is transformed.\n" )); + + if ( table.Tag == TTAG_glyf ) + { + is_glyf_xform = TRUE; + table.dst_offset = dest_offset; + + if ( reconstruct_glyf( stream, + &checksum, + &loca_checksum, + &sfnt, + sfnt_size, + &dest_offset, + info, + memory ) ) + goto Fail; + + FT_TRACE4(( "Checksum = %09lx.\n", checksum )); + } + + else if ( table.Tag == TTAG_loca ) + checksum = loca_checksum; + + else if ( table.Tag == TTAG_hmtx ) + { + /* If glyf is not transformed and hmtx is, handle separately. */ + if ( !is_glyf_xform ) + { + if ( get_x_mins( stream, indices, num_tables, info, memory ) ) + goto Fail; + } + + table.dst_offset = dest_offset; + + if ( reconstruct_hmtx( stream, + info->num_glyphs, + info->num_hmetrics, + info->x_mins, + &checksum, + &sfnt, + sfnt_size, + &dest_offset, + memory ) ) + goto Fail; + } + else + { + /* Unknown transform. */ + FT_ERROR(( "Unknown table transform.\n" )); + goto Fail; + } + } + + font_checksum += checksum; + + buf_cursor = &table_entry[0]; + WRITE_ULONG( buf_cursor, table.Tag ); + WRITE_ULONG( buf_cursor, checksum ); + WRITE_ULONG( buf_cursor, table.dst_offset ); + WRITE_ULONG( buf_cursor, table.dst_length ); + + WRITE_SFNT_BUF_AT( table_entry_offset, table_entry, 16 ); + + /* Update checksum. */ + font_checksum += compute_ULong_sum( table_entry, 16 ); + + if ( pad4( &sfnt, sfnt_size, &dest_offset, memory ) ) + goto Fail; + + /* Sanity check. */ + if ( (FT_ULong)( table.dst_offset + table.dst_length ) > dest_offset ) + { + FT_ERROR(( "Table was partially written.\n" )); + goto Fail; + } + } + + /* Update `head' checkSumAdjustment. */ + info->head_table = find_table( indices, num_tables, TTAG_head ); + if ( !info->head_table ) + { + FT_ERROR(( "`head' table is missing.\n" )); + goto Fail; + } + + if ( info->head_table->dst_length < 12 ) + goto Fail; + + buf_cursor = sfnt + info->head_table->dst_offset + 8; + font_checksum = 0xB1B0AFBA - font_checksum; + + WRITE_ULONG( buf_cursor, font_checksum ); + + FT_TRACE2(( "Final checksum = %09lx.\n", font_checksum )); + + woff2->actual_sfnt_size = dest_offset; + + /* Set pointer of sfnt stream to its correct value. */ + *sfnt_bytes = sfnt; + + FT_FREE( table_entry ); + FT_Stream_Close( stream ); + FT_FREE( stream ); + + return error; + + Fail: + if ( !error ) + error = FT_THROW( Invalid_Table ); + + /* Set pointer of sfnt stream to its correct value. */ + *sfnt_bytes = sfnt; + + FT_FREE( table_entry ); + FT_Stream_Close( stream ); + FT_FREE( stream ); + + return error; + } + + + /* Replace `face->root.stream' with a stream containing the extracted */ + /* SFNT of a WOFF2 font. */ + + FT_LOCAL_DEF( FT_Error ) + woff2_open_font( FT_Stream stream, + TT_Face face, + FT_Int* face_instance_index, + FT_Long* num_faces ) + { + FT_Memory memory = stream->memory; + FT_Error error = FT_Err_Ok; + FT_Int face_index; + + WOFF2_HeaderRec woff2; + WOFF2_InfoRec info = { 0, 0, 0, NULL, NULL, NULL, NULL }; + WOFF2_Table tables = NULL; + WOFF2_Table* indices = NULL; + WOFF2_Table* temp_indices = NULL; + WOFF2_Table last_table; + + FT_Int nn; + FT_ULong j; + FT_ULong flags; + FT_UShort xform_version; + FT_ULong src_offset = 0; + + FT_UInt glyf_index; + FT_UInt loca_index; + FT_UInt32 file_offset; + + FT_Byte* sfnt = NULL; + FT_Stream sfnt_stream = NULL; + FT_Byte* sfnt_header; + FT_ULong sfnt_size; + + FT_Byte* uncompressed_buf = NULL; + + static const FT_Frame_Field woff2_header_fields[] = + { +#undef FT_STRUCTURE +#define FT_STRUCTURE WOFF2_HeaderRec + + FT_FRAME_START( 48 ), + FT_FRAME_ULONG ( signature ), + FT_FRAME_ULONG ( flavor ), + FT_FRAME_ULONG ( length ), + FT_FRAME_USHORT ( num_tables ), + FT_FRAME_SKIP_BYTES( 2 ), + FT_FRAME_ULONG ( totalSfntSize ), + FT_FRAME_ULONG ( totalCompressedSize ), + FT_FRAME_SKIP_BYTES( 2 * 2 ), + FT_FRAME_ULONG ( metaOffset ), + FT_FRAME_ULONG ( metaLength ), + FT_FRAME_ULONG ( metaOrigLength ), + FT_FRAME_ULONG ( privOffset ), + FT_FRAME_ULONG ( privLength ), + FT_FRAME_END + }; + + + FT_ASSERT( stream == face->root.stream ); + FT_ASSERT( FT_STREAM_POS() == 0 ); + + face_index = FT_ABS( *face_instance_index ) & 0xFFFF; + + /* Read WOFF2 Header. */ + if ( FT_STREAM_READ_FIELDS( woff2_header_fields, &woff2 ) ) + return error; + + FT_TRACE4(( "signature -> 0x%lX\n", woff2.signature )); + FT_TRACE2(( "flavor -> 0x%08lx\n", woff2.flavor )); + FT_TRACE4(( "length -> %lu\n", woff2.length )); + FT_TRACE2(( "num_tables -> %hu\n", woff2.num_tables )); + FT_TRACE4(( "totalSfntSize -> %lu\n", woff2.totalSfntSize )); + FT_TRACE4(( "metaOffset -> %lu\n", woff2.metaOffset )); + FT_TRACE4(( "metaLength -> %lu\n", woff2.metaLength )); + FT_TRACE4(( "privOffset -> %lu\n", woff2.privOffset )); + FT_TRACE4(( "privLength -> %lu\n", woff2.privLength )); + + /* Make sure we don't recurse back here. */ + if ( woff2.flavor == TTAG_wOF2 ) + return FT_THROW( Invalid_Table ); + + /* Miscellaneous checks. */ + if ( woff2.length != stream->size || + woff2.num_tables == 0 || + 48 + woff2.num_tables * 20UL >= woff2.length || + ( woff2.metaOffset == 0 && ( woff2.metaLength != 0 || + woff2.metaOrigLength != 0 ) ) || + ( woff2.metaLength != 0 && woff2.metaOrigLength == 0 ) || + ( woff2.metaOffset >= woff2.length ) || + ( woff2.length - woff2.metaOffset < woff2.metaLength ) || + ( woff2.privOffset == 0 && woff2.privLength != 0 ) || + ( woff2.privOffset >= woff2.length ) || + ( woff2.length - woff2.privOffset < woff2.privLength ) ) + { + FT_ERROR(( "woff2_open_font: invalid WOFF2 header\n" )); + return FT_THROW( Invalid_Table ); + } + + FT_TRACE2(( "woff2_open_font: WOFF2 Header is valid.\n" )); + + woff2.ttc_fonts = NULL; + + /* Read table directory. */ + if ( FT_NEW_ARRAY( tables, woff2.num_tables ) || + FT_NEW_ARRAY( indices, woff2.num_tables ) ) + goto Exit; + + FT_TRACE2(( + "\n" + " tag flags transform origLen transformLen offset\n" + " -----------------------------------------------------------\n" )); + /* " XXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX" */ + + for ( nn = 0; nn < woff2.num_tables; nn++ ) + { + WOFF2_Table table = tables + nn; + + + if ( FT_READ_BYTE( table->FlagByte ) ) + goto Exit; + + if ( ( table->FlagByte & 0x3f ) == 0x3f ) + { + if ( FT_READ_ULONG( table->Tag ) ) + goto Exit; + } + else + { + table->Tag = woff2_known_tags( table->FlagByte & 0x3f ); + if ( !table->Tag ) + { + FT_ERROR(( "woff2_open_font: Unknown table tag." )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + } + + flags = 0; + xform_version = ( table->FlagByte >> 6 ) & 0x03; + + /* 0 means xform for glyph/loca, non-0 for others. */ + if ( table->Tag == TTAG_glyf || table->Tag == TTAG_loca ) + { + if ( xform_version == 0 ) + flags |= WOFF2_FLAGS_TRANSFORM; + } + else if ( xform_version != 0 ) + flags |= WOFF2_FLAGS_TRANSFORM; + + flags |= xform_version; + + if ( READ_BASE128( table->dst_length ) ) + goto Exit; + + table->TransformLength = table->dst_length; + + if ( ( flags & WOFF2_FLAGS_TRANSFORM ) != 0 ) + { + if ( READ_BASE128( table->TransformLength ) ) + goto Exit; + + if ( table->Tag == TTAG_loca && table->TransformLength ) + { + FT_ERROR(( "woff2_open_font: Invalid loca `transformLength'.\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + } + + if ( src_offset + table->TransformLength < src_offset ) + { + FT_ERROR(( "woff2_open_font: invalid WOFF2 table directory.\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + table->src_offset = src_offset; + table->src_length = table->TransformLength; + src_offset += table->TransformLength; + table->flags = flags; + + FT_TRACE2(( " %c%c%c%c %08d %08d %08ld %08ld %08ld\n", + (FT_Char)( table->Tag >> 24 ), + (FT_Char)( table->Tag >> 16 ), + (FT_Char)( table->Tag >> 8 ), + (FT_Char)( table->Tag ), + table->FlagByte & 0x3f, + ( table->FlagByte >> 6 ) & 0x03, + table->dst_length, + table->TransformLength, + table->src_offset )); + + indices[nn] = table; + } + + /* End of last table is uncompressed size. */ + last_table = indices[woff2.num_tables - 1]; + + woff2.uncompressed_size = last_table->src_offset + + last_table->src_length; + if ( woff2.uncompressed_size < last_table->src_offset ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + FT_TRACE2(( "Table directory parsed.\n" )); + + /* Check for and read collection directory. */ + woff2.num_fonts = 1; + woff2.header_version = 0; + + if ( woff2.flavor == TTAG_ttcf ) + { + FT_TRACE2(( "Font is a TTC, reading collection directory.\n" )); + + if ( FT_READ_ULONG( woff2.header_version ) ) + goto Exit; + + if ( woff2.header_version != 0x00010000 && + woff2.header_version != 0x00020000 ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + if ( READ_255USHORT( woff2.num_fonts ) ) + goto Exit; + + if ( !woff2.num_fonts ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + FT_TRACE4(( "Number of fonts in TTC: %d\n", woff2.num_fonts )); + + if ( FT_NEW_ARRAY( woff2.ttc_fonts, woff2.num_fonts ) ) + goto Exit; + + for ( nn = 0; nn < woff2.num_fonts; nn++ ) + { + WOFF2_TtcFont ttc_font = woff2.ttc_fonts + nn; + + + if ( READ_255USHORT( ttc_font->num_tables ) ) + goto Exit; + if ( FT_READ_ULONG( ttc_font->flavor ) ) + goto Exit; + + if ( FT_NEW_ARRAY( ttc_font->table_indices, ttc_font->num_tables ) ) + goto Exit; + + FT_TRACE5(( "Number of tables in font %d: %d\n", + nn, ttc_font->num_tables )); + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( ttc_font->num_tables ) + FT_TRACE6(( " Indices: " )); +#endif + + glyf_index = 0; + loca_index = 0; + + for ( j = 0; j < ttc_font->num_tables; j++ ) + { + FT_UShort table_index; + WOFF2_Table table; + + + if ( READ_255USHORT( table_index ) ) + goto Exit; + + FT_TRACE6(( "%hu ", table_index )); + if ( table_index >= woff2.num_tables ) + { + FT_ERROR(( "woff2_open_font: invalid table index\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + ttc_font->table_indices[j] = table_index; + + table = indices[table_index]; + if ( table->Tag == TTAG_loca ) + loca_index = table_index; + if ( table->Tag == TTAG_glyf ) + glyf_index = table_index; + } + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( ttc_font->num_tables ) + FT_TRACE6(( "\n" )); +#endif + + /* glyf and loca must be consecutive */ + if ( glyf_index > 0 || loca_index > 0 ) + { + if ( glyf_index > loca_index || + loca_index - glyf_index != 1 ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + } + } + + /* Collection directory reading complete. */ + FT_TRACE2(( "WOFF2 collection directory is valid.\n" )); + } + else + woff2.ttc_fonts = NULL; + + woff2.compressed_offset = FT_STREAM_POS(); + file_offset = ROUND4( woff2.compressed_offset + + woff2.totalCompressedSize ); + + /* Some more checks before we start reading the tables. */ + if ( file_offset > woff2.length ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + if ( woff2.metaOffset ) + { + if ( file_offset != woff2.metaOffset ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + file_offset = ROUND4(woff2.metaOffset + woff2.metaLength); + } + + if ( woff2.privOffset ) + { + if ( file_offset != woff2.privOffset ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + file_offset = ROUND4(woff2.privOffset + woff2.privLength); + } + + if ( file_offset != ( ROUND4( woff2.length ) ) ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + /* Validate requested face index. */ + *num_faces = woff2.num_fonts; + /* value -(N+1) requests information on index N */ + if ( *face_instance_index < 0 ) + face_index--; + + if ( face_index >= woff2.num_fonts ) + { + if ( *face_instance_index >= 0 ) + { + error = FT_THROW( Invalid_Argument ); + goto Exit; + } + else + face_index = 0; + } + + /* Only retain tables of the requested face in a TTC. */ + if ( woff2.header_version ) + { + WOFF2_TtcFont ttc_font = woff2.ttc_fonts + face_index; + + + /* Create a temporary array. */ + if ( FT_NEW_ARRAY( temp_indices, + ttc_font->num_tables ) ) + goto Exit; + + FT_TRACE4(( "Storing tables for TTC face index %d.\n", face_index )); + for ( nn = 0; nn < ttc_font->num_tables; nn++ ) + temp_indices[nn] = indices[ttc_font->table_indices[nn]]; + + /* Resize array to required size. */ + if ( FT_RENEW_ARRAY( indices, + woff2.num_tables, + ttc_font->num_tables ) ) + goto Exit; + + for ( nn = 0; nn < ttc_font->num_tables; nn++ ) + indices[nn] = temp_indices[nn]; + + FT_FREE( temp_indices ); + + /* Change header values. */ + woff2.flavor = ttc_font->flavor; + woff2.num_tables = ttc_font->num_tables; + } + + /* We need to allocate this much at the minimum. */ + sfnt_size = 12 + woff2.num_tables * 16UL; + /* This is what we normally expect. */ + /* Initially trust `totalSfntSize' and change later as required. */ + if ( woff2.totalSfntSize > sfnt_size ) + { + /* However, adjust the value to something reasonable. */ + + /* Factor 64 is heuristic. */ + if ( ( woff2.totalSfntSize >> 6 ) > woff2.length ) + sfnt_size = woff2.length << 6; + else + sfnt_size = woff2.totalSfntSize; + + /* Value 1<<26 = 67108864 is heuristic. */ + if (sfnt_size >= (1 << 26)) + sfnt_size = 1 << 26; + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( sfnt_size != woff2.totalSfntSize ) + FT_TRACE4(( "adjusting estimate of uncompressed font size" + " to %lu bytes\n", + sfnt_size )); +#endif + } + + /* Write sfnt header. */ + if ( FT_ALLOC( sfnt, sfnt_size ) || + FT_NEW( sfnt_stream ) ) + goto Exit; + + sfnt_header = sfnt; + + WRITE_ULONG( sfnt_header, woff2.flavor ); + + if ( woff2.num_tables ) + { + FT_UInt searchRange, entrySelector, rangeShift, x; + + + x = woff2.num_tables; + entrySelector = 0; + while ( x ) + { + x >>= 1; + entrySelector += 1; + } + entrySelector--; + + searchRange = ( 1 << entrySelector ) * 16; + rangeShift = ( woff2.num_tables * 16 ) - searchRange; + + WRITE_USHORT( sfnt_header, woff2.num_tables ); + WRITE_USHORT( sfnt_header, searchRange ); + WRITE_USHORT( sfnt_header, entrySelector ); + WRITE_USHORT( sfnt_header, rangeShift ); + } + + info.header_checksum = compute_ULong_sum( sfnt, 12 ); + + /* Sort tables by tag. */ + ft_qsort( indices, + woff2.num_tables, + sizeof ( WOFF2_Table ), + compare_tags ); + + if ( woff2.uncompressed_size < 1 ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + if ( woff2.uncompressed_size > sfnt_size ) + { + FT_ERROR(( "woff2_open_font: SFNT table lengths are too large.\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + /* Allocate memory for uncompressed table data. */ + if ( FT_ALLOC( uncompressed_buf, woff2.uncompressed_size ) || + FT_FRAME_ENTER( woff2.totalCompressedSize ) ) + goto Exit; + + /* Uncompress the stream. */ + error = woff2_decompress( uncompressed_buf, + woff2.uncompressed_size, + stream->cursor, + woff2.totalCompressedSize ); + + FT_FRAME_EXIT(); + + if ( error ) + goto Exit; + + error = reconstruct_font( uncompressed_buf, + woff2.uncompressed_size, + indices, + &woff2, + &info, + &sfnt, + &sfnt_size, + memory ); + + if ( error ) + goto Exit; + + /* Resize `sfnt' to actual size of sfnt stream. */ + if ( woff2.actual_sfnt_size < sfnt_size ) + { + FT_TRACE5(( "Trimming sfnt stream from %lu to %lu.\n", + sfnt_size, woff2.actual_sfnt_size )); + if ( FT_REALLOC( sfnt, + (FT_ULong)( sfnt_size ), + (FT_ULong)( woff2.actual_sfnt_size ) ) ) + goto Exit; + } + + /* `reconstruct_font' has done all the work. */ + /* Swap out stream and return. */ + FT_Stream_OpenMemory( sfnt_stream, sfnt, woff2.actual_sfnt_size ); + sfnt_stream->memory = stream->memory; + sfnt_stream->close = stream_close; + + FT_Stream_Free( + face->root.stream, + ( face->root.face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 ); + + face->root.stream = sfnt_stream; + face->root.face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM; + + /* Set face_index to 0 or -1. */ + if ( *face_instance_index >= 0 ) + *face_instance_index = 0; + else + *face_instance_index = -1; + + FT_TRACE2(( "woff2_open_font: SFNT synthesized.\n" )); + + Exit: + FT_FREE( tables ); + FT_FREE( indices ); + FT_FREE( uncompressed_buf ); + FT_FREE( info.x_mins ); + + if ( woff2.ttc_fonts ) + { + WOFF2_TtcFont ttc_font = woff2.ttc_fonts; + + + for ( nn = 0; nn < woff2.num_fonts; nn++ ) + { + FT_FREE( ttc_font->table_indices ); + ttc_font++; + } + + FT_FREE( woff2.ttc_fonts ); + } + + if ( error ) + { + FT_FREE( sfnt ); + if ( sfnt_stream ) + { + FT_Stream_Close( sfnt_stream ); + FT_FREE( sfnt_stream ); + } + } + + return error; + } + + +#undef READ_255USHORT +#undef READ_BASE128 +#undef ROUND4 +#undef WRITE_USHORT +#undef WRITE_ULONG +#undef WRITE_SHORT +#undef WRITE_SFNT_BUF +#undef WRITE_SFNT_BUF_AT + +#undef N_CONTOUR_STREAM +#undef N_POINTS_STREAM +#undef FLAG_STREAM +#undef GLYPH_STREAM +#undef COMPOSITE_STREAM +#undef BBOX_STREAM +#undef INSTRUCTION_STREAM + + +/* END */ diff --git a/src/3rdparty/freetype/src/sfnt/sfwoff2.h b/src/3rdparty/freetype/src/sfnt/sfwoff2.h new file mode 100644 index 0000000000..798f66bd0a --- /dev/null +++ b/src/3rdparty/freetype/src/sfnt/sfwoff2.h @@ -0,0 +1,75 @@ +/**************************************************************************** + * + * sfwoff2.h + * + * WOFFF2 format management (specification). + * + * Copyright (C) 2019-2020 by + * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef SFWOFF2_H_ +#define SFWOFF2_H_ + + +#include <freetype/internal/sfnt.h> +#include <freetype/internal/ftobjs.h> + + +FT_BEGIN_HEADER + + + /* Leave the first byte open to store `flag_byte'. */ +#define WOFF2_FLAGS_TRANSFORM 1 << 8 + +#define WOFF2_SFNT_HEADER_SIZE 12 +#define WOFF2_SFNT_ENTRY_SIZE 16 + + /* Suggested maximum size for output. */ +#define WOFF2_DEFAULT_MAX_SIZE 30 * 1024 * 1024 + + /* 98% of Google Fonts have no glyph above 5k bytes. */ +#define WOFF2_DEFAULT_GLYPH_BUF 5120 + + /* Composite glyph flags. */ + /* See `CompositeGlyph.java' in `sfntly' for full definitions. */ +#define FLAG_ARG_1_AND_2_ARE_WORDS 1 << 0 +#define FLAG_WE_HAVE_A_SCALE 1 << 3 +#define FLAG_MORE_COMPONENTS 1 << 5 +#define FLAG_WE_HAVE_AN_X_AND_Y_SCALE 1 << 6 +#define FLAG_WE_HAVE_A_TWO_BY_TWO 1 << 7 +#define FLAG_WE_HAVE_INSTRUCTIONS 1 << 8 + + /* Simple glyph flags */ +#define GLYF_ON_CURVE 1 << 0 +#define GLYF_X_SHORT 1 << 1 +#define GLYF_Y_SHORT 1 << 2 +#define GLYF_REPEAT 1 << 3 +#define GLYF_THIS_X_IS_SAME 1 << 4 +#define GLYF_THIS_Y_IS_SAME 1 << 5 + + /* Other constants */ +#define CONTOUR_OFFSET_END_POINT 10 + + + FT_LOCAL( FT_Error ) + woff2_open_font( FT_Stream stream, + TT_Face face, + FT_Int* face_index, + FT_Long* num_faces ); + + +FT_END_HEADER + +#endif /* SFWOFF2_H_ */ + + +/* END */ diff --git a/src/3rdparty/freetype/src/sfnt/ttbdf.c b/src/3rdparty/freetype/src/sfnt/ttbdf.c index 853599fc43..a287d3afc4 100644 --- a/src/3rdparty/freetype/src/sfnt/ttbdf.c +++ b/src/3rdparty/freetype/src/sfnt/ttbdf.c @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded BDF properties (body). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,10 +16,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> #include "ttbdf.h" #include "sferrors.h" diff --git a/src/3rdparty/freetype/src/sfnt/ttbdf.h b/src/3rdparty/freetype/src/sfnt/ttbdf.h index e4164e61fc..e60c01cb8b 100644 --- a/src/3rdparty/freetype/src/sfnt/ttbdf.h +++ b/src/3rdparty/freetype/src/sfnt/ttbdf.h @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded BDF properties (specification). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define TTBDF_H_ -#include <ft2build.h> #include "ttload.h" -#include FT_BDF_H +#include <freetype/ftbdf.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/sfnt/ttcmap.c b/src/3rdparty/freetype/src/sfnt/ttcmap.c index 683f3b1818..556a712199 100644 --- a/src/3rdparty/freetype/src/sfnt/ttcmap.c +++ b/src/3rdparty/freetype/src/sfnt/ttcmap.c @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,14 +16,13 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include "sferrors.h" /* must come before FT_INTERNAL_VALIDATE_H */ +#include "sferrors.h" /* must come before `ftvalid.h' */ -#include FT_INTERNAL_VALIDATE_H -#include FT_INTERNAL_STREAM_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include <freetype/internal/ftvalid.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/services/svpscmap.h> #include "ttload.h" #include "ttcmap.h" #include "ttpost.h" @@ -3752,6 +3751,7 @@ static const TT_CMap_Class tt_cmap_classes[] = { +#undef TTCMAPCITEM #define TTCMAPCITEM( a ) &a, #include "ttcmapc.h" NULL, @@ -3764,29 +3764,33 @@ FT_LOCAL_DEF( FT_Error ) tt_face_build_cmaps( TT_Face face ) { - FT_Byte* table = face->cmap_table; - FT_Byte* limit = table + face->cmap_size; + FT_Byte* const table = face->cmap_table; + FT_Byte* limit; FT_UInt volatile num_cmaps; - FT_Byte* volatile p = table; + FT_Byte* volatile p = table; FT_Library library = FT_FACE_LIBRARY( face ); FT_UNUSED( library ); - if ( !p || p + 4 > limit ) + if ( !p || face->cmap_size < 4 ) return FT_THROW( Invalid_Table ); - /* only recognize format 0 */ - if ( TT_NEXT_USHORT( p ) != 0 ) - { - FT_ERROR(( "tt_face_build_cmaps:" - " unsupported `cmap' table format = %d\n", - TT_PEEK_USHORT( p - 2 ) )); - return FT_THROW( Invalid_Table ); - } + /* Version 1.8.3 of the OpenType specification contains the following */ + /* (https://docs.microsoft.com/en-us/typography/opentype/spec/cmap): */ + /* */ + /* The 'cmap' table version number remains at 0x0000 for fonts that */ + /* make use of the newer subtable formats. */ + /* */ + /* This essentially means that a version format test is useless. */ + + /* ignore format */ + p += 2; num_cmaps = TT_NEXT_USHORT( p ); + FT_TRACE4(( "tt_face_build_cmaps: %d cmaps\n", num_cmaps )); + limit = table + face->cmap_size; for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- ) { FT_CharMapRec charmap; diff --git a/src/3rdparty/freetype/src/sfnt/ttcmap.h b/src/3rdparty/freetype/src/sfnt/ttcmap.h index 36801c939e..c7d7c21d2c 100644 --- a/src/3rdparty/freetype/src/sfnt/ttcmap.h +++ b/src/3rdparty/freetype/src/sfnt/ttcmap.h @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,10 +20,9 @@ #define TTCMAP_H_ -#include <ft2build.h> -#include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_INTERNAL_VALIDATE_H -#include FT_SERVICE_TT_CMAP_H +#include <freetype/internal/tttypes.h> +#include <freetype/internal/ftvalid.h> +#include <freetype/internal/services/svttcmap.h> FT_BEGIN_HEADER @@ -91,6 +90,11 @@ FT_BEGIN_HEADER }; +#undef TTCMAPCITEM +#define TTCMAPCITEM( a ) FT_CALLBACK_TABLE const TT_CMap_ClassRec a; +#include "ttcmapc.h" + + typedef struct TT_ValidatorRec_ { FT_ValidatorRec validator; diff --git a/src/3rdparty/freetype/src/sfnt/ttcmapc.h b/src/3rdparty/freetype/src/sfnt/ttcmapc.h index ace9e69ca8..2e4ce5075b 100644 --- a/src/3rdparty/freetype/src/sfnt/ttcmapc.h +++ b/src/3rdparty/freetype/src/sfnt/ttcmapc.h @@ -4,7 +4,7 @@ * * TT CMAP classes definitions (specification only). * - * Copyright (C) 2009-2019 by + * Copyright (C) 2009-2020 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/sfnt/ttcolr.c b/src/3rdparty/freetype/src/sfnt/ttcolr.c index 6b537d95b8..9025e356ce 100644 --- a/src/3rdparty/freetype/src/sfnt/ttcolr.c +++ b/src/3rdparty/freetype/src/sfnt/ttcolr.c @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (body). * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. @@ -27,11 +27,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H -#include FT_COLOR_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> +#include <freetype/ftcolor.h> #ifdef TT_CONFIG_OPTION_COLOR_LAYERS @@ -40,9 +39,9 @@ /* NOTE: These are the table sizes calculated through the specs. */ -#define BASE_GLYPH_SIZE 6 -#define LAYER_SIZE 4 -#define COLR_HEADER_SIZE 14 +#define BASE_GLYPH_SIZE 6U +#define LAYER_SIZE 4U +#define COLR_HEADER_SIZE 14U typedef struct BaseGlyphRecord_ diff --git a/src/3rdparty/freetype/src/sfnt/ttcolr.h b/src/3rdparty/freetype/src/sfnt/ttcolr.h index 817489a855..6412162669 100644 --- a/src/3rdparty/freetype/src/sfnt/ttcolr.h +++ b/src/3rdparty/freetype/src/sfnt/ttcolr.h @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (specification). * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. @@ -22,7 +22,6 @@ #define __TTCOLR_H__ -#include <ft2build.h> #include "ttload.h" diff --git a/src/3rdparty/freetype/src/sfnt/ttcpal.c b/src/3rdparty/freetype/src/sfnt/ttcpal.c index 3482169a89..9c514bafe5 100644 --- a/src/3rdparty/freetype/src/sfnt/ttcpal.c +++ b/src/3rdparty/freetype/src/sfnt/ttcpal.c @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (body). * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. @@ -27,11 +27,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H -#include FT_COLOR_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> +#include <freetype/ftcolor.h> #ifdef TT_CONFIG_OPTION_COLOR_LAYERS @@ -40,8 +39,8 @@ /* NOTE: These are the table sizes calculated through the specs. */ -#define CPAL_V0_HEADER_BASE_SIZE 12 -#define COLOR_SIZE 4 +#define CPAL_V0_HEADER_BASE_SIZE 12U +#define COLOR_SIZE 4U /* all data from `CPAL' not covered in FT_Palette_Data */ @@ -140,7 +139,7 @@ 3U * 4 > table_size ) goto InvalidTable; - p += face->palette_data.num_palettes * 2; + p += face->palette_data.num_palettes * 2U; type_offset = FT_NEXT_ULONG( p ); label_offset = FT_NEXT_ULONG( p ); @@ -150,7 +149,7 @@ { if ( type_offset >= table_size ) goto InvalidTable; - if ( face->palette_data.num_palettes * 2 > + if ( face->palette_data.num_palettes * 2U > table_size - type_offset ) goto InvalidTable; @@ -171,7 +170,7 @@ { if ( label_offset >= table_size ) goto InvalidTable; - if ( face->palette_data.num_palettes * 2 > + if ( face->palette_data.num_palettes * 2U > table_size - label_offset ) goto InvalidTable; @@ -192,7 +191,7 @@ { if ( entry_label_offset >= table_size ) goto InvalidTable; - if ( face->palette_data.num_palette_entries * 2 > + if ( face->palette_data.num_palette_entries * 2U > table_size - entry_label_offset ) goto InvalidTable; diff --git a/src/3rdparty/freetype/src/sfnt/ttcpal.h b/src/3rdparty/freetype/src/sfnt/ttcpal.h index d1b244f3e3..b544be696a 100644 --- a/src/3rdparty/freetype/src/sfnt/ttcpal.h +++ b/src/3rdparty/freetype/src/sfnt/ttcpal.h @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (specification). * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. @@ -22,7 +22,6 @@ #define __TTCPAL_H__ -#include <ft2build.h> #include "ttload.h" diff --git a/src/3rdparty/freetype/src/sfnt/ttkern.c b/src/3rdparty/freetype/src/sfnt/ttkern.c index 8d1b781090..d4a70c7855 100644 --- a/src/3rdparty/freetype/src/sfnt/ttkern.c +++ b/src/3rdparty/freetype/src/sfnt/ttkern.c @@ -5,7 +5,7 @@ * Load the basic TrueType kerning table. This doesn't handle * kerning data within the GPOS table at the moment. * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,10 +17,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> #include "ttkern.h" #include "sferrors.h" diff --git a/src/3rdparty/freetype/src/sfnt/ttkern.h b/src/3rdparty/freetype/src/sfnt/ttkern.h index 5f283e5e62..f44b5bdeb0 100644 --- a/src/3rdparty/freetype/src/sfnt/ttkern.h +++ b/src/3rdparty/freetype/src/sfnt/ttkern.h @@ -5,7 +5,7 @@ * Load the basic TrueType kerning table. This doesn't handle * kerning data within the GPOS table at the moment. * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -21,9 +21,8 @@ #define TTKERN_H_ -#include <ft2build.h> -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_TRUETYPE_TYPES_H +#include <freetype/internal/ftstream.h> +#include <freetype/internal/tttypes.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/sfnt/ttload.c b/src/3rdparty/freetype/src/sfnt/ttload.c index 5443bf4b69..4b46f41357 100644 --- a/src/3rdparty/freetype/src/sfnt/ttload.c +++ b/src/3rdparty/freetype/src/sfnt/ttload.c @@ -5,7 +5,7 @@ * Load the basic TrueType tables, i.e., tables that can be either in * TTF or OTF fonts (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,10 +17,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> #include "ttload.h" #include "sferrors.h" @@ -65,8 +64,8 @@ #endif - FT_TRACE4(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ", - face, + FT_TRACE4(( "tt_face_lookup_table: %p, `%c%c%c%c' -- ", + (void *)face, (FT_Char)( tag >> 24 ), (FT_Char)( tag >> 16 ), (FT_Char)( tag >> 8 ), @@ -363,7 +362,7 @@ }; - FT_TRACE2(( "tt_face_load_font_dir: %08p\n", face )); + FT_TRACE2(( "tt_face_load_font_dir: %p\n", (void *)face )); /* read the offset table */ @@ -397,7 +396,15 @@ } } else + { valid_entries = sfnt.num_tables; + if ( !valid_entries ) + { + FT_TRACE2(( "tt_face_load_font_dir: no valid tables found\n" )); + error = FT_THROW( Unknown_File_Format ); + goto Exit; + } + } face->num_tables = valid_entries; face->format_tag = sfnt.format_tag; @@ -916,7 +923,7 @@ /* load language tags */ { TT_LangTag entry = table->langTags; - TT_LangTag limit = entry + table->numLangTagRecords; + TT_LangTag limit = FT_OFFSET( entry, table->numLangTagRecords ); for ( ; entry < limit; entry++ ) @@ -1307,7 +1314,7 @@ /* we don't load the glyph names, we do that in another */ /* module (ttpost). */ - FT_TRACE3(( "FormatType: 0x%x\n", post->FormatType )); + FT_TRACE3(( "FormatType: 0x%lx\n", post->FormatType )); FT_TRACE3(( "isFixedPitch: %s\n", post->isFixedPitch ? " yes" : " no" )); diff --git a/src/3rdparty/freetype/src/sfnt/ttload.h b/src/3rdparty/freetype/src/sfnt/ttload.h index cc18c18694..4e53d8b782 100644 --- a/src/3rdparty/freetype/src/sfnt/ttload.h +++ b/src/3rdparty/freetype/src/sfnt/ttload.h @@ -5,7 +5,7 @@ * Load the basic TrueType tables, i.e., tables that can be either in * TTF or OTF fonts (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -21,9 +21,8 @@ #define TTLOAD_H_ -#include <ft2build.h> -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_TRUETYPE_TYPES_H +#include <freetype/internal/ftstream.h> +#include <freetype/internal/tttypes.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/sfnt/ttmtx.c b/src/3rdparty/freetype/src/sfnt/ttmtx.c index b6725c962f..021123336e 100644 --- a/src/3rdparty/freetype/src/sfnt/ttmtx.c +++ b/src/3rdparty/freetype/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,13 +16,12 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_SERVICE_METRICS_VARIATIONS_H +#include <freetype/internal/services/svmetric.h> #endif #include "ttmtx.h" diff --git a/src/3rdparty/freetype/src/sfnt/ttmtx.h b/src/3rdparty/freetype/src/sfnt/ttmtx.h index 5b0b60b641..dba65ca9ba 100644 --- a/src/3rdparty/freetype/src/sfnt/ttmtx.h +++ b/src/3rdparty/freetype/src/sfnt/ttmtx.h @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define TTMTX_H_ -#include <ft2build.h> -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_TRUETYPE_TYPES_H +#include <freetype/internal/ftstream.h> +#include <freetype/internal/tttypes.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/sfnt/ttpost.c b/src/3rdparty/freetype/src/sfnt/ttpost.c index 636a0a004a..e93a4bf1b1 100644 --- a/src/3rdparty/freetype/src/sfnt/ttpost.c +++ b/src/3rdparty/freetype/src/sfnt/ttpost.c @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -25,10 +25,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES @@ -54,7 +53,7 @@ #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES -#include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include <freetype/internal/services/svpscmap.h> #define MAC_NAME( x ) (FT_String*)psnames->macintosh_name( (FT_UInt)(x) ) @@ -240,7 +239,7 @@ break; else { - FT_TRACE6(( "load_format_20: %d byte left in post table\n", + FT_TRACE6(( "load_format_20: %ld byte left in post table\n", post_limit - FT_STREAM_POS() )); if ( FT_READ_BYTE( len ) ) diff --git a/src/3rdparty/freetype/src/sfnt/ttpost.h b/src/3rdparty/freetype/src/sfnt/ttpost.h index 812a0fc92d..94c7d16800 100644 --- a/src/3rdparty/freetype/src/sfnt/ttpost.h +++ b/src/3rdparty/freetype/src/sfnt/ttpost.h @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -23,7 +23,7 @@ #include <ft2build.h> #include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_TRUETYPE_TYPES_H +#include <freetype/internal/tttypes.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/sfnt/ttsbit.c b/src/3rdparty/freetype/src/sfnt/ttsbit.c index 23bd9d7eb0..9dd4419710 100644 --- a/src/3rdparty/freetype/src/sfnt/ttsbit.c +++ b/src/3rdparty/freetype/src/sfnt/ttsbit.c @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (body). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Copyright 2013 by Google, Inc. @@ -19,11 +19,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H -#include FT_BITMAP_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> +#include <freetype/ftbitmap.h> #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS @@ -348,7 +347,7 @@ FT_TRACE2(( "tt_face_load_strike_metrics:" " sanitizing invalid ascender and descender\n" " " - " values for strike %d (%dppem, %dppem)\n", + " values for strike %ld (%dppem, %dppem)\n", strike_index, metrics->x_ppem, metrics->y_ppem )); diff --git a/src/3rdparty/freetype/src/sfnt/ttsbit.h b/src/3rdparty/freetype/src/sfnt/ttsbit.h index 5ab8ff5568..b867e43a61 100644 --- a/src/3rdparty/freetype/src/sfnt/ttsbit.h +++ b/src/3rdparty/freetype/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,7 +20,6 @@ #define TTSBIT_H_ -#include <ft2build.h> #include "ttload.h" diff --git a/src/3rdparty/freetype/src/sfnt/woff2tags.c b/src/3rdparty/freetype/src/sfnt/woff2tags.c new file mode 100644 index 0000000000..fd9f2e6c5d --- /dev/null +++ b/src/3rdparty/freetype/src/sfnt/woff2tags.c @@ -0,0 +1,109 @@ +/**************************************************************************** + * + * woff2tags.c + * + * WOFF2 Font table tags (base). + * + * Copyright (C) 2019-2020 by + * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#include <freetype/tttags.h> +#include "woff2tags.h" + + /* + * Return tag from index in the order given in WOFF2 specification. + * + * See + * + * https://www.w3.org/TR/WOFF2/#table_dir_format + * + * for details. + */ + FT_LOCAL_DEF( FT_ULong ) + woff2_known_tags( FT_Byte index ) + { + const FT_ULong known_tags[63] = + { + FT_MAKE_TAG('c', 'm', 'a', 'p'), /* 0 */ + FT_MAKE_TAG('h', 'e', 'a', 'd'), /* 1 */ + FT_MAKE_TAG('h', 'h', 'e', 'a'), /* 2 */ + FT_MAKE_TAG('h', 'm', 't', 'x'), /* 3 */ + FT_MAKE_TAG('m', 'a', 'x', 'p'), /* 4 */ + FT_MAKE_TAG('n', 'a', 'm', 'e'), /* 5 */ + FT_MAKE_TAG('O', 'S', '/', '2'), /* 6 */ + FT_MAKE_TAG('p', 'o', 's', 't'), /* 7 */ + FT_MAKE_TAG('c', 'v', 't', ' '), /* 8 */ + FT_MAKE_TAG('f', 'p', 'g', 'm'), /* 9 */ + FT_MAKE_TAG('g', 'l', 'y', 'f'), /* 10 */ + FT_MAKE_TAG('l', 'o', 'c', 'a'), /* 11 */ + FT_MAKE_TAG('p', 'r', 'e', 'p'), /* 12 */ + FT_MAKE_TAG('C', 'F', 'F', ' '), /* 13 */ + FT_MAKE_TAG('V', 'O', 'R', 'G'), /* 14 */ + FT_MAKE_TAG('E', 'B', 'D', 'T'), /* 15 */ + FT_MAKE_TAG('E', 'B', 'L', 'C'), /* 16 */ + FT_MAKE_TAG('g', 'a', 's', 'p'), /* 17 */ + FT_MAKE_TAG('h', 'd', 'm', 'x'), /* 18 */ + FT_MAKE_TAG('k', 'e', 'r', 'n'), /* 19 */ + FT_MAKE_TAG('L', 'T', 'S', 'H'), /* 20 */ + FT_MAKE_TAG('P', 'C', 'L', 'T'), /* 21 */ + FT_MAKE_TAG('V', 'D', 'M', 'X'), /* 22 */ + FT_MAKE_TAG('v', 'h', 'e', 'a'), /* 23 */ + FT_MAKE_TAG('v', 'm', 't', 'x'), /* 24 */ + FT_MAKE_TAG('B', 'A', 'S', 'E'), /* 25 */ + FT_MAKE_TAG('G', 'D', 'E', 'F'), /* 26 */ + FT_MAKE_TAG('G', 'P', 'O', 'S'), /* 27 */ + FT_MAKE_TAG('G', 'S', 'U', 'B'), /* 28 */ + FT_MAKE_TAG('E', 'B', 'S', 'C'), /* 29 */ + FT_MAKE_TAG('J', 'S', 'T', 'F'), /* 30 */ + FT_MAKE_TAG('M', 'A', 'T', 'H'), /* 31 */ + FT_MAKE_TAG('C', 'B', 'D', 'T'), /* 32 */ + FT_MAKE_TAG('C', 'B', 'L', 'C'), /* 33 */ + FT_MAKE_TAG('C', 'O', 'L', 'R'), /* 34 */ + FT_MAKE_TAG('C', 'P', 'A', 'L'), /* 35 */ + FT_MAKE_TAG('S', 'V', 'G', ' '), /* 36 */ + FT_MAKE_TAG('s', 'b', 'i', 'x'), /* 37 */ + FT_MAKE_TAG('a', 'c', 'n', 't'), /* 38 */ + FT_MAKE_TAG('a', 'v', 'a', 'r'), /* 39 */ + FT_MAKE_TAG('b', 'd', 'a', 't'), /* 40 */ + FT_MAKE_TAG('b', 'l', 'o', 'c'), /* 41 */ + FT_MAKE_TAG('b', 's', 'l', 'n'), /* 42 */ + FT_MAKE_TAG('c', 'v', 'a', 'r'), /* 43 */ + FT_MAKE_TAG('f', 'd', 's', 'c'), /* 44 */ + FT_MAKE_TAG('f', 'e', 'a', 't'), /* 45 */ + FT_MAKE_TAG('f', 'm', 't', 'x'), /* 46 */ + FT_MAKE_TAG('f', 'v', 'a', 'r'), /* 47 */ + FT_MAKE_TAG('g', 'v', 'a', 'r'), /* 48 */ + FT_MAKE_TAG('h', 's', 't', 'y'), /* 49 */ + FT_MAKE_TAG('j', 'u', 's', 't'), /* 50 */ + FT_MAKE_TAG('l', 'c', 'a', 'r'), /* 51 */ + FT_MAKE_TAG('m', 'o', 'r', 't'), /* 52 */ + FT_MAKE_TAG('m', 'o', 'r', 'x'), /* 53 */ + FT_MAKE_TAG('o', 'p', 'b', 'd'), /* 54 */ + FT_MAKE_TAG('p', 'r', 'o', 'p'), /* 55 */ + FT_MAKE_TAG('t', 'r', 'a', 'k'), /* 56 */ + FT_MAKE_TAG('Z', 'a', 'p', 'f'), /* 57 */ + FT_MAKE_TAG('S', 'i', 'l', 'f'), /* 58 */ + FT_MAKE_TAG('G', 'l', 'a', 't'), /* 59 */ + FT_MAKE_TAG('G', 'l', 'o', 'c'), /* 60 */ + FT_MAKE_TAG('F', 'e', 'a', 't'), /* 61 */ + FT_MAKE_TAG('S', 'i', 'l', 'l'), /* 62 */ + }; + + + if ( index > 62 ) + return 0; + + return known_tags[index]; + } + + +/* END */ diff --git a/src/3rdparty/freetype/src/sfnt/woff2tags.h b/src/3rdparty/freetype/src/sfnt/woff2tags.h new file mode 100644 index 0000000000..c437c77aa1 --- /dev/null +++ b/src/3rdparty/freetype/src/sfnt/woff2tags.h @@ -0,0 +1,39 @@ +/**************************************************************************** + * + * woff2tags.h + * + * WOFFF2 Font table tags (specification). + * + * Copyright (C) 2019-2020 by + * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef WOFF2TAGS_H +#define WOFF2TAGS_H + + +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/compiler-macros.h> + + +FT_BEGIN_HEADER + + + FT_LOCAL( FT_ULong ) + woff2_known_tags( FT_Byte index ); + + +FT_END_HEADER + +#endif /* WOFF2TAGS_H */ + + +/* END */ diff --git a/src/3rdparty/freetype/src/smooth/Jamfile b/src/3rdparty/freetype/src/smooth/Jamfile deleted file mode 100644 index 6ca1cede9e..0000000000 --- a/src/3rdparty/freetype/src/smooth/Jamfile +++ /dev/null @@ -1,32 +0,0 @@ -# FreeType 2 src/smooth Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) smooth ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = ftgrays - ftsmooth - ftspic - ; - } - else - { - _sources = smooth ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/smooth Jamfile diff --git a/src/3rdparty/freetype/src/smooth/ftgrays.c b/src/3rdparty/freetype/src/smooth/ftgrays.c index fd357a50fc..681900fd40 100644 --- a/src/3rdparty/freetype/src/smooth/ftgrays.c +++ b/src/3rdparty/freetype/src/smooth/ftgrays.c @@ -4,7 +4,7 @@ * * A new `perfect' anti-aliasing renderer (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -278,12 +278,11 @@ typedef ptrdiff_t FT_PtrDist; #else /* !STANDALONE_ */ -#include <ft2build.h> #include "ftgrays.h" -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H -#include FT_OUTLINE_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/ftoutln.h> #include "ftsmerrs.h" @@ -1649,7 +1648,7 @@ typedef ptrdiff_t FT_PtrDist; if ( !ras.invalid ) gray_record_cell( RAS_VAR ); - FT_TRACE7(( "band [%d..%d]: %d cell%s\n", + FT_TRACE7(( "band [%d..%d]: %ld cell%s\n", ras.min_ey, ras.max_ey, ras.num_cells, diff --git a/src/3rdparty/freetype/src/smooth/ftgrays.h b/src/3rdparty/freetype/src/smooth/ftgrays.h index e9f9c7a4ad..caba632833 100644 --- a/src/3rdparty/freetype/src/smooth/ftgrays.h +++ b/src/3rdparty/freetype/src/smooth/ftgrays.h @@ -4,7 +4,7 @@ * * FreeType smooth renderer declaration * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -28,7 +28,7 @@ #include "ftimage.h" #else #include <ft2build.h> -#include FT_IMAGE_H +#include <freetype/ftimage.h> #endif diff --git a/src/3rdparty/freetype/src/smooth/ftsmerrs.h b/src/3rdparty/freetype/src/smooth/ftsmerrs.h index d52c0dd9e2..e93f3df9b3 100644 --- a/src/3rdparty/freetype/src/smooth/ftsmerrs.h +++ b/src/3rdparty/freetype/src/smooth/ftsmerrs.h @@ -4,7 +4,7 @@ * * smooth renderer error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -26,7 +26,7 @@ #ifndef FTSMERRS_H_ #define FTSMERRS_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -34,7 +34,7 @@ #define FT_ERR_PREFIX Smooth_Err_ #define FT_ERR_BASE FT_Mod_Err_Smooth -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* FTSMERRS_H_ */ diff --git a/src/3rdparty/freetype/src/smooth/ftsmooth.c b/src/3rdparty/freetype/src/smooth/ftsmooth.c index cd034d2b40..5d66bd6fc4 100644 --- a/src/3rdparty/freetype/src/smooth/ftsmooth.c +++ b/src/3rdparty/freetype/src/smooth/ftsmooth.c @@ -4,7 +4,7 @@ * * Anti-aliasing renderer interface (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,46 +16,15 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H -#include FT_OUTLINE_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/ftoutln.h> #include "ftsmooth.h" #include "ftgrays.h" #include "ftsmerrs.h" - /* initialize renderer -- init its raster */ - static FT_Error - ft_smooth_init( FT_Renderer render ) - { - -#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - FT_Vector* sub = render->root.library->lcd_geometry; - - - /* set up default subpixel geometry for striped RGB panels. */ - sub[0].x = -21; - sub[0].y = 0; - sub[1].x = 0; - sub[1].y = 0; - sub[2].x = 21; - sub[2].y = 0; - -#elif 0 /* or else, once ClearType patents expire */ - - FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT ); - -#endif - - render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); - - return 0; - } - - /* sets render-specific mode */ static FT_Error ft_smooth_set_mode( FT_Renderer render, @@ -107,14 +76,359 @@ FT_Outline_Get_CBox( &slot->outline, cbox ); } + typedef struct TOrigin_ + { + unsigned char* origin; /* pixmap origin at the bottom-left */ + int pitch; /* pitch to go down one row */ + + } TOrigin; + +#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + /* initialize renderer -- init its raster */ + static FT_Error + ft_smooth_init( FT_Renderer render ) + { + FT_Vector* sub = render->root.library->lcd_geometry; + + + /* set up default subpixel geometry for striped RGB panels. */ + sub[0].x = -21; + sub[0].y = 0; + sub[1].x = 0; + sub[1].y = 0; + sub[2].x = 21; + sub[2].y = 0; + + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); + + return 0; + } + + + /* This function writes every third byte in direct rendering mode */ + static void + ft_smooth_lcd_spans( int y, + int count, + const FT_Span* spans, + TOrigin* target ) + { + unsigned char* dst_line = target->origin - y * target->pitch; + unsigned char* dst; + unsigned short w; + + + for ( ; count--; spans++ ) + for ( dst = dst_line + spans->x * 3, w = spans->len; w--; dst += 3 ) + *dst = spans->coverage; + } + + + static FT_Error + ft_smooth_raster_lcd( FT_Renderer render, + FT_Outline* outline, + FT_Bitmap* bitmap ) + { + FT_Error error = FT_Err_Ok; + FT_Vector* sub = render->root.library->lcd_geometry; + FT_Pos x, y; + + FT_Raster_Params params; + TOrigin target; + + + /* Render 3 separate coverage bitmaps, shifting the outline. */ + /* Set up direct rendering to record them on each third byte. */ + params.source = outline; + params.flags = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT; + params.gray_spans = (FT_SpanFunc)ft_smooth_lcd_spans; + params.user = ⌖ + + params.clip_box.xMin = 0; + params.clip_box.yMin = 0; + params.clip_box.xMax = bitmap->width; + params.clip_box.yMax = bitmap->rows; + + if ( bitmap->pitch < 0 ) + target.origin = bitmap->buffer; + else + target.origin = bitmap->buffer + + ( bitmap->rows - 1 ) * (unsigned int)bitmap->pitch; + + target.pitch = bitmap->pitch; + + FT_Outline_Translate( outline, + -sub[0].x, + -sub[0].y ); + error = render->raster_render( render->raster, ¶ms ); + x = sub[0].x; + y = sub[0].y; + if ( error ) + goto Exit; + + target.origin++; + FT_Outline_Translate( outline, + sub[0].x - sub[1].x, + sub[0].y - sub[1].y ); + error = render->raster_render( render->raster, ¶ms ); + x = sub[1].x; + y = sub[1].y; + if ( error ) + goto Exit; + + target.origin++; + FT_Outline_Translate( outline, + sub[1].x - sub[2].x, + sub[1].y - sub[2].y ); + error = render->raster_render( render->raster, ¶ms ); + x = sub[2].x; + y = sub[2].y; + + Exit: + FT_Outline_Translate( outline, x, y ); + + return error; + } + - /* convert a slot's glyph image into a bitmap */ static FT_Error - ft_smooth_render_generic( FT_Renderer render, - FT_GlyphSlot slot, - FT_Render_Mode mode, - const FT_Vector* origin, - FT_Render_Mode required_mode ) + ft_smooth_raster_lcdv( FT_Renderer render, + FT_Outline* outline, + FT_Bitmap* bitmap ) + { + FT_Error error = FT_Err_Ok; + int pitch = bitmap->pitch; + FT_Vector* sub = render->root.library->lcd_geometry; + FT_Pos x, y; + + FT_Raster_Params params; + + + params.target = bitmap; + params.source = outline; + params.flags = FT_RASTER_FLAG_AA; + + /* Render 3 separate coverage bitmaps, shifting the outline. */ + /* Notice that the subpixel geometry vectors are rotated. */ + /* Triple the pitch to render on each third row. */ + bitmap->pitch *= 3; + bitmap->rows /= 3; + + FT_Outline_Translate( outline, + -sub[0].y, + sub[0].x ); + error = render->raster_render( render->raster, ¶ms ); + x = sub[0].y; + y = -sub[0].x; + if ( error ) + goto Exit; + + bitmap->buffer += pitch; + FT_Outline_Translate( outline, + sub[0].y - sub[1].y, + sub[1].x - sub[0].x ); + error = render->raster_render( render->raster, ¶ms ); + x = sub[1].y; + y = -sub[1].x; + bitmap->buffer -= pitch; + if ( error ) + goto Exit; + + bitmap->buffer += 2 * pitch; + FT_Outline_Translate( outline, + sub[1].y - sub[2].y, + sub[2].x - sub[1].x ); + error = render->raster_render( render->raster, ¶ms ); + x = sub[2].y; + y = -sub[2].x; + bitmap->buffer -= 2 * pitch; + + Exit: + FT_Outline_Translate( outline, x, y ); + + bitmap->pitch /= 3; + bitmap->rows *= 3; + + return error; + } + +#else /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + + /* initialize renderer -- init its raster */ + static FT_Error + ft_smooth_init( FT_Renderer render ) + { + /* set up default LCD filtering */ + FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT ); + + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); + + return 0; + } + + + static FT_Error + ft_smooth_raster_lcd( FT_Renderer render, + FT_Outline* outline, + FT_Bitmap* bitmap ) + { + FT_Error error = FT_Err_Ok; + FT_Vector* points = outline->points; + FT_Vector* points_end = FT_OFFSET( points, outline->n_points ); + FT_Vector* vec; + + FT_Raster_Params params; + + + params.target = bitmap; + params.source = outline; + params.flags = FT_RASTER_FLAG_AA; + + /* implode outline */ + for ( vec = points; vec < points_end; vec++ ) + vec->x *= 3; + + /* render outline into the bitmap */ + error = render->raster_render( render->raster, ¶ms ); + + /* deflate outline */ + for ( vec = points; vec < points_end; vec++ ) + vec->x /= 3; + + return error; + } + + + static FT_Error + ft_smooth_raster_lcdv( FT_Renderer render, + FT_Outline* outline, + FT_Bitmap* bitmap ) + { + FT_Error error = FT_Err_Ok; + FT_Vector* points = outline->points; + FT_Vector* points_end = FT_OFFSET( points, outline->n_points ); + FT_Vector* vec; + + FT_Raster_Params params; + + + params.target = bitmap; + params.source = outline; + params.flags = FT_RASTER_FLAG_AA; + + /* implode outline */ + for ( vec = points; vec < points_end; vec++ ) + vec->y *= 3; + + /* render outline into the bitmap */ + error = render->raster_render( render->raster, ¶ms ); + + /* deflate outline */ + for ( vec = points; vec < points_end; vec++ ) + vec->y /= 3; + + return error; + } + +#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + +/* Oversampling scale to be used in rendering overlaps */ +#define SCALE ( 1 << 2 ) + + /* This function averages inflated spans in direct rendering mode */ + static void + ft_smooth_overlap_spans( int y, + int count, + const FT_Span* spans, + TOrigin* target ) + { + unsigned char* dst = target->origin - ( y / SCALE ) * target->pitch; + unsigned short x; + unsigned int cover, sum; + + + /* When accumulating the oversampled spans we need to assure that */ + /* fully covered pixels are equal to 255 and do not overflow. */ + /* It is important that the SCALE is a power of 2, each subpixel */ + /* cover can also reach a power of 2 after rounding, and the total */ + /* is clamped to 255 when it adds up to 256. */ + for ( ; count--; spans++ ) + { + cover = ( spans->coverage + SCALE * SCALE / 2 ) / ( SCALE * SCALE ); + for ( x = 0; x < spans->len; x++ ) + { + sum = dst[( spans->x + x ) / SCALE] + cover; + dst[( spans->x + x ) / SCALE] = (unsigned char)( sum - ( sum >> 8 ) ); + } + } + } + + + static FT_Error + ft_smooth_raster_overlap( FT_Renderer render, + FT_Outline* outline, + FT_Bitmap* bitmap ) + { + FT_Error error = FT_Err_Ok; + FT_Vector* points = outline->points; + FT_Vector* points_end = FT_OFFSET( points, outline->n_points ); + FT_Vector* vec; + + FT_Raster_Params params; + TOrigin target; + + + /* Reject outlines that are too wide for 16-bit FT_Span. */ + /* Other limits are applied upstream with the same error code. */ + if ( bitmap->width * SCALE > 0x7FFF ) + return FT_THROW( Raster_Overflow ); + + /* Set up direct rendering to average oversampled spans. */ + params.source = outline; + params.flags = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT; + params.gray_spans = (FT_SpanFunc)ft_smooth_overlap_spans; + params.user = ⌖ + + params.clip_box.xMin = 0; + params.clip_box.yMin = 0; + params.clip_box.xMax = bitmap->width * SCALE; + params.clip_box.yMax = bitmap->rows * SCALE; + + if ( bitmap->pitch < 0 ) + target.origin = bitmap->buffer; + else + target.origin = bitmap->buffer + + ( bitmap->rows - 1 ) * (unsigned int)bitmap->pitch; + + target.pitch = bitmap->pitch; + + /* inflate outline */ + for ( vec = points; vec < points_end; vec++ ) + { + vec->x *= SCALE; + vec->y *= SCALE; + } + + /* render outline into the bitmap */ + error = render->raster_render( render->raster, ¶ms ); + + /* deflate outline */ + for ( vec = points; vec < points_end; vec++ ) + { + vec->x /= SCALE; + vec->y /= SCALE; + } + + return error; + } + +#undef SCALE + + static FT_Error + ft_smooth_render( FT_Renderer render, + FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ) { FT_Error error = FT_Err_Ok; FT_Outline* outline = &slot->outline; @@ -122,10 +436,6 @@ FT_Memory memory = render->root.memory; FT_Pos x_shift = 0; FT_Pos y_shift = 0; - FT_Int hmul = ( mode == FT_RENDER_MODE_LCD ); - FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V ); - - FT_Raster_Params params; /* check glyph image format */ @@ -136,7 +446,10 @@ } /* check mode */ - if ( mode != required_mode ) + if ( mode != FT_RENDER_MODE_NORMAL && + mode != FT_RENDER_MODE_LIGHT && + mode != FT_RENDER_MODE_LCD && + mode != FT_RENDER_MODE_LCD_V ) { error = FT_THROW( Cannot_Render_Glyph ); goto Exit; @@ -155,6 +468,9 @@ goto Exit; } + if ( !bitmap->rows || !bitmap->pitch ) + goto Exit; + /* allocate new one */ if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) goto Exit; @@ -178,188 +494,57 @@ if ( x_shift || y_shift ) FT_Outline_Translate( outline, x_shift, y_shift ); - /* set up parameters */ - params.target = bitmap; - params.source = outline; - params.flags = FT_RASTER_FLAG_AA; - -#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - /* implode outline if needed */ + if ( mode == FT_RENDER_MODE_NORMAL || + mode == FT_RENDER_MODE_LIGHT ) { - FT_Vector* points = outline->points; - FT_Vector* points_end = points + outline->n_points; - FT_Vector* vec; - - - if ( hmul ) - for ( vec = points; vec < points_end; vec++ ) - vec->x *= 3; - - if ( vmul ) - for ( vec = points; vec < points_end; vec++ ) - vec->y *= 3; - } - - /* render outline into the bitmap */ - error = render->raster_render( render->raster, ¶ms ); - - /* deflate outline if needed */ - { - FT_Vector* points = outline->points; - FT_Vector* points_end = points + outline->n_points; - FT_Vector* vec; + if ( outline->flags & FT_OUTLINE_OVERLAP ) + error = ft_smooth_raster_overlap( render, outline, bitmap ); + else + { + FT_Raster_Params params; - if ( hmul ) - for ( vec = points; vec < points_end; vec++ ) - vec->x /= 3; + params.target = bitmap; + params.source = outline; + params.flags = FT_RASTER_FLAG_AA; - if ( vmul ) - for ( vec = points; vec < points_end; vec++ ) - vec->y /= 3; + error = render->raster_render( render->raster, ¶ms ); + } } - - if ( error ) - goto Exit; - - /* finally apply filtering */ - if ( hmul || vmul ) + else { - FT_Byte* lcd_weights; - FT_Bitmap_LcdFilterFunc lcd_filter_func; + if ( mode == FT_RENDER_MODE_LCD ) + error = ft_smooth_raster_lcd ( render, outline, bitmap ); + else if ( mode == FT_RENDER_MODE_LCD_V ) + error = ft_smooth_raster_lcdv( render, outline, bitmap ); +#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - /* Per-face LCD filtering takes priority if set up. */ - if ( slot->face && slot->face->internal->lcd_filter_func ) + /* finally apply filtering */ { - lcd_weights = slot->face->internal->lcd_weights; - lcd_filter_func = slot->face->internal->lcd_filter_func; - } - else - { - lcd_weights = slot->library->lcd_weights; - lcd_filter_func = slot->library->lcd_filter_func; - } + FT_Byte* lcd_weights; + FT_Bitmap_LcdFilterFunc lcd_filter_func; - if ( lcd_filter_func ) - lcd_filter_func( bitmap, lcd_weights ); - } - -#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - if ( hmul ) /* lcd */ - { - FT_Byte* line; - FT_Byte* temp = NULL; - FT_UInt i, j; - - unsigned int height = bitmap->rows; - unsigned int width = bitmap->width; - int pitch = bitmap->pitch; - - FT_Vector* sub = slot->library->lcd_geometry; - - - /* Render 3 separate monochrome bitmaps, shifting the outline. */ - width /= 3; - - FT_Outline_Translate( outline, - -sub[0].x, - -sub[0].y ); - error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - - bitmap->buffer += width; - FT_Outline_Translate( outline, - sub[0].x - sub[1].x, - sub[0].y - sub[1].y ); - error = render->raster_render( render->raster, ¶ms ); - bitmap->buffer -= width; - if ( error ) - goto Exit; - - bitmap->buffer += 2 * width; - FT_Outline_Translate( outline, - sub[1].x - sub[2].x, - sub[1].y - sub[2].y ); - error = render->raster_render( render->raster, ¶ms ); - bitmap->buffer -= 2 * width; - if ( error ) - goto Exit; - - x_shift -= sub[2].x; - y_shift -= sub[2].y; - - /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */ - /* XXX: It is more efficient to render every third byte above. */ - - if ( FT_ALLOC( temp, (FT_ULong)pitch ) ) - goto Exit; - - for ( i = 0; i < height; i++ ) - { - line = bitmap->buffer + i * (FT_ULong)pitch; - for ( j = 0; j < width; j++ ) + /* Per-face LCD filtering takes priority if set up. */ + if ( slot->face && slot->face->internal->lcd_filter_func ) { - temp[3 * j ] = line[j]; - temp[3 * j + 1] = line[j + width]; - temp[3 * j + 2] = line[j + width + width]; + lcd_weights = slot->face->internal->lcd_weights; + lcd_filter_func = slot->face->internal->lcd_filter_func; } - FT_MEM_COPY( line, temp, pitch ); + else + { + lcd_weights = slot->library->lcd_weights; + lcd_filter_func = slot->library->lcd_filter_func; + } + + if ( lcd_filter_func ) + lcd_filter_func( bitmap, lcd_weights ); } - FT_FREE( temp ); - } - else if ( vmul ) /* lcd_v */ - { - int pitch = bitmap->pitch; - - FT_Vector* sub = slot->library->lcd_geometry; - - - /* Render 3 separate monochrome bitmaps, shifting the outline. */ - /* Notice that the subpixel geometry vectors are rotated. */ - /* Triple the pitch to render on each third row. */ - bitmap->pitch *= 3; - bitmap->rows /= 3; - - FT_Outline_Translate( outline, - -sub[0].y, - sub[0].x ); - error = render->raster_render( render->raster, ¶ms ); - if ( error ) - goto Exit; - - bitmap->buffer += pitch; - FT_Outline_Translate( outline, - sub[0].y - sub[1].y, - sub[1].x - sub[0].x ); - error = render->raster_render( render->raster, ¶ms ); - bitmap->buffer -= pitch; - if ( error ) - goto Exit; - - bitmap->buffer += 2 * pitch; - FT_Outline_Translate( outline, - sub[1].y - sub[2].y, - sub[2].x - sub[1].x ); - error = render->raster_render( render->raster, ¶ms ); - bitmap->buffer -= 2 * pitch; - if ( error ) - goto Exit; - - x_shift -= sub[2].y; - y_shift += sub[2].x; - - bitmap->pitch /= 3; - bitmap->rows *= 3; - } - else /* grayscale */ - error = render->raster_render( render->raster, ¶ms ); +#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ -#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + } Exit: if ( !error ) @@ -380,45 +565,6 @@ } - /* convert a slot's glyph image into a bitmap */ - static FT_Error - ft_smooth_render( FT_Renderer render, - FT_GlyphSlot slot, - FT_Render_Mode mode, - const FT_Vector* origin ) - { - if ( mode == FT_RENDER_MODE_LIGHT ) - mode = FT_RENDER_MODE_NORMAL; - - return ft_smooth_render_generic( render, slot, mode, origin, - FT_RENDER_MODE_NORMAL ); - } - - - /* convert a slot's glyph image into a horizontal LCD bitmap */ - static FT_Error - ft_smooth_render_lcd( FT_Renderer render, - FT_GlyphSlot slot, - FT_Render_Mode mode, - const FT_Vector* origin ) - { - return ft_smooth_render_generic( render, slot, mode, origin, - FT_RENDER_MODE_LCD ); - } - - - /* convert a slot's glyph image into a vertical LCD bitmap */ - static FT_Error - ft_smooth_render_lcd_v( FT_Renderer render, - FT_GlyphSlot slot, - FT_Render_Mode mode, - const FT_Vector* origin ) - { - return ft_smooth_render_generic( render, slot, mode, origin, - FT_RENDER_MODE_LCD_V ); - } - - FT_DEFINE_RENDERER( ft_smooth_renderer_class, @@ -446,58 +592,4 @@ ) - FT_DEFINE_RENDERER( - ft_smooth_lcd_renderer_class, - - FT_MODULE_RENDERER, - sizeof ( FT_RendererRec ), - - "smooth-lcd", - 0x10000L, - 0x20000L, - - NULL, /* module specific interface */ - - (FT_Module_Constructor)ft_smooth_init, /* module_init */ - (FT_Module_Destructor) NULL, /* module_done */ - (FT_Module_Requester) NULL, /* get_interface */ - - FT_GLYPH_FORMAT_OUTLINE, - - (FT_Renderer_RenderFunc) ft_smooth_render_lcd, /* render_glyph */ - (FT_Renderer_TransformFunc)ft_smooth_transform, /* transform_glyph */ - (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */ - (FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */ - - (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */ - ) - - - FT_DEFINE_RENDERER( - ft_smooth_lcdv_renderer_class, - - FT_MODULE_RENDERER, - sizeof ( FT_RendererRec ), - - "smooth-lcdv", - 0x10000L, - 0x20000L, - - NULL, /* module specific interface */ - - (FT_Module_Constructor)ft_smooth_init, /* module_init */ - (FT_Module_Destructor) NULL, /* module_done */ - (FT_Module_Requester) NULL, /* get_interface */ - - FT_GLYPH_FORMAT_OUTLINE, - - (FT_Renderer_RenderFunc) ft_smooth_render_lcd_v, /* render_glyph */ - (FT_Renderer_TransformFunc)ft_smooth_transform, /* transform_glyph */ - (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */ - (FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */ - - (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */ - ) - - /* END */ diff --git a/src/3rdparty/freetype/src/smooth/ftsmooth.h b/src/3rdparty/freetype/src/smooth/ftsmooth.h index fbb21a31d0..22a88d54ec 100644 --- a/src/3rdparty/freetype/src/smooth/ftsmooth.h +++ b/src/3rdparty/freetype/src/smooth/ftsmooth.h @@ -4,7 +4,7 @@ * * Anti-aliasing renderer interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define FTSMOOTH_H_ -#include <ft2build.h> -#include FT_RENDER_H +#include <freetype/ftrender.h> FT_BEGIN_HEADER @@ -29,10 +28,6 @@ FT_BEGIN_HEADER FT_DECLARE_RENDERER( ft_smooth_renderer_class ) - FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class ) - - FT_DECLARE_RENDERER( ft_smooth_lcdv_renderer_class ) - FT_END_HEADER diff --git a/src/3rdparty/freetype/src/smooth/ftspic.c b/src/3rdparty/freetype/src/smooth/ftspic.c deleted file mode 100644 index 10f04cf4cc..0000000000 --- a/src/3rdparty/freetype/src/smooth/ftspic.c +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftspic.c */ -/* */ -/* The FreeType position independent code services for smooth module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include "ftspic.h" -#include "ftsmerrs.h" - - -#ifdef FT_CONFIG_OPTION_PIC - - /* forward declaration of PIC init functions from ftgrays.c */ - void - FT_Init_Class_ft_grays_raster( FT_Raster_Funcs* funcs ); - - - void - ft_smooth_renderer_class_pic_free( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - - - if ( pic_container->smooth ) - { - SmoothPIC* container = (SmoothPIC*)pic_container->smooth; - - - if ( --container->ref_count ) - return; - - FT_FREE( container ); - pic_container->smooth = NULL; - } - } - - - FT_Error - ft_smooth_renderer_class_pic_init( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - SmoothPIC* container = NULL; - FT_Memory memory = library->memory; - - - /* since this function also serve smooth_lcd and smooth_lcdv renderers, - it implements reference counting */ - if ( pic_container->smooth ) - { - ((SmoothPIC*)pic_container->smooth)->ref_count++; - return error; - } - - /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC( container, sizeof ( *container ) ) ) - return error; - FT_MEM_SET( container, 0, sizeof ( *container ) ); - pic_container->smooth = container; - - container->ref_count = 1; - - /* initialize pointer table - */ - /* this is how the module usually expects this data */ - FT_Init_Class_ft_grays_raster( &container->ft_grays_raster ); - - return error; - } - - - /* re-route these init and free functions to the above functions */ - FT_Error - ft_smooth_lcd_renderer_class_pic_init( FT_Library library ) - { - return ft_smooth_renderer_class_pic_init( library ); - } - - - void - ft_smooth_lcd_renderer_class_pic_free( FT_Library library ) - { - ft_smooth_renderer_class_pic_free( library ); - } - - - FT_Error - ft_smooth_lcdv_renderer_class_pic_init( FT_Library library ) - { - return ft_smooth_renderer_class_pic_init( library ); - } - - - void - ft_smooth_lcdv_renderer_class_pic_free( FT_Library library ) - { - ft_smooth_renderer_class_pic_free( library ); - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/smooth/ftspic.h b/src/3rdparty/freetype/src/smooth/ftspic.h deleted file mode 100644 index 80fb64cff4..0000000000 --- a/src/3rdparty/freetype/src/smooth/ftspic.h +++ /dev/null @@ -1,75 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftspic.h */ -/* */ -/* The FreeType position independent code services for smooth module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef FTSPIC_H_ -#define FTSPIC_H_ - - -#include FT_INTERNAL_PIC_H - - -FT_BEGIN_HEADER - -#ifndef FT_CONFIG_OPTION_PIC - -#define FT_GRAYS_RASTER_GET ft_grays_raster - -#else /* FT_CONFIG_OPTION_PIC */ - - typedef struct SmoothPIC_ - { - int ref_count; - FT_Raster_Funcs ft_grays_raster; - - } SmoothPIC; - - -#define GET_PIC( lib ) \ - ( (SmoothPIC*)( (lib)->pic_container.smooth ) ) -#define FT_GRAYS_RASTER_GET ( GET_PIC( library )->ft_grays_raster ) - - - /* see ftspic.c for the implementation */ - void - ft_smooth_renderer_class_pic_free( FT_Library library ); - - void - ft_smooth_lcd_renderer_class_pic_free( FT_Library library ); - - void - ft_smooth_lcdv_renderer_class_pic_free( FT_Library library ); - - FT_Error - ft_smooth_renderer_class_pic_init( FT_Library library ); - - FT_Error - ft_smooth_lcd_renderer_class_pic_init( FT_Library library ); - - FT_Error - ft_smooth_lcdv_renderer_class_pic_init( FT_Library library ); - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - -FT_END_HEADER - -#endif /* FTSPIC_H_ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/smooth/module.mk b/src/3rdparty/freetype/src/smooth/module.mk index 44b76dfec6..9b1507f1e0 100644 --- a/src/3rdparty/freetype/src/smooth/module.mk +++ b/src/3rdparty/freetype/src/smooth/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -18,10 +18,6 @@ FTMODULE_H_COMMANDS += SMOOTH_RENDERER define SMOOTH_RENDERER $(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_renderer_class $(CLOSE_DRIVER) $(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer$(ECHO_DRIVER_DONE) -$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcd_renderer_class $(CLOSE_DRIVER) -$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for LCDs$(ECHO_DRIVER_DONE) -$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcdv_renderer_class $(CLOSE_DRIVER) -$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for vertical LCDs$(ECHO_DRIVER_DONE) endef # EOF diff --git a/src/3rdparty/freetype/src/smooth/rules.mk b/src/3rdparty/freetype/src/smooth/rules.mk index 0153ac24a4..b08056fac5 100644 --- a/src/3rdparty/freetype/src/smooth/rules.mk +++ b/src/3rdparty/freetype/src/smooth/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/smooth/smooth.c b/src/3rdparty/freetype/src/smooth/smooth.c index 9c543d3360..04b531c087 100644 --- a/src/3rdparty/freetype/src/smooth/smooth.c +++ b/src/3rdparty/freetype/src/smooth/smooth.c @@ -4,7 +4,7 @@ * * FreeType anti-aliasing rasterer module component (body only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "ftgrays.c" #include "ftsmooth.c" diff --git a/src/3rdparty/freetype/src/tools/Jamfile b/src/3rdparty/freetype/src/tools/Jamfile deleted file mode 100644 index 475161e07f..0000000000 --- a/src/3rdparty/freetype/src/tools/Jamfile +++ /dev/null @@ -1,5 +0,0 @@ -# Jamfile for src/tools -# -SubDir FT2_TOP src tools ; - -Main apinames : apinames.c ; diff --git a/src/3rdparty/freetype/src/tools/afblue.pl b/src/3rdparty/freetype/src/tools/afblue.pl index 937d4ecf6e..bbc4f472c9 100644 --- a/src/3rdparty/freetype/src/tools/afblue.pl +++ b/src/3rdparty/freetype/src/tools/afblue.pl @@ -5,7 +5,7 @@ # # Process a blue zone character data file. # -# Copyright (C) 2013-2019 by +# Copyright (C) 2013-2020 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/tools/chktrcmp.py b/src/3rdparty/freetype/src/tools/chktrcmp.py index 4c40bdafdb..4c40bdafdb 100644..100755 --- a/src/3rdparty/freetype/src/tools/chktrcmp.py +++ b/src/3rdparty/freetype/src/tools/chktrcmp.py diff --git a/src/3rdparty/freetype/src/tools/docmaker/content.py b/src/3rdparty/freetype/src/tools/docmaker/content.py deleted file mode 100644 index 198780aee4..0000000000 --- a/src/3rdparty/freetype/src/tools/docmaker/content.py +++ /dev/null @@ -1,672 +0,0 @@ -# -# content.py -# -# Parse comment blocks to build content blocks (library file). -# -# Copyright 2002-2018 by -# David Turner. -# -# This file is part of the FreeType project, and may only be used, -# modified, and distributed under the terms of the FreeType project -# license, LICENSE.TXT. By continuing to use, modify, or distribute -# this file you indicate that you have read the license and -# understand and accept it fully. - -# -# This file contains routines to parse documentation comment blocks, -# building more structured objects out of them. -# - - -from sources import * -from utils import * - -import string, re - - -# -# Regular expressions to detect code sequences. `Code sequences' are simply -# code fragments embedded in '{' and '}', as demonstrated in the following -# example. -# -# { -# x = y + z; -# if ( zookoo == 2 ) -# { -# foobar(); -# } -# } -# -# Note that the indentation of the first opening brace and the last closing -# brace must be exactly the same. The code sequence itself should have a -# larger indentation than the surrounding braces. -# -re_code_start = re.compile( r"(\s*){\s*$" ) -re_code_end = re.compile( r"(\s*)}\s*$" ) - - -# -# A regular expression to isolate identifiers from other text. Two syntax -# forms are supported: -# -# <name> -# <name>[<id>] -# -# where both `<name>' and `<id>' consist of alphanumeric characters, `_', -# and `-'. Use `<id>' if there are multiple, valid `<name>' entries; in the -# index, `<id>' will be appended in parentheses. -# -# For example, -# -# stem_darkening[autofit] -# -# becomes `stem_darkening (autofit)' in the index. -# -re_identifier = re.compile( r""" - ((?:\w|-)+ - (?:\[(?:\w|-)+\])?) - """, re.VERBOSE ) - - -# -# We collect macro names ending in `_H' (group 1), as defined in -# `freetype/config/ftheader.h'. While outputting the object data, we use -# this info together with the object's file location (group 2) to emit the -# appropriate header file macro and its associated file name before the -# object itself. -# -# Example: -# -# #define FT_FREETYPE_H <freetype.h> -# -re_header_macro = re.compile( r'^#define\s{1,}(\w{1,}_H)\s{1,}<(.*)>' ) - - -################################################################ -## -## DOC CODE CLASS -## -## The `DocCode' class is used to store source code lines. -## -## `self.lines' contains a set of source code lines that will be dumped as -## HTML in a <PRE> tag. -## -## The object is filled line by line by the parser; it strips the leading -## `margin' space from each input line before storing it in `self.lines'. -## -class DocCode: - - def __init__( self, margin, lines ): - self.lines = [] - self.words = None - - # remove margin spaces - for l in lines: - if string.strip( l[:margin] ) == "": - l = l[margin:] - self.lines.append( l ) - - def dump( self, prefix = "", width = 60 ): - lines = self.dump_lines( 0, width ) - for l in lines: - print( prefix + l ) - - def dump_lines( self, margin = 0, width = 60 ): - result = [] - for l in self.lines: - result.append( " " * margin + l ) - return result - - - -################################################################ -## -## DOC PARA CLASS -## -## `Normal' text paragraphs are stored in the `DocPara' class. -## -## `self.words' contains the list of words that make up the paragraph. -## -class DocPara: - - def __init__( self, lines ): - self.lines = None - self.words = [] - for l in lines: - l = string.strip( l ) - self.words.extend( string.split( l ) ) - - def dump( self, prefix = "", width = 60 ): - lines = self.dump_lines( 0, width ) - for l in lines: - print( prefix + l ) - - def dump_lines( self, margin = 0, width = 60 ): - cur = "" # current line - col = 0 # current width - result = [] - - for word in self.words: - ln = len( word ) - if col > 0: - ln = ln + 1 - - if col + ln > width: - result.append( " " * margin + cur ) - cur = word - col = len( word ) - else: - if col > 0: - cur = cur + " " - cur = cur + word - col = col + ln - - if col > 0: - result.append( " " * margin + cur ) - - return result - - -################################################################ -## -## DOC FIELD CLASS -## -## The `DocField' class stores a list containing either `DocPara' or -## `DocCode' objects. Each DocField object also has an optional `name' -## that is used when the object corresponds to a field or value definition. -## -class DocField: - - def __init__( self, name, lines ): - self.name = name # can be `None' for normal paragraphs/sources - self.items = [] # list of items - - mode_none = 0 # start parsing mode - mode_code = 1 # parsing code sequences - mode_para = 3 # parsing normal paragraph - - margin = -1 # current code sequence indentation - cur_lines = [] - - # analyze the markup lines to check whether they contain paragraphs, - # code sequences, or fields definitions - # - start = 0 - mode = mode_none - - for l in lines: - # are we parsing a code sequence? - if mode == mode_code: - m = re_code_end.match( l ) - if m and len( m.group( 1 ) ) <= margin: - # that's it, we finished the code sequence - code = DocCode( 0, cur_lines ) - self.items.append( code ) - margin = -1 - cur_lines = [] - mode = mode_none - else: - # otherwise continue the code sequence - cur_lines.append( l[margin:] ) - else: - # start of code sequence? - m = re_code_start.match( l ) - if m: - # save current lines - if cur_lines: - para = DocPara( cur_lines ) - self.items.append( para ) - cur_lines = [] - - # switch to code extraction mode - margin = len( m.group( 1 ) ) - mode = mode_code - else: - if not string.split( l ) and cur_lines: - # if the line is empty, we end the current paragraph, - # if any - para = DocPara( cur_lines ) - self.items.append( para ) - cur_lines = [] - else: - # otherwise, simply add the line to the current - # paragraph - cur_lines.append( l ) - - if mode == mode_code: - # unexpected end of code sequence - code = DocCode( margin, cur_lines ) - self.items.append( code ) - elif cur_lines: - para = DocPara( cur_lines ) - self.items.append( para ) - - def dump( self, prefix = "" ): - if self.field: - print( prefix + self.field + " ::" ) - prefix = prefix + "----" - - first = 1 - for p in self.items: - if not first: - print( "" ) - p.dump( prefix ) - first = 0 - - def dump_lines( self, margin = 0, width = 60 ): - result = [] - nl = None - - for p in self.items: - if nl: - result.append( "" ) - - result.extend( p.dump_lines( margin, width ) ) - nl = 1 - - return result - - -# -# A regular expression to detect field definitions. -# -# Examples: -# -# foo :: -# foo.bar :: -# -re_field = re.compile( r""" - \s* - ( - \w* - | - \w (\w | \.)* \w - ) - \s* :: - """, re.VERBOSE ) - - -################################################################ -## -## DOC MARKUP CLASS -## -class DocMarkup: - - def __init__( self, tag, lines ): - self.tag = string.lower( tag ) - self.fields = [] - - cur_lines = [] - field = None - mode = 0 - - for l in lines: - m = re_field.match( l ) - if m: - # We detected the start of a new field definition. - - # first, save the current one - if cur_lines: - f = DocField( field, cur_lines ) - self.fields.append( f ) - cur_lines = [] - field = None - - field = m.group( 1 ) # record field name - ln = len( m.group( 0 ) ) - l = " " * ln + l[ln:] - cur_lines = [l] - else: - cur_lines.append( l ) - - if field or cur_lines: - f = DocField( field, cur_lines ) - self.fields.append( f ) - - def get_name( self ): - try: - return self.fields[0].items[0].words[0] - except: - return None - - def dump( self, margin ): - print( " " * margin + "<" + self.tag + ">" ) - for f in self.fields: - f.dump( " " ) - print( " " * margin + "</" + self.tag + ">" ) - - -################################################################ -## -## DOC CHAPTER CLASS -## -class DocChapter: - - def __init__( self, block ): - self.block = block - self.sections = [] - if block: - self.name = block.name - self.title = block.get_markup_words( "title" ) - self.order = block.get_markup_words( "sections" ) - else: - self.name = "Other" - self.title = string.split( "Miscellaneous" ) - self.order = [] - - -################################################################ -## -## DOC SECTION CLASS -## -class DocSection: - - def __init__( self, name = "Other" ): - self.name = name - self.blocks = {} - self.block_names = [] # ordered block names in section - self.defs = [] - self.abstract = "" - self.description = "" - self.order = [] - self.title = "ERROR" - self.chapter = None - - def add_def( self, block ): - self.defs.append( block ) - - def add_block( self, block ): - self.block_names.append( block.name ) - self.blocks[block.name] = block - - def process( self ): - # look up one block that contains a valid section description - for block in self.defs: - title = block.get_markup_text( "title" ) - if title: - self.title = title - self.abstract = block.get_markup_words( "abstract" ) - self.description = block.get_markup_items( "description" ) - self.order = block.get_markup_words_all( "order" ) - return - - def reorder( self ): - self.block_names = sort_order_list( self.block_names, self.order ) - - -################################################################ -## -## CONTENT PROCESSOR CLASS -## -class ContentProcessor: - - def __init__( self ): - """Initialize a block content processor.""" - self.reset() - - self.sections = {} # dictionary of documentation sections - self.section = None # current documentation section - - self.chapters = [] # list of chapters - - self.headers = {} # dictionary of header macros - - def set_section( self, section_name ): - """Set current section during parsing.""" - if not section_name in self.sections: - section = DocSection( section_name ) - self.sections[section_name] = section - self.section = section - else: - self.section = self.sections[section_name] - - def add_chapter( self, block ): - chapter = DocChapter( block ) - self.chapters.append( chapter ) - - def reset( self ): - """Reset the content processor for a new block.""" - self.markups = [] - self.markup = None - self.markup_lines = [] - - def add_markup( self ): - """Add a new markup section.""" - if self.markup and self.markup_lines: - - # get rid of last line of markup if it's empty - marks = self.markup_lines - if len( marks ) > 0 and not string.strip( marks[-1] ): - self.markup_lines = marks[:-1] - - m = DocMarkup( self.markup, self.markup_lines ) - - self.markups.append( m ) - - self.markup = None - self.markup_lines = [] - - def process_content( self, content ): - """Process a block content and return a list of DocMarkup objects - corresponding to it.""" - markup = None - markup_lines = [] - first = 1 - - margin = -1 - in_code = 0 - - for line in content: - if in_code: - m = re_code_end.match( line ) - if m and len( m.group( 1 ) ) <= margin: - in_code = 0 - margin = -1 - else: - m = re_code_start.match( line ) - if m: - in_code = 1 - margin = len( m.group( 1 ) ) - - found = None - - if not in_code: - for t in re_markup_tags: - m = t.match( line ) - if m: - found = string.lower( m.group( 1 ) ) - prefix = len( m.group( 0 ) ) - # remove markup from line - line = " " * prefix + line[prefix:] - break - - # is it the start of a new markup section ? - if found: - first = 0 - self.add_markup() # add current markup content - self.markup = found - if len( string.strip( line ) ) > 0: - self.markup_lines.append( line ) - elif first == 0: - self.markup_lines.append( line ) - - self.add_markup() - - return self.markups - - def parse_sources( self, source_processor ): - blocks = source_processor.blocks - count = len( blocks ) - - for n in range( count ): - source = blocks[n] - if source.content: - # this is a documentation comment, we need to catch - # all following normal blocks in the "follow" list - # - follow = [] - m = n + 1 - while m < count and not blocks[m].content: - follow.append( blocks[m] ) - m = m + 1 - - doc_block = DocBlock( source, follow, self ) - - def finish( self ): - # process all sections to extract their abstract, description - # and ordered list of items - # - for sec in self.sections.values(): - sec.process() - - # process chapters to check that all sections are correctly - # listed there - for chap in self.chapters: - for sec in chap.order: - if sec in self.sections: - section = self.sections[sec] - section.chapter = chap - section.reorder() - chap.sections.append( section ) - else: - sys.stderr.write( "WARNING: chapter '" + \ - chap.name + "' in " + chap.block.location() + \ - " lists unknown section '" + sec + "'\n" ) - - # check that all sections are in a chapter - # - others = [] - for sec in self.sections.values(): - if not sec.chapter: - sec.reorder() - others.append( sec ) - - # create a new special chapter for all remaining sections - # when necessary - # - if others: - chap = DocChapter( None ) - chap.sections = others - self.chapters.append( chap ) - - -################################################################ -## -## DOC BLOCK CLASS -## -class DocBlock: - - def __init__( self, source, follow, processor ): - processor.reset() - - self.source = source - self.code = [] - self.type = "ERRTYPE" - self.name = "ERRNAME" - self.section = processor.section - self.markups = processor.process_content( source.content ) - - # compute block type from first markup tag - try: - self.type = self.markups[0].tag - except: - pass - - # compute block name from first markup paragraph - try: - markup = self.markups[0] - para = markup.fields[0].items[0] - name = para.words[0] - m = re_identifier.match( name ) - if m: - name = m.group( 1 ) - self.name = name - except: - pass - - if self.type == "section": - # detect new section starts - processor.set_section( self.name ) - processor.section.add_def( self ) - elif self.type == "chapter": - # detect new chapter - processor.add_chapter( self ) - else: - processor.section.add_block( self ) - - # now, compute the source lines relevant to this documentation - # block. We keep normal comments in for obvious reasons (??) - source = [] - for b in follow: - if b.format: - break - for l in b.lines: - # collect header macro definitions - m = re_header_macro.match( l ) - if m: - processor.headers[m.group( 2 )] = m.group( 1 ); - - # we use "/* */" as a separator - if re_source_sep.match( l ): - break - source.append( l ) - - # now strip the leading and trailing empty lines from the sources - start = 0 - end = len( source ) - 1 - - while start < end and not string.strip( source[start] ): - start = start + 1 - - while start < end and not string.strip( source[end] ): - end = end - 1 - - if start == end and not string.strip( source[start] ): - self.code = [] - else: - self.code = source[start:end + 1] - - def location( self ): - return self.source.location() - - def get_markup( self, tag_name ): - """Return the DocMarkup corresponding to a given tag in a block.""" - for m in self.markups: - if m.tag == string.lower( tag_name ): - return m - return None - - def get_markup_words( self, tag_name ): - try: - m = self.get_markup( tag_name ) - return m.fields[0].items[0].words - except: - return [] - - def get_markup_words_all( self, tag_name ): - try: - m = self.get_markup( tag_name ) - words = [] - for item in m.fields[0].items: - # We honour empty lines in an `<Order>' section element by - # adding the sentinel `/empty/'. The formatter should then - # convert it to an appropriate representation in the - # `section_enter' function. - words += item.words - words.append( "/empty/" ) - return words - except: - return [] - - def get_markup_text( self, tag_name ): - result = self.get_markup_words( tag_name ) - return string.join( result ) - - def get_markup_items( self, tag_name ): - try: - m = self.get_markup( tag_name ) - return m.fields[0].items - except: - return None - -# eof diff --git a/src/3rdparty/freetype/src/tools/docmaker/docbeauty.py b/src/3rdparty/freetype/src/tools/docmaker/docbeauty.py deleted file mode 100644 index 0b021fa6c9..0000000000 --- a/src/3rdparty/freetype/src/tools/docmaker/docbeauty.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python -# -# DocBeauty (c) 2003, 2004, 2008 David Turner <david@freetype.org> -# -# This program is used to beautify the documentation comments used -# in the FreeType 2 public headers. -# - -from sources import * -from content import * -from utils import * - -import sys, os, string, getopt - - -content_processor = ContentProcessor() - - -def beautify_block( block ): - if block.content: - content_processor.reset() - - markups = content_processor.process_content( block.content ) - text = [] - first = 1 - - for markup in markups: - text.extend( markup.beautify( first ) ) - first = 0 - - # now beautify the documentation "borders" themselves - lines = [" /*************************************************************************"] - for l in text: - lines.append( " *" + l ) - lines.append( " */" ) - - block.lines = lines - - -def usage(): - print( "\nDocBeauty 0.1 Usage information\n" ) - print( " docbeauty [options] file1 [file2 ...]\n" ) - print( "using the following options:\n" ) - print( " -h : print this page" ) - print( " -b : backup original files with the 'orig' extension" ) - print( "" ) - print( " --backup : same as -b" ) - - -def main( argv ): - """main program loop""" - - global output_dir - - try: - opts, args = getopt.getopt( sys.argv[1:], \ - "hb", \ - ["help", "backup"] ) - except getopt.GetoptError: - usage() - sys.exit( 2 ) - - if args == []: - usage() - sys.exit( 1 ) - - # process options - # - output_dir = None - do_backup = None - - for opt in opts: - if opt[0] in ( "-h", "--help" ): - usage() - sys.exit( 0 ) - - if opt[0] in ( "-b", "--backup" ): - do_backup = 1 - - # create context and processor - source_processor = SourceProcessor() - - # retrieve the list of files to process - file_list = make_file_list( args ) - for filename in file_list: - source_processor.parse_file( filename ) - - for block in source_processor.blocks: - beautify_block( block ) - - new_name = filename + ".new" - ok = None - - try: - file = open( new_name, "wt" ) - for block in source_processor.blocks: - for line in block.lines: - file.write( line ) - file.write( "\n" ) - file.close() - except: - ok = 0 - - -# if called from the command line -# -if __name__ == '__main__': - main( sys.argv ) - - -# eof diff --git a/src/3rdparty/freetype/src/tools/docmaker/docmaker.py b/src/3rdparty/freetype/src/tools/docmaker/docmaker.py deleted file mode 100644 index eb49afb0a0..0000000000 --- a/src/3rdparty/freetype/src/tools/docmaker/docmaker.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python -# -# docmaker.py -# -# Convert source code markup to HTML documentation. -# -# Copyright 2002-2018 by -# David Turner. -# -# This file is part of the FreeType project, and may only be used, -# modified, and distributed under the terms of the FreeType project -# license, LICENSE.TXT. By continuing to use, modify, or distribute -# this file you indicate that you have read the license and -# understand and accept it fully. - -# -# This program is a re-write of the original DocMaker tool used to generate -# the API Reference of the FreeType font rendering engine by converting -# in-source comments into structured HTML. -# -# This new version is capable of outputting XML data as well as accepting -# more liberal formatting options. It also uses regular expression matching -# and substitution to speed up operation significantly. -# - -from sources import * -from content import * -from utils import * -from formatter import * -from tohtml import * - -import utils - -import sys, glob, getopt - - -def usage(): - print( "\nDocMaker Usage information\n" ) - print( " docmaker [options] file1 [file2 ...]\n" ) - print( "using the following options:\n" ) - print( " -h : print this page" ) - print( " -t : set project title, as in '-t \"My Project\"'" ) - print( " -o : set output directory, as in '-o mydir'" ) - print( " -p : set documentation prefix, as in '-p ft2'" ) - print( "" ) - print( " --title : same as -t, as in '--title=\"My Project\"'" ) - print( " --output : same as -o, as in '--output=mydir'" ) - print( " --prefix : same as -p, as in '--prefix=ft2'" ) - - -def main( argv ): - """Main program loop.""" - - global output_dir - - try: - opts, args = getopt.getopt( sys.argv[1:], - "ht:o:p:", - ["help", "title=", "output=", "prefix="] ) - except getopt.GetoptError: - usage() - sys.exit( 2 ) - - if args == []: - usage() - sys.exit( 1 ) - - # process options - project_title = "Project" - project_prefix = None - output_dir = None - - for opt in opts: - if opt[0] in ( "-h", "--help" ): - usage() - sys.exit( 0 ) - - if opt[0] in ( "-t", "--title" ): - project_title = opt[1] - - if opt[0] in ( "-o", "--output" ): - utils.output_dir = opt[1] - - if opt[0] in ( "-p", "--prefix" ): - project_prefix = opt[1] - - check_output() - - # create context and processor - source_processor = SourceProcessor() - content_processor = ContentProcessor() - - # retrieve the list of files to process - file_list = make_file_list( args ) - for filename in file_list: - source_processor.parse_file( filename ) - content_processor.parse_sources( source_processor ) - - # process sections - content_processor.finish() - - formatter = HtmlFormatter( content_processor, - project_title, - project_prefix ) - - formatter.toc_dump() - formatter.index_dump() - formatter.section_dump_all() - - -# if called from the command line -if __name__ == '__main__': - main( sys.argv ) - -# eof diff --git a/src/3rdparty/freetype/src/tools/docmaker/formatter.py b/src/3rdparty/freetype/src/tools/docmaker/formatter.py deleted file mode 100644 index 2708fd40d6..0000000000 --- a/src/3rdparty/freetype/src/tools/docmaker/formatter.py +++ /dev/null @@ -1,228 +0,0 @@ -# -# formatter.py -# -# Convert parsed content blocks to a structured document (library file). -# -# Copyright 2002-2018 by -# David Turner. -# -# This file is part of the FreeType project, and may only be used, -# modified, and distributed under the terms of the FreeType project -# license, LICENSE.TXT. By continuing to use, modify, or distribute -# this file you indicate that you have read the license and -# understand and accept it fully. - -# -# This is the base Formatter class. Its purpose is to convert a content -# processor's data into specific documents (i.e., table of contents, global -# index, and individual API reference indices). -# -# You need to sub-class it to output anything sensible. For example, the -# file `tohtml.py' contains the definition of the `HtmlFormatter' sub-class -# to output HTML. -# - - -from sources import * -from content import * -from utils import * - - -################################################################ -## -## FORMATTER CLASS -## -class Formatter: - - def __init__( self, processor ): - self.processor = processor - self.identifiers = {} - self.chapters = processor.chapters - self.sections = processor.sections.values() - self.block_index = [] - - # store all blocks in a dictionary - self.blocks = [] - for section in self.sections: - for block in section.blocks.values(): - self.add_identifier( block.name, block ) - - # add enumeration values to the index, since this is useful - for markup in block.markups: - if markup.tag == 'values': - for field in markup.fields: - self.add_identifier( field.name, block ) - - self.block_index = self.identifiers.keys() - self.block_index.sort( key = index_key ) - - # also add section names to dictionary (without making them appear - # in the index) - for section in self.sections: - self.add_identifier( section.name, section ) - - def add_identifier( self, name, block ): - if name in self.identifiers: - # duplicate name! - sys.stderr.write( "WARNING: duplicate definition for" - + " '" + name + "' " - + "in " + block.location() + ", " - + "previous definition in " - + self.identifiers[name].location() - + "\n" ) - else: - self.identifiers[name] = block - - # - # formatting the table of contents - # - def toc_enter( self ): - pass - - def toc_chapter_enter( self, chapter ): - pass - - def toc_section_enter( self, section ): - pass - - def toc_section_exit( self, section ): - pass - - def toc_chapter_exit( self, chapter ): - pass - - def toc_index( self, index_filename ): - pass - - def toc_exit( self ): - pass - - def toc_dump( self, toc_filename = None, index_filename = None ): - output = None - if toc_filename: - output = open_output( toc_filename ) - - self.toc_enter() - - for chap in self.processor.chapters: - - self.toc_chapter_enter( chap ) - - for section in chap.sections: - self.toc_section_enter( section ) - self.toc_section_exit( section ) - - self.toc_chapter_exit( chap ) - - self.toc_index( index_filename ) - - self.toc_exit() - - if output: - close_output( output ) - - # - # formatting the index - # - def index_enter( self ): - pass - - def index_name_enter( self, name ): - pass - - def index_name_exit( self, name ): - pass - - def index_exit( self ): - pass - - def index_dump( self, index_filename = None ): - output = None - if index_filename: - output = open_output( index_filename ) - - self.index_enter() - - for name in self.block_index: - self.index_name_enter( name ) - self.index_name_exit( name ) - - self.index_exit() - - if output: - close_output( output ) - - # - # formatting a section - # - def section_enter( self, section ): - pass - - def block_enter( self, block ): - pass - - def markup_enter( self, markup, block = None ): - pass - - def field_enter( self, field, markup = None, block = None ): - pass - - def field_exit( self, field, markup = None, block = None ): - pass - - def markup_exit( self, markup, block = None ): - pass - - def block_exit( self, block ): - pass - - def section_exit( self, section ): - pass - - def section_dump( self, section, section_filename = None ): - output = None - if section_filename: - output = open_output( section_filename ) - - self.section_enter( section ) - - for name in section.block_names: - skip_entry = 0 - try: - block = self.identifiers[name] - # `block_names' can contain field names also, - # which we filter out - for markup in block.markups: - if markup.tag == 'values': - for field in markup.fields: - if field.name == name: - skip_entry = 1 - except: - skip_entry = 1 # this happens e.g. for `/empty/' entries - - if skip_entry: - continue - - self.block_enter( block ) - - for markup in block.markups[1:]: # always ignore first markup! - self.markup_enter( markup, block ) - - for field in markup.fields: - self.field_enter( field, markup, block ) - self.field_exit( field, markup, block ) - - self.markup_exit( markup, block ) - - self.block_exit( block ) - - self.section_exit( section ) - - if output: - close_output( output ) - - def section_dump_all( self ): - for section in self.sections: - self.section_dump( section ) - -# eof diff --git a/src/3rdparty/freetype/src/tools/docmaker/sources.py b/src/3rdparty/freetype/src/tools/docmaker/sources.py deleted file mode 100644 index e3b95e0faa..0000000000 --- a/src/3rdparty/freetype/src/tools/docmaker/sources.py +++ /dev/null @@ -1,410 +0,0 @@ -# -# sources.py -# -# Convert source code comments to multi-line blocks (library file). -# -# Copyright 2002-2018 by -# David Turner. -# -# This file is part of the FreeType project, and may only be used, -# modified, and distributed under the terms of the FreeType project -# license, LICENSE.TXT. By continuing to use, modify, or distribute -# this file you indicate that you have read the license and -# understand and accept it fully. - -# -# This library file contains definitions of classes needed to decompose C -# source code files into a series of multi-line `blocks'. There are two -# kinds of blocks. -# -# - Normal blocks, which contain source code or ordinary comments. -# -# - Documentation blocks, which have restricted formatting, and whose text -# always start with a documentation markup tag like `<Function>', -# `<Type>', etc. -# -# The routines to process the content of documentation blocks are contained -# in file `content.py'; the classes and methods found here only deal with -# text parsing and basic documentation block extraction. -# - - -import fileinput, re, string - - -################################################################ -## -## SOURCE BLOCK FORMAT CLASS -## -## A simple class containing compiled regular expressions to detect -## potential documentation format block comments within C source code. -## -## The `column' pattern must contain a group to `unbox' the content of -## documentation comment blocks. -## -## Later on, paragraphs are converted to long lines, which simplifies the -## regular expressions that act upon the text. -## -class SourceBlockFormat: - - def __init__( self, id, start, column, end ): - """Create a block pattern, used to recognize special documentation - blocks.""" - self.id = id - self.start = re.compile( start, re.VERBOSE ) - self.column = re.compile( column, re.VERBOSE ) - self.end = re.compile( end, re.VERBOSE ) - - -# -# Format 1 documentation comment blocks. -# -# /************************************/ (at least 2 asterisks) -# /* */ -# /* */ -# /* */ -# /************************************/ (at least 2 asterisks) -# -start = r''' - \s* # any number of whitespace - /\*{2,}/ # followed by '/' and at least two asterisks then '/' - \s*$ # probably followed by whitespace -''' - -column = r''' - \s* # any number of whitespace - /\*{1} # followed by '/' and precisely one asterisk - ([^*].*) # followed by anything (group 1) - \*{1}/ # followed by one asterisk and a '/' - \s*$ # probably followed by whitespace -''' - -re_source_block_format1 = SourceBlockFormat( 1, start, column, start ) - - -# -# Format 2 documentation comment blocks. -# -# /************************************ (at least 2 asterisks) -# * -# * (1 asterisk) -# * -# */ (1 or more asterisks) -# -start = r''' - \s* # any number of whitespace - /\*{2,} # followed by '/' and at least two asterisks - \s*$ # probably followed by whitespace -''' - -column = r''' - \s* # any number of whitespace - \*{1}(?![*/]) # followed by precisely one asterisk not followed by `/' - (.*) # then anything (group1) -''' - -end = r''' - \s* # any number of whitespace - \*+/ # followed by at least one asterisk, then '/' -''' - -re_source_block_format2 = SourceBlockFormat( 2, start, column, end ) - - -# -# The list of supported documentation block formats. We could add new ones -# quite easily. -# -re_source_block_formats = [re_source_block_format1, re_source_block_format2] - - -# -# The following regular expressions correspond to markup tags within the -# documentation comment blocks. They are equivalent despite their different -# syntax. -# -# A markup tag consists of letters or character `-', to be found in group 1. -# -# Notice that a markup tag _must_ begin a new paragraph. -# -re_markup_tag1 = re.compile( r'''\s*<((?:\w|-)*)>''' ) # <xxxx> format -re_markup_tag2 = re.compile( r'''\s*@((?:\w|-)*):''' ) # @xxxx: format - -# -# The list of supported markup tags. We could add new ones quite easily. -# -re_markup_tags = [re_markup_tag1, re_markup_tag2] - - -# -# A regular expression to detect a cross reference, after markup tags have -# been stripped off. -# -# Two syntax forms are supported: -# -# @<name> -# @<name>[<id>] -# -# where both `<name>' and `<id>' consist of alphanumeric characters, `_', -# and `-'. Use `<id>' if there are multiple, valid `<name>' entries. -# -# Example: @foo[bar] -# -re_crossref = re.compile( r""" - @ - (?P<name>(?:\w|-)+ - (?:\[(?:\w|-)+\])?) - (?P<rest>.*) - """, re.VERBOSE ) - -# -# Two regular expressions to detect italic and bold markup, respectively. -# Group 1 is the markup, group 2 the rest of the line. -# -# Note that the markup is limited to words consisting of letters, digits, -# the characters `_' and `-', or an apostrophe (but not as the first -# character). -# -re_italic = re.compile( r"_((?:\w|-)(?:\w|'|-)*)_(.*)" ) # _italic_ -re_bold = re.compile( r"\*((?:\w|-)(?:\w|'|-)*)\*(.*)" ) # *bold* - -# -# This regular expression code to identify an URL has been taken from -# -# https://mail.python.org/pipermail/tutor/2002-September/017228.html -# -# (with slight modifications). -# -urls = r'(?:https?|telnet|gopher|file|wais|ftp)' -ltrs = r'\w' -gunk = r'/#~:.?+=&%@!\-' -punc = r'.:?\-' -any = "%(ltrs)s%(gunk)s%(punc)s" % { 'ltrs' : ltrs, - 'gunk' : gunk, - 'punc' : punc } -url = r""" - ( - \b # start at word boundary - %(urls)s : # need resource and a colon - [%(any)s] +? # followed by one or more of any valid - # character, but be conservative and - # take only what you need to... - (?= # [look-ahead non-consumptive assertion] - [%(punc)s]* # either 0 or more punctuation - (?: # [non-grouping parentheses] - [^%(any)s] | $ # followed by a non-url char - # or end of the string - ) - ) - ) - """ % {'urls' : urls, - 'any' : any, - 'punc' : punc } - -re_url = re.compile( url, re.VERBOSE | re.MULTILINE ) - -# -# A regular expression that stops collection of comments for the current -# block. -# -re_source_sep = re.compile( r'\s*/\*\s*\*/' ) # /* */ - -# -# A regular expression to find possible C identifiers while outputting -# source code verbatim, covering things like `*foo' or `(bar'. Group 1 is -# the prefix, group 2 the identifier -- since we scan lines from left to -# right, sequentially splitting the source code into prefix and identifier -# is fully sufficient for our purposes. -# -re_source_crossref = re.compile( r'(\W*)(\w*)' ) - -# -# A regular expression that matches a list of reserved C source keywords. -# -re_source_keywords = re.compile( '''\\b ( typedef | - struct | - enum | - union | - const | - char | - int | - short | - long | - void | - signed | - unsigned | - \#include | - \#define | - \#undef | - \#if | - \#ifdef | - \#ifndef | - \#else | - \#endif ) \\b''', re.VERBOSE ) - - -################################################################ -## -## SOURCE BLOCK CLASS -## -## There are two important fields in a `SourceBlock' object. -## -## self.lines -## A list of text lines for the corresponding block. -## -## self.content -## For documentation comment blocks only, this is the block content -## that has been `unboxed' from its decoration. This is `None' for all -## other blocks (i.e., sources or ordinary comments with no starting -## markup tag) -## -class SourceBlock: - - def __init__( self, processor, filename, lineno, lines ): - self.processor = processor - self.filename = filename - self.lineno = lineno - self.lines = lines[:] - self.format = processor.format - self.content = [] - - if self.format == None: - return - - words = [] - - # extract comment lines - lines = [] - - for line0 in self.lines: - m = self.format.column.match( line0 ) - if m: - lines.append( m.group( 1 ) ) - - # now, look for a markup tag - for l in lines: - l = string.strip( l ) - if len( l ) > 0: - for tag in re_markup_tags: - if tag.match( l ): - self.content = lines - return - - def location( self ): - return "(" + self.filename + ":" + repr( self.lineno ) + ")" - - # debugging only -- not used in normal operations - def dump( self ): - if self.content: - print( "{{{content start---" ) - for l in self.content: - print( l ) - print( "---content end}}}" ) - return - - fmt = "" - if self.format: - fmt = repr( self.format.id ) + " " - - for line in self.lines: - print( line ) - - -################################################################ -## -## SOURCE PROCESSOR CLASS -## -## The `SourceProcessor' is in charge of reading a C source file and -## decomposing it into a series of different `SourceBlock' objects. -## -## A SourceBlock object consists of the following data. -## -## - A documentation comment block using one of the layouts above. Its -## exact format will be discussed later. -## -## - Normal sources lines, including comments. -## -## -class SourceProcessor: - - def __init__( self ): - """Initialize a source processor.""" - self.blocks = [] - self.filename = None - self.format = None - self.lines = [] - - def reset( self ): - """Reset a block processor and clean up all its blocks.""" - self.blocks = [] - self.format = None - - def parse_file( self, filename ): - """Parse a C source file and add its blocks to the processor's - list.""" - self.reset() - - self.filename = filename - - fileinput.close() - self.format = None - self.lineno = 0 - self.lines = [] - - for line in fileinput.input( filename ): - # strip trailing newlines, important on Windows machines! - if line[-1] == '\012': - line = line[0:-1] - - if self.format == None: - self.process_normal_line( line ) - else: - if self.format.end.match( line ): - # A normal block end. Add it to `lines' and create a - # new block - self.lines.append( line ) - self.add_block_lines() - elif self.format.column.match( line ): - # A normal column line. Add it to `lines'. - self.lines.append( line ) - else: - # An unexpected block end. Create a new block, but - # don't process the line. - self.add_block_lines() - - # we need to process the line again - self.process_normal_line( line ) - - # record the last lines - self.add_block_lines() - - def process_normal_line( self, line ): - """Process a normal line and check whether it is the start of a new - block.""" - for f in re_source_block_formats: - if f.start.match( line ): - self.add_block_lines() - self.format = f - self.lineno = fileinput.filelineno() - - self.lines.append( line ) - - def add_block_lines( self ): - """Add the current accumulated lines and create a new block.""" - if self.lines != []: - block = SourceBlock( self, - self.filename, - self.lineno, - self.lines ) - - self.blocks.append( block ) - self.format = None - self.lines = [] - - # debugging only, not used in normal operations - def dump( self ): - """Print all blocks in a processor.""" - for b in self.blocks: - b.dump() - -# eof diff --git a/src/3rdparty/freetype/src/tools/docmaker/tohtml.py b/src/3rdparty/freetype/src/tools/docmaker/tohtml.py deleted file mode 100644 index 9f318a2a49..0000000000 --- a/src/3rdparty/freetype/src/tools/docmaker/tohtml.py +++ /dev/null @@ -1,725 +0,0 @@ -# -# tohtml.py -# -# A sub-class container of the `Formatter' class to produce HTML. -# -# Copyright 2002-2018 by -# David Turner. -# -# This file is part of the FreeType project, and may only be used, -# modified, and distributed under the terms of the FreeType project -# license, LICENSE.TXT. By continuing to use, modify, or distribute -# this file you indicate that you have read the license and -# understand and accept it fully. - -# The parent class is contained in file `formatter.py'. - - -from sources import * -from content import * -from formatter import * - -import time - - -# The following strings define the HTML header used by all generated pages. -html_header_1 = """\ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" -"https://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>\ -""" - -html_header_2 = """\ - API Reference</title> -<style type="text/css"> - a:link { color: #0000EF; } - a:visited { color: #51188E; } - a:hover { color: #FF0000; } - - body { font-family: Verdana, Geneva, Arial, Helvetica, serif; - color: #000000; - background: #FFFFFF; - width: 87%; - margin: auto; } - - div.section { width: 75%; - margin: auto; } - div.section hr { margin: 4ex 0 1ex 0; } - div.section h4 { background-color: #EEEEFF; - font-size: medium; - font-style: oblique; - font-weight: bold; - margin: 3ex 0 1.5ex 9%; - padding: 0.3ex 0 0.3ex 1%; } - div.section p { margin: 1.5ex 0 1.5ex 10%; } - div.section pre { margin: 3ex 0 3ex 9%; - background-color: #D6E8FF; - padding: 2ex 0 2ex 1%; } - div.section table.fields { width: 90%; - margin: 1.5ex 0 1.5ex 10%; } - div.section table.toc { width: 95%; - margin: 1.5ex 0 1.5ex 5%; } - div.timestamp { text-align: center; - font-size: 69%; - margin: 1.5ex 0 1.5ex 0; } - - h1 { text-align: center; } - h3 { font-size: medium; - margin: 4ex 0 1.5ex 0; } - - p { text-align: justify; } - - pre.colored { color: blue; } - - span.keyword { font-family: monospace; - text-align: left; - white-space: pre; - color: darkblue; } - - table.fields td.val { font-weight: bold; - text-align: right; - width: 30%; - vertical-align: baseline; - padding: 1ex 1em 1ex 0; } - table.fields td.desc { vertical-align: baseline; - padding: 1ex 0 1ex 1em; } - table.fields td.desc p:first-child { margin: 0; } - table.fields td.desc p { margin: 1.5ex 0 0 0; } - table.index { margin: 6ex auto 6ex auto; - border: 0; - border-collapse: separate; - border-spacing: 1em 0.3ex; } - table.index tr { padding: 0; } - table.index td { padding: 0; } - table.index-toc-link { width: 100%; - border: 0; - border-spacing: 0; - margin: 1ex 0 1ex 0; } - table.index-toc-link td.left { padding: 0 0.5em 0 0.5em; - font-size: 83%; - text-align: left; } - table.index-toc-link td.middle { padding: 0 0.5em 0 0.5em; - font-size: 83%; - text-align: center; } - table.index-toc-link td.right { padding: 0 0.5em 0 0.5em; - font-size: 83%; - text-align: right; } - table.synopsis { margin: 6ex auto 6ex auto; - border: 0; - border-collapse: separate; - border-spacing: 2em 0.6ex; } - table.synopsis tr { padding: 0; } - table.synopsis td { padding: 0; } - table.toc td.link { width: 30%; - text-align: right; - vertical-align: baseline; - padding: 1ex 1em 1ex 0; } - table.toc td.desc { vertical-align: baseline; - padding: 1ex 0 1ex 1em; - text-align: left; } - table.toc td.desc p:first-child { margin: 0; - text-align: left; } - table.toc td.desc p { margin: 1.5ex 0 0 0; - text-align: left; } - -</style> -</head> -<body> -""" - -html_header_3l = """ -<table class="index-toc-link"><tr><td class="left">[<a href="\ -""" - -html_header_3r = """ -<table class="index-toc-link"><tr><td class="right">[<a href="\ -""" - -html_header_4 = """\ -">Index</a>]</td><td class="right">[<a href="\ -""" - -html_header_5t = """\ -">TOC</a>]</td></tr></table> -<h1>\ -""" - -html_header_5i = """\ -">Index</a>]</td></tr></table> -<h1>\ -""" - -html_header_6 = """\ - API Reference</h1> -""" - - -# The HTML footer used by all generated pages. -html_footer = """\ -</body> -</html>\ -""" - -# The header and footer used for each section. -section_title_header1 = '<h1 id="' -section_title_header2 = '">' -section_title_footer = "</h1>" - -# The header and footer used for code segments. -code_header = '<pre class="colored">' -code_footer = '</pre>' - -# Paragraph header and footer. -para_header = "<p>" -para_footer = "</p>" - -# Block header and footer. -block_header = '<div class="section">' -block_footer_start = """\ -<hr> -<table class="index-toc-link"><tr><td class="left">[<a href="\ -""" -block_footer_middle = """\ -">Index</a>]</td>\ -<td class="middle">[<a href="#">Top</a>]</td>\ -<td class="right">[<a href="\ -""" -block_footer_end = """\ -">TOC</a>]</td></tr></table></div> -""" - -# Description header/footer. -description_header = "" -description_footer = "" - -# Marker header/inter/footer combination. -marker_header = "<h4>" -marker_inter = "</h4>" -marker_footer = "" - -# Header location header/footer. -header_location_header = "<p>" -header_location_footer = "</p>" - -# Source code extracts header/footer. -source_header = "<pre>" -source_footer = "</pre>" - -# Chapter header/inter/footer. -chapter_header = """\ -<div class="section"> -<h2>\ -""" -chapter_inter = '</h2>' -chapter_footer = '</div>' - -# Index footer. -index_footer_start = """\ -<hr> -<table class="index-toc-link"><tr><td class="right">[<a href="\ -""" -index_footer_end = """\ -">TOC</a>]</td></tr></table> -""" - -# TOC footer. -toc_footer_start = """\ -<hr> -<table class="index-toc-link"><tr><td class="left">[<a href="\ -""" -toc_footer_end = """\ -">Index</a>]</td></tr></table> -""" - - -# Source language keyword coloration and styling. -keyword_prefix = '<span class="keyword">' -keyword_suffix = '</span>' - -section_synopsis_header = '<h2>Synopsis</h2>' -section_synopsis_footer = '' - - -# Translate a single line of source to HTML. This converts `<', `>', and -# `&' into `<',`>', and `&'. -# -def html_quote( line ): - result = string.replace( line, "&", "&" ) - result = string.replace( result, "<", "<" ) - result = string.replace( result, ">", ">" ) - return result - - -################################################################ -## -## HTML FORMATTER CLASS -## -class HtmlFormatter( Formatter ): - - def __init__( self, processor, project_title, file_prefix ): - Formatter.__init__( self, processor ) - - global html_header_1 - global html_header_2 - global html_header_3l, html_header_3r - global html_header_4 - global html_header_5t, html_header_5i - global html_header_6 - global html_footer - - if file_prefix: - file_prefix = file_prefix + "-" - else: - file_prefix = "" - - self.headers = processor.headers - self.project_title = project_title - self.file_prefix = file_prefix - self.html_header = ( - html_header_1 + project_title - + html_header_2 - + html_header_3l + file_prefix + "index.html" - + html_header_4 + file_prefix + "toc.html" - + html_header_5t + project_title - + html_header_6 ) - self.html_index_header = ( - html_header_1 + project_title - + html_header_2 - + html_header_3r + file_prefix + "toc.html" - + html_header_5t + project_title - + html_header_6 ) - self.html_toc_header = ( - html_header_1 + project_title - + html_header_2 - + html_header_3l + file_prefix + "index.html" - + html_header_5i + project_title - + html_header_6 ) - self.html_footer = ( - '<div class="timestamp">generated on ' - + time.asctime( time.localtime( time.time() ) ) - + "</div>" + html_footer ) - - self.columns = 3 - - def make_section_url( self, section ): - return self.file_prefix + section.name + ".html" - - def make_block_url( self, block, name = None ): - if name == None: - name = block.name - - try: - section_url = self.make_section_url( block.section ) - except: - # we already have a section - section_url = self.make_section_url( block ) - - return section_url + "#" + name - - def make_html_word( self, word ): - """Analyze a simple word to detect cross-references and markup.""" - # handle cross-references - m = re_crossref.match( word ) - if m: - try: - name = m.group( 'name' ) - rest = m.group( 'rest' ) - block = self.identifiers[name] - url = self.make_block_url( block ) - # display `foo[bar]' as `foo' - name = re.sub( r'\[.*\]', '', name ) - # normalize url, following RFC 3986 - url = string.replace( url, "[", "(" ) - url = string.replace( url, "]", ")" ) - - try: - # for sections, display title - url = ( '‘<a href="' + url + '">' - + block.title + '</a>’' - + rest ) - except: - url = ( '<a href="' + url + '">' - + name + '</a>' - + rest ) - - return url - except: - # we detected a cross-reference to an unknown item - sys.stderr.write( "WARNING: undefined cross reference" - + " '" + name + "'.\n" ) - return '?' + name + '?' + rest - - # handle markup for italic and bold - m = re_italic.match( word ) - if m: - name = m.group( 1 ) - rest = m.group( 2 ) - return '<i>' + name + '</i>' + rest - - m = re_bold.match( word ) - if m: - name = m.group( 1 ) - rest = m.group( 2 ) - return '<b>' + name + '</b>' + rest - - return html_quote( word ) - - def make_html_para( self, words ): - """Convert words of a paragraph into tagged HTML text. Also handle - cross references.""" - line = "" - if words: - line = self.make_html_word( words[0] ) - for word in words[1:]: - line = line + " " + self.make_html_word( word ) - # handle hyperlinks - line = re_url.sub( r'<a href="\1">\1</a>', line ) - # convert `...' quotations into real left and right single quotes - line = re.sub( r"(^|\W)`(.*?)'(\W|$)", - r'\1‘\2’\3', - line ) - # convert tilde into non-breakable space - line = string.replace( line, "~", " " ) - - return para_header + line + para_footer - - def make_html_code( self, lines ): - """Convert a code sequence to HTML.""" - line = code_header + '\n' - for l in lines: - line = line + html_quote( l ).rstrip() + '\n' - - return line + code_footer - - def make_html_items( self, items ): - """Convert a field's content into HTML.""" - lines = [] - for item in items: - if item.lines: - lines.append( self.make_html_code( item.lines ) ) - else: - lines.append( self.make_html_para( item.words ) ) - - return string.join( lines, '\n' ) - - def print_html_items( self, items ): - print( self.make_html_items( items ) ) - - def print_html_field( self, field ): - if field.name: - print( '<table><tr valign="top"><td><b>' - + field.name - + "</b></td><td>" ) - - print( self.make_html_items( field.items ) ) - - if field.name: - print( "</td></tr></table>" ) - - def html_source_quote( self, line, block_name = None ): - result = "" - while line: - m = re_source_crossref.match( line ) - if m: - name = m.group( 2 ) - prefix = html_quote( m.group( 1 ) ) - length = len( m.group( 0 ) ) - - if name == block_name: - # this is the current block name, if any - result = result + prefix + '<b>' + name + '</b>' - elif re_source_keywords.match( name ): - # this is a C keyword - result = ( result + prefix - + keyword_prefix + name + keyword_suffix ) - elif name in self.identifiers: - # this is a known identifier - block = self.identifiers[name] - id = block.name - - # link to a field ID if possible - try: - for markup in block.markups: - if markup.tag == 'values': - for field in markup.fields: - if field.name: - id = name - - result = ( result + prefix - + '<a href="' - + self.make_block_url( block, id ) - + '">' + name + '</a>' ) - except: - # sections don't have `markups'; however, we don't - # want references to sections here anyway - result = result + html_quote( line[:length] ) - - else: - result = result + html_quote( line[:length] ) - - line = line[length:] - else: - result = result + html_quote( line ) - line = [] - - return result - - def print_html_field_list( self, fields ): - print( '<table class="fields">' ) - for field in fields: - print( '<tr><td class="val" id="' + field.name + '">' - + field.name - + '</td><td class="desc">' ) - self.print_html_items( field.items ) - print( "</td></tr>" ) - print( "</table>" ) - - def print_html_markup( self, markup ): - table_fields = [] - for field in markup.fields: - if field.name: - # We begin a new series of field or value definitions. We - # record them in the `table_fields' list before outputting - # all of them as a single table. - table_fields.append( field ) - else: - if table_fields: - self.print_html_field_list( table_fields ) - table_fields = [] - - self.print_html_items( field.items ) - - if table_fields: - self.print_html_field_list( table_fields ) - - # - # formatting the index - # - def index_enter( self ): - print( self.html_index_header ) - self.index_items = {} - - def index_name_enter( self, name ): - block = self.identifiers[name] - url = self.make_block_url( block ) - self.index_items[name] = url - - def index_exit( self ): - # `block_index' already contains the sorted list of index names - count = len( self.block_index ) - rows = ( count + self.columns - 1 ) // self.columns - - print( '<table class="index">' ) - for r in range( rows ): - line = "<tr>" - for c in range( self.columns ): - i = r + c * rows - if i < count: - bname = self.block_index[r + c * rows] - url = self.index_items[bname] - # display `foo[bar]' as `foo (bar)' - bname = string.replace( bname, "[", " (" ) - bname = string.replace( bname, "]", ")" ) - # normalize url, following RFC 3986 - url = string.replace( url, "[", "(" ) - url = string.replace( url, "]", ")" ) - line = ( line + '<td><a href="' + url + '">' - + bname + '</a></td>' ) - else: - line = line + '<td></td>' - line = line + "</tr>" - print( line ) - - print( "</table>" ) - - print( index_footer_start - + self.file_prefix + "toc.html" - + index_footer_end ) - - print( self.html_footer ) - - self.index_items = {} - - def index_dump( self, index_filename = None ): - if index_filename == None: - index_filename = self.file_prefix + "index.html" - - Formatter.index_dump( self, index_filename ) - - # - # formatting the table of contents - # - def toc_enter( self ): - print( self.html_toc_header ) - print( "<h1>Table of Contents</h1>" ) - - def toc_chapter_enter( self, chapter ): - print( chapter_header + string.join( chapter.title ) + chapter_inter ) - print( '<table class="toc">' ) - - def toc_section_enter( self, section ): - print( '<tr><td class="link">' - + '<a href="' + self.make_section_url( section ) + '">' - + section.title + '</a></td><td class="desc">' ) - print( self.make_html_para( section.abstract ) ) - - def toc_section_exit( self, section ): - print( "</td></tr>" ) - - def toc_chapter_exit( self, chapter ): - print( "</table>" ) - print( chapter_footer ) - - def toc_index( self, index_filename ): - print( chapter_header - + '<a href="' + index_filename + '">Global Index</a>' - + chapter_inter + chapter_footer ) - - def toc_exit( self ): - print( toc_footer_start - + self.file_prefix + "index.html" - + toc_footer_end ) - - print( self.html_footer ) - - def toc_dump( self, toc_filename = None, index_filename = None ): - if toc_filename == None: - toc_filename = self.file_prefix + "toc.html" - - if index_filename == None: - index_filename = self.file_prefix + "index.html" - - Formatter.toc_dump( self, toc_filename, index_filename ) - - # - # formatting sections - # - def section_enter( self, section ): - print( self.html_header ) - - print( section_title_header1 + section.name + section_title_header2 - + section.title - + section_title_footer ) - - maxwidth = 0 - for b in section.blocks.values(): - if len( b.name ) > maxwidth: - maxwidth = len( b.name ) - - width = 70 # XXX magic number - if maxwidth > 0: - # print section synopsis - print( section_synopsis_header ) - print( '<table class="synopsis">' ) - - columns = width // maxwidth - if columns < 1: - columns = 1 - - count = len( section.block_names ) - # don't handle last entry if it is empty - if section.block_names[-1] == "/empty/": - count -= 1 - rows = ( count + columns - 1 ) // columns - - for r in range( rows ): - line = "<tr>" - for c in range( columns ): - i = r + c * rows - line = line + '<td>' - if i < count: - name = section.block_names[i] - if name == "/empty/": - # it can happen that a complete row is empty, and - # without a proper `filler' the browser might - # collapse the row to a much smaller height (or - # even omit it completely) - line = line + " " - else: - url = name - # display `foo[bar]' as `foo' - name = re.sub( r'\[.*\]', '', name ) - # normalize url, following RFC 3986 - url = string.replace( url, "[", "(" ) - url = string.replace( url, "]", ")" ) - line = ( line + '<a href="#' + url + '">' - + name + '</a>' ) - - line = line + '</td>' - line = line + "</tr>" - print( line ) - - print( "</table>" ) - print( section_synopsis_footer ) - - print( description_header ) - print( self.make_html_items( section.description ) ) - print( description_footer ) - - def block_enter( self, block ): - print( block_header ) - - # place html anchor if needed - if block.name: - url = block.name - # display `foo[bar]' as `foo' - name = re.sub( r'\[.*\]', '', block.name ) - # normalize url, following RFC 3986 - url = string.replace( url, "[", "(" ) - url = string.replace( url, "]", ")" ) - print( '<h3 id="' + url + '">' + name + '</h3>' ) - - # dump the block C source lines now - if block.code: - header = '' - for f in self.headers.keys(): - if block.source.filename.find( f ) >= 0: - header = self.headers[f] + ' (' + f + ')' - break - -# if not header: -# sys.stderr.write( -# "WARNING: No header macro for" -# + " '" + block.source.filename + "'.\n" ) - - if header: - print( header_location_header - + 'Defined in ' + header + '.' - + header_location_footer ) - - print( source_header ) - for l in block.code: - print( self.html_source_quote( l, block.name ) ) - print( source_footer ) - - def markup_enter( self, markup, block ): - if markup.tag == "description": - print( description_header ) - else: - print( marker_header + markup.tag + marker_inter ) - - self.print_html_markup( markup ) - - def markup_exit( self, markup, block ): - if markup.tag == "description": - print( description_footer ) - else: - print( marker_footer ) - - def block_exit( self, block ): - print( block_footer_start + self.file_prefix + "index.html" - + block_footer_middle + self.file_prefix + "toc.html" - + block_footer_end ) - - def section_exit( self, section ): - print( html_footer ) - - def section_dump_all( self ): - for section in self.sections: - self.section_dump( section, - self.file_prefix + section.name + '.html' ) - -# eof diff --git a/src/3rdparty/freetype/src/tools/docmaker/utils.py b/src/3rdparty/freetype/src/tools/docmaker/utils.py deleted file mode 100644 index f40f1674a0..0000000000 --- a/src/3rdparty/freetype/src/tools/docmaker/utils.py +++ /dev/null @@ -1,127 +0,0 @@ -# -# utils.py -# -# Auxiliary functions for the `docmaker' tool (library file). -# -# Copyright 2002-2018 by -# David Turner. -# -# This file is part of the FreeType project, and may only be used, -# modified, and distributed under the terms of the FreeType project -# license, LICENSE.TXT. By continuing to use, modify, or distribute -# this file you indicate that you have read the license and -# understand and accept it fully. - - -import string, sys, os, glob, itertools - - -# current output directory -# -output_dir = None - - -# A function that generates a sorting key. We want lexicographical order -# (primary key) except that capital letters are sorted before lowercase -# ones (secondary key). -# -# The primary key is implemented by lowercasing the input. The secondary -# key is simply the original data appended, character by character. For -# example, the sort key for `FT_x' is `fFtT__xx', while the sort key for -# `ft_X' is `fftt__xX'. Since ASCII codes of uppercase letters are -# numerically smaller than the codes of lowercase letters, `fFtT__xx' gets -# sorted before `fftt__xX'. -# -def index_key( s ): - return string.join( itertools.chain( *zip( s.lower(), s ) ) ) - - -# Sort `input_list', placing the elements of `order_list' in front. -# -def sort_order_list( input_list, order_list ): - new_list = order_list[:] - for id in input_list: - if not id in order_list: - new_list.append( id ) - return new_list - - -# Divert standard output to a given project documentation file. Use -# `output_dir' to determine the filename location if necessary and save the -# old stdout handle in a tuple that is returned by this function. -# -def open_output( filename ): - global output_dir - - if output_dir and output_dir != "": - filename = output_dir + os.sep + filename - - old_stdout = sys.stdout - new_file = open( filename, "w" ) - sys.stdout = new_file - - return ( new_file, old_stdout ) - - -# Close the output that was returned by `open_output'. -# -def close_output( output ): - output[0].close() - sys.stdout = output[1] - - -# Check output directory. -# -def check_output(): - global output_dir - if output_dir: - if output_dir != "": - if not os.path.isdir( output_dir ): - sys.stderr.write( "argument" - + " '" + output_dir + "' " - + "is not a valid directory\n" ) - sys.exit( 2 ) - else: - output_dir = None - - -def file_exists( pathname ): - """Check that a given file exists.""" - result = 1 - try: - file = open( pathname, "r" ) - file.close() - except: - result = None - sys.stderr.write( pathname + " couldn't be accessed\n" ) - - return result - - -def make_file_list( args = None ): - """Build a list of input files from command-line arguments.""" - file_list = [] - # sys.stderr.write( repr( sys.argv[1 :] ) + '\n' ) - - if not args: - args = sys.argv[1:] - - for pathname in args: - if string.find( pathname, '*' ) >= 0: - newpath = glob.glob( pathname ) - newpath.sort() # sort files -- this is important because - # of the order of files - else: - newpath = [pathname] - - file_list.extend( newpath ) - - if len( file_list ) == 0: - file_list = None - else: - # now filter the file list to remove non-existing ones - file_list = filter( file_exists, file_list ) - - return file_list - -# eof diff --git a/src/3rdparty/freetype/src/tools/ftfuzzer/README b/src/3rdparty/freetype/src/tools/ftfuzzer/README deleted file mode 100644 index 09d8e9f325..0000000000 --- a/src/3rdparty/freetype/src/tools/ftfuzzer/README +++ /dev/null @@ -1,81 +0,0 @@ -ftfuzzer -======== - - -ftfuzzer.cc ------------ - -This file contains a target function for FreeType fuzzing. It can be -used with libFuzzer (https://llvm.org/docs/LibFuzzer.html) or -potentially any other similar fuzzer. - -Usage: - - 1. Build `libfreetype.a' and `ftfuzzer.cc' using the most recent - clang compiler with these flags: - - # for fuzzer coverage feedback - -fsanitize-coverage=edge,8bit-counters - # for bug checking - -fsanitize=address,signed-integer-overflow,shift - - You also need the header files from the `libarchive' library - (https://www.libarchive.org/) for handling tar files (see file - `ftmutator.cc' below for more). - - 2. Link with `libFuzzer' (it contains `main') and `libarchive'. - - 3. Run the fuzzer on some test corpus. - -The exact flags and commands may vary. - - https://github.com/google/oss-fuzz/tree/master/projects/freetype2 - -There is a continuous fuzzing bot that runs ftfuzzer. - - https://oss-fuzz.com - -(You need an account to be able to see coverage reports and the like -on oss-fuzz.com.) - -Check the bot configuration for the most current settings. - - -ftmutator.cc ------------- - -FreeType has the ability to `attach' auxiliary files to a font file, -providing additional information. The main usage is to load AFM files -for PostScript Type 1 fonts. - -However, libFuzzer currently only supports mutation of a single input -file. For this reason, `ftmutator.cc' contains a custom fuzzer -mutator that uses an uncompressed tar file archive as the input. The -first file in such a tarball gets opened by FreeType as a font, all -other files are treated as input for `FT_Attach_Stream'. - -Compilation is similar to `ftfuzzer.c'. - - -runinput.cc ------------ - -To run the target function on a set of input files, this file contains -a convenience `main' function. Link it with `ftfuzzer.cc', -`libfreetype.a', and `libarchive' and run like - - ./a.out my_tests_inputs/* - ----------------------------------------------------------------------- - -Copyright 2015-2018 by -David Turner, Robert Wilhelm, and Werner Lemberg. - -This file is part of the FreeType project, and may only be used, -modified, and distributed under the terms of the FreeType project -license, LICENSE.TXT. By continuing to use, modify, or distribute -this file you indicate that you have read the license and understand -and accept it fully. - - ---- end of README --- diff --git a/src/3rdparty/freetype/src/tools/ftfuzzer/ftfuzzer.cc b/src/3rdparty/freetype/src/tools/ftfuzzer/ftfuzzer.cc deleted file mode 100644 index acf2bc9820..0000000000 --- a/src/3rdparty/freetype/src/tools/ftfuzzer/ftfuzzer.cc +++ /dev/null @@ -1,428 +0,0 @@ -// ftfuzzer.cc -// -// A fuzzing function to test FreeType with libFuzzer. -// -// Copyright 2015-2018 by -// David Turner, Robert Wilhelm, and Werner Lemberg. -// -// This file is part of the FreeType project, and may only be used, -// modified, and distributed under the terms of the FreeType project -// license, LICENSE.TXT. By continuing to use, modify, or distribute -// this file you indicate that you have read the license and -// understand and accept it fully. - - -// we use `unique_ptr', `decltype', and other gimmicks defined since C++11 -#if __cplusplus < 201103L -# error "a C++11 compiler is needed" -#endif - -#include <archive.h> -#include <archive_entry.h> - -#include <assert.h> -#include <stdint.h> - -#include <memory> -#include <vector> - - - using namespace std; - - -#include <ft2build.h> - -#include FT_FREETYPE_H -#include FT_GLYPH_H -#include FT_CACHE_H -#include FT_CACHE_CHARMAP_H -#include FT_CACHE_IMAGE_H -#include FT_CACHE_SMALL_BITMAPS_H -#include FT_SYNTHESIS_H -#include FT_ADVANCES_H -#include FT_OUTLINE_H -#include FT_BBOX_H -#include FT_MODULE_H -#include FT_DRIVER_H -#include FT_MULTIPLE_MASTERS_H - - - static FT_Library library; - static int InitResult; - - - struct FT_Global - { - FT_Global() - { - InitResult = FT_Init_FreeType( &library ); - if ( InitResult ) - return; - - // try to activate Adobe's CFF engine; it might not be the default - unsigned int cff_hinting_engine = FT_HINTING_ADOBE; - FT_Property_Set( library, - "cff", - "hinting-engine", &cff_hinting_engine ); - } - - ~FT_Global() - { - FT_Done_FreeType( library ); - } - }; - - FT_Global global_ft; - - - // We want to select n values at random (without repetition), - // with 0 < n <= N. The algorithm is taken from TAoCP, Vol. 2 - // (Algorithm S, selection sampling technique) - struct Random - { - int n; - int N; - - int t; // total number of values so far - int m; // number of selected values so far - - uint32_t r; // the current pseudo-random number - - Random( int n_, - int N_ ) - : n( n_ ), - N( N_ ) - { - t = 0; - m = 0; - - // Ideally, this should depend on the input file, - // for example, taking the sha256 as input; - // however, this is overkill for fuzzying tests. - r = 12345; - } - - int get() - { - if ( m >= n ) - return -1; - - Redo: - // We can't use `rand': different C libraries might provide - // different implementations of this function. As a replacement, - // we use a 32bit version of the `xorshift' algorithm. - r ^= r << 13; - r ^= r >> 17; - r ^= r << 5; - - double U = double( r ) / UINT32_MAX; - - if ( ( N - t ) * U >= ( n - m ) ) - { - t++; - goto Redo; - } - - t++; - m++; - - return t; - } - }; - - - static int - archive_read_entry_data( struct archive *ar, - vector<FT_Byte> *vw ) - { - int r; - const FT_Byte* buff; - size_t size; - int64_t offset; - - for (;;) - { - r = archive_read_data_block( ar, - reinterpret_cast<const void**>( &buff ), - &size, - &offset ); - if ( r == ARCHIVE_EOF ) - return ARCHIVE_OK; - if ( r != ARCHIVE_OK ) - return r; - - vw->insert( vw->end(), buff, buff + size ); - } - } - - - static vector<vector<FT_Byte>> - parse_data( const uint8_t* data, - size_t size ) - { - struct archive_entry* entry; - int r; - vector<vector<FT_Byte>> files; - - unique_ptr<struct archive, - decltype ( archive_read_free )*> a( archive_read_new(), - archive_read_free ); - - // activate reading of uncompressed tar archives - archive_read_support_format_tar( a.get() ); - - // the need for `const_cast' was removed with libarchive commit be4d4dd - if ( !( r = archive_read_open_memory( - a.get(), - const_cast<void*>(static_cast<const void*>( data ) ), - size ) ) ) - { - unique_ptr<struct archive, - decltype ( archive_read_close )*> a_open( a.get(), - archive_read_close ); - - // read files contained in archive - for (;;) - { - r = archive_read_next_header( a_open.get(), &entry ); - if ( r == ARCHIVE_EOF ) - break; - if ( r != ARCHIVE_OK ) - break; - - vector<FT_Byte> entry_data; - r = archive_read_entry_data( a.get(), &entry_data ); - if ( r != ARCHIVE_OK ) - break; - - files.push_back( move( entry_data ) ); - } - } - - if ( files.size() == 0 ) - files.emplace_back( data, data + size ); - - return files; - } - - - static void - setIntermediateAxis( FT_Face face ) - { - // only handle Multiple Masters and GX variation fonts - if ( !FT_HAS_MULTIPLE_MASTERS( face ) ) - return; - - // get variation data for current instance - FT_MM_Var* variations_ptr = nullptr; - if ( FT_Get_MM_Var( face, &variations_ptr ) ) - return; - - unique_ptr<FT_MM_Var, - decltype ( free )*> variations( variations_ptr, free ); - vector<FT_Fixed> coords( variations->num_axis ); - - // select an arbitrary instance - for ( unsigned int i = 0; i < variations->num_axis; i++ ) - coords[i] = ( variations->axis[i].minimum + - variations->axis[i].def ) / 2; - - if ( FT_Set_Var_Design_Coordinates( face, - FT_UInt( coords.size() ), - coords.data() ) ) - return; - } - - - // the interface function to the libFuzzer library - extern "C" int - LLVMFuzzerTestOneInput( const uint8_t* data, - size_t size_ ) - { - assert( !InitResult ); - - if ( size_ < 1 ) - return 0; - - const vector<vector<FT_Byte>>& files = parse_data( data, size_ ); - - FT_Face face; - FT_Int32 load_flags = FT_LOAD_DEFAULT; -#if 0 - FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL; -#endif - - // We use a conservative approach here, at the cost of calling - // `FT_New_Face' quite often. The idea is that the fuzzer should be - // able to try all faces and named instances of a font, expecting that - // some faces don't work for various reasons, e.g., a broken subfont, or - // an unsupported NFNT bitmap font in a Mac dfont resource that holds - // more than a single font. - - // get number of faces - if ( FT_New_Memory_Face( library, - files[0].data(), - (FT_Long)files[0].size(), - -1, - &face ) ) - return 0; - long num_faces = face->num_faces; - FT_Done_Face( face ); - - // loop over up to 20 arbitrarily selected faces - // from index range [0;num-faces-1] - long max_face_cnt = num_faces < 20 - ? num_faces - : 20; - - Random faces_pool( (int)max_face_cnt, (int)num_faces ); - - for ( long face_cnt = 0; - face_cnt < max_face_cnt; - face_cnt++ ) - { - long face_index = faces_pool.get() - 1; - - // get number of instances - if ( FT_New_Memory_Face( library, - files[0].data(), - (FT_Long)files[0].size(), - -( face_index + 1 ), - &face ) ) - continue; - long num_instances = face->style_flags >> 16; - FT_Done_Face( face ); - - // loop over the face without instance (index 0) - // and up to 20 arbitrarily selected instances - // from index range [1;num_instances] - long max_instance_cnt = num_instances < 20 - ? num_instances - : 20; - - Random instances_pool( (int)max_instance_cnt, (int)num_instances ); - - for ( long instance_cnt = 0; - instance_cnt <= max_instance_cnt; - instance_cnt++ ) - { - long instance_index = 0; - - if ( !instance_cnt ) - { - if ( FT_New_Memory_Face( library, - files[0].data(), - (FT_Long)files[0].size(), - face_index, - &face ) ) - continue; - } - else - { - instance_index = instances_pool.get(); - - if ( FT_New_Memory_Face( library, - files[0].data(), - (FT_Long)files[0].size(), - ( instance_index << 16 ) + face_index, - &face ) ) - continue; - } - - // if we have more than a single input file coming from an archive, - // attach them (starting with the second file) using the order given - // in the archive - for ( size_t files_index = 1; - files_index < files.size(); - files_index++ ) - { - FT_Open_Args open_args = {}; - open_args.flags = FT_OPEN_MEMORY; - open_args.memory_base = files[files_index].data(); - open_args.memory_size = (FT_Long)files[files_index].size(); - - // the last archive element will be eventually used as the - // attachment - FT_Attach_Stream( face, &open_args ); - } - - // loop over an arbitrary size for outlines - // and up to ten arbitrarily selected bitmap strike sizes - // from the range [0;num_fixed_sizes - 1] - int max_size_cnt = face->num_fixed_sizes < 10 - ? face->num_fixed_sizes - : 10; - - Random sizes_pool( max_size_cnt, face->num_fixed_sizes ); - - for ( int size_cnt = 0; - size_cnt <= max_size_cnt; - size_cnt++ ) - { - FT_Int32 flags = load_flags; - - int size_index = 0; - - if ( !size_cnt ) - { - // set up 20pt at 72dpi as an arbitrary size - if ( FT_Set_Char_Size( face, 20 * 64, 20 * 64, 72, 72 ) ) - continue; - flags |= FT_LOAD_NO_BITMAP; - } - else - { - // bitmap strikes are not active for font variations - if ( instance_index ) - continue; - - size_index = sizes_pool.get() - 1; - - if ( FT_Select_Size( face, size_index ) ) - continue; - flags |= FT_LOAD_COLOR; - } - - // test MM interface only for a face without a selected instance - // and without a selected bitmap strike - if ( !instance_index && !size_cnt ) - setIntermediateAxis( face ); - - // loop over all glyphs - for ( unsigned int glyph_index = 0; - glyph_index < (unsigned int)face->num_glyphs; - glyph_index++ ) - { - if ( FT_Load_Glyph( face, glyph_index, flags ) ) - continue; - - // Rendering is the most expensive and the least interesting part. - // - // if ( FT_Render_Glyph( face->glyph, render_mode) ) - // continue; - // FT_GlyphSlot_Embolden( face->glyph ); - -#if 0 - FT_Glyph glyph; - if ( !FT_Get_Glyph( face->glyph, &glyph ) ) - FT_Done_Glyph( glyph ); - - FT_Outline* outline = &face->glyph->outline; - FT_Matrix rot30 = { 0xDDB4, -0x8000, 0x8000, 0xDDB4 }; - - FT_Outline_Transform( outline, &rot30 ); - - FT_BBox bbox; - FT_Outline_Get_BBox( outline, &bbox ); -#endif - } - } - FT_Done_Face( face ); - } - } - - return 0; - } - - -// END diff --git a/src/3rdparty/freetype/src/tools/ftfuzzer/ftmutator.cc b/src/3rdparty/freetype/src/tools/ftfuzzer/ftmutator.cc deleted file mode 100644 index ae4b140404..0000000000 --- a/src/3rdparty/freetype/src/tools/ftfuzzer/ftmutator.cc +++ /dev/null @@ -1,314 +0,0 @@ -// ftmutator.cc -// -// A custom fuzzer mutator to test for FreeType with libFuzzer. -// -// Copyright 2015-2018 by -// David Turner, Robert Wilhelm, and Werner Lemberg. -// -// This file is part of the FreeType project, and may only be used, -// modified, and distributed under the terms of the FreeType project -// license, LICENSE.TXT. By continuing to use, modify, or distribute -// this file you indicate that you have read the license and -// understand and accept it fully. - - -// Since `tar' is not a valid format for input to FreeType, treat any input -// that looks like `tar' as multiple files and mutate them separately. -// -// In the future, a variation of this may be used to guide mutation on a -// logically higher level. - - -// we use `unique_ptr', `decltype', and other gimmicks defined since C++11 -#if __cplusplus < 201103L -# error "a C++11 compiler is needed" -#endif - -#include <cstdint> -#include <cassert> -#include <cstdio> -#include <cstdlib> -#include <cstddef> -#include <cstring> -#include <iostream> - -#include <memory> -#include <vector> - -#include <archive.h> -#include <archive_entry.h> - -#include "FuzzerInterface.h" - - - using namespace std; - - - // This function should be defined by `ftfuzzer.cc'. - extern "C" int - LLVMFuzzerTestOneInput( const uint8_t* Data, - size_t Size ); - - - static void - check_result( struct archive* a, - int r ) - { - if ( r == ARCHIVE_OK ) - return; - - const char* m = archive_error_string( a ); - write( 1, m, strlen( m ) ); - exit( 1 ); - } - - - static int - archive_read_entry_data( struct archive *ar, - vector<uint8_t> *vw ) - { - int r; - const uint8_t* buff; - size_t size; - int64_t offset; - - for (;;) - { - r = archive_read_data_block( ar, - reinterpret_cast<const void**>( &buff ), - &size, - &offset ); - if ( r == ARCHIVE_EOF ) - return ARCHIVE_OK; - if ( r != ARCHIVE_OK ) - return r; - - vw->insert( vw->end(), buff, buff + size ); - } - } - - - static vector<vector<uint8_t>> - parse_data( const uint8_t* data, - size_t size ) - { - struct archive_entry* entry; - int r; - vector<vector<uint8_t>> files; - - unique_ptr<struct archive, - decltype ( archive_read_free )*> a( archive_read_new(), - archive_read_free ); - - // activate reading of uncompressed tar archives - archive_read_support_format_tar( a.get() ); - - // the need for `const_cast' was removed with libarchive commit be4d4dd - if ( !( r = archive_read_open_memory( - a.get(), - const_cast<void*>(static_cast<const void*>( data ) ), - size ) ) ) - { - unique_ptr<struct archive, - decltype ( archive_read_close )*> a_open( a.get(), - archive_read_close ); - - // read files contained in archive - for (;;) - { - r = archive_read_next_header( a_open.get(), &entry ); - if ( r == ARCHIVE_EOF ) - break; - if ( r != ARCHIVE_OK ) - break; - - vector<uint8_t> entry_data; - r = archive_read_entry_data( a.get(), &entry_data ); - if ( entry_data.size() == 0 ) - continue; - - files.push_back( move( entry_data ) ); - if ( r != ARCHIVE_OK ) - break; - } - } - - return files; - } - - - class FTFuzzer - : public fuzzer::UserSuppliedFuzzer - { - - public: - FTFuzzer( fuzzer::FuzzerRandomBase* Rand ) - : fuzzer::UserSuppliedFuzzer( Rand ) {} - - - int - TargetFunction( const uint8_t* Data, - size_t Size ) - { - return LLVMFuzzerTestOneInput( Data, Size ); - } - - - // Custom mutator. - virtual size_t - Mutate( uint8_t* Data, - size_t Size, - size_t MaxSize ) - { - vector<vector<uint8_t>> files = parse_data( Data, Size ); - - // If the file was not recognized as a tar file, treat it as non-tar. - if ( files.size() == 0 ) - return fuzzer::UserSuppliedFuzzer::Mutate( Data, Size, MaxSize ); - - // This is somewhat `white box' on tar. The tar format uses 512 byte - // blocks. One block as header for each file, two empty blocks of 0's - // at the end. File data is padded to fill its last block. - size_t used_blocks = files.size() + 2; - for ( const auto& file : files ) - used_blocks += ( file.size() + 511 ) / 512; - - size_t max_blocks = MaxSize / 512; - - // If the input is big, it will need to be downsized. If the original - // tar file was too big, it may have been clipped to fit. In this - // case it may not be possible to properly write out the data, as - // there may not be enough space for the trailing two blocks. Start - // dropping file data or files from the end. - for ( size_t i = files.size(); - i-- > 1 && used_blocks > max_blocks; ) - { - size_t blocks_to_free = used_blocks - max_blocks; - size_t blocks_currently_used_by_file_data = - ( files[i].size() + 511 ) / 512; - - if ( blocks_currently_used_by_file_data >= blocks_to_free ) - { - files[i].resize( ( blocks_currently_used_by_file_data - - blocks_to_free ) * 512 ); - used_blocks -= blocks_to_free; - continue; - } - - files.pop_back(); - used_blocks -= blocks_currently_used_by_file_data + 1; - } - - // If we get down to one file, don't use tar. - if ( files.size() == 1 ) - { - memcpy( Data, files[0].data(), files[0].size() ); - return fuzzer::UserSuppliedFuzzer::Mutate( Data, - files[0].size(), - MaxSize ); - } - - size_t free_blocks = max_blocks - used_blocks; - - // Allow each file to use up as much of the currently available space - // it can. If it uses or gives up blocks, add them or remove them - // from the pool. - for ( auto&& file : files ) - { - size_t blocks_currently_used_by_file = ( file.size() + 511 ) / 512; - size_t blocks_available = blocks_currently_used_by_file + - free_blocks; - size_t max_size = blocks_available * 512; - size_t data_size = file.size(); - - file.resize( max_size ); - file.resize( fuzzer::UserSuppliedFuzzer::Mutate( file.data(), - data_size, - max_size ) ); - - size_t blocks_now_used_by_file = ( file.size() + 511 ) / 512; - free_blocks = free_blocks + - blocks_currently_used_by_file - - blocks_now_used_by_file; - } - - unique_ptr<struct archive, - decltype ( archive_write_free )*> a( archive_write_new(), - archive_write_free ); - - check_result( a.get(), archive_write_add_filter_none( a.get() ) ); - check_result( a.get(), archive_write_set_format_ustar( a.get() ) ); - - // `used' may not be correct until after the archive is closed. - size_t used = 0xbadbeef; - check_result( a.get(), archive_write_open_memory( a.get(), - Data, - MaxSize, - &used ) ); - - { - unique_ptr<struct archive, - decltype ( archive_write_close )*> a_open( a.get(), - archive_write_close ); - - int file_index = 0; - for ( const auto& file : files ) - { - unique_ptr<struct archive_entry, - decltype ( archive_entry_free )*> - e( archive_entry_new2( a_open.get() ), - archive_entry_free ); - - char name_buffer[100]; - snprintf( name_buffer, 100, "file%d", file_index++ ); - - archive_entry_set_pathname( e.get(), name_buffer ); - archive_entry_set_size( e.get(), file.size() ); - archive_entry_set_filetype( e.get(), AE_IFREG ); - archive_entry_set_perm( e.get(), 0644 ); - - check_result( a_open.get(), - archive_write_header( a_open.get(), e.get() ) ); - archive_write_data( a_open.get(), file.data(), file.size() ); - check_result( a_open.get(), - archive_write_finish_entry( a_open.get() ) ); - } - } - - return used; - } - - - // Cross `Data1' and `Data2', write up to `MaxOutSize' bytes into `Out', - // return the number of bytes written, which should be positive. - virtual size_t - CrossOver( const uint8_t* Data1, - size_t Size1, - const uint8_t* Data2, - size_t Size2, - uint8_t* Out, - size_t MaxOutSize ) - { - return fuzzer::UserSuppliedFuzzer::CrossOver( Data1, - Size1, - Data2, - Size2, - Out, - MaxOutSize ); - } - - }; // end of FTFuzzer class - - - int - main( int argc, - char* *argv ) - { - fuzzer::FuzzerRandomLibc Rand( 0 ); - FTFuzzer F( &Rand ); - - fuzzer::FuzzerDriver( argc, argv, F ); - } - - -// END diff --git a/src/3rdparty/freetype/src/tools/ftfuzzer/rasterfuzzer.cc b/src/3rdparty/freetype/src/tools/ftfuzzer/rasterfuzzer.cc deleted file mode 100644 index c69b95ea0f..0000000000 --- a/src/3rdparty/freetype/src/tools/ftfuzzer/rasterfuzzer.cc +++ /dev/null @@ -1,129 +0,0 @@ -// rasterfuzzer.cc -// -// A fuzzing function to test FreeType's rasterizers with libFuzzer. -// -// Copyright 2016-2018 by -// David Turner, Robert Wilhelm, and Werner Lemberg. -// -// This file is part of the FreeType project, and may only be used, -// modified, and distributed under the terms of the FreeType project -// license, LICENSE.TXT. By continuing to use, modify, or distribute -// this file you indicate that you have read the license and -// understand and accept it fully. - - -#include <stdint.h> - -#include <vector> - - - using namespace std; - - -#include <ft2build.h> - -#include FT_FREETYPE_H -#include FT_IMAGE_H -#include FT_OUTLINE_H - - - static FT_Library library; - static int InitResult; - - - struct FT_Global { - FT_Global() { - InitResult = FT_Init_FreeType( &library ); - } - ~FT_Global() { - FT_Done_FreeType( library ); - } - }; - - FT_Global global_ft; - - - extern "C" int - LLVMFuzzerTestOneInput( const uint8_t* data, - size_t size_ ) - { - unsigned char pixels[4]; - - FT_Bitmap bitmap_mono = { - 1, // rows - 1, // width - 4, // pitch - pixels, // buffer - 2, // num_grays - FT_PIXEL_MODE_MONO, // pixel_mode - 0, // palette_mode - NULL // palette - }; - - FT_Bitmap bitmap_gray = { - 1, // rows - 1, // width - 4, // pitch - pixels, // buffer - 256, // num_grays - FT_PIXEL_MODE_GRAY, // pixel_mode - 0, // palette_mode - NULL // palette - }; - - const size_t vsize = sizeof ( FT_Vector ); - const size_t tsize = sizeof ( char ); - - // we use the input data for both points and tags - short n_points = short( size_ / ( vsize + tsize ) ); - if ( n_points <= 2 ) - return 0; - - FT_Vector* points = reinterpret_cast<FT_Vector*>( - const_cast<uint8_t*>( - data ) ); - char* tags = reinterpret_cast<char*>( - const_cast<uint8_t*>( - data + size_t( n_points ) * vsize ) ); - - // to reduce the number of invalid outlines that are immediately - // rejected in `FT_Outline_Render', limit values to 2^18 pixels - // (i.e., 2^24 bits) - for ( short i = 0; i < n_points; i++ ) - { - if ( points[i].x == LONG_MIN ) - points[i].x = 0; - else if ( points[i].x < 0 ) - points[i].x = -( -points[i].x & 0xFFFFFF ) - 1; - else - points[i].x = ( points[i].x & 0xFFFFFF ) + 1; - - if ( points[i].y == LONG_MIN ) - points[i].y = 0; - else if ( points[i].y < 0 ) - points[i].y = -( -points[i].y & 0xFFFFFF ) - 1; - else - points[i].y = ( points[i].y & 0xFFFFFF ) + 1; - } - - short contours[1]; - contours[0] = n_points - 1; - - FT_Outline outline = - { - 1, // n_contours - n_points, // n_points - points, // points - tags, // tags - contours, // contours - FT_OUTLINE_NONE // flags - }; - - FT_Outline_Get_Bitmap( library, &outline, &bitmap_mono ); - FT_Outline_Get_Bitmap( library, &outline, &bitmap_gray ); - - return 0; - } - - -// END diff --git a/src/3rdparty/freetype/src/tools/ftfuzzer/runinput.cc b/src/3rdparty/freetype/src/tools/ftfuzzer/runinput.cc deleted file mode 100644 index 2b02f57580..0000000000 --- a/src/3rdparty/freetype/src/tools/ftfuzzer/runinput.cc +++ /dev/null @@ -1,58 +0,0 @@ -// runinput.cc -// -// A `main' function for fuzzers like `ftfuzzer.cc'. -// -// Copyright 2015-2018 by -// David Turner, Robert Wilhelm, and Werner Lemberg. -// -// This file is part of the FreeType project, and may only be used, -// modified, and distributed under the terms of the FreeType project -// license, LICENSE.TXT. By continuing to use, modify, or distribute -// this file you indicate that you have read the license and -// understand and accept it fully. - - -#include <assert.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <stdint.h> - - - extern "C" void - LLVMFuzzerTestOneInput( const uint8_t* data, - size_t size ); - - - unsigned char a[1 << 24]; - - - int - main( int argc, - char* *argv ) - { - assert( argc >= 2 ); - - for ( int i = 1; i < argc; i++ ) - { - fprintf( stderr, "%s\n", argv[i] ); - - FILE* f = fopen( argv[i], "r" ); - assert( f ); - - size_t n = fread( a, 1, sizeof ( a ), f ); - fclose( f ); - if ( !n ) - continue; - - unsigned char* b = (unsigned char*)malloc( n ); - memcpy( b, a, n ); - - LLVMFuzzerTestOneInput( b, n ); - - free( b ); - } - } - - -// END diff --git a/src/3rdparty/freetype/src/tools/ftrandom/Makefile b/src/3rdparty/freetype/src/tools/ftrandom/Makefile deleted file mode 100644 index 24dc49c563..0000000000 --- a/src/3rdparty/freetype/src/tools/ftrandom/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# TOP_DIR and OBJ_DIR should be set by the user to the right directories, -# if necessary. - -TOP_DIR ?= ../../.. -OBJ_DIR ?= $(TOP_DIR)/objs - - -# The setup below is for gcc on a Unix-like platform, -# where FreeType has been set up to create a static library -# (which is the default). - -VPATH = $(OBJ_DIR) \ - $(OBJ_DIR)/.libs - -SRC_DIR = $(TOP_DIR)/src/tools/ftrandom - -CC = gcc -WFLAGS = -Wmissing-prototypes \ - -Wunused \ - -Wimplicit \ - -Wreturn-type \ - -Wparentheses \ - -pedantic \ - -Wformat \ - -Wchar-subscripts \ - -Wsequence-point -CFLAGS = $(WFLAGS) \ - -g -INCLUDES = -I $(TOP_DIR)/include -LDFLAGS = -LIBS = -lm \ - -lz \ - -lpng \ - -lbz2 \ - -lharfbuzz - -all: $(OBJ_DIR)/ftrandom - -$(OBJ_DIR)/ftrandom.o: $(SRC_DIR)/ftrandom.c - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< - -$(OBJ_DIR)/ftrandom: $(OBJ_DIR)/ftrandom.o libfreetype.a - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -# EOF diff --git a/src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c b/src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c index ab5cfc98b6..ab62429787 100644 --- a/src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c +++ b/src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c @@ -45,8 +45,8 @@ #include <time.h> #include <ft2build.h> -#include FT_FREETYPE_H -#include FT_OUTLINE_H +#include <freetype/freetype.h> +#include <freetype/ftoutln.h> #define true 1 #define false 0 diff --git a/src/3rdparty/freetype/src/tools/glnames.py b/src/3rdparty/freetype/src/tools/glnames.py index e1b613d11b..a19ce178b8 100644 --- a/src/3rdparty/freetype/src/tools/glnames.py +++ b/src/3rdparty/freetype/src/tools/glnames.py @@ -6,7 +6,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/tools/make_distribution_archives.py b/src/3rdparty/freetype/src/tools/make_distribution_archives.py new file mode 100755 index 0000000000..f29eb128c7 --- /dev/null +++ b/src/3rdparty/freetype/src/tools/make_distribution_archives.py @@ -0,0 +1,208 @@ +#!/usr/bin/env python3 +"""Generate distribution archives for a given FreeType 2 release.""" + +from __future__ import print_function + +import argparse +import atexit +import os +import shutil +import subprocess +import sys +import tempfile + +_TOP_DIR = os.path.abspath(os.path.join(__file__, "..", "..", "..")) +_SCRIPT_DIR = os.path.dirname(os.path.join(_TOP_DIR, "builds", "meson", "")) + + +def get_cmd_output(cmd, cwd=None): + """Run a command and return its output as a string.""" + if cwd is not None: + out = subprocess.check_output(cmd, cwd=cwd) + else: + out = subprocess.check_output(cmd) + return out.decode("utf-8").rstrip() + + +def is_git_dir_clean(git_dir): + """Return True iff |git_dir| is a git directory in clean state.""" + out = get_cmd_output(["git", "status", "--porcelain"], cwd=git_dir) + return len(out) == 0 + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + + parser.add_argument( + "--source_dir", default=_TOP_DIR, help="Source directory path." + ) + + parser.add_argument( + "--version", + help=( + "Specify alternate FreeType version (it is otherwise extracted" + " from current sources by default)." + ), + ) + + parser.add_argument( + "--gnu-config-dir", + help=( + "Path of input directory containing recent `config.guess` and" + " `config.sub` files from GNU config." + ), + ) + + parser.add_argument( + "--build-dir", + help="Specify build directory. Only used for debugging this script.", + ) + + parser.add_argument( + "--ignore-clean-check", + action="store_true", + help=( + "Do not check for a clean source git repository. Only used for" + " debugging this script." + ), + ) + + parser.add_argument( + "output_dir", help="Output directory for generated archives." + ) + + args = parser.parse_args() + + git_dir = args.source_dir if args.source_dir else _TOP_DIR + if not args.ignore_clean_check and not is_git_dir_clean(git_dir): + sys.stderr.write( + "ERROR: Your git repository is not in a clean state: %s\n" + % git_dir + ) + return 1 + + if args.version: + version = args.version + else: + # Extract FreeType version from sources. + version = get_cmd_output( + [ + sys.executable, + os.path.join(_SCRIPT_DIR, "extract_freetype_version.py"), + os.path.join(_TOP_DIR, "include", "freetype", "freetype.h"), + ] + ) + + # Determine the build directory. This will be a temporary file that is + # cleaned up on script exit by default, unless --build-dir=DIR is used, + # in which case we only create and empty the directory, but never remove + # its content on exit. + if args.build_dir: + build_dir = args.build_dir + if not os.path.exists(build_dir): + os.makedirs(build_dir) + else: + # Remove anything from the build directory, if any. + for item in os.listdir(build_dir): + file_path = os.path.join(build_dir, item) + if os.path.isdir(file_path): + shutil.rmtree(file_path) + else: + os.unlink(file_path) + else: + # Create a temporary directory, and ensure it is removed on exit. + build_dir = tempfile.mkdtemp(prefix="freetype-dist-") + + def clean_build_dir(): + shutil.rmtree(build_dir) + + atexit.register(clean_build_dir) + + # Copy all source files known to git into $BUILD_DIR/freetype-$VERSION + # with the exception of .gitignore and .mailmap files. + source_files = [ + f + for f in get_cmd_output(["git", "ls-files"], cwd=git_dir).split("\n") + if os.path.basename(f) not in (".gitignore", ".mailmap") + ] + + freetype_dir = "freetype-" + version + tmp_src_dir = os.path.join(build_dir, freetype_dir) + os.makedirs(tmp_src_dir) + + for src in source_files: + dst = os.path.join(tmp_src_dir, src) + dst_dir = os.path.dirname(dst) + if not os.path.exists(dst_dir): + os.makedirs(dst_dir) + shutil.copy(os.path.join(git_dir, src), dst) + + # Run autogen.sh in directory. + subprocess.check_call(["/bin/sh", "autogen.sh"], cwd=tmp_src_dir) + shutil.rmtree( + os.path.join(tmp_src_dir, "builds", "unix", "autom4te.cache") + ) + + # Copy config.guess and config.sub if possible! + if args.gnu_config_dir: + for f in ("config.guess", "config.sub"): + shutil.copy( + os.path.join(args.gnu_config_dir, f), + os.path.join(tmp_src_dir, "builds", "unix", f), + ) + + # Generate reference documentation under docs/ + subprocess.check_call( + [ + sys.executable, + os.path.join(_SCRIPT_DIR, "generate_reference_docs.py"), + "--input-dir", + tmp_src_dir, + "--version", + version, + "--output-dir", + os.path.join(tmp_src_dir, "docs"), + ] + ) + + shutil.rmtree(os.path.join(tmp_src_dir, "docs", "markdown")) + os.unlink(os.path.join(tmp_src_dir, "docs", "mkdocs.yml")) + + # Generate our archives + freetype_tar = freetype_dir + ".tar" + + subprocess.check_call( + ["tar", "-H", "ustar", "-chf", freetype_tar, freetype_dir], + cwd=build_dir, + ) + + subprocess.check_call( + ["gzip", "-9", "--keep", freetype_tar], cwd=build_dir + ) + + subprocess.check_call(["xz", "--keep", freetype_tar], cwd=build_dir) + + ftwinversion = "ft" + "".join(version.split(".")) + subprocess.check_call( + ["zip", "-qlr9", ftwinversion + ".zip", freetype_dir], cwd=build_dir + ) + + # Copy file to output directory now. + if not os.path.exists(args.output_dir): + os.makedirs(args.output_dir) + + for f in ( + freetype_tar + ".gz", + freetype_tar + ".xz", + ftwinversion + ".zip", + ): + shutil.copy( + os.path.join(build_dir, f), os.path.join(args.output_dir, f) + ) + + # Done! + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/3rdparty/freetype/src/tools/test_afm.c b/src/3rdparty/freetype/src/tools/test_afm.c index 8de619bb03..a4b2268984 100644 --- a/src/3rdparty/freetype/src/tools/test_afm.c +++ b/src/3rdparty/freetype/src/tools/test_afm.c @@ -2,10 +2,9 @@ * gcc -DFT2_BUILD_LIBRARY -I../../include -o test_afm test_afm.c \ * -L../../objs/.libs -lfreetype -lz -static */ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/freetype.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/psaux.h> void dump_fontinfo( AFM_FontInfo fi ) { diff --git a/src/3rdparty/freetype/src/tools/test_bbox.c b/src/3rdparty/freetype/src/tools/test_bbox.c index 64b82c384b..d9fd932993 100644 --- a/src/3rdparty/freetype/src/tools/test_bbox.c +++ b/src/3rdparty/freetype/src/tools/test_bbox.c @@ -1,6 +1,5 @@ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_BBOX_H +#include <freetype/freetype.h> +#include <freetype/ftbbox.h> #include <time.h> /* for clock() */ diff --git a/src/3rdparty/freetype/src/tools/test_trig.c b/src/3rdparty/freetype/src/tools/test_trig.c index 99ac1cf174..4f3410ab38 100644 --- a/src/3rdparty/freetype/src/tools/test_trig.c +++ b/src/3rdparty/freetype/src/tools/test_trig.c @@ -1,6 +1,5 @@ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_TRIGONOMETRY_H +#include <freetype/freetype.h> +#include <freetype/fttrigon.h> #include <math.h> #include <stdio.h> diff --git a/src/3rdparty/freetype/src/tools/update-copyright b/src/3rdparty/freetype/src/tools/update-copyright index 4a8bf9b0ea..4a8bf9b0ea 100644..100755 --- a/src/3rdparty/freetype/src/tools/update-copyright +++ b/src/3rdparty/freetype/src/tools/update-copyright diff --git a/src/3rdparty/freetype/src/tools/update-copyright-year b/src/3rdparty/freetype/src/tools/update-copyright-year index 2ae50d6f52..c659bbafb8 100644..100755 --- a/src/3rdparty/freetype/src/tools/update-copyright-year +++ b/src/3rdparty/freetype/src/tools/update-copyright-year @@ -2,7 +2,7 @@ eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}' & eval 'exec perl -wS -i "$0" $argv:q' if 0; -# Copyright (C) 2015-2019 by +# Copyright (C) 2015-2020 by # Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/3rdparty/freetype/src/truetype/Jamfile b/src/3rdparty/freetype/src/truetype/Jamfile deleted file mode 100644 index 2de63a7b4c..0000000000 --- a/src/3rdparty/freetype/src/truetype/Jamfile +++ /dev/null @@ -1,37 +0,0 @@ -# FreeType 2 src/truetype Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) truetype ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = ttdriver - ttgload - ttgxvar - ttinterp - ttobjs - ttpic - ttpload - ttsubpix - ; - } - else - { - _sources = truetype ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/truetype Jamfile diff --git a/src/3rdparty/freetype/src/truetype/module.mk b/src/3rdparty/freetype/src/truetype/module.mk index 8a841cc956..2d8d39d1f7 100644 --- a/src/3rdparty/freetype/src/truetype/module.mk +++ b/src/3rdparty/freetype/src/truetype/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/truetype/rules.mk b/src/3rdparty/freetype/src/truetype/rules.mk index df8dcd4a4e..2f6fecfc44 100644 --- a/src/3rdparty/freetype/src/truetype/rules.mk +++ b/src/3rdparty/freetype/src/truetype/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/truetype/truetype.c b/src/3rdparty/freetype/src/truetype/truetype.c index 84928e7321..41b6808a84 100644 --- a/src/3rdparty/freetype/src/truetype/truetype.c +++ b/src/3rdparty/freetype/src/truetype/truetype.c @@ -4,7 +4,7 @@ * * FreeType TrueType driver component (body only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "ttdriver.c" /* driver interface */ #include "ttgload.c" /* glyph loader */ diff --git a/src/3rdparty/freetype/src/truetype/ttdriver.c b/src/3rdparty/freetype/src/truetype/ttdriver.c index ff626d53ab..bf830b1418 100644 --- a/src/3rdparty/freetype/src/truetype/ttdriver.c +++ b/src/3rdparty/freetype/src/truetype/ttdriver.c @@ -4,7 +4,7 @@ * * TrueType font driver implementation (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,22 +16,21 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H -#include FT_SERVICE_FONT_FORMAT_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/sfnt.h> +#include <freetype/internal/services/svfntfmt.h> #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_MULTIPLE_MASTERS_H -#include FT_SERVICE_MULTIPLE_MASTERS_H -#include FT_SERVICE_METRICS_VARIATIONS_H +#include <freetype/ftmm.h> +#include <freetype/internal/services/svmm.h> +#include <freetype/internal/services/svmetric.h> #endif -#include FT_SERVICE_TRUETYPE_ENGINE_H -#include FT_SERVICE_TRUETYPE_GLYF_H -#include FT_SERVICE_PROPERTIES_H -#include FT_DRIVER_H +#include <freetype/internal/services/svtteng.h> +#include <freetype/internal/services/svttglyf.h> +#include <freetype/internal/services/svprop.h> +#include <freetype/ftdriver.h> #include "ttdriver.h" #include "ttgload.h" diff --git a/src/3rdparty/freetype/src/truetype/ttdriver.h b/src/3rdparty/freetype/src/truetype/ttdriver.h index 3936c6a4de..ee1438eb6e 100644 --- a/src/3rdparty/freetype/src/truetype/ttdriver.h +++ b/src/3rdparty/freetype/src/truetype/ttdriver.h @@ -4,7 +4,7 @@ * * High-level TrueType driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define TTDRIVER_H_ -#include <ft2build.h> -#include FT_INTERNAL_DRIVER_H +#include <freetype/internal/ftdrv.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/truetype/tterrors.h b/src/3rdparty/freetype/src/truetype/tterrors.h index 5609d28d68..efeafd3a1b 100644 --- a/src/3rdparty/freetype/src/truetype/tterrors.h +++ b/src/3rdparty/freetype/src/truetype/tterrors.h @@ -4,7 +4,7 @@ * * TrueType error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -26,7 +26,7 @@ #ifndef TTERRORS_H_ #define TTERRORS_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -34,7 +34,7 @@ #define FT_ERR_PREFIX TT_Err_ #define FT_ERR_BASE FT_Mod_Err_TrueType -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* TTERRORS_H_ */ diff --git a/src/3rdparty/freetype/src/truetype/ttgload.c b/src/3rdparty/freetype/src/truetype/ttgload.c index a04684086b..1dd319dcbf 100644 --- a/src/3rdparty/freetype/src/truetype/ttgload.c +++ b/src/3rdparty/freetype/src/truetype/ttgload.c @@ -4,7 +4,7 @@ * * TrueType Glyph Loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,15 +17,15 @@ #include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H -#include FT_TRUETYPE_TAGS_H -#include FT_OUTLINE_H -#include FT_DRIVER_H -#include FT_LIST_H +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/sfnt.h> +#include <freetype/tttags.h> +#include <freetype/ftoutln.h> +#include <freetype/ftdriver.h> +#include <freetype/ftlist.h> #include "ttgload.h" #include "ttpload.h" @@ -60,7 +60,7 @@ #define SAME_X 0x10 #define Y_POSITIVE 0x20 /* two meanings depending on Y_SHORT_VECTOR */ #define SAME_Y 0x20 -#define OVERLAP_SIMPLE 0x40 /* we ignore this value */ +#define OVERLAP_SIMPLE 0x40 /* retained as FT_OUTLINE_OVERLAP */ /************************************************************************** @@ -77,7 +77,7 @@ #define WE_HAVE_A_2X2 0x0080 #define WE_HAVE_INSTR 0x0100 #define USE_MY_METRICS 0x0200 -#define OVERLAP_COMPOUND 0x0400 /* we ignore this value */ +#define OVERLAP_COMPOUND 0x0400 /* retained as FT_OUTLINE_OVERLAP */ #define SCALED_COMPONENT_OFFSET 0x0800 #define UNSCALED_COMPONENT_OFFSET 0x1000 @@ -137,6 +137,11 @@ face->horizontal.Descender ); } +#ifdef FT_DEBUG_LEVEL_TRACE + if ( !face->vertical_info ) + FT_TRACE5(( " [vertical metrics missing, computing values]\n" )); +#endif + FT_TRACE5(( " advance height (font units): %d\n", *ah )); FT_TRACE5(( " top side bearing (font units): %d\n", *tsb )); } @@ -333,9 +338,9 @@ loader->bbox.yMax = FT_NEXT_SHORT( p ); FT_TRACE5(( " # of contours: %d\n", loader->n_contours )); - FT_TRACE5(( " xMin: %4d xMax: %4d\n", loader->bbox.xMin, + FT_TRACE5(( " xMin: %4ld xMax: %4ld\n", loader->bbox.xMin, loader->bbox.xMax )); - FT_TRACE5(( " yMin: %4d yMax: %4d\n", loader->bbox.yMin, + FT_TRACE5(( " yMin: %4ld yMax: %4ld\n", loader->bbox.yMin, loader->bbox.yMax )); loader->cursor = p; @@ -489,6 +494,10 @@ } } + /* retain the overlap flag */ + if ( n_points && outline->tags[0] & OVERLAP_SIMPLE ) + gloader->base.outline.flags |= FT_OUTLINE_OVERLAP; + /* reading the X coordinates */ vec = outline->points; @@ -1102,9 +1111,16 @@ } #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* if we have a HVAR table, `pp1' and/or `pp2' are already adjusted */ - if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) || - !IS_HINTED( loader->load_flags ) ) + /* if we have a HVAR table, `pp1' and/or `pp2' */ + /* are already adjusted but unscaled */ + if ( ( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) && + IS_HINTED( loader->load_flags ) ) + { + loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale ); + loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale ); + /* pp1.y and pp2.y are always zero */ + } + else #endif { loader->pp1 = outline->points[n_points - 4]; @@ -1112,9 +1128,17 @@ } #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* if we have a VVAR table, `pp3' and/or `pp4' are already adjusted */ - if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) || - !IS_HINTED( loader->load_flags ) ) + /* if we have a VVAR table, `pp3' and/or `pp4' */ + /* are already adjusted but unscaled */ + if ( ( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) && + IS_HINTED( loader->load_flags ) ) + { + loader->pp3.x = FT_MulFix( loader->pp3.x, x_scale ); + loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale ); + loader->pp4.x = FT_MulFix( loader->pp4.x, x_scale ); + loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale ); + } + else #endif { loader->pp3 = outline->points[n_points - 2]; @@ -2168,6 +2192,11 @@ goto Exit; } } + + /* retain the overlap flag */ + if ( gloader->base.num_subglyphs && + gloader->base.subglyphs[0].flags & OVERLAP_COMPOUND ) + gloader->base.outline.flags |= FT_OUTLINE_OVERLAP; } /***********************************************************************/ @@ -2287,13 +2316,14 @@ if ( face->vertical_info && face->vertical.number_Of_VMetrics > 0 ) { - top = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax, + top = (FT_Short)FT_DivFix( SUB_LONG( loader->pp3.y, bbox.yMax ), y_scale ); if ( loader->pp3.y <= loader->pp4.y ) advance = 0; else - advance = (FT_UShort)FT_DivFix( loader->pp3.y - loader->pp4.y, + advance = (FT_UShort)FT_DivFix( SUB_LONG( loader->pp3.y, + loader->pp4.y ), y_scale ); } else @@ -2965,8 +2995,6 @@ error = compute_glyph_metrics( &loader, glyph_index ); } - tt_loader_done( &loader ); - /* Set the `high precision' bit flag. */ /* This is _critical_ to get correct output for monochrome */ /* TrueType glyphs at all sizes using the bytecode interpreter. */ @@ -2975,6 +3003,15 @@ size->metrics->y_ppem < 24 ) glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; + FT_TRACE1(( " subglyphs = %u, contours = %hd, points = %hd," + " flags = 0x%.3x\n", + loader.gloader->base.num_subglyphs, + glyph->outline.n_contours, + glyph->outline.n_points, + glyph->outline.flags )); + + tt_loader_done( &loader ); + Exit: #ifdef FT_DEBUG_LEVEL_TRACE if ( error ) diff --git a/src/3rdparty/freetype/src/truetype/ttgload.h b/src/3rdparty/freetype/src/truetype/ttgload.h index f1324bc862..8f72cd558c 100644 --- a/src/3rdparty/freetype/src/truetype/ttgload.h +++ b/src/3rdparty/freetype/src/truetype/ttgload.h @@ -4,7 +4,7 @@ * * TrueType Glyph Loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,7 +20,6 @@ #define TTGLOAD_H_ -#include <ft2build.h> #include "ttobjs.h" #ifdef TT_USE_BYTECODE_INTERPRETER diff --git a/src/3rdparty/freetype/src/truetype/ttgxvar.c b/src/3rdparty/freetype/src/truetype/ttgxvar.c index 78d87dc097..b462263de1 100644 --- a/src/3rdparty/freetype/src/truetype/ttgxvar.c +++ b/src/3rdparty/freetype/src/truetype/ttgxvar.c @@ -4,7 +4,7 @@ * * TrueType GX Font Variation loader * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. * * This file is part of the FreeType project, and may only be used, @@ -40,14 +40,14 @@ #include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H -#include FT_TRUETYPE_TAGS_H -#include FT_TRUETYPE_IDS_H -#include FT_MULTIPLE_MASTERS_H -#include FT_LIST_H +#include <freetype/internal/ftstream.h> +#include <freetype/internal/sfnt.h> +#include <freetype/tttags.h> +#include <freetype/ttnameid.h> +#include <freetype/ftmm.h> +#include <freetype/ftlist.h> #include "ttpload.h" #include "ttgxvar.h" @@ -1470,6 +1470,7 @@ FT_ULong table_len; FT_ULong gvar_start; FT_ULong offsetToData; + FT_ULong offsets_len; GX_GVar_Head gvar_head; static const FT_Frame_Field gvar_fields[] = @@ -1530,9 +1531,13 @@ goto Exit; } - /* rough sanity check: offsets can be either 2 or 4 bytes */ - if ( (FT_ULong)gvar_head.glyphCount * - ( ( gvar_head.flags & 1 ) ? 4 : 2 ) > table_len ) + /* offsets can be either 2 or 4 bytes */ + /* (one more offset than glyphs, to mark size of last) */ + offsets_len = ( gvar_head.glyphCount + 1 ) * + ( ( gvar_head.flags & 1 ) ? 4L : 2L ); + + /* rough sanity check */ + if (offsets_len > table_len ) { FT_TRACE1(( "ft_var_load_gvar: invalid number of glyphs\n" )); error = FT_THROW( Invalid_Table ); @@ -1541,81 +1546,102 @@ FT_TRACE2(( "loaded\n" )); - blend->gvar_size = table_len; - blend->tuplecount = gvar_head.globalCoordCount; - blend->gv_glyphcnt = gvar_head.glyphCount; - offsetToData = gvar_start + gvar_head.offsetToData; + blend->gvar_size = table_len; + offsetToData = gvar_start + gvar_head.offsetToData; FT_TRACE5(( "gvar: there %s %d shared coordinate%s:\n", - blend->tuplecount == 1 ? "is" : "are", - blend->tuplecount, - blend->tuplecount == 1 ? "" : "s" )); + gvar_head.globalCoordCount == 1 ? "is" : "are", + gvar_head.globalCoordCount, + gvar_head.globalCoordCount == 1 ? "" : "s" )); - if ( FT_NEW_ARRAY( blend->glyphoffsets, blend->gv_glyphcnt + 1 ) ) + if ( FT_FRAME_ENTER( offsets_len ) ) goto Exit; + /* offsets (one more offset than glyphs, to mark size of last) */ + if ( FT_NEW_ARRAY( blend->glyphoffsets, gvar_head.glyphCount + 1 ) ) + goto Fail2; + if ( gvar_head.flags & 1 ) { - FT_ULong limit = gvar_start + table_len; - + FT_ULong limit = gvar_start + table_len; + FT_ULong max_offset = 0; - /* long offsets (one more offset than glyphs, to mark size of last) */ - if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 4L ) ) - goto Exit; - for ( i = 0; i <= blend->gv_glyphcnt; i++ ) + for ( i = 0; i <= gvar_head.glyphCount; i++ ) { blend->glyphoffsets[i] = offsetToData + FT_GET_ULONG(); - /* use `>', not `>=' */ - if ( blend->glyphoffsets[i] > limit ) + + if ( max_offset <= blend->glyphoffsets[i] ) + max_offset = blend->glyphoffsets[i]; + else { FT_TRACE2(( "ft_var_load_gvar:" - " invalid glyph variation data offset for index %d\n", + " glyph variation data offset %d not monotonic\n", i )); - error = FT_THROW( Invalid_Table ); - break; + blend->glyphoffsets[i] = max_offset; + } + + /* use `<', not `<=' */ + if ( limit < blend->glyphoffsets[i] ) + { + FT_TRACE2(( "ft_var_load_gvar:" + " glyph variation data offset %d out of range\n", + i )); + blend->glyphoffsets[i] = limit; } } } else { - FT_ULong limit = gvar_start + table_len; - + FT_ULong limit = gvar_start + table_len; + FT_ULong max_offset = 0; - /* short offsets (one more offset than glyphs, to mark size of last) */ - if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 2L ) ) - goto Exit; - for ( i = 0; i <= blend->gv_glyphcnt; i++ ) + for ( i = 0; i <= gvar_head.glyphCount; i++ ) { blend->glyphoffsets[i] = offsetToData + FT_GET_USHORT() * 2; - /* use `>', not `>=' */ - if ( blend->glyphoffsets[i] > limit ) + + if ( max_offset <= blend->glyphoffsets[i] ) + max_offset = blend->glyphoffsets[i]; + else { FT_TRACE2(( "ft_var_load_gvar:" - " invalid glyph variation data offset for index %d\n", + " glyph variation data offset %d not monotonic\n", i )); - error = FT_THROW( Invalid_Table ); - break; + blend->glyphoffsets[i] = max_offset; + } + + /* use `<', not `<=' */ + if ( limit < blend->glyphoffsets[i] ) + { + FT_TRACE2(( "ft_var_load_gvar:" + " glyph variation data offset %d out of range\n", + i )); + blend->glyphoffsets[i] = limit; } } } + blend->gv_glyphcnt = gvar_head.glyphCount; + FT_FRAME_EXIT(); - if ( error ) - goto Exit; - if ( blend->tuplecount != 0 ) + if ( gvar_head.globalCoordCount != 0 ) { - if ( FT_NEW_ARRAY( blend->tuplecoords, - gvar_head.axisCount * blend->tuplecount ) ) - goto Exit; + if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord ) || + FT_FRAME_ENTER( gvar_head.globalCoordCount * + gvar_head.axisCount * 2L ) ) + { + FT_TRACE2(( "ft_var_load_gvar:" + " glyph variation shared tuples missing\n" )); + goto Fail; + } - if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord ) || - FT_FRAME_ENTER( blend->tuplecount * gvar_head.axisCount * 2L ) ) - goto Exit; + if ( FT_NEW_ARRAY( blend->tuplecoords, + gvar_head.axisCount * gvar_head.globalCoordCount ) ) + goto Fail2; - for ( i = 0; i < blend->tuplecount; i++ ) + for ( i = 0; i < gvar_head.globalCoordCount; i++ ) { FT_TRACE5(( " [ " )); for ( j = 0; j < (FT_UInt)gvar_head.axisCount; j++ ) @@ -1628,6 +1654,8 @@ FT_TRACE5(( "]\n" )); } + blend->tuplecount = gvar_head.globalCoordCount; + FT_TRACE5(( "\n" )); FT_FRAME_EXIT(); @@ -1635,6 +1663,14 @@ Exit: return error; + + Fail2: + FT_FRAME_EXIT(); + + Fail: + FT_FREE( blend->glyphoffsets ); + blend->gv_glyphcnt = 0; + goto Exit; } @@ -1693,7 +1729,7 @@ if ( tuple_coords[i] == 0 ) { - FT_TRACE6(( " tuple coordinate is zero, ignore\n", i )); + FT_TRACE6(( " tuple coordinate is zero, ignore\n" )); continue; } @@ -2127,7 +2163,7 @@ /* `fvar' table validity check in `sfnt_init_face' */ /* the various `*_size' variables, which we also use as */ - /* offsets into the `mmlen' array, must be multiples of the */ + /* offsets into the `mmvar' array, must be multiples of the */ /* pointer size (except the last one); without such an */ /* alignment there might be runtime errors due to */ /* misaligned addresses */ @@ -3037,7 +3073,7 @@ TT_Set_Named_Instance( TT_Face face, FT_UInt instance_index ) { - FT_Error error = FT_ERR( Invalid_Argument ); + FT_Error error; GX_Blend blend; FT_MM_Var* mmvar; @@ -3057,7 +3093,10 @@ /* `instance_index' starts with value 1, thus `>' */ if ( instance_index > num_instances ) + { + error = FT_ERR( Invalid_Argument ); goto Exit; + } if ( instance_index > 0 ) { @@ -3766,7 +3805,7 @@ blend->glyphoffsets[glyph_index + 1] ) { FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:" - " no variation data for this glyph\n" )); + " no variation data for glyph %d\n", glyph_index )); return FT_Err_Ok; } diff --git a/src/3rdparty/freetype/src/truetype/ttgxvar.h b/src/3rdparty/freetype/src/truetype/ttgxvar.h index 07c99b6403..26e89bcf74 100644 --- a/src/3rdparty/freetype/src/truetype/ttgxvar.h +++ b/src/3rdparty/freetype/src/truetype/ttgxvar.h @@ -4,7 +4,7 @@ * * TrueType GX Font Variation loader (specification) * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, Werner Lemberg and George Williams. * * This file is part of the FreeType project, and may only be used, @@ -20,7 +20,6 @@ #define TTGXVAR_H_ -#include <ft2build.h> #include "ttobjs.h" diff --git a/src/3rdparty/freetype/src/truetype/ttinterp.c b/src/3rdparty/freetype/src/truetype/ttinterp.c index 70434e1729..0c3cb10ae8 100644 --- a/src/3rdparty/freetype/src/truetype/ttinterp.c +++ b/src/3rdparty/freetype/src/truetype/ttinterp.c @@ -4,7 +4,7 @@ * * TrueType bytecode interpreter (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 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 @@ /* issues; many thanks! */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H -#include FT_TRIGONOMETRY_H -#include FT_SYSTEM_H -#include FT_DRIVER_H -#include FT_MULTIPLE_MASTERS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/fttrigon.h> +#include <freetype/ftsystem.h> +#include <freetype/ftdriver.h> +#include <freetype/ftmm.h> #include "ttinterp.h" #include "tterrors.h" @@ -294,7 +293,7 @@ FT_Error error; - FT_TRACE1(( "Init_Context: new object at 0x%08p\n", exec )); + FT_TRACE1(( "Init_Context: new object at %p\n", (void *)exec )); exec->memory = memory; exec->callSize = 32; @@ -319,7 +318,7 @@ return FT_Err_Ok; Fail_Memory: - FT_ERROR(( "Init_Context: not enough memory for %p\n", exec )); + FT_ERROR(( "Init_Context: not enough memory for %p\n", (void *)exec )); TT_Done_Context( exec ); return error; @@ -1956,8 +1955,8 @@ * distance :: * The distance (not) to round. * - * compensation :: - * The engine compensation. + * color :: + * The engine compensation color. * * @Return: * The compensated distance. @@ -1965,12 +1964,11 @@ static FT_F26Dot6 Round_None( TT_ExecContext exc, FT_F26Dot6 distance, - FT_F26Dot6 compensation ) + FT_Int color ) { + FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; - FT_UNUSED( exc ); - if ( distance >= 0 ) { @@ -2000,8 +1998,8 @@ * distance :: * The distance to round. * - * compensation :: - * The engine compensation. + * color :: + * The engine compensation color. * * @Return: * Rounded distance. @@ -2009,12 +2007,11 @@ static FT_F26Dot6 Round_To_Grid( TT_ExecContext exc, FT_F26Dot6 distance, - FT_F26Dot6 compensation ) + FT_Int color ) { + FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; - FT_UNUSED( exc ); - if ( distance >= 0 ) { @@ -2046,8 +2043,8 @@ * distance :: * The distance to round. * - * compensation :: - * The engine compensation. + * color :: + * The engine compensation color. * * @Return: * Rounded distance. @@ -2055,12 +2052,11 @@ static FT_F26Dot6 Round_To_Half_Grid( TT_ExecContext exc, FT_F26Dot6 distance, - FT_F26Dot6 compensation ) + FT_Int color ) { + FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; - FT_UNUSED( exc ); - if ( distance >= 0 ) { @@ -2094,8 +2090,8 @@ * distance :: * The distance to round. * - * compensation :: - * The engine compensation. + * color :: + * The engine compensation color. * * @Return: * Rounded distance. @@ -2103,12 +2099,11 @@ static FT_F26Dot6 Round_Down_To_Grid( TT_ExecContext exc, FT_F26Dot6 distance, - FT_F26Dot6 compensation ) + FT_Int color ) { + FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; - FT_UNUSED( exc ); - if ( distance >= 0 ) { @@ -2139,8 +2134,8 @@ * distance :: * The distance to round. * - * compensation :: - * The engine compensation. + * color :: + * The engine compensation color. * * @Return: * Rounded distance. @@ -2148,12 +2143,11 @@ static FT_F26Dot6 Round_Up_To_Grid( TT_ExecContext exc, FT_F26Dot6 distance, - FT_F26Dot6 compensation ) + FT_Int color ) { + FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; - FT_UNUSED( exc ); - if ( distance >= 0 ) { @@ -2185,8 +2179,8 @@ * distance :: * The distance to round. * - * compensation :: - * The engine compensation. + * color :: + * The engine compensation color. * * @Return: * Rounded distance. @@ -2194,12 +2188,11 @@ static FT_F26Dot6 Round_To_Double_Grid( TT_ExecContext exc, FT_F26Dot6 distance, - FT_F26Dot6 compensation ) + FT_Int color ) { + FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; - FT_UNUSED( exc ); - if ( distance >= 0 ) { @@ -2231,8 +2224,8 @@ * distance :: * The distance to round. * - * compensation :: - * The engine compensation. + * color :: + * The engine compensation color. * * @Return: * Rounded distance. @@ -2246,8 +2239,9 @@ static FT_F26Dot6 Round_Super( TT_ExecContext exc, FT_F26Dot6 distance, - FT_F26Dot6 compensation ) + FT_Int color ) { + FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; @@ -2286,8 +2280,8 @@ * distance :: * The distance to round. * - * compensation :: - * The engine compensation. + * color :: + * The engine compensation color. * * @Return: * Rounded distance. @@ -2299,8 +2293,9 @@ static FT_F26Dot6 Round_Super_45( TT_ExecContext exc, FT_F26Dot6 distance, - FT_F26Dot6 compensation ) + FT_Int color ) { + FT_F26Dot6 compensation = exc->tt_metrics.compensations[color]; FT_F26Dot6 val; @@ -2899,7 +2894,7 @@ Ins_ODD( TT_ExecContext exc, FT_Long* args ) { - args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 127 ) == 64 ); + args[0] = ( ( exc->func_round( exc, args[0], 3 ) & 127 ) == 64 ); } @@ -2913,7 +2908,7 @@ Ins_EVEN( TT_ExecContext exc, FT_Long* args ) { - args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 127 ) == 0 ); + args[0] = ( ( exc->func_round( exc, args[0], 3 ) & 127 ) == 0 ); } @@ -3243,10 +3238,7 @@ Ins_ROUND( TT_ExecContext exc, FT_Long* args ) { - args[0] = exc->func_round( - exc, - args[0], - exc->tt_metrics.compensations[exc->opcode - 0x68] ); + args[0] = exc->func_round( exc, args[0], exc->opcode & 3 ); } @@ -3260,10 +3252,7 @@ Ins_NROUND( TT_ExecContext exc, FT_Long* args ) { - args[0] = Round_None( - exc, - args[0], - exc->tt_metrics.compensations[exc->opcode - 0x6C] ); + args[0] = Round_None( exc, args[0], exc->opcode & 3 ); } @@ -3718,7 +3707,7 @@ /* We will then parse the current table. */ rec = exc->FDefs; - limit = rec + exc->numFDefs; + limit = FT_OFFSET( rec, exc->numFDefs ); n = (FT_ULong)args[0]; for ( ; rec < limit; rec++ ) @@ -3965,6 +3954,9 @@ if ( BOUNDSL( F, exc->maxFunc + 1 ) ) goto Fail; + if ( !exc->FDefs ) + goto Fail; + /* Except for some old Apple fonts, all functions in a TrueType */ /* font are defined in increasing order, starting from 0. This */ /* means that we normally have */ @@ -4062,7 +4054,7 @@ /* */ /* If this isn't true, we need to look up the function table. */ - def = exc->FDefs + F; + def = FT_OFFSET( exc->FDefs, F ); if ( exc->maxFunc + 1 != exc->numFDefs || def->opc != F ) { /* look up the FDefs table */ @@ -4070,7 +4062,7 @@ def = exc->FDefs; - limit = def + exc->numFDefs; + limit = FT_OFFSET( def, exc->numFDefs ); while ( def < limit && def->opc != F ) def++; @@ -4150,7 +4142,7 @@ /* First of all, look for the same function in our table */ def = exc->IDefs; - limit = def + exc->numIDefs; + limit = FT_OFFSET( def, exc->numIDefs ); for ( ; def < limit; def++ ) if ( def->opc == (FT_ULong)args[0] ) @@ -5730,9 +5722,6 @@ { FT_F26Dot6 dx, dy; FT_UShort point; -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - FT_Int B1, B2; -#endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL FT_Bool in_twilight = FT_BOOL( exc->GS.gep0 == 0 || exc->GS.gep1 == 0 || @@ -5767,8 +5756,12 @@ } else #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - if ( SUBPIXEL_HINTING_INFINALITY ) + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode ) { + FT_Int B1, B2; + + /* If not using ignore_x_mode rendering, allow ZP2 move. */ /* If inline deltas aren't allowed, skip ZP2 move. */ /* If using ignore_x_mode rendering, allow ZP2 point move if: */ @@ -5777,72 +5770,57 @@ /* - the glyph is specifically set to allow SHPIX moves */ /* - the move is on a previously Y-touched point */ - if ( exc->ignore_x_mode ) + /* save point for later comparison */ + B1 = exc->zp2.cur[point].y; + + if ( exc->face->sph_compatibility_mode ) { - /* save point for later comparison */ + if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) + dy = FT_PIX_ROUND( B1 + dy ) - B1; + + /* skip post-iup deltas */ + if ( exc->iup_called && + ( ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) || + ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) ) + goto Skip; + + if ( !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) && + ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) || + ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) || + ( exc->sph_tweak_flags & SPH_TWEAK_DO_SHPIX ) ) ) + Move_Zp2_Point( exc, point, 0, dy, TRUE ); + + /* save new point */ if ( exc->GS.freeVector.y != 0 ) - B1 = exc->zp2.cur[point].y; - else - B1 = exc->zp2.cur[point].x; - - if ( !exc->face->sph_compatibility_mode && - exc->GS.freeVector.y != 0 ) { - Move_Zp2_Point( exc, point, dx, dy, TRUE ); + B2 = exc->zp2.cur[point].y; - /* save new point */ - if ( exc->GS.freeVector.y != 0 ) - { - B2 = exc->zp2.cur[point].y; - - /* reverse any disallowed moves */ - if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && - ( B1 & 63 ) != 0 && - ( B2 & 63 ) != 0 && - B1 != B2 ) - Move_Zp2_Point( exc, - point, - NEG_LONG( dx ), - NEG_LONG( dy ), - TRUE ); - } + /* reverse any disallowed moves */ + if ( ( B1 & 63 ) == 0 && + ( B2 & 63 ) != 0 && + B1 != B2 ) + Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE ); } - else if ( exc->face->sph_compatibility_mode ) - { - if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) - { - dx = FT_PIX_ROUND( B1 + dx ) - B1; - dy = FT_PIX_ROUND( B1 + dy ) - B1; - } - - /* skip post-iup deltas */ - if ( exc->iup_called && - ( ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) || - ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) ) - goto Skip; - - if ( !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) && - ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) || - ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) || - ( exc->sph_tweak_flags & SPH_TWEAK_DO_SHPIX ) ) ) - Move_Zp2_Point( exc, point, 0, dy, TRUE ); - - /* save new point */ - if ( exc->GS.freeVector.y != 0 ) - { - B2 = exc->zp2.cur[point].y; + } + else if ( exc->GS.freeVector.y != 0 ) + { + Move_Zp2_Point( exc, point, dx, dy, TRUE ); - /* reverse any disallowed moves */ - if ( ( B1 & 63 ) == 0 && - ( B2 & 63 ) != 0 && - B1 != B2 ) - Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE ); - } - } - else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL ) - Move_Zp2_Point( exc, point, dx, dy, TRUE ); + /* save new point */ + B2 = exc->zp2.cur[point].y; + + /* reverse any disallowed moves */ + if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && + ( B1 & 63 ) != 0 && + ( B2 & 63 ) != 0 && + B1 != B2 ) + Move_Zp2_Point( exc, + point, + NEG_LONG( dx ), + NEG_LONG( dy ), + TRUE ); } - else + else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL ) Move_Zp2_Point( exc, point, dx, dy, TRUE ); } else @@ -5890,22 +5868,8 @@ { FT_UShort point = 0; FT_F26Dot6 distance; -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - FT_F26Dot6 control_value_cutin = 0; - FT_F26Dot6 delta; - if ( SUBPIXEL_HINTING_INFINALITY ) - { - control_value_cutin = exc->GS.control_value_cutin; - - if ( exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && - !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) - control_value_cutin = 0; - } -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - point = (FT_UShort)args[0]; if ( BOUNDS( point, exc->zp1.n_points ) || @@ -5928,16 +5892,25 @@ distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - delta = SUB_LONG( distance, args[1] ); - if ( delta < 0 ) - delta = NEG_LONG( delta ); - /* subpixel hinting - make MSIRP respect CVT cut-in; */ - if ( SUBPIXEL_HINTING_INFINALITY && - exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && - delta >= control_value_cutin ) - distance = args[1]; + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode && + exc->GS.freeVector.x != 0 ) + { + FT_F26Dot6 control_value_cutin = exc->GS.control_value_cutin; + FT_F26Dot6 delta; + + + if ( !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) + control_value_cutin = 0; + + delta = SUB_LONG( distance, args[1] ); + if ( delta < 0 ) + delta = NEG_LONG( delta ); + + if ( delta >= control_value_cutin ) + distance = args[1]; + } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ exc->func_move( exc, @@ -5984,18 +5957,10 @@ if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && exc->GS.freeVector.x != 0 ) - distance = SUB_LONG( - Round_None( exc, - cur_dist, - exc->tt_metrics.compensations[0] ), - cur_dist ); + distance = SUB_LONG( Round_None( exc, cur_dist, 3 ), cur_dist ); else #endif - distance = SUB_LONG( - exc->func_round( exc, - cur_dist, - exc->tt_metrics.compensations[0] ), - cur_dist ); + distance = SUB_LONG( exc->func_round( exc, cur_dist, 3 ), cur_dist ); } else distance = 0; @@ -6021,21 +5986,10 @@ FT_UShort point; FT_F26Dot6 distance; FT_F26Dot6 org_dist; - FT_F26Dot6 control_value_cutin; - control_value_cutin = exc->GS.control_value_cutin; - cvtEntry = (FT_ULong)args[1]; - point = (FT_UShort)args[0]; - -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - if ( SUBPIXEL_HINTING_INFINALITY && - exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && - exc->GS.freeVector.y == 0 && - !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) - control_value_cutin = 0; -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ + cvtEntry = (FT_ULong)args[1]; + point = (FT_UShort)args[0]; if ( BOUNDS( point, exc->zp0.n_points ) || BOUNDSL( cvtEntry, exc->cvtSize ) ) @@ -6079,7 +6033,7 @@ exc->zp0.org[point].x = TT_MulFix14( distance, exc->GS.freeVector.x ); exc->zp0.org[point].y = TT_MulFix14( distance, - exc->GS.freeVector.y ), + exc->GS.freeVector.y ); exc->zp0.cur[point] = exc->zp0.org[point]; } #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY @@ -6095,9 +6049,19 @@ if ( ( exc->opcode & 1 ) != 0 ) /* rounding and control cut-in flag */ { + FT_F26Dot6 control_value_cutin = exc->GS.control_value_cutin; FT_F26Dot6 delta; +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode && + exc->GS.freeVector.x != 0 && + exc->GS.freeVector.y == 0 && + !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) + control_value_cutin = 0; +#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ + delta = SUB_LONG( distance, org_dist ); if ( delta < 0 ) delta = NEG_LONG( delta ); @@ -6109,14 +6073,10 @@ if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && exc->GS.freeVector.x != 0 ) - distance = Round_None( exc, - distance, - exc->tt_metrics.compensations[0] ); + distance = Round_None( exc, distance, 3 ); else #endif - distance = exc->func_round( exc, - distance, - exc->tt_metrics.compensations[0] ); + distance = exc->func_round( exc, distance, 3 ); } exc->func_move( exc, &exc->zp0, point, SUB_LONG( distance, org_dist ) ); @@ -6138,18 +6098,8 @@ FT_Long* args ) { FT_UShort point = 0; - FT_F26Dot6 org_dist, distance, minimum_distance; - + FT_F26Dot6 org_dist, distance; - minimum_distance = exc->GS.minimum_distance; - -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - if ( SUBPIXEL_HINTING_INFINALITY && - exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && - !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) - minimum_distance = 0; -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ point = (FT_UShort)args[0]; @@ -6223,27 +6173,29 @@ if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && exc->GS.freeVector.x != 0 ) - distance = Round_None( - exc, - org_dist, - exc->tt_metrics.compensations[exc->opcode & 3] ); + distance = Round_None( exc, org_dist, exc->opcode & 3 ); else #endif - distance = exc->func_round( - exc, - org_dist, - exc->tt_metrics.compensations[exc->opcode & 3] ); + distance = exc->func_round( exc, org_dist, exc->opcode & 3 ); } else - distance = Round_None( - exc, - org_dist, - exc->tt_metrics.compensations[exc->opcode & 3] ); + distance = Round_None( exc, org_dist, exc->opcode & 3 ); /* minimum distance flag */ if ( ( exc->opcode & 8 ) != 0 ) { + FT_F26Dot6 minimum_distance = exc->GS.minimum_distance; + + +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode && + exc->GS.freeVector.x != 0 && + !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) + minimum_distance = 0; +#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ + if ( org_dist >= 0 ) { if ( distance < minimum_distance ) @@ -6287,30 +6239,13 @@ FT_F26Dot6 cvt_dist, distance, cur_dist, - org_dist, - control_value_cutin, - minimum_distance; -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - FT_Int B1 = 0; /* pacify compiler */ - FT_Int B2 = 0; - FT_Bool reverse_move = FALSE; -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ + org_dist; FT_F26Dot6 delta; - minimum_distance = exc->GS.minimum_distance; - control_value_cutin = exc->GS.control_value_cutin; - point = (FT_UShort)args[0]; - cvtEntry = (FT_ULong)( ADD_LONG( args[1], 1 ) ); - -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - if ( SUBPIXEL_HINTING_INFINALITY && - exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && - !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) - control_value_cutin = minimum_distance = 0; -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ + point = (FT_UShort)args[0]; + cvtEntry = (FT_ULong)( ADD_LONG( args[1], 1 ) ); /* XXX: UNDOCUMENTED! cvt[-1] = 0 always */ @@ -6346,12 +6281,14 @@ /* twilight points (confirmed by Greg Hitchcock) */ if ( exc->GS.gep1 == 0 ) { - exc->zp1.org[point].x = exc->zp0.org[exc->GS.rp0].x + - TT_MulFix14( cvt_dist, - exc->GS.freeVector.x ); - exc->zp1.org[point].y = exc->zp0.org[exc->GS.rp0].y + - TT_MulFix14( cvt_dist, - exc->GS.freeVector.y ); + exc->zp1.org[point].x = ADD_LONG( + exc->zp0.org[exc->GS.rp0].x, + TT_MulFix14( cvt_dist, + exc->GS.freeVector.x ) ); + exc->zp1.org[point].y = ADD_LONG( + exc->zp0.org[exc->GS.rp0].y, + TT_MulFix14( cvt_dist, + exc->GS.freeVector.y ) ); exc->zp1.cur[point] = exc->zp1.org[point]; } @@ -6366,19 +6303,6 @@ cvt_dist = NEG_LONG( cvt_dist ); } -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - if ( SUBPIXEL_HINTING_INFINALITY && - exc->ignore_x_mode && - exc->GS.freeVector.y != 0 && - ( exc->sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) ) - { - if ( cur_dist < -64 ) - cvt_dist -= 16; - else if ( cur_dist > 64 && cur_dist < 84 ) - cvt_dist += 32; - } -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - /* control value cut-in and round */ if ( ( exc->opcode & 4 ) != 0 ) @@ -6388,6 +6312,9 @@ if ( exc->GS.gep0 == exc->GS.gep1 ) { + FT_F26Dot6 control_value_cutin = exc->GS.control_value_cutin; + + /* XXX: According to Greg Hitchcock, the following wording is */ /* the right one: */ /* */ @@ -6408,10 +6335,7 @@ cvt_dist = org_dist; } - distance = exc->func_round( - exc, - cvt_dist, - exc->tt_metrics.compensations[exc->opcode & 3] ); + distance = exc->func_round( exc, cvt_dist, exc->opcode & 3 ); } else { @@ -6422,6 +6346,22 @@ exc->ignore_x_mode && exc->GS.gep0 == exc->GS.gep1 ) { + FT_F26Dot6 control_value_cutin = exc->GS.control_value_cutin; + + + if ( exc->GS.freeVector.x != 0 && + !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) + control_value_cutin = 0; + + if ( exc->GS.freeVector.y != 0 && + ( exc->sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) ) + { + if ( cur_dist < -64 ) + cvt_dist -= 16; + else if ( cur_dist > 64 && cur_dist < 84 ) + cvt_dist += 32; + } + delta = SUB_LONG( cvt_dist, org_dist ); if ( delta < 0 ) delta = NEG_LONG( delta ); @@ -6431,16 +6371,24 @@ } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - distance = Round_None( - exc, - cvt_dist, - exc->tt_metrics.compensations[exc->opcode & 3] ); + distance = Round_None( exc, cvt_dist, exc->opcode & 3 ); } /* minimum distance test */ if ( ( exc->opcode & 8 ) != 0 ) { + FT_F26Dot6 minimum_distance = exc->GS.minimum_distance; + + +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode && + exc->GS.freeVector.x != 0 && + !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) + minimum_distance = 0; +#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ + if ( org_dist >= 0 ) { if ( distance < minimum_distance ) @@ -6454,60 +6402,51 @@ } #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - if ( SUBPIXEL_HINTING_INFINALITY ) + if ( SUBPIXEL_HINTING_INFINALITY && + exc->ignore_x_mode && + exc->GS.freeVector.y != 0 ) { + FT_Int B1, B2; + + B1 = exc->zp1.cur[point].y; /* Round moves if necessary */ - if ( exc->ignore_x_mode && - exc->GS.freeVector.y != 0 && - ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) ) + if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) distance = FT_PIX_ROUND( B1 + distance - cur_dist ) - B1 + cur_dist; - if ( exc->ignore_x_mode && - exc->GS.freeVector.y != 0 && - ( exc->opcode & 16 ) == 0 && + if ( ( exc->opcode & 16 ) == 0 && ( exc->opcode & 8 ) == 0 && ( exc->sph_tweak_flags & SPH_TWEAK_COURIER_NEW_2_HACK ) ) distance += 64; - } -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ - exc->func_move( exc, - &exc->zp1, - point, - SUB_LONG( distance, cur_dist ) ); + exc->func_move( exc, + &exc->zp1, + point, + SUB_LONG( distance, cur_dist ) ); -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - if ( SUBPIXEL_HINTING_INFINALITY ) - { B2 = exc->zp1.cur[point].y; /* Reverse move if necessary */ - if ( exc->ignore_x_mode ) - { - if ( exc->face->sph_compatibility_mode && - exc->GS.freeVector.y != 0 && + if ( ( exc->face->sph_compatibility_mode && ( B1 & 63 ) == 0 && - ( B2 & 63 ) != 0 ) - reverse_move = TRUE; - - if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && - exc->GS.freeVector.y != 0 && - ( B2 & 63 ) != 0 && - ( B1 & 63 ) != 0 ) - reverse_move = TRUE; - } - - if ( reverse_move ) + ( B2 & 63 ) != 0 ) || + ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && + ( B1 & 63 ) != 0 && + ( B2 & 63 ) != 0 ) ) exc->func_move( exc, &exc->zp1, point, SUB_LONG( cur_dist, distance ) ); } - + else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ + exc->func_move( exc, + &exc->zp1, + point, + SUB_LONG( distance, cur_dist ) ); + Fail: exc->GS.rp1 = exc->GS.rp0; @@ -7180,10 +7119,9 @@ FT_UShort A; FT_ULong C, P; FT_Long B; -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - FT_UShort B1, B2; +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && exc->iup_called && @@ -7264,6 +7202,9 @@ /* rules, always skipping deltas in subpixel direction. */ else if ( exc->ignore_x_mode && exc->GS.freeVector.y != 0 ) { + FT_UShort B1, B2; + + /* save the y value of the point now; compare after move */ B1 = (FT_UShort)exc->zp0.cur[A].y; @@ -7715,7 +7656,7 @@ Ins_UNKNOWN( TT_ExecContext exc ) { TT_DefRecord* def = exc->IDefs; - TT_DefRecord* limit = def + exc->numIDefs; + TT_DefRecord* limit = FT_OFFSET( def, exc->numIDefs ); for ( ; def < limit; def++ ) @@ -7841,7 +7782,7 @@ num_twilight_points = 0xFFFFU; FT_TRACE5(( "TT_RunIns: Resetting number of twilight points\n" - " from %d to the more reasonable value %d\n", + " from %d to the more reasonable value %ld\n", exc->twilight.n_points, num_twilight_points )); exc->twilight.n_points = (FT_UShort)num_twilight_points; @@ -7867,7 +7808,7 @@ FT_MAX( 50, exc->cvtSize / 10 ); else - exc->loopcall_counter_max = 300 + 8 * exc->cvtSize; + exc->loopcall_counter_max = 300 + 22 * exc->cvtSize; /* as a protection against an unreasonable number of CVT entries */ /* we assume at most 100 control values per glyph for the counter */ @@ -7876,11 +7817,11 @@ exc->loopcall_counter_max = 100 * (FT_ULong)exc->face->root.num_glyphs; FT_TRACE5(( "TT_RunIns: Limiting total number of loops in LOOPCALL" - " to %d\n", exc->loopcall_counter_max )); + " to %ld\n", exc->loopcall_counter_max )); exc->neg_jump_counter_max = exc->loopcall_counter_max; FT_TRACE5(( "TT_RunIns: Limiting total number of backward jumps" - " to %d\n", exc->neg_jump_counter_max )); + " to %ld\n", exc->neg_jump_counter_max )); /* set PPEM and CVT functions */ exc->tt_metrics.ratio = 0; @@ -7917,14 +7858,14 @@ /* if tracing level is 7, show current code position */ /* and the first few stack elements also */ FT_TRACE6(( " " )); - FT_TRACE7(( "%06d ", exc->IP )); + FT_TRACE7(( "%06ld ", exc->IP )); FT_TRACE6(( "%s", opcode_name[exc->opcode] + 2 )); FT_TRACE7(( "%*s", *opcode_name[exc->opcode] == 'A' ? 2 : 12 - ( *opcode_name[exc->opcode] - '0' ), "#" )); for ( n = 1; n <= cnt; n++ ) - FT_TRACE7(( " %d", exc->stack[exc->top - n] )); + FT_TRACE7(( " %ld", exc->stack[exc->top - n] )); FT_TRACE6(( "\n" )); } #endif /* FT_DEBUG_LEVEL_TRACE */ @@ -8567,7 +8508,7 @@ case FT_ERR( Invalid_Opcode ): { TT_DefRecord* def = exc->IDefs; - TT_DefRecord* limit = def + exc->numIDefs; + TT_DefRecord* limit = FT_OFFSET( def, exc->numIDefs ); for ( ; def < limit; def++ ) @@ -8642,7 +8583,7 @@ } while ( !exc->instruction_trap ); LNo_Error_: - FT_TRACE4(( " %d instruction%s executed\n", + FT_TRACE4(( " %ld instruction%s executed\n", ins_counter, ins_counter == 1 ? "" : "s" )); return FT_Err_Ok; diff --git a/src/3rdparty/freetype/src/truetype/ttinterp.h b/src/3rdparty/freetype/src/truetype/ttinterp.h index 0cb1e892fb..6a83705a6c 100644 --- a/src/3rdparty/freetype/src/truetype/ttinterp.h +++ b/src/3rdparty/freetype/src/truetype/ttinterp.h @@ -4,7 +4,7 @@ * * TrueType bytecode interpreter (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,7 +19,6 @@ #ifndef TTINTERP_H_ #define TTINTERP_H_ -#include <ft2build.h> #include "ttobjs.h" @@ -52,7 +51,7 @@ FT_BEGIN_HEADER typedef FT_F26Dot6 (*TT_Round_Func)( TT_ExecContext exc, FT_F26Dot6 distance, - FT_F26Dot6 compensation ); + FT_Int color ); /* Point displacement along the freedom vector routine */ typedef void diff --git a/src/3rdparty/freetype/src/truetype/ttobjs.c b/src/3rdparty/freetype/src/truetype/ttobjs.c index e4775a51ed..06d4569559 100644 --- a/src/3rdparty/freetype/src/truetype/ttobjs.c +++ b/src/3rdparty/freetype/src/truetype/ttobjs.c @@ -4,7 +4,7 @@ * * Objects manager (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_SFNT_H -#include FT_DRIVER_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> +#include <freetype/internal/sfnt.h> +#include <freetype/ftdriver.h> #include "ttgload.h" #include "ttpload.h" @@ -1116,10 +1115,10 @@ /* The Apple specification says that the compensation for */ /* `gray' is always zero. FreeType doesn't do any */ /* compensation at all. */ - tt_metrics->compensations[0] = 0; /* gray */ - tt_metrics->compensations[1] = 0; /* black */ - tt_metrics->compensations[2] = 0; /* white */ - tt_metrics->compensations[3] = 0; /* the same as gray */ + tt_metrics->compensations[0] = 0; /* gray */ + tt_metrics->compensations[1] = 0; /* black */ + tt_metrics->compensations[2] = 0; /* white */ + tt_metrics->compensations[3] = 0; /* zero */ } /* allocate function defs, instruction defs, cvt, and storage area */ diff --git a/src/3rdparty/freetype/src/truetype/ttobjs.h b/src/3rdparty/freetype/src/truetype/ttobjs.h index 9fc654d5d1..d986deabc4 100644 --- a/src/3rdparty/freetype/src/truetype/ttobjs.h +++ b/src/3rdparty/freetype/src/truetype/ttobjs.h @@ -4,7 +4,7 @@ * * Objects manager (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define TTOBJS_H_ -#include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_TRUETYPE_TYPES_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/tttypes.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/truetype/ttpic.c b/src/3rdparty/freetype/src/truetype/ttpic.c deleted file mode 100644 index cdbb80639e..0000000000 --- a/src/3rdparty/freetype/src/truetype/ttpic.c +++ /dev/null @@ -1,101 +0,0 @@ -/***************************************************************************/ -/* */ -/* ttpic.c */ -/* */ -/* The FreeType position independent code services for truetype module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include "ttpic.h" -#include "tterrors.h" - - -#ifdef FT_CONFIG_OPTION_PIC - - /* forward declaration of PIC init functions from ttdriver.c */ - FT_Error - FT_Create_Class_tt_services( FT_Library library, - FT_ServiceDescRec** output_class ); - void - FT_Destroy_Class_tt_services( FT_Library library, - FT_ServiceDescRec* clazz ); - void - FT_Init_Class_tt_service_gx_multi_masters( - FT_Service_MultiMastersRec* sv_mm ); - void - FT_Init_Class_tt_service_truetype_glyf( - FT_Service_TTGlyfRec* sv_ttglyf ); - - - void - tt_driver_class_pic_free( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - - - if ( pic_container->truetype ) - { - TTModulePIC* container = (TTModulePIC*)pic_container->truetype; - - - if ( container->tt_services ) - FT_Destroy_Class_tt_services( library, container->tt_services ); - container->tt_services = NULL; - FT_FREE( container ); - pic_container->truetype = NULL; - } - } - - - FT_Error - tt_driver_class_pic_init( FT_Library library ) - { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - TTModulePIC* container = NULL; - FT_Memory memory = library->memory; - - - /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC( container, sizeof ( *container ) ) ) - return error; - FT_MEM_SET( container, 0, sizeof ( *container ) ); - pic_container->truetype = container; - - /* initialize pointer table - this is how the module usually */ - /* expects this data */ - error = FT_Create_Class_tt_services( library, - &container->tt_services ); - if ( error ) - goto Exit; -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_Init_Class_tt_service_gx_multi_masters( - &container->tt_service_gx_multi_masters ); -#endif - FT_Init_Class_tt_service_truetype_glyf( - &container->tt_service_truetype_glyf ); - - Exit: - if ( error ) - tt_driver_class_pic_free( library ); - return error; - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/truetype/ttpic.h b/src/3rdparty/freetype/src/truetype/ttpic.h deleted file mode 100644 index df878ae6f1..0000000000 --- a/src/3rdparty/freetype/src/truetype/ttpic.h +++ /dev/null @@ -1,88 +0,0 @@ -/***************************************************************************/ -/* */ -/* ttpic.h */ -/* */ -/* The FreeType position independent code services for truetype module. */ -/* */ -/* Copyright 2009-2018 by */ -/* Oran Agra and Mickey Gabel. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef TTPIC_H_ -#define TTPIC_H_ - - -#include FT_INTERNAL_PIC_H - - -#ifndef FT_CONFIG_OPTION_PIC - -#define TT_SERVICES_GET tt_services -#define TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters -#define TT_SERVICE_METRICS_VARIATIONS_GET tt_service_metrics_variations -#define TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf -#define TT_SERVICE_PROPERTIES_GET tt_service_properties - -#else /* FT_CONFIG_OPTION_PIC */ - -#include FT_MULTIPLE_MASTERS_H -#include FT_SERVICE_MULTIPLE_MASTERS_H -#include FT_SERVICE_METRICS_VARIATIONS_H -#include FT_SERVICE_TRUETYPE_GLYF_H -#include FT_SERVICE_PROPERTIES_H - - -FT_BEGIN_HEADER - - typedef struct TTModulePIC_ - { - FT_ServiceDescRec* tt_services; -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_Service_MultiMastersRec tt_service_gx_multi_masters; - FT_Service_MetricsVariationsRec tt_service_metrics_variations; -#endif - FT_Service_TTGlyfRec tt_service_truetype_glyf; - FT_Service_PropertiesRec tt_service_properties; - - } TTModulePIC; - - -#define GET_PIC( lib ) \ - ( (TTModulePIC*)((lib)->pic_container.truetype) ) -#define TT_SERVICES_GET \ - ( GET_PIC( library )->tt_services ) -#define TT_SERVICE_METRICS_VARIATIONS_GET \ - ( GET_PIC( library )->tt_service_metrics_variations ) -#define TT_SERVICE_GX_MULTI_MASTERS_GET \ - ( GET_PIC( library )->tt_service_gx_multi_masters ) -#define TT_SERVICE_TRUETYPE_GLYF_GET \ - ( GET_PIC( library )->tt_service_truetype_glyf ) -#define TT_SERVICE_PROPERTIES_GET \ - ( GET_PIC( library )->tt_service_properties ) - - - /* see ttpic.c for the implementation */ - void - tt_driver_class_pic_free( FT_Library library ); - - FT_Error - tt_driver_class_pic_init( FT_Library library ); - -FT_END_HEADER - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ - -#endif /* TTPIC_H_ */ - - -/* END */ diff --git a/src/3rdparty/freetype/src/truetype/ttpload.c b/src/3rdparty/freetype/src/truetype/ttpload.c index bc954c2dba..b1255b88cd 100644 --- a/src/3rdparty/freetype/src/truetype/ttpload.c +++ b/src/3rdparty/freetype/src/truetype/ttpload.c @@ -4,7 +4,7 @@ * * TrueType-specific tables loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftstream.h> +#include <freetype/tttags.h> #include "ttpload.h" @@ -124,7 +123,7 @@ if ( face->num_locations != (FT_ULong)face->root.num_glyphs + 1 ) { - FT_TRACE2(( "glyph count mismatch! loca: %d, maxp: %d\n", + FT_TRACE2(( "glyph count mismatch! loca: %ld, maxp: %ld\n", face->num_locations - 1, face->root.num_glyphs )); /* we only handle the case where `maxp' gives a larger value */ @@ -165,7 +164,7 @@ face->num_locations = (FT_ULong)face->root.num_glyphs + 1; table_len = new_loca_len; - FT_TRACE2(( "adjusting num_locations to %d\n", + FT_TRACE2(( "adjusting num_locations to %ld\n", face->num_locations )); } else @@ -173,7 +172,7 @@ face->root.num_glyphs = face->num_locations ? (FT_Long)face->num_locations - 1 : 0; - FT_TRACE2(( "adjusting num_glyphs to %d\n", + FT_TRACE2(( "adjusting num_glyphs to %ld\n", face->root.num_glyphs )); } } @@ -238,7 +237,7 @@ if ( pos1 > face->glyf_len ) { FT_TRACE1(( "tt_face_get_location:" - " too large offset (0x%08lx) found for glyph index %ld,\n" + " too large offset (0x%08lx) found for glyph index %d,\n" " " " exceeding the end of `glyf' table (0x%08lx)\n", pos1, gindex, face->glyf_len )); @@ -252,7 +251,7 @@ if ( gindex == face->num_locations - 2 ) { FT_TRACE1(( "tt_face_get_location:" - " too large size (%ld bytes) found for glyph index %ld,\n" + " too large size (%ld bytes) found for glyph index %d,\n" " " " truncating at the end of `glyf' table to %ld bytes\n", pos2 - pos1, gindex, face->glyf_len - pos1 )); @@ -261,7 +260,7 @@ else { FT_TRACE1(( "tt_face_get_location:" - " too large offset (0x%08lx) found for glyph index %ld,\n" + " too large offset (0x%08lx) found for glyph index %d,\n" " " " exceeding the end of `glyf' table (0x%08lx)\n", pos2, gindex + 1, face->glyf_len )); @@ -429,7 +428,7 @@ if ( FT_FRAME_EXTRACT( table_len, face->font_program ) ) goto Exit; - FT_TRACE2(( "loaded, %12d bytes\n", face->font_program_size )); + FT_TRACE2(( "loaded, %12ld bytes\n", face->font_program_size )); } Exit: @@ -492,7 +491,7 @@ if ( FT_FRAME_EXTRACT( table_len, face->cvt_program ) ) goto Exit; - FT_TRACE2(( "loaded, %12d bytes\n", face->cvt_program_size )); + FT_TRACE2(( "loaded, %12ld bytes\n", face->cvt_program_size )); } Exit: @@ -633,7 +632,7 @@ FT_UInt nn; FT_Byte* result = NULL; FT_ULong record_size = face->hdmx_record_size; - FT_Byte* record = face->hdmx_table + 8; + FT_Byte* record = FT_OFFSET( face->hdmx_table, 8 ); for ( nn = 0; nn < face->hdmx_record_count; nn++ ) diff --git a/src/3rdparty/freetype/src/truetype/ttpload.h b/src/3rdparty/freetype/src/truetype/ttpload.h index 022750e324..bb669e0278 100644 --- a/src/3rdparty/freetype/src/truetype/ttpload.h +++ b/src/3rdparty/freetype/src/truetype/ttpload.h @@ -4,7 +4,7 @@ * * TrueType-specific tables loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define TTPLOAD_H_ -#include <ft2build.h> -#include FT_INTERNAL_TRUETYPE_TYPES_H +#include <freetype/internal/tttypes.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/truetype/ttsubpix.c b/src/3rdparty/freetype/src/truetype/ttsubpix.c index 23a2e5b440..56667deaf7 100644 --- a/src/3rdparty/freetype/src/truetype/ttsubpix.c +++ b/src/3rdparty/freetype/src/truetype/ttsubpix.c @@ -4,7 +4,7 @@ * * TrueType Subpixel Hinting. * - * Copyright (C) 2010-2019 by + * Copyright (C) 2010-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -15,14 +15,13 @@ * */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H -#include FT_TRUETYPE_TAGS_H -#include FT_OUTLINE_H -#include FT_DRIVER_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/sfnt.h> +#include <freetype/tttags.h> +#include <freetype/ftoutln.h> +#include <freetype/ftdriver.h> #include "ttsubpix.h" diff --git a/src/3rdparty/freetype/src/truetype/ttsubpix.h b/src/3rdparty/freetype/src/truetype/ttsubpix.h index 4966800c2d..229a6cf055 100644 --- a/src/3rdparty/freetype/src/truetype/ttsubpix.h +++ b/src/3rdparty/freetype/src/truetype/ttsubpix.h @@ -4,7 +4,7 @@ * * TrueType Subpixel Hinting. * - * Copyright (C) 2010-2019 by + * Copyright (C) 2010-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,7 +19,6 @@ #ifndef TTSUBPIX_H_ #define TTSUBPIX_H_ -#include <ft2build.h> #include "ttobjs.h" #include "ttinterp.h" diff --git a/src/3rdparty/freetype/src/type1/Jamfile b/src/3rdparty/freetype/src/type1/Jamfile deleted file mode 100644 index 0bcfb2e406..0000000000 --- a/src/3rdparty/freetype/src/type1/Jamfile +++ /dev/null @@ -1,35 +0,0 @@ -# FreeType 2 src/type1 Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) type1 ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = t1afm - t1driver - t1gload - t1load - t1objs - t1parse - ; - } - else - { - _sources = type1 ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/type1 Jamfile diff --git a/src/3rdparty/freetype/src/type1/module.mk b/src/3rdparty/freetype/src/type1/module.mk index 2f48c65821..cffb774b45 100644 --- a/src/3rdparty/freetype/src/type1/module.mk +++ b/src/3rdparty/freetype/src/type1/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/type1/rules.mk b/src/3rdparty/freetype/src/type1/rules.mk index 901169c7a5..213e619247 100644 --- a/src/3rdparty/freetype/src/type1/rules.mk +++ b/src/3rdparty/freetype/src/type1/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/type1/t1afm.c b/src/3rdparty/freetype/src/type1/t1afm.c index 6841184539..b9cd66b045 100644 --- a/src/3rdparty/freetype/src/type1/t1afm.c +++ b/src/3rdparty/freetype/src/type1/t1afm.c @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,11 +16,10 @@ */ -#include <ft2build.h> #include "t1afm.h" -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/psaux.h> #include "t1errors.h" diff --git a/src/3rdparty/freetype/src/type1/t1afm.h b/src/3rdparty/freetype/src/type1/t1afm.h index a8e6a5495a..edf919c791 100644 --- a/src/3rdparty/freetype/src/type1/t1afm.h +++ b/src/3rdparty/freetype/src/type1/t1afm.h @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -19,9 +19,8 @@ #ifndef T1AFM_H_ #define T1AFM_H_ -#include <ft2build.h> #include "t1objs.h" -#include FT_INTERNAL_TYPE1_TYPES_H +#include <freetype/internal/t1types.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/type1/t1driver.c b/src/3rdparty/freetype/src/type1/t1driver.c index 557733da3b..b786a87817 100644 --- a/src/3rdparty/freetype/src/type1/t1driver.c +++ b/src/3rdparty/freetype/src/type1/t1driver.c @@ -4,7 +4,7 @@ * * Type 1 driver interface (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,7 +16,6 @@ */ -#include <ft2build.h> #include "t1driver.h" #include "t1gload.h" #include "t1load.h" @@ -27,20 +26,20 @@ #include "t1afm.h" #endif -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_HASH_H -#include FT_INTERNAL_POSTSCRIPT_PROPS_H -#include FT_DRIVER_H - -#include FT_SERVICE_MULTIPLE_MASTERS_H -#include FT_SERVICE_GLYPH_DICT_H -#include FT_SERVICE_FONT_FORMAT_H -#include FT_SERVICE_POSTSCRIPT_NAME_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H -#include FT_SERVICE_POSTSCRIPT_INFO_H -#include FT_SERVICE_PROPERTIES_H -#include FT_SERVICE_KERNING_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/fthash.h> +#include <freetype/internal/ftpsprop.h> +#include <freetype/ftdriver.h> + +#include <freetype/internal/services/svmm.h> +#include <freetype/internal/services/svgldict.h> +#include <freetype/internal/services/svfntfmt.h> +#include <freetype/internal/services/svpostnm.h> +#include <freetype/internal/services/svpscmap.h> +#include <freetype/internal/services/svpsinfo.h> +#include <freetype/internal/services/svprop.h> +#include <freetype/internal/services/svkern.h> /************************************************************************** diff --git a/src/3rdparty/freetype/src/type1/t1driver.h b/src/3rdparty/freetype/src/type1/t1driver.h index 206f64a0bc..e7eae0b88c 100644 --- a/src/3rdparty/freetype/src/type1/t1driver.h +++ b/src/3rdparty/freetype/src/type1/t1driver.h @@ -4,7 +4,7 @@ * * High-level Type 1 driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define T1DRIVER_H_ -#include <ft2build.h> -#include FT_INTERNAL_DRIVER_H +#include <freetype/internal/ftdrv.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/type1/t1errors.h b/src/3rdparty/freetype/src/type1/t1errors.h index b35f67a24c..ad03a3d32a 100644 --- a/src/3rdparty/freetype/src/type1/t1errors.h +++ b/src/3rdparty/freetype/src/type1/t1errors.h @@ -4,7 +4,7 @@ * * Type 1 error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 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 @@ #ifndef T1ERRORS_H_ #define T1ERRORS_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -33,7 +33,7 @@ #define FT_ERR_PREFIX T1_Err_ #define FT_ERR_BASE FT_Mod_Err_Type1 -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* T1ERRORS_H_ */ diff --git a/src/3rdparty/freetype/src/type1/t1gload.c b/src/3rdparty/freetype/src/type1/t1gload.c index f9b115b186..d16b81f246 100644 --- a/src/3rdparty/freetype/src/type1/t1gload.c +++ b/src/3rdparty/freetype/src/type1/t1gload.c @@ -4,7 +4,7 @@ * * Type 1 Glyph Loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,15 +16,14 @@ */ -#include <ft2build.h> #include "t1gload.h" -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_OUTLINE_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_CFF_TYPES_H -#include FT_DRIVER_H +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/ftoutln.h> +#include <freetype/internal/psaux.h> +#include <freetype/internal/cfftypes.h> +#include <freetype/ftdriver.h> #include "t1errors.h" @@ -334,7 +333,7 @@ else advances[nn] = 0; - FT_TRACE5(( " idx %d: advance width %d font unit%s\n", + FT_TRACE5(( " idx %d: advance width %ld font unit%s\n", first + nn, advances[nn], advances[nn] == 1 ? "" : "s" )); diff --git a/src/3rdparty/freetype/src/type1/t1gload.h b/src/3rdparty/freetype/src/type1/t1gload.h index 80440369dc..9947507c84 100644 --- a/src/3rdparty/freetype/src/type1/t1gload.h +++ b/src/3rdparty/freetype/src/type1/t1gload.h @@ -4,7 +4,7 @@ * * Type 1 Glyph Loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,7 +20,6 @@ #define T1GLOAD_H_ -#include <ft2build.h> #include "t1objs.h" diff --git a/src/3rdparty/freetype/src/type1/t1load.c b/src/3rdparty/freetype/src/type1/t1load.c index 5cffdfaac4..84986007b0 100644 --- a/src/3rdparty/freetype/src/type1/t1load.c +++ b/src/3rdparty/freetype/src/type1/t1load.c @@ -4,7 +4,7 @@ * * Type 1 font loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -61,12 +61,12 @@ #include <ft2build.h> -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> #include FT_CONFIG_CONFIG_H -#include FT_MULTIPLE_MASTERS_H -#include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_HASH_H +#include <freetype/ftmm.h> +#include <freetype/internal/t1types.h> +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/fthash.h> #include "t1load.h" #include "t1errors.h" @@ -309,31 +309,55 @@ FT_UInt i; FT_Fixed axiscoords[T1_MAX_MM_AXIS]; PS_Blend blend = face->blend; + FT_UShort* axis_flags; + + FT_Offset mmvar_size; + FT_Offset axis_flags_size; + FT_Offset axis_size; error = T1_Get_Multi_Master( face, &mmaster ); if ( error ) goto Exit; - if ( FT_ALLOC( mmvar, - sizeof ( FT_MM_Var ) + - mmaster.num_axis * sizeof ( FT_Var_Axis ) ) ) + + /* the various `*_size' variables, which we also use as */ + /* offsets into the `mmvar' array, must be multiples of the */ + /* pointer size (except the last one); without such an */ + /* alignment there might be runtime errors due to */ + /* misaligned addresses */ +#undef ALIGN_SIZE +#define ALIGN_SIZE( n ) \ + ( ( (n) + sizeof (void*) - 1 ) & ~( sizeof (void*) - 1 ) ) + + mmvar_size = ALIGN_SIZE( sizeof ( FT_MM_Var ) ); + axis_flags_size = ALIGN_SIZE( mmaster.num_axis * + sizeof ( FT_UShort ) ); + axis_size = mmaster.num_axis * sizeof ( FT_Var_Axis ); + + if ( FT_ALLOC( mmvar, mmvar_size + + axis_flags_size + + axis_size ) ) goto Exit; mmvar->num_axis = mmaster.num_axis; mmvar->num_designs = mmaster.num_designs; mmvar->num_namedstyles = 0; /* Not supported */ - mmvar->axis = (FT_Var_Axis*)&mmvar[1]; - /* Point to axes after MM_Var struct */ - mmvar->namedstyle = NULL; + + /* while axis flags are meaningless here, we have to provide the array */ + /* to make `FT_Get_Var_Axis_Flags' work: the function expects that the */ + /* values directly follow the data of `FT_MM_Var' */ + axis_flags = (FT_UShort*)( (char*)mmvar + mmvar_size ); + for ( i = 0; i < mmaster.num_axis; i++ ) + axis_flags[i] = 0; + + mmvar->axis = (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size ); + mmvar->namedstyle = NULL; for ( i = 0; i < mmaster.num_axis; i++ ) { mmvar->axis[i].name = mmaster.axis[i].name; mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum ); mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum ); - mmvar->axis[i].def = ( mmvar->axis[i].minimum + - mmvar->axis[i].maximum ) / 2; - /* Does not apply. But this value is in range */ mmvar->axis[i].strid = ~0U; /* Does not apply */ mmvar->axis[i].tag = ~0U; /* Does not apply */ @@ -1039,7 +1063,7 @@ map->design_points[p] = T1_ToInt( parser ); map->blend_points [p] = T1_ToFixed( parser, 0 ); - FT_TRACE4(( " [%d %f]", + FT_TRACE4(( " [%ld %f]", map->design_points[p], (double)map->blend_points[p] / 65536 )); } @@ -1731,7 +1755,7 @@ */ FT_TRACE0(( "parse_subrs: adjusting number of subroutines" - " (from %d to %d)\n", + " (from %d to %ld)\n", num_subrs, ( parser->root.limit - parser->root.cursor ) >> 3 )); num_subrs = ( parser->root.limit - parser->root.cursor ) >> 3; @@ -1902,7 +1926,7 @@ if ( num_glyphs > ( limit - cur ) >> 3 ) { FT_TRACE0(( "parse_charstrings: adjusting number of glyphs" - " (from %d to %d)\n", + " (from %d to %ld)\n", num_glyphs, ( limit - cur ) >> 3 )); num_glyphs = ( limit - cur ) >> 3; } diff --git a/src/3rdparty/freetype/src/type1/t1load.h b/src/3rdparty/freetype/src/type1/t1load.h index 44f835bde2..4396415c20 100644 --- a/src/3rdparty/freetype/src/type1/t1load.h +++ b/src/3rdparty/freetype/src/type1/t1load.h @@ -4,7 +4,7 @@ * * Type 1 font loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,10 +20,9 @@ #define T1LOAD_H_ -#include <ft2build.h> -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_MULTIPLE_MASTERS_H +#include <freetype/internal/ftstream.h> +#include <freetype/internal/psaux.h> +#include <freetype/ftmm.h> #include "t1parse.h" diff --git a/src/3rdparty/freetype/src/type1/t1objs.c b/src/3rdparty/freetype/src/type1/t1objs.c index 741388a645..3b918b7338 100644 --- a/src/3rdparty/freetype/src/type1/t1objs.c +++ b/src/3rdparty/freetype/src/type1/t1objs.c @@ -4,7 +4,7 @@ * * Type 1 objects manager (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,12 +16,11 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_IDS_H -#include FT_DRIVER_H +#include <freetype/internal/ftcalc.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/ttnameid.h> +#include <freetype/ftdriver.h> #include "t1gload.h" #include "t1load.h" @@ -32,8 +31,8 @@ #include "t1afm.h" #endif -#include FT_SERVICE_POSTSCRIPT_CMAPS_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/services/svpscmap.h> +#include <freetype/internal/psaux.h> /************************************************************************** @@ -347,8 +346,8 @@ if ( error ) goto Exit; - FT_TRACE2(( "T1_Face_Init: %08p (index %d)\n", - face, + FT_TRACE2(( "T1_Face_Init: %p (index %d)\n", + (void *)face, face_index )); /* if we just wanted to check the format, leave successfully now */ diff --git a/src/3rdparty/freetype/src/type1/t1objs.h b/src/3rdparty/freetype/src/type1/t1objs.h index 2161091f77..536be8ba1e 100644 --- a/src/3rdparty/freetype/src/type1/t1objs.h +++ b/src/3rdparty/freetype/src/type1/t1objs.h @@ -4,7 +4,7 @@ * * Type 1 objects manager (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -21,9 +21,9 @@ #include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H +#include <freetype/internal/ftobjs.h> #include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_TYPE1_TYPES_H +#include <freetype/internal/t1types.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/type1/t1parse.c b/src/3rdparty/freetype/src/type1/t1parse.c index 56caeb9e40..74cf38bde7 100644 --- a/src/3rdparty/freetype/src/type1/t1parse.c +++ b/src/3rdparty/freetype/src/type1/t1parse.c @@ -4,7 +4,7 @@ * * Type 1 parser (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -33,10 +33,9 @@ */ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/psaux.h> #include "t1parse.h" diff --git a/src/3rdparty/freetype/src/type1/t1parse.h b/src/3rdparty/freetype/src/type1/t1parse.h index dab8fddc8b..1ea0110b50 100644 --- a/src/3rdparty/freetype/src/type1/t1parse.h +++ b/src/3rdparty/freetype/src/type1/t1parse.h @@ -4,7 +4,7 @@ * * Type 1 parser (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,9 +20,8 @@ #define T1PARSE_H_ -#include <ft2build.h> -#include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_STREAM_H +#include <freetype/internal/t1types.h> +#include <freetype/internal/ftstream.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/type1/t1tokens.h b/src/3rdparty/freetype/src/type1/t1tokens.h index 97f2dbe0cf..c09420355d 100644 --- a/src/3rdparty/freetype/src/type1/t1tokens.h +++ b/src/3rdparty/freetype/src/type1/t1tokens.h @@ -4,7 +4,7 @@ * * Type 1 tokenizer (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 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/type1/type1.c b/src/3rdparty/freetype/src/type1/type1.c index ce8557a5fb..cadee78994 100644 --- a/src/3rdparty/freetype/src/type1/type1.c +++ b/src/3rdparty/freetype/src/type1/type1.c @@ -4,7 +4,7 @@ * * FreeType Type 1 driver component (body only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "t1afm.c" #include "t1driver.c" diff --git a/src/3rdparty/freetype/src/type42/Jamfile b/src/3rdparty/freetype/src/type42/Jamfile deleted file mode 100644 index 6123b35598..0000000000 --- a/src/3rdparty/freetype/src/type42/Jamfile +++ /dev/null @@ -1,32 +0,0 @@ -# FreeType 2 src/type42 Jamfile -# -# Copyright (C) 2002-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) type42 ; - -{ - local _sources ; - - if $(FT2_MULTI) - { - _sources = t42drivr - t42objs - t42parse - ; - } - else - { - _sources = type42 ; - } - - Library $(FT2_LIB) : $(_sources).c ; -} - -# end of src/type42 Jamfile diff --git a/src/3rdparty/freetype/src/type42/module.mk b/src/3rdparty/freetype/src/type42/module.mk index 9e9d15455b..6ef3a95ead 100644 --- a/src/3rdparty/freetype/src/type42/module.mk +++ b/src/3rdparty/freetype/src/type42/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2019 by +# Copyright (C) 2002-2020 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/type42/rules.mk b/src/3rdparty/freetype/src/type42/rules.mk index 9d71f5300e..f4ce91a3b7 100644 --- a/src/3rdparty/freetype/src/type42/rules.mk +++ b/src/3rdparty/freetype/src/type42/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2002-2019 by +# Copyright (C) 2002-2020 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/type42/t42drivr.c b/src/3rdparty/freetype/src/type42/t42drivr.c index 09ad632e97..90898b4329 100644 --- a/src/3rdparty/freetype/src/type42/t42drivr.c +++ b/src/3rdparty/freetype/src/type42/t42drivr.c @@ -4,7 +4,7 @@ * * High-level Type 42 driver interface (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -39,12 +39,12 @@ #include "t42drivr.h" #include "t42objs.h" #include "t42error.h" -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftdebug.h> -#include FT_SERVICE_FONT_FORMAT_H -#include FT_SERVICE_GLYPH_DICT_H -#include FT_SERVICE_POSTSCRIPT_NAME_H -#include FT_SERVICE_POSTSCRIPT_INFO_H +#include <freetype/internal/services/svfntfmt.h> +#include <freetype/internal/services/svgldict.h> +#include <freetype/internal/services/svpostnm.h> +#include <freetype/internal/services/svpsinfo.h> #undef FT_COMPONENT #define FT_COMPONENT t42 diff --git a/src/3rdparty/freetype/src/type42/t42drivr.h b/src/3rdparty/freetype/src/type42/t42drivr.h index a35ca28f84..8bf2afc755 100644 --- a/src/3rdparty/freetype/src/type42/t42drivr.h +++ b/src/3rdparty/freetype/src/type42/t42drivr.h @@ -4,7 +4,7 @@ * * High-level Type 42 driver interface (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,7 @@ #define T42DRIVR_H_ -#include <ft2build.h> -#include FT_INTERNAL_DRIVER_H +#include <freetype/internal/ftdrv.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/type42/t42error.h b/src/3rdparty/freetype/src/type42/t42error.h index 5fb2143949..e48132ec09 100644 --- a/src/3rdparty/freetype/src/type42/t42error.h +++ b/src/3rdparty/freetype/src/type42/t42error.h @@ -4,7 +4,7 @@ * * Type 42 error codes (specification only). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 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 @@ #ifndef T42ERROR_H_ #define T42ERROR_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -33,7 +33,7 @@ #define FT_ERR_PREFIX T42_Err_ #define FT_ERR_BASE FT_Mod_Err_Type42 -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* T42ERROR_H_ */ diff --git a/src/3rdparty/freetype/src/type42/t42objs.c b/src/3rdparty/freetype/src/type42/t42objs.c index d31bace451..6acfcdf401 100644 --- a/src/3rdparty/freetype/src/type42/t42objs.c +++ b/src/3rdparty/freetype/src/type42/t42objs.c @@ -4,7 +4,7 @@ * * Type 42 objects manager (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -19,9 +19,9 @@ #include "t42objs.h" #include "t42parse.h" #include "t42error.h" -#include FT_INTERNAL_DEBUG_H -#include FT_LIST_H -#include FT_TRUETYPE_IDS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/ftlist.h> +#include <freetype/ttnameid.h> #undef FT_COMPONENT diff --git a/src/3rdparty/freetype/src/type42/t42objs.h b/src/3rdparty/freetype/src/type42/t42objs.h index 98300cf348..69f5cffd44 100644 --- a/src/3rdparty/freetype/src/type42/t42objs.h +++ b/src/3rdparty/freetype/src/type42/t42objs.h @@ -4,7 +4,7 @@ * * Type 42 objects manager (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -19,15 +19,14 @@ #ifndef T42OBJS_H_ #define T42OBJS_H_ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_TYPE1_TABLES_H -#include FT_INTERNAL_TYPE1_TYPES_H +#include <freetype/freetype.h> +#include <freetype/t1tables.h> +#include <freetype/internal/t1types.h> #include "t42types.h" -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DRIVER_H -#include FT_SERVICE_POSTSCRIPT_CMAPS_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdrv.h> +#include <freetype/internal/services/svpscmap.h> +#include <freetype/internal/pshints.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/type42/t42parse.c b/src/3rdparty/freetype/src/type42/t42parse.c index c47a77786d..98507699fa 100644 --- a/src/3rdparty/freetype/src/type42/t42parse.c +++ b/src/3rdparty/freetype/src/type42/t42parse.c @@ -4,7 +4,7 @@ * * Type 42 font parser (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -18,9 +18,9 @@ #include "t42parse.h" #include "t42error.h" -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/psaux.h> /************************************************************************** @@ -826,7 +826,7 @@ if ( loader->num_glyphs > ( limit - parser->root.cursor ) >> 2 ) { FT_TRACE0(( "t42_parse_charstrings: adjusting number of glyphs" - " (from %d to %d)\n", + " (from %d to %ld)\n", loader->num_glyphs, ( limit - parser->root.cursor ) >> 2 )); loader->num_glyphs = ( limit - parser->root.cursor ) >> 2; diff --git a/src/3rdparty/freetype/src/type42/t42parse.h b/src/3rdparty/freetype/src/type42/t42parse.h index 0c7bb48496..2ccf052d78 100644 --- a/src/3rdparty/freetype/src/type42/t42parse.h +++ b/src/3rdparty/freetype/src/type42/t42parse.h @@ -4,7 +4,7 @@ * * Type 42 font parser (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -21,7 +21,7 @@ #include "t42objs.h" -#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include <freetype/internal/psaux.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/type42/t42types.h b/src/3rdparty/freetype/src/type42/t42types.h index a258144ec3..ba0cc21429 100644 --- a/src/3rdparty/freetype/src/type42/t42types.h +++ b/src/3rdparty/freetype/src/type42/t42types.h @@ -4,7 +4,7 @@ * * Type 42 font data types (specification only). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -20,11 +20,10 @@ #define T42TYPES_H_ -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_TYPE1_TABLES_H -#include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include <freetype/freetype.h> +#include <freetype/t1tables.h> +#include <freetype/internal/t1types.h> +#include <freetype/internal/pshints.h> FT_BEGIN_HEADER diff --git a/src/3rdparty/freetype/src/type42/type42.c b/src/3rdparty/freetype/src/type42/type42.c index 0cb7b77eec..012559e2fd 100644 --- a/src/3rdparty/freetype/src/type42/type42.c +++ b/src/3rdparty/freetype/src/type42/type42.c @@ -4,7 +4,7 @@ * * FreeType Type 42 driver component. * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -17,7 +17,6 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include <ft2build.h> #include "t42drivr.c" #include "t42objs.c" diff --git a/src/3rdparty/freetype/src/winfonts/Jamfile b/src/3rdparty/freetype/src/winfonts/Jamfile deleted file mode 100644 index 4b92226159..0000000000 --- a/src/3rdparty/freetype/src/winfonts/Jamfile +++ /dev/null @@ -1,16 +0,0 @@ -# FreeType 2 src/winfonts Jamfile -# -# Copyright (C) 2001-2019 by -# David Turner, Robert Wilhelm, and Werner Lemberg. -# -# This file is part of the FreeType project, and may only be used, modified, -# and distributed under the terms of the FreeType project license, -# LICENSE.TXT. By continuing to use, modify, or distribute this file you -# indicate that you have read the license and understand and accept it -# fully. - -SubDir FT2_TOP $(FT2_SRC_DIR) winfonts ; - -Library $(FT2_LIB) : winfnt.c ; - -# end of src/winfonts Jamfile diff --git a/src/3rdparty/freetype/src/winfonts/fnterrs.h b/src/3rdparty/freetype/src/winfonts/fnterrs.h index af29307c75..550de386fc 100644 --- a/src/3rdparty/freetype/src/winfonts/fnterrs.h +++ b/src/3rdparty/freetype/src/winfonts/fnterrs.h @@ -4,7 +4,7 @@ * * Win FNT/FON error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -26,7 +26,7 @@ #ifndef FNTERRS_H_ #define FNTERRS_H_ -#include FT_MODULE_ERRORS_H +#include <freetype/ftmoderr.h> #undef FTERRORS_H_ @@ -34,7 +34,7 @@ #define FT_ERR_PREFIX FNT_Err_ #define FT_ERR_BASE FT_Mod_Err_Winfonts -#include FT_ERRORS_H +#include <freetype/fterrors.h> #endif /* FNTERRS_H_ */ diff --git a/src/3rdparty/freetype/src/winfonts/module.mk b/src/3rdparty/freetype/src/winfonts/module.mk index 82fb0151f8..4614c55fd0 100644 --- a/src/3rdparty/freetype/src/winfonts/module.mk +++ b/src/3rdparty/freetype/src/winfonts/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/winfonts/rules.mk b/src/3rdparty/freetype/src/winfonts/rules.mk index 998d49bc9f..e73ef5ea99 100644 --- a/src/3rdparty/freetype/src/winfonts/rules.mk +++ b/src/3rdparty/freetype/src/winfonts/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 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/winfonts/winfnt.c b/src/3rdparty/freetype/src/winfonts/winfnt.c index 2d771be2cc..e83312d166 100644 --- a/src/3rdparty/freetype/src/winfonts/winfnt.c +++ b/src/3rdparty/freetype/src/winfonts/winfnt.c @@ -4,7 +4,7 @@ * * FreeType font driver for Windows FNT/FON files * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * Copyright 2003 Huw D M Davies for Codeweavers * Copyright 2007 Dmitry Timoshkov for Codeweavers @@ -18,17 +18,16 @@ */ -#include <ft2build.h> -#include FT_WINFONTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_OBJECTS_H -#include FT_TRUETYPE_IDS_H +#include <freetype/ftwinfnt.h> +#include <freetype/internal/ftdebug.h> +#include <freetype/internal/ftstream.h> +#include <freetype/internal/ftobjs.h> +#include <freetype/ttnameid.h> #include "winfnt.h" #include "fnterrs.h" -#include FT_SERVICE_WINFNT_H -#include FT_SERVICE_FONT_FORMAT_H +#include <freetype/internal/services/svwinfnt.h> +#include <freetype/internal/services/svfntfmt.h> /************************************************************************** * @@ -331,7 +330,7 @@ { FT_TRACE2(( "invalid alignment shift count for resource data\n" )); error = FT_THROW( Invalid_File_Format ); - goto Exit; + goto Exit1; } @@ -597,6 +596,10 @@ Exit: return error; + + Exit1: + FT_FRAME_EXIT(); + goto Exit; } diff --git a/src/3rdparty/freetype/src/winfonts/winfnt.h b/src/3rdparty/freetype/src/winfonts/winfnt.h index b628ad4c42..3367c7715e 100644 --- a/src/3rdparty/freetype/src/winfonts/winfnt.h +++ b/src/3rdparty/freetype/src/winfonts/winfnt.h @@ -4,7 +4,7 @@ * * FreeType font driver for Windows FNT/FON files * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * Copyright 2007 Dmitry Timoshkov for Codeweavers * @@ -21,9 +21,8 @@ #define WINFNT_H_ -#include <ft2build.h> -#include FT_WINFONTS_H -#include FT_INTERNAL_DRIVER_H +#include <freetype/ftwinfnt.h> +#include <freetype/internal/ftdrv.h> FT_BEGIN_HEADER |