From 58f56950848bae9c90da3873090c7698e0128b12 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 14 Aug 2019 11:13:36 +0200 Subject: Update bundled Freetype to 2.10.1 [ChangeLog][Freetype] Upgraded bundled Freetype version to 2.10.1. Fixes: QTBUG-77466 Change-Id: I1de8b8b03e0ffd0b17eeafff1017df7c638c9279 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/freetype/src/autofit/Jamfile | 2 +- src/3rdparty/freetype/src/autofit/afangles.c | 52 ++--- src/3rdparty/freetype/src/autofit/afangles.h | 6 +- src/3rdparty/freetype/src/autofit/afblue.c | 39 ++-- src/3rdparty/freetype/src/autofit/afblue.cin | 32 +-- src/3rdparty/freetype/src/autofit/afblue.dat | 28 ++- src/3rdparty/freetype/src/autofit/afblue.h | 171 +++++++-------- src/3rdparty/freetype/src/autofit/afblue.hin | 32 +-- src/3rdparty/freetype/src/autofit/afcjk.c | 195 +++++++++-------- src/3rdparty/freetype/src/autofit/afcjk.h | 38 ++-- src/3rdparty/freetype/src/autofit/afcover.h | 32 +-- src/3rdparty/freetype/src/autofit/afdummy.c | 42 ++-- src/3rdparty/freetype/src/autofit/afdummy.h | 34 +-- src/3rdparty/freetype/src/autofit/aferrors.h | 48 ++--- src/3rdparty/freetype/src/autofit/afglobal.c | 98 +++++---- src/3rdparty/freetype/src/autofit/afglobal.h | 46 ++-- src/3rdparty/freetype/src/autofit/afhints.c | 181 ++++++++++------ src/3rdparty/freetype/src/autofit/afhints.h | 238 +++++++++++---------- src/3rdparty/freetype/src/autofit/afindic.c | 32 +-- src/3rdparty/freetype/src/autofit/afindic.h | 34 +-- src/3rdparty/freetype/src/autofit/aflatin.c | 304 ++++++++++++++++----------- src/3rdparty/freetype/src/autofit/aflatin.h | 44 ++-- src/3rdparty/freetype/src/autofit/aflatin2.c | 147 ++++++------- src/3rdparty/freetype/src/autofit/aflatin2.h | 34 +-- src/3rdparty/freetype/src/autofit/afloader.c | 175 ++++++++------- src/3rdparty/freetype/src/autofit/afloader.h | 42 ++-- src/3rdparty/freetype/src/autofit/afmodule.c | 88 +++----- src/3rdparty/freetype/src/autofit/afmodule.h | 36 ++-- src/3rdparty/freetype/src/autofit/afranges.c | 47 +++-- src/3rdparty/freetype/src/autofit/afranges.h | 32 +-- src/3rdparty/freetype/src/autofit/afscript.h | 38 ++-- src/3rdparty/freetype/src/autofit/afshaper.c | 61 +++--- src/3rdparty/freetype/src/autofit/afshaper.h | 32 +-- src/3rdparty/freetype/src/autofit/afstyles.h | 39 ++-- src/3rdparty/freetype/src/autofit/aftypes.h | 252 ++++++++-------------- src/3rdparty/freetype/src/autofit/afwarp.c | 54 ++--- src/3rdparty/freetype/src/autofit/afwarp.h | 36 ++-- src/3rdparty/freetype/src/autofit/afwrtsys.h | 32 +-- src/3rdparty/freetype/src/autofit/autofit.c | 33 ++- src/3rdparty/freetype/src/autofit/module.mk | 2 +- src/3rdparty/freetype/src/autofit/rules.mk | 3 +- 41 files changed, 1500 insertions(+), 1411 deletions(-) (limited to 'src/3rdparty/freetype/src/autofit') diff --git a/src/3rdparty/freetype/src/autofit/Jamfile b/src/3rdparty/freetype/src/autofit/Jamfile index 01b866ec61..ea69dee377 100644 --- a/src/3rdparty/freetype/src/autofit/Jamfile +++ b/src/3rdparty/freetype/src/autofit/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/autofit Jamfile # -# Copyright 2003-2018 by +# 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, diff --git a/src/3rdparty/freetype/src/autofit/afangles.c b/src/3rdparty/freetype/src/autofit/afangles.c index c65a3ae23e..9e1f7a21ff 100644 --- a/src/3rdparty/freetype/src/autofit/afangles.c +++ b/src/3rdparty/freetype/src/autofit/afangles.c @@ -1,28 +1,28 @@ -/***************************************************************************/ -/* */ -/* afangles.c */ -/* */ -/* Routines used to compute vector angles with limited accuracy */ -/* and very high speed. It also contains sorting routines (body). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afangles.c + * + * Routines used to compute vector angles with limited accuracy + * and very high speed. It also contains sorting routines (body). + * + * 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. + * + */ #include "aftypes.h" /* - * We are not using `af_angle_atan' anymore, but we keep the source - * code below just in case... + * We are not using `af_angle_atan' anymore, but we keep the source + * code below just in case... */ @@ -30,16 +30,16 @@ /* - * The trick here is to realize that we don't need a very accurate angle - * approximation. We are going to use the result of `af_angle_atan' to - * only compare the sign of angle differences, or check whether its - * magnitude is very small. + * The trick here is to realize that we don't need a very accurate angle + * approximation. We are going to use the result of `af_angle_atan' to + * only compare the sign of angle differences, or check whether its + * magnitude is very small. * - * The approximation + * The approximation * - * dy * PI / (|dx|+|dy|) + * dy * PI / (|dx|+|dy|) * - * should be enough, and much faster to compute. + * should be enough, and much faster to compute. */ FT_LOCAL_DEF( AF_Angle ) af_angle_atan( FT_Fixed dx, diff --git a/src/3rdparty/freetype/src/autofit/afangles.h b/src/3rdparty/freetype/src/autofit/afangles.h index f33f9e108e..18d7dae3a6 100644 --- a/src/3rdparty/freetype/src/autofit/afangles.h +++ b/src/3rdparty/freetype/src/autofit/afangles.h @@ -1,7 +1,7 @@ /* - * afangles.h + * afangles.h * - * This is a dummy file, used to please the build system. It is never - * included by the auto-fitter sources. + * This is a dummy file, used to please the build system. It is never + * included by the auto-fitter sources. * */ diff --git a/src/3rdparty/freetype/src/autofit/afblue.c b/src/3rdparty/freetype/src/autofit/afblue.c index e4078fd044..b99dbeb19c 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.c +++ b/src/3rdparty/freetype/src/autofit/afblue.c @@ -1,22 +1,22 @@ /* This file has been generated by the Perl script `afblue.pl', */ /* using data from file `afblue.dat'. */ -/***************************************************************************/ -/* */ -/* afblue.c */ -/* */ -/* Auto-fitter data for blue strings (body). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afblue.c + * + * Auto-fitter data for blue strings (body). + * + * Copyright (C) 2013-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. + * + */ #include "aftypes.h" @@ -296,6 +296,10 @@ '\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', + '\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', /* ᡃ */ + '\0', '\xE1', '\x80', '\x81', ' ', '\xE1', '\x80', '\x82', ' ', '\xE1', '\x80', '\x84', ' ', '\xE1', '\x80', '\x92', ' ', '\xE1', '\x80', '\x9D', ' ', '\xE1', '\x81', '\xA5', ' ', '\xE1', '\x81', '\x8A', ' ', '\xE1', '\x81', '\x8B', /* ခ ဂ င ဒ ဝ ၥ ၊ ။ */ '\0', '\xE1', '\x80', '\x84', ' ', '\xE1', '\x80', '\x8E', ' ', '\xE1', '\x80', '\x92', ' ', '\xE1', '\x80', '\x95', ' ', '\xE1', '\x80', '\x97', ' ', '\xE1', '\x80', '\x9D', ' ', '\xE1', '\x81', '\x8A', ' ', '\xE1', '\x81', '\x8B', /* င ဎ ဒ ပ ဗ ဝ ၊ ။ */ @@ -649,6 +653,9 @@ { AF_BLUE_STRING_MALAYALAM_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 }, { 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 }, { AF_BLUE_STRING_MYANMAR_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT }, { AF_BLUE_STRING_MYANMAR_BOTTOM, 0 }, diff --git a/src/3rdparty/freetype/src/autofit/afblue.cin b/src/3rdparty/freetype/src/autofit/afblue.cin index 4913e2eb6f..6545d1fd43 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.cin +++ b/src/3rdparty/freetype/src/autofit/afblue.cin @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afblue.c */ -/* */ -/* Auto-fitter data for blue strings (body). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afblue.c + * + * Auto-fitter data for blue strings (body). + * + * Copyright (C) 2013-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. + * + */ #include "aftypes.h" diff --git a/src/3rdparty/freetype/src/autofit/afblue.dat b/src/3rdparty/freetype/src/autofit/afblue.dat index bc2f0d2754..46db43fe22 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.dat +++ b/src/3rdparty/freetype/src/autofit/afblue.dat @@ -1,15 +1,15 @@ -// afblue.dat +// afblue.dat // -// Auto-fitter data for blue strings. +// Auto-fitter data for blue strings. // -// Copyright 2013-2018 by -// David Turner, Robert Wilhelm, and Werner Lemberg. +// Copyright (C) 2013-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. +// 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 data specific to blue zones. It gets processed by @@ -392,6 +392,11 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: AF_BLUE_STRING_MALAYALAM_BOTTOM "ട ഠ ധ ശ ഘ ച ഥ ല" + AF_BLUE_STRING_MONGOLIAN_TOP_BASE + "ᠳ ᠴ ᠶ ᠽ ᡂ ᡊ ‍ᡡ‍ ‍ᡳ‍" + AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE + "ᡃ" + AF_BLUE_STRING_MYANMAR_TOP "ခ ဂ င ဒ ဝ ၥ ၊ ။" AF_BLUE_STRING_MYANMAR_BOTTOM @@ -947,6 +952,11 @@ 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_MONG + { AF_BLUE_STRING_MONGOLIAN_TOP_BASE, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE, 0 } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_MYMR { AF_BLUE_STRING_MYANMAR_TOP, AF_BLUE_PROPERTY_LATIN_TOP | AF_BLUE_PROPERTY_LATIN_X_HEIGHT } diff --git a/src/3rdparty/freetype/src/autofit/afblue.h b/src/3rdparty/freetype/src/autofit/afblue.h index de31e259c3..b69b1df521 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.h +++ b/src/3rdparty/freetype/src/autofit/afblue.h @@ -1,22 +1,22 @@ /* This file has been generated by the Perl script `afblue.pl', */ /* using data from file `afblue.dat'. */ -/***************************************************************************/ -/* */ -/* afblue.h */ -/* */ -/* Auto-fitter data for blue strings (specification). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afblue.h + * + * Auto-fitter data for blue strings (specification). + * + * Copyright (C) 2013-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. + * + */ #ifndef AFBLUE_H_ @@ -212,56 +212,58 @@ FT_BEGIN_HEADER AF_BLUE_STRING_LISU_BOTTOM = 3506, AF_BLUE_STRING_MALAYALAM_TOP = 3538, AF_BLUE_STRING_MALAYALAM_BOTTOM = 3582, - AF_BLUE_STRING_MYANMAR_TOP = 3614, - AF_BLUE_STRING_MYANMAR_BOTTOM = 3646, - AF_BLUE_STRING_MYANMAR_ASCENDER = 3678, - AF_BLUE_STRING_MYANMAR_DESCENDER = 3706, - AF_BLUE_STRING_NKO_TOP = 3738, - AF_BLUE_STRING_NKO_BOTTOM = 3762, - AF_BLUE_STRING_NKO_SMALL_TOP = 3777, - AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3786, - AF_BLUE_STRING_OL_CHIKI = 3798, - AF_BLUE_STRING_OLD_TURKIC_TOP = 3822, - AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3837, - AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3857, - AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3897, - AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3927, - AF_BLUE_STRING_OSAGE_SMALL_TOP = 3942, - AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3982, - AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4022, - AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4047, - AF_BLUE_STRING_OSMANYA_TOP = 4062, - AF_BLUE_STRING_OSMANYA_BOTTOM = 4102, - AF_BLUE_STRING_SAURASHTRA_TOP = 4142, - AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4174, - AF_BLUE_STRING_SHAVIAN_TOP = 4194, - AF_BLUE_STRING_SHAVIAN_BOTTOM = 4204, - AF_BLUE_STRING_SHAVIAN_DESCENDER = 4229, - AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4239, - AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4274, - AF_BLUE_STRING_SINHALA_TOP = 4289, - AF_BLUE_STRING_SINHALA_BOTTOM = 4321, - AF_BLUE_STRING_SINHALA_DESCENDER = 4353, - AF_BLUE_STRING_SUNDANESE_TOP = 4397, - AF_BLUE_STRING_SUNDANESE_BOTTOM = 4421, - AF_BLUE_STRING_SUNDANESE_DESCENDER = 4453, - AF_BLUE_STRING_TAI_VIET_TOP = 4461, - AF_BLUE_STRING_TAI_VIET_BOTTOM = 4481, - AF_BLUE_STRING_TAMIL_TOP = 4493, - AF_BLUE_STRING_TAMIL_BOTTOM = 4525, - AF_BLUE_STRING_TELUGU_TOP = 4557, - AF_BLUE_STRING_TELUGU_BOTTOM = 4585, - AF_BLUE_STRING_THAI_TOP = 4613, - AF_BLUE_STRING_THAI_BOTTOM = 4637, - AF_BLUE_STRING_THAI_ASCENDER = 4665, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4677, - AF_BLUE_STRING_THAI_DESCENDER = 4689, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4705, - AF_BLUE_STRING_THAI_DIGIT_TOP = 4713, - AF_BLUE_STRING_TIFINAGH = 4725, - AF_BLUE_STRING_VAI_TOP = 4757, - AF_BLUE_STRING_VAI_BOTTOM = 4789, - af_blue_1_1 = 4820, + 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, #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, @@ -355,24 +357,25 @@ FT_BEGIN_HEADER AF_BLUE_STRINGSET_LATP = 166, AF_BLUE_STRINGSET_LISU = 173, AF_BLUE_STRINGSET_MLYM = 176, - AF_BLUE_STRINGSET_MYMR = 179, - AF_BLUE_STRINGSET_NKOO = 184, - AF_BLUE_STRINGSET_NONE = 189, - AF_BLUE_STRINGSET_OLCK = 190, - AF_BLUE_STRINGSET_ORKH = 193, - AF_BLUE_STRINGSET_OSGE = 196, - AF_BLUE_STRINGSET_OSMA = 204, - AF_BLUE_STRINGSET_SAUR = 207, - AF_BLUE_STRINGSET_SHAW = 210, - AF_BLUE_STRINGSET_SINH = 216, - AF_BLUE_STRINGSET_SUND = 220, - AF_BLUE_STRINGSET_TAML = 224, - AF_BLUE_STRINGSET_TAVT = 227, - AF_BLUE_STRINGSET_TELU = 230, - AF_BLUE_STRINGSET_TFNG = 233, - AF_BLUE_STRINGSET_THAI = 236, - AF_BLUE_STRINGSET_VAII = 244, - af_blue_2_1 = 247, + 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, #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 682147cb30..30a28dafa5 100644 --- a/src/3rdparty/freetype/src/autofit/afblue.hin +++ b/src/3rdparty/freetype/src/autofit/afblue.hin @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afblue.h */ -/* */ -/* Auto-fitter data for blue strings (specification). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afblue.h + * + * Auto-fitter data for blue strings (specification). + * + * Copyright (C) 2013-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. + * + */ #ifndef AFBLUE_H_ diff --git a/src/3rdparty/freetype/src/autofit/afcjk.c b/src/3rdparty/freetype/src/autofit/afcjk.c index 21b6bffa33..a61689bee3 100644 --- a/src/3rdparty/freetype/src/autofit/afcjk.c +++ b/src/3rdparty/freetype/src/autofit/afcjk.c @@ -1,24 +1,24 @@ -/***************************************************************************/ -/* */ -/* afcjk.c */ -/* */ -/* Auto-fitter hinting routines for CJK writing system (body). */ -/* */ -/* Copyright 2006-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afcjk.c + * + * Auto-fitter hinting routines for CJK writing system (body). + * + * Copyright (C) 2006-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. + * + */ /* - * The algorithm is based on akito's autohint patch, archived at + * The algorithm is based on akito's autohint patch, archived at * - * https://web.archive.org/web/20051219160454/http://www.kde.gr.jp:80/~akito/patch/freetype2/2.1.7/ + * https://web.archive.org/web/20051219160454/http://www.kde.gr.jp:80/~akito/patch/freetype2/2.1.7/ * */ @@ -27,7 +27,6 @@ #include FT_INTERNAL_DEBUG_H #include "afglobal.h" -#include "afpic.h" #include "aflatin.h" #include "afcjk.h" @@ -44,14 +43,14 @@ #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. */ - /* */ + /************************************************************************** + * + * 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_afcjk +#define FT_COMPONENT afcjk /*************************************************************************/ @@ -92,23 +91,29 @@ AF_CJKMetricsRec dummy[1]; AF_Scaler scaler = &dummy->root.scaler; -#ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = metrics->root.globals; -#endif - AF_StyleClass style_class = metrics->root.style_class; - AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET - [style_class->script]; + AF_ScriptClass script_class = af_script_classes[style_class->script]; + + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif - void* shaper_buf; const char* p; #ifdef FT_DEBUG_LEVEL_TRACE FT_ULong ch = 0; #endif - p = script_class->standard_charstring; + p = script_class->standard_charstring; + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); +#endif /* We check a list of standard characters. The first match wins. */ @@ -193,10 +198,10 @@ goto Exit; /* - * We assume that the glyphs selected for the stem width - * computation are `featureless' enough so that the linking - * algorithm works fine without adjustments of its scoring - * function. + * We assume that the glyphs selected for the stem width + * computation are `featureless' enough so that the linking + * algorithm works fine without adjustments of its scoring + * function. */ af_latin_hints_link_segments( hints, 0, @@ -296,7 +301,14 @@ AF_Blue_Stringset bss = sc->blue_stringset; const AF_Blue_StringRec* bs = &af_blue_stringsets[bss]; - void* shaper_buf; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif /* we walk over the blue character strings as specified in the */ @@ -307,7 +319,9 @@ "==========================\n" "\n" )); +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); +#endif for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ ) { @@ -483,8 +497,8 @@ if ( num_flats == 0 && num_fills == 0 ) { /* - * we couldn't find a single glyph to compute this blue zone, - * we will simply ignore it then + * we couldn't find a single glyph to compute this blue zone, + * we will simply ignore it then */ FT_TRACE5(( " empty\n" )); continue; @@ -565,15 +579,25 @@ FT_Bool started = 0, same_width = 1; FT_Fixed advance = 0, old_advance = 0; - void* shaper_buf; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif /* in all supported charmaps, digits have character codes 0x30-0x39 */ const char digits[] = "0 1 2 3 4 5 6 7 8 9"; const char* p; - p = digits; + p = digits; + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); +#endif while ( *p ) { @@ -890,11 +914,11 @@ } /* - * now compute the `serif' segments + * now compute the `serif' segments * - * In Hanzi, some strokes are wider on one or both of the ends. - * We either identify the stems on the ends as serifs or remove - * the linkage, depending on the length of the stems. + * In Hanzi, some strokes are wider on one or both of the ends. + * We either identify the stems on the ends as serifs or remove + * the linkage, depending on the length of the stems. * */ @@ -1000,21 +1024,21 @@ scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale : hints->y_scale; - /*********************************************************************/ - /* */ - /* We begin by generating a sorted table of edges for the current */ - /* direction. To do so, we simply scan each segment and try to find */ - /* an edge in our table that corresponds to its position. */ - /* */ - /* If no edge is found, we create and insert a new edge in the */ - /* sorted table. Otherwise, we simply add the segment to the edge's */ - /* list which is then processed in the second step to compute the */ - /* edge's properties. */ - /* */ - /* Note that the edges table is sorted along the segment/edge */ - /* position. */ - /* */ - /*********************************************************************/ + /********************************************************************** + * + * We begin by generating a sorted table of edges for the current + * direction. To do so, we simply scan each segment and try to find + * an edge in our table that corresponds to its position. + * + * If no edge is found, we create and insert a new edge in the + * sorted table. Otherwise, we simply add the segment to the edge's + * list which is then processed in the second step to compute the + * edge's properties. + * + * Note that the edges table is sorted along the segment/edge + * position. + * + */ edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold, scale ); @@ -1114,17 +1138,17 @@ } } - /******************************************************************/ - /* */ - /* Good, we now compute each edge's properties according to the */ - /* segments found on its position. Basically, these are */ - /* */ - /* - the edge's main direction */ - /* - stem edge, serif edge or both (which defaults to stem then) */ - /* - rounded edge, straight or both (which defaults to straight) */ - /* - link for edge */ - /* */ - /******************************************************************/ + /******************************************************************* + * + * Good, we now compute each edge's properties according to the + * segments found on its position. Basically, these are + * + * - the edge's main direction + * - stem edge, serif edge or both (which defaults to stem then) + * - rounded edge, straight or both (which defaults to straight) + * - link for edge + * + */ /* first of all, set the `edge' field in each segment -- this is */ /* required in order to compute edge links */ @@ -1160,6 +1184,8 @@ seg = edge->first; + if ( !seg ) + goto Skip_Loop; do { @@ -1174,7 +1200,7 @@ /* check for links -- if seg->serif is set, then seg->link must */ /* be ignored */ - is_serif = (FT_Bool)( seg->serif && seg->serif->edge != edge ); + is_serif = FT_BOOL( seg->serif && seg->serif->edge != edge ); if ( seg->link || is_serif ) { @@ -1215,13 +1241,14 @@ edge2->flags |= AF_EDGE_SERIF; } else - edge->link = edge2; + edge->link = edge2; } seg = seg->edge_next; } while ( seg != edge->first ); + Skip_Loop: /* set the round/straight flags */ edge->flags = AF_EDGE_NORMAL; @@ -1364,8 +1391,8 @@ af_glyph_hints_rescale( hints, (AF_StyleMetrics)metrics ); /* - * correct x_scale and y_scale when needed, since they may have - * been modified af_cjk_scale_dim above + * correct x_scale and y_scale when needed, since they may have + * been modified af_cjk_scale_dim above */ hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale; hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta; @@ -1384,21 +1411,21 @@ other_flags = 0; /* - * We snap the width of vertical stems for the monochrome and - * horizontal LCD rendering targets only. + * We snap the width of vertical stems for the monochrome and + * horizontal LCD rendering targets only. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_HORZ_SNAP; /* - * We snap the width of horizontal stems for the monochrome and - * vertical LCD rendering targets only. + * We snap the width of horizontal stems for the monochrome and + * vertical LCD rendering targets only. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V ) other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* - * We adjust stems to full pixels unless in `light' or `lcd' mode. + * We adjust stems to full pixels unless in `light' or `lcd' mode. */ if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; @@ -2094,8 +2121,8 @@ goto Exit; /* - * now hint the remaining edges (serifs and single) in order - * to complete our processing + * now hint the remaining edges (serifs and single) in order + * to complete our processing */ for ( edge = edges; edge < edge_limit; edge++ ) { diff --git a/src/3rdparty/freetype/src/autofit/afcjk.h b/src/3rdparty/freetype/src/autofit/afcjk.h index d229c0c9cf..59acae5342 100644 --- a/src/3rdparty/freetype/src/autofit/afcjk.h +++ b/src/3rdparty/freetype/src/autofit/afcjk.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afcjk.h */ -/* */ -/* Auto-fitter hinting routines for CJK writing system (specification). */ -/* */ -/* Copyright 2006-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afcjk.h + * + * Auto-fitter hinting routines for CJK writing system (specification). + * + * Copyright (C) 2006-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. + * + */ #ifndef AFCJK_H_ @@ -41,9 +41,9 @@ FT_BEGIN_HEADER /* - * CJK glyphs tend to fill the square. So we have both vertical and - * horizontal blue zones. But some glyphs have flat bounding strokes that - * leave some space between neighbour glyphs. + * CJK glyphs tend to fill the square. So we have both vertical and + * horizontal blue zones. But some glyphs have flat bounding strokes that + * leave some space between neighbour glyphs. */ #define AF_CJK_IS_TOP_BLUE( b ) \ diff --git a/src/3rdparty/freetype/src/autofit/afcover.h b/src/3rdparty/freetype/src/autofit/afcover.h index 6eeb8fc9fb..ff207a97e0 100644 --- a/src/3rdparty/freetype/src/autofit/afcover.h +++ b/src/3rdparty/freetype/src/autofit/afcover.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afcover.h */ -/* */ -/* Auto-fitter coverages (specification only). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afcover.h + * + * Auto-fitter coverages (specification only). + * + * Copyright (C) 2013-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. + * + */ /* This header file can be included multiple times. */ diff --git a/src/3rdparty/freetype/src/autofit/afdummy.c b/src/3rdparty/freetype/src/autofit/afdummy.c index f30c517cbb..7e07a41e7d 100644 --- a/src/3rdparty/freetype/src/autofit/afdummy.c +++ b/src/3rdparty/freetype/src/autofit/afdummy.c @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* afdummy.c */ -/* */ -/* Auto-fitter dummy routines to be used if no hinting should be */ -/* performed (body). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afdummy.c + * + * Auto-fitter dummy routines to be used if no hinting should be + * performed (body). + * + * 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. + * + */ #include "afdummy.h" @@ -38,13 +38,15 @@ static FT_Error - af_dummy_hints_apply( FT_UInt glyph_index, - AF_GlyphHints hints, - FT_Outline* outline ) + af_dummy_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, + FT_Outline* outline, + AF_StyleMetrics metrics ) { FT_Error error; FT_UNUSED( glyph_index ); + FT_UNUSED( metrics ); error = af_glyph_hints_reload( hints, outline ); diff --git a/src/3rdparty/freetype/src/autofit/afdummy.h b/src/3rdparty/freetype/src/autofit/afdummy.h index b382acd92a..ab9227d35d 100644 --- a/src/3rdparty/freetype/src/autofit/afdummy.h +++ b/src/3rdparty/freetype/src/autofit/afdummy.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* afdummy.h */ -/* */ -/* Auto-fitter dummy routines to be used if no hinting should be */ -/* performed (specification). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afdummy.h + * + * Auto-fitter dummy routines to be used if no hinting should be + * performed (specification). + * + * 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. + * + */ #ifndef AFDUMMY_H_ diff --git a/src/3rdparty/freetype/src/autofit/aferrors.h b/src/3rdparty/freetype/src/autofit/aferrors.h index e5de54360f..2ec336f72c 100644 --- a/src/3rdparty/freetype/src/autofit/aferrors.h +++ b/src/3rdparty/freetype/src/autofit/aferrors.h @@ -1,27 +1,27 @@ -/***************************************************************************/ -/* */ -/* aferrors.h */ -/* */ -/* Autofitter error codes (specification only). */ -/* */ -/* Copyright 2005-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. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to define the Autofitter error enumeration */ - /* constants. */ - /* */ - /*************************************************************************/ +/**************************************************************************** + * + * aferrors.h + * + * Autofitter error codes (specification only). + * + * Copyright (C) 2005-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. + * + */ + + + /************************************************************************** + * + * This file is used to define the Autofitter error enumeration + * constants. + * + */ #ifndef AFERRORS_H_ #define AFERRORS_H_ diff --git a/src/3rdparty/freetype/src/autofit/afglobal.c b/src/3rdparty/freetype/src/autofit/afglobal.c index 3d09c53e8a..6a9a1e5aaa 100644 --- a/src/3rdparty/freetype/src/autofit/afglobal.c +++ b/src/3rdparty/freetype/src/autofit/afglobal.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afglobal.c */ -/* */ -/* Auto-fitter routines to compute global hinting values (body). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afglobal.c + * + * Auto-fitter routines to compute global hinting values (body). + * + * 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. + * + */ #include "afglobal.h" @@ -22,14 +22,14 @@ #include FT_INTERNAL_DEBUG_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. */ - /* */ + /************************************************************************** + * + * 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_afglobal +#define FT_COMPONENT afglobal /* get writing system specific header files */ @@ -38,7 +38,6 @@ #include "afwrtsys.h" #include "aferrors.h" -#include "afpic.h" #undef SCRIPT @@ -67,8 +66,6 @@ #include "afstyles.h" -#ifndef FT_CONFIG_OPTION_PIC - #undef WRITING_SYSTEM #define WRITING_SYSTEM( ws, WS ) \ &af_ ## ws ## _writing_system_class, @@ -110,8 +107,6 @@ NULL /* do not remove */ }; -#endif /* !FT_CONFIG_OPTION_PIC */ - #ifdef FT_DEBUG_LEVEL_TRACE @@ -159,12 +154,12 @@ } /* scan each style in a Unicode charmap */ - for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) + for ( ss = 0; af_style_classes[ss]; ss++ ) { AF_StyleClass style_class = - AF_STYLE_CLASSES_GET[ss]; + af_style_classes[ss]; AF_ScriptClass script_class = - AF_SCRIPT_CLASSES_GET[style_class->script]; + af_script_classes[style_class->script]; AF_Script_UniRange range; @@ -172,8 +167,8 @@ continue; /* - * Scan all Unicode points in the range and set the corresponding - * glyph style index. + * Scan all Unicode points in the range and set the corresponding + * glyph style index. */ if ( style_class->coverage == AF_COVERAGE_DEFAULT ) { @@ -246,9 +241,9 @@ } /* handle the remaining default OpenType features ... */ - for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) + for ( ss = 0; af_style_classes[ss]; ss++ ) { - AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss]; + AF_StyleClass style_class = af_style_classes[ss]; if ( style_class->coverage == AF_COVERAGE_DEFAULT ) @@ -256,7 +251,7 @@ } /* ... and finally the default OpenType features of the default script */ - af_shaper_get_coverage( globals, AF_STYLE_CLASSES_GET[dflt], gstyles, 1 ); + af_shaper_get_coverage( globals, af_style_classes[dflt], gstyles, 1 ); /* mark ASCII digits */ for ( i = 0x30; i <= 0x39; i++ ) @@ -270,8 +265,8 @@ Exit: /* - * By default, all uncovered glyphs are set to the fallback style. - * XXX: Shouldn't we disable hinting or do something similar? + * By default, all uncovered glyphs are set to the fallback style. + * XXX: Shouldn't we disable hinting or do something similar? */ if ( globals->module->fallback_style != AF_STYLE_UNASSIGNED ) { @@ -295,9 +290,9 @@ "==============\n" "\n" )); - for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) + for ( ss = 0; af_style_classes[ss]; ss++ ) { - AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss]; + AF_StyleClass style_class = af_style_classes[ss]; FT_UInt count = 0; FT_Long idx; @@ -397,9 +392,9 @@ if ( globals->metrics[nn] ) { AF_StyleClass style_class = - AF_STYLE_CLASSES_GET[nn]; + af_style_classes[nn]; AF_WritingSystemClass writing_system_class = - AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system]; + af_writing_system_classes[style_class->writing_system]; if ( writing_system_class->style_metrics_done ) @@ -448,8 +443,9 @@ style = (AF_Style)( globals->glyph_styles[gindex] & AF_STYLE_UNASSIGNED ); - style_class = AF_STYLE_CLASSES_GET[style]; - writing_system_class = AF_WRITING_SYSTEM_CLASSES_GET + Again: + style_class = af_style_classes[style]; + writing_system_class = af_writing_system_classes [style_class->writing_system]; metrics = globals->metrics[style]; @@ -475,6 +471,16 @@ writing_system_class->style_metrics_done( metrics ); FT_FREE( metrics ); + + /* internal error code -1 indicates */ + /* that no blue zones have been found */ + if ( error == -1 ) + { + style = (AF_Style)( globals->glyph_styles[gindex] & + AF_STYLE_UNASSIGNED ); + goto Again; + } + goto Exit; } } @@ -494,9 +500,9 @@ FT_UInt gindex ) { if ( gindex < (FT_ULong)globals->glyph_count ) - return (FT_Bool)( globals->glyph_styles[gindex] & AF_DIGIT ); + return FT_BOOL( globals->glyph_styles[gindex] & AF_DIGIT ); - return (FT_Bool)0; + return FT_BOOL( 0 ); } diff --git a/src/3rdparty/freetype/src/autofit/afglobal.h b/src/3rdparty/freetype/src/autofit/afglobal.h index 489ed46d9e..52f38350db 100644 --- a/src/3rdparty/freetype/src/autofit/afglobal.h +++ b/src/3rdparty/freetype/src/autofit/afglobal.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* afglobal.h */ -/* */ -/* Auto-fitter routines to compute global hinting values */ -/* (specification). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afglobal.h + * + * Auto-fitter routines to compute global hinting values + * (specification). + * + * 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. + * + */ #ifndef AFGLOBAL_H_ @@ -60,8 +60,8 @@ FT_BEGIN_HEADER /* - * Default values and flags for both autofitter globals (found in - * AF_ModuleRec) and face globals (in AF_FaceGlobalsRec). + * Default values and flags for both autofitter globals (found in + * AF_ModuleRec) and face globals (in AF_FaceGlobalsRec). */ /* index of fallback style in `af_style_classes' */ @@ -98,8 +98,8 @@ FT_BEGIN_HEADER /* - * Note that glyph_styles[] maps each glyph to an index into the - * `af_style_classes' array. + * Note that glyph_styles[] maps each glyph to an index into the + * `af_style_classes' array. * */ typedef struct AF_FaceGlobalsRec_ @@ -140,8 +140,8 @@ FT_BEGIN_HEADER /* - * model the global hints data for a given face, decomposed into - * style-specific items + * model the global hints data for a given face, decomposed into + * style-specific items */ FT_LOCAL( FT_Error ) diff --git a/src/3rdparty/freetype/src/autofit/afhints.c b/src/3rdparty/freetype/src/autofit/afhints.c index 0666dbc8e2..ed111c4117 100644 --- a/src/3rdparty/freetype/src/autofit/afhints.c +++ b/src/3rdparty/freetype/src/autofit/afhints.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afhints.c */ -/* */ -/* Auto-fitter hinting routines (body). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afhints.c + * + * Auto-fitter hinting routines (body). + * + * 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. + * + */ #include "afhints.h" @@ -22,14 +22,14 @@ #include FT_INTERNAL_DEBUG_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. */ - /* */ + /************************************************************************** + * + * 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_afhints +#define FT_COMPONENT afhints /* Get new segment for given axis. */ @@ -297,6 +297,19 @@ } + static int + af_get_strong_edge_index( AF_GlyphHints hints, + AF_Edge* strong_edges, + int dimension ) + { + AF_AxisHints axis = &hints->axis[dimension]; + AF_Edge edges = axis->edges; + + + return AF_INDEX_NUM( strong_edges[dimension], edges ); + } + + #ifdef __cplusplus extern "C" { #endif @@ -317,8 +330,10 @@ { AF_DUMP(( " index hedge hseg vedge vseg flags " /* " XXXXX XXXXX XXXXX XXXXX XXXXX XXXXXX" */ - " xorg yorg xscale yscale xfit yfit" )); + " xorg yorg xscale yscale xfit yfit " /* " XXXXX XXXXX XXXX.XX XXXX.XX XXXX.XX XXXX.XX" */ + " hbef haft vbef vaft" )); + /* " XXXXX XXXXX XXXXX XXXXX" */ } else AF_DUMP(( " (none)\n" )); @@ -330,6 +345,7 @@ int segment_idx_1 = af_get_segment_index( hints, point_idx, 1 ); char buf1[16], buf2[16], buf3[16], buf4[16]; + char buf5[16], buf6[16], buf7[16], buf8[16]; /* insert extra newline at the beginning of a contour */ @@ -340,7 +356,8 @@ } AF_DUMP(( " %5d %5s %5s %5s %5s %s" - " %5d %5d %7.2f %7.2f %7.2f %7.2f\n", + " %5d %5d %7.2f %7.2f %7.2f %7.2f" + " %5s %5s %5s %5s\n", point_idx, af_print_idx( buf1, af_get_edge_index( hints, segment_idx_1, 1 ) ), @@ -359,7 +376,20 @@ point->ox / 64.0, point->oy / 64.0, point->x / 64.0, - point->y / 64.0 )); + point->y / 64.0, + + af_print_idx( buf5, af_get_strong_edge_index( hints, + point->before, + 1 ) ), + af_print_idx( buf6, af_get_strong_edge_index( hints, + point->after, + 1 ) ), + af_print_idx( buf7, af_get_strong_edge_index( hints, + point->before, + 0 ) ), + af_print_idx( buf8, af_get_strong_edge_index( hints, + point->after, + 0 ) ) )); } AF_DUMP(( "\n" )); } @@ -519,7 +549,7 @@ *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->fx : seg->first->fy; if ( seg->edge ) - *is_blue = (FT_Bool)( seg->edge->blue_edge != 0 ); + *is_blue = FT_BOOL( seg->edge->blue_edge ); else *is_blue = FALSE; @@ -558,8 +588,8 @@ /* - * note: AF_DIMENSION_HORZ corresponds to _vertical_ edges - * since they have a constant X coordinate. + * note: AF_DIMENSION_HORZ corresponds to _vertical_ edges + * since they have a constant X coordinate. */ if ( dimension == AF_DIMENSION_HORZ ) AF_DUMP(( "Table of %s edges (1px=%.2fu, 10u=%.2fpx):\n", @@ -681,8 +711,8 @@ memory = hints->memory; /* - * note that we don't need to free the segment and edge - * buffers since they are really within the hints->points array + * note that we don't need to free the segment and edge + * buffers since they are really within the hints->points array */ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { @@ -776,9 +806,9 @@ } /* - * then reallocate the points arrays if necessary -- - * note that we reserve two additional point positions, used to - * hint metrics appropriately + * then reallocate the points arrays if necessary -- + * note that we reserve two additional point positions, used to + * hint metrics appropriately */ new_max = (FT_UInt)( outline->n_points + 2 ); old_max = (FT_UInt)hints->max_points; @@ -898,6 +928,14 @@ prev = end; } } + +#ifdef FT_DEBUG_AUTOFIT + point->before[0] = NULL; + point->before[1] = NULL; + point->after[0] = NULL; + point->after[1] = NULL; +#endif + } } @@ -918,15 +956,15 @@ { /* - * Compute directions of `in' and `out' vectors. + * Compute directions of `in' and `out' vectors. * - * Note that distances between points that are very near to each - * other are accumulated. In other words, the auto-hinter either - * prepends the small vectors between near points to the first - * non-near vector, or the sum of small vector lengths exceeds a - * threshold, thus `grouping' the small vectors. All intermediate - * points are tagged as weak; the directions are adjusted also to - * be equal to the accumulated one. + * Note that distances between points that are very near to each + * other are accumulated. In other words, the auto-hinter either + * prepends the small vectors between near points to the first + * non-near vector, or the sum of small vector lengths exceeds a + * threshold, thus `grouping' the small vectors. All intermediate + * points are tagged as weak; the directions are adjusted also to + * be equal to the accumulated one. */ FT_Int near_limit2 = 2 * near_limit - 1; @@ -956,12 +994,12 @@ out_y = point->fy - prev->fy; /* - * We use Taxicab metrics to measure the vector length. + * We use Taxicab metrics to measure the vector length. * - * Note that the accumulated distances so far could have the - * opposite direction of the distance measured here. For this - * reason we use `near_limit2' for the comparison to get a - * non-near point even in the worst case. + * Note that the accumulated distances so far could have the + * opposite direction of the distance measured here. For this + * reason we use `near_limit2' for the comparison to get a + * non-near point even in the worst case. */ if ( FT_ABS( out_x ) + FT_ABS( out_y ) >= near_limit2 ) break; @@ -979,11 +1017,11 @@ curr = first; /* - * We abuse the `u' and `v' fields to store index deltas to the - * next and previous non-near point, respectively. + * We abuse the `u' and `v' fields to store index deltas to the + * next and previous non-near point, respectively. * - * To avoid problems with not having non-near points, we point to - * `first' by default as the next non-near point. + * To avoid problems with not having non-near points, we point to + * `first' by default as the next non-near point. * */ curr->u = (FT_Pos)( first - curr ); @@ -1035,12 +1073,12 @@ } /* - * The next step is to `simplify' an outline's topology so that we - * can identify local extrema more reliably: A series of - * non-horizontal or non-vertical vectors pointing into the same - * quadrant are handled as a single, long vector. From a - * topological point of the view, the intermediate points are of no - * interest and thus tagged as weak. + * The next step is to `simplify' an outline's topology so that we + * can identify local extrema more reliably: A series of + * non-horizontal or non-vertical vectors pointing into the same + * quadrant are handled as a single, long vector. From a + * topological point of the view, the intermediate points are of no + * interest and thus tagged as weak. */ for ( point = points; point < point_limit; point++ ) @@ -1080,9 +1118,9 @@ } /* - * Finally, check for remaining weak points. Everything else not - * collected in edges so far is then implicitly classified as strong - * points. + * Finally, check for remaining weak points. Everything else not + * collected in edges so far is then implicitly classified as strong + * points. */ for ( point = points; point < point_limit; point++ ) @@ -1309,6 +1347,12 @@ if ( delta >= 0 ) { u = edge->pos - ( edge->opos - ou ); + +#ifdef FT_DEBUG_AUTOFIT + point->before[dim] = edge; + point->after[dim] = NULL; +#endif + goto Store_Point; } @@ -1318,6 +1362,12 @@ if ( delta >= 0 ) { u = edge->pos + ( ou - edge->opos ); + +#ifdef FT_DEBUG_AUTOFIT + point->before[dim] = NULL; + point->after[dim] = edge; +#endif + goto Store_Point; } @@ -1364,6 +1414,12 @@ { /* we are on the edge */ u = edge->pos; + +#ifdef FT_DEBUG_AUTOFIT + point->before[dim] = NULL; + point->after[dim] = NULL; +#endif + goto Store_Point; } } @@ -1374,6 +1430,11 @@ AF_Edge after = edges + min + 0; +#ifdef FT_DEBUG_AUTOFIT + point->before[dim] = before; + point->after[dim] = after; +#endif + /* assert( before && after && before != after ) */ if ( before->scale == 0 ) before->scale = FT_DivFix( after->pos - before->pos, diff --git a/src/3rdparty/freetype/src/autofit/afhints.h b/src/3rdparty/freetype/src/autofit/afhints.h index 3326ebc44e..e0cf612f0c 100644 --- a/src/3rdparty/freetype/src/autofit/afhints.h +++ b/src/3rdparty/freetype/src/autofit/afhints.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afhints.h */ -/* */ -/* Auto-fitter hinting routines (specification). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afhints.h + * + * Auto-fitter hinting routines (specification). + * + * 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. + * + */ #ifndef AFHINTS_H_ @@ -26,8 +26,8 @@ FT_BEGIN_HEADER /* - * The definition of outline glyph hints. These are shared by all - * writing system analysis routines (until now). + * The definition of outline glyph hints. These are shared by all + * writing system analysis routines (until now). */ typedef enum AF_Dimension_ @@ -56,153 +56,153 @@ FT_BEGIN_HEADER /* - * The following explanations are mostly taken from the article + * The following explanations are mostly taken from the article * - * Real-Time Grid Fitting of Typographic Outlines + * Real-Time Grid Fitting of Typographic Outlines * - * by David Turner and Werner Lemberg + * by David Turner and Werner Lemberg * - * https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf + * https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf * - * with appropriate updates. + * with appropriate updates. * * - * Segments + * Segments * - * `af_{cjk,latin,...}_hints_compute_segments' are the functions to - * find segments in an outline. + * `af_{cjk,latin,...}_hints_compute_segments' are the functions to + * find segments in an outline. * - * A segment is a series of at least two consecutive points that are - * approximately aligned along a coordinate axis. The analysis to do - * so is specific to a writing system. + * A segment is a series of at least two consecutive points that are + * approximately aligned along a coordinate axis. The analysis to do + * so is specific to a writing system. * * - * Edges + * Edges * - * `af_{cjk,latin,...}_hints_compute_edges' are the functions to find - * edges. + * `af_{cjk,latin,...}_hints_compute_edges' are the functions to find + * edges. * - * As soon as segments are defined, the auto-hinter groups them into - * edges. An edge corresponds to a single position on the main - * dimension that collects one or more segments (allowing for a small - * threshold). + * As soon as segments are defined, the auto-hinter groups them into + * edges. An edge corresponds to a single position on the main + * dimension that collects one or more segments (allowing for a small + * threshold). * - * As an example, the `latin' writing system first tries to grid-fit - * edges, then to align segments on the edges unless it detects that - * they form a serif. + * As an example, the `latin' writing system first tries to grid-fit + * edges, then to align segments on the edges unless it detects that + * they form a serif. * * - * A H - * | | - * | | - * | | - * | | - * C | | F - * +------<-----+ +-----<------+ - * | B G | - * | | - * | | - * +--------------->------------------+ - * D E + * A H + * | | + * | | + * | | + * | | + * C | | F + * +------<-----+ +-----<------+ + * | B G | + * | | + * | | + * +--------------->------------------+ + * D E * * - * Stems + * Stems * - * Stems are detected by `af_{cjk,latin,...}_hint_edges'. + * Stems are detected by `af_{cjk,latin,...}_hint_edges'. * - * Segments need to be `linked' to other ones in order to detect stems. - * A stem is made of two segments that face each other in opposite - * directions and that are sufficiently close to each other. Using - * vocabulary from the TrueType specification, stem segments form a - * `black distance'. + * Segments need to be `linked' to other ones in order to detect stems. + * A stem is made of two segments that face each other in opposite + * directions and that are sufficiently close to each other. Using + * vocabulary from the TrueType specification, stem segments form a + * `black distance'. * - * In the above ASCII drawing, the horizontal segments are BC, DE, and - * FG; the vertical segments are AB, CD, EF, and GH. + * In the above ASCII drawing, the horizontal segments are BC, DE, and + * FG; the vertical segments are AB, CD, EF, and GH. * - * Each segment has at most one `best' candidate to form a black - * distance, or no candidate at all. Notice that two distinct segments - * can have the same candidate, which frequently means a serif. + * Each segment has at most one `best' candidate to form a black + * distance, or no candidate at all. Notice that two distinct segments + * can have the same candidate, which frequently means a serif. * - * A stem is recognized by the following condition: + * A stem is recognized by the following condition: * - * best segment_1 = segment_2 && best segment_2 = segment_1 + * best segment_1 = segment_2 && best segment_2 = segment_1 * - * The best candidate is stored in field `link' in structure - * `AF_Segment'. + * The best candidate is stored in field `link' in structure + * `AF_Segment'. * - * In the above ASCII drawing, the best candidate for both AB and CD is - * GH, while the best candidate for GH is AB. Similarly, the best - * candidate for EF and GH is AB, while the best candidate for AB is - * GH. + * In the above ASCII drawing, the best candidate for both AB and CD is + * GH, while the best candidate for GH is AB. Similarly, the best + * candidate for EF and GH is AB, while the best candidate for AB is + * GH. * - * The detection and handling of stems is dependent on the writing - * system. + * The detection and handling of stems is dependent on the writing + * system. * * - * Serifs + * Serifs * - * Serifs are detected by `af_{cjk,latin,...}_hint_edges'. + * Serifs are detected by `af_{cjk,latin,...}_hint_edges'. * - * In comparison to a stem, a serif (as handled by the auto-hinter - * module that takes care of the `latin' writing system) has + * In comparison to a stem, a serif (as handled by the auto-hinter + * module that takes care of the `latin' writing system) has * - * best segment_1 = segment_2 && best segment_2 != segment_1 + * best segment_1 = segment_2 && best segment_2 != segment_1 * - * where segment_1 corresponds to the serif segment (CD and EF in the - * above ASCII drawing). + * where segment_1 corresponds to the serif segment (CD and EF in the + * above ASCII drawing). * - * The best candidate is stored in field `serif' in structure - * `AF_Segment' (and `link' is set to NULL). + * The best candidate is stored in field `serif' in structure + * `AF_Segment' (and `link' is set to NULL). * * - * Touched points + * Touched points * - * A point is called `touched' if it has been processed somehow by the - * auto-hinter. It basically means that it shouldn't be moved again - * (or moved only under certain constraints to preserve the already - * applied processing). + * A point is called `touched' if it has been processed somehow by the + * auto-hinter. It basically means that it shouldn't be moved again + * (or moved only under certain constraints to preserve the already + * applied processing). * * - * Flat and round segments + * Flat and round segments * - * Segments are `round' or `flat', depending on the series of points - * that define them. A segment is round if the next and previous point - * of an extremum (which can be either a single point or sequence of - * points) are both conic or cubic control points. Otherwise, a - * segment with an extremum is flat. + * Segments are `round' or `flat', depending on the series of points + * that define them. A segment is round if the next and previous point + * of an extremum (which can be either a single point or sequence of + * points) are both conic or cubic control points. Otherwise, a + * segment with an extremum is flat. * * - * Strong Points + * Strong Points * - * Experience has shown that points not part of an edge need to be - * interpolated linearly between their two closest edges, even if these - * are not part of the contour of those particular points. Typical - * candidates for this are + * Experience has shown that points not part of an edge need to be + * interpolated linearly between their two closest edges, even if these + * are not part of the contour of those particular points. Typical + * candidates for this are * - * - angle points (i.e., points where the `in' and `out' direction - * differ greatly) + * - angle points (i.e., points where the `in' and `out' direction + * differ greatly) * - * - inflection points (i.e., where the `in' and `out' angles are the - * same, but the curvature changes sign) [currently, such points - * aren't handled specially in the auto-hinter] + * - inflection points (i.e., where the `in' and `out' angles are the + * same, but the curvature changes sign) [currently, such points + * aren't handled specially in the auto-hinter] * - * `af_glyph_hints_align_strong_points' is the function that takes - * care of such situations; it is equivalent to the TrueType `IP' - * hinting instruction. + * `af_glyph_hints_align_strong_points' is the function that takes + * care of such situations; it is equivalent to the TrueType `IP' + * hinting instruction. * * - * Weak Points + * Weak Points * - * Other points in the outline must be interpolated using the - * coordinates of their previous and next unfitted contour neighbours. - * These are called `weak points' and are touched by the function - * `af_glyph_hints_align_weak_points', equivalent to the TrueType `IUP' - * hinting instruction. Typical candidates are control points and - * points on the contour without a major direction. + * Other points in the outline must be interpolated using the + * coordinates of their previous and next unfitted contour neighbours. + * These are called `weak points' and are touched by the function + * `af_glyph_hints_align_weak_points', equivalent to the TrueType `IUP' + * hinting instruction. Typical candidates are control points and + * points on the contour without a major direction. * - * The major effect is to reduce possible distortion caused by - * alignment of edges and strong points, thus weak points are processed - * after strong points. + * The major effect is to reduce possible distortion caused by + * alignment of edges and strong points, thus weak points are processed + * after strong points. */ @@ -252,6 +252,12 @@ FT_BEGIN_HEADER AF_Point next; /* next point in contour */ AF_Point prev; /* previous point in contour */ +#ifdef FT_DEBUG_AUTOFIT + /* track `before' and `after' edges for strong points */ + AF_Edge before[2]; + AF_Edge after[2]; +#endif + } AF_PointRec; diff --git a/src/3rdparty/freetype/src/autofit/afindic.c b/src/3rdparty/freetype/src/autofit/afindic.c index dfbea5f34c..a17117c712 100644 --- a/src/3rdparty/freetype/src/autofit/afindic.c +++ b/src/3rdparty/freetype/src/autofit/afindic.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afindic.c */ -/* */ -/* Auto-fitter hinting routines for Indic writing system (body). */ -/* */ -/* Copyright 2007-2018 by */ -/* Rahul Bhalerao , . */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afindic.c + * + * Auto-fitter hinting routines for Indic writing system (body). + * + * Copyright (C) 2007-2019 by + * Rahul Bhalerao , . + * + * 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 "aftypes.h" diff --git a/src/3rdparty/freetype/src/autofit/afindic.h b/src/3rdparty/freetype/src/autofit/afindic.h index 5688738e6e..bc5bc59fa5 100644 --- a/src/3rdparty/freetype/src/autofit/afindic.h +++ b/src/3rdparty/freetype/src/autofit/afindic.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* afindic.h */ -/* */ -/* Auto-fitter hinting routines for Indic writing system */ -/* (specification). */ -/* */ -/* Copyright 2007-2018 by */ -/* Rahul Bhalerao , . */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afindic.h + * + * Auto-fitter hinting routines for Indic writing system + * (specification). + * + * Copyright (C) 2007-2019 by + * Rahul Bhalerao , . + * + * 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 AFINDIC_H_ diff --git a/src/3rdparty/freetype/src/autofit/aflatin.c b/src/3rdparty/freetype/src/autofit/aflatin.c index 9f1b54056f..27d4024882 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin.c +++ b/src/3rdparty/freetype/src/autofit/aflatin.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* aflatin.c */ -/* */ -/* Auto-fitter hinting routines for latin writing system (body). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * aflatin.c + * + * Auto-fitter hinting routines for latin writing system (body). + * + * 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. + * + */ #include @@ -21,7 +21,6 @@ #include FT_INTERNAL_DEBUG_H #include "afglobal.h" -#include "afpic.h" #include "aflatin.h" #include "aferrors.h" @@ -31,14 +30,14 @@ #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. */ - /* */ + /************************************************************************** + * + * 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_aflatin +#define FT_COMPONENT aflatin /* needed for computation of round vs. flat segments */ @@ -83,24 +82,30 @@ AF_LatinMetricsRec dummy[1]; AF_Scaler scaler = &dummy->root.scaler; -#ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = metrics->root.globals; -#endif - AF_StyleClass style_class = metrics->root.style_class; - AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET - [style_class->script]; + AF_ScriptClass script_class = af_script_classes[style_class->script]; + + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif - void* shaper_buf; const char* p; #ifdef FT_DEBUG_LEVEL_TRACE FT_ULong ch = 0; #endif - p = script_class->standard_charstring; - shaper_buf = af_shaper_buf_create( face ); + p = script_class->standard_charstring; + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + shaper_buf = af_shaper_buf_create( face ); +#endif /* * We check a list of standard characters to catch features like * `c2sc' (small caps from caps) that don't contain lowercase letters @@ -144,7 +149,11 @@ af_shaper_buf_destroy( face, shaper_buf ); if ( !glyph_index ) + { + FT_TRACE5(( "standard character missing;" + " using fallback stem widths\n" )); goto Exit; + } FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n", ch, glyph_index )); @@ -186,10 +195,10 @@ goto Exit; /* - * We assume that the glyphs selected for the stem width - * computation are `featureless' enough so that the linking - * algorithm works fine without adjustments of its scoring - * function. + * We assume that the glyphs selected for the stem width + * computation are `featureless' enough so that the linking + * algorithm works fine without adjustments of its scoring + * function. */ af_latin_hints_link_segments( hints, 0, @@ -307,7 +316,7 @@ /* Find all blue zones. Flat segments give the reference points, */ /* round segments the overshoot positions. */ - static void + static int af_latin_metrics_init_blues( AF_LatinMetrics metrics, FT_Face face ) { @@ -329,7 +338,14 @@ FT_Pos flat_threshold = FLAT_THRESHOLD( metrics->units_per_em ); - void* shaper_buf; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif /* we walk over the blue character strings as specified in the */ @@ -339,7 +355,9 @@ "============================\n" "\n" )); +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); +#endif for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ ) { @@ -884,8 +902,8 @@ if ( num_flats == 0 && num_rounds == 0 ) { /* - * we couldn't find a single glyph to compute this blue zone, - * we will simply ignore it then + * we couldn't find a single glyph to compute this blue zone, + * we will simply ignore it then */ FT_TRACE5(( " empty\n" )); continue; @@ -967,10 +985,11 @@ af_shaper_buf_destroy( face, shaper_buf ); - /* we finally check whether blue zones are ordered; */ - /* `ref' and `shoot' values of two blue zones must not overlap */ if ( axis->blue_count ) { + /* we finally check whether blue zones are ordered; */ + /* `ref' and `shoot' values of two blue zones must not overlap */ + FT_UInt i; AF_LatinBlue blue_sorted[AF_BLUE_STRINGSET_MAX_LEN + 2]; @@ -1019,11 +1038,34 @@ *a )); } } + + FT_TRACE5(( "\n" )); + + return 0; } + else + { + /* disable hinting for the current style if there are no blue zones */ - FT_TRACE5(( "\n" )); + AF_FaceGlobals globals = metrics->root.globals; + FT_UShort* gstyles = globals->glyph_styles; + + FT_Long i; + + + FT_TRACE5(( "no blue zones found:" + " hinting disabled for this style\n" )); + + for ( i = 0; i < globals->glyph_count; i++ ) + { + if ( ( gstyles[i] & AF_STYLE_MASK ) == sc->style ) + gstyles[i] = AF_STYLE_NONE_DFLT; + } - return; + FT_TRACE5(( "\n" )); + + return 1; + } } @@ -1036,15 +1078,25 @@ FT_Bool started = 0, same_width = 1; FT_Fixed advance = 0, old_advance = 0; - void* shaper_buf; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ + void* shaper_buf; +#else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; +#endif /* in all supported charmaps, digits have character codes 0x30-0x39 */ const char digits[] = "0 1 2 3 4 5 6 7 8 9"; const char* p; - p = digits; + p = digits; + +#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); +#endif while ( *p ) { @@ -1092,6 +1144,8 @@ af_latin_metrics_init( AF_LatinMetrics metrics, FT_Face face ) { + FT_Error error = FT_Err_Ok; + FT_CharMap oldmap = face->charmap; @@ -1100,12 +1154,18 @@ if ( !FT_Select_Charmap( face, FT_ENCODING_UNICODE ) ) { af_latin_metrics_init_widths( metrics, face ); - af_latin_metrics_init_blues( metrics, face ); + if ( af_latin_metrics_init_blues( metrics, face ) ) + { + /* use internal error code to indicate missing blue zones */ + error = -1; + goto Exit; + } af_latin_metrics_check_digits( metrics, face ); } + Exit: FT_Set_Charmap( face, oldmap ); - return FT_Err_Ok; + return error; } @@ -1283,7 +1343,7 @@ /* an extra-light axis corresponds to a standard width that is */ /* smaller than 5/8 pixels */ axis->extra_light = - (FT_Bool)( FT_MulFix( axis->standard_width, scale ) < 32 + 8 ); + FT_BOOL( FT_MulFix( axis->standard_width, scale ) < 32 + 8 ); #ifdef FT_DEBUG_LEVEL_TRACE if ( axis->extra_light ) @@ -1419,13 +1479,13 @@ nn, blue->ref.org, blue->ref.fit / 64.0, - blue->flags & AF_LATIN_BLUE_ACTIVE ? "" - : " (inactive)", + ( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? "" + : " (inactive)", nn, blue->shoot.org, blue->shoot.fit / 64.0, - blue->flags & AF_LATIN_BLUE_ACTIVE ? "" - : " (inactive)" )); + ( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? "" + : " (inactive)" )); } #endif } @@ -1967,17 +2027,17 @@ if ( len >= len_threshold ) { /* - * The score is the sum of two demerits indicating the - * `badness' of a fit, measured along the segments' main axis - * and orthogonal to it, respectively. + * The score is the sum of two demerits indicating the + * `badness' of a fit, measured along the segments' main axis + * and orthogonal to it, respectively. * - * o The less overlapping along the main axis, the worse it - * is, causing a larger demerit. + * - The less overlapping along the main axis, the worse it + * is, causing a larger demerit. * - * o The nearer the orthogonal distance to a stem width, the - * better it is, causing a smaller demerit. For simplicity, - * however, we only increase the demerit for values that - * exceed the largest stem width. + * - The nearer the orthogonal distance to a stem width, the + * better it is, causing a smaller demerit. For simplicity, + * however, we only increase the demerit for values that + * exceed the largest stem width. */ FT_Pos dist = pos2 - pos1; @@ -2049,13 +2109,8 @@ FT_Memory memory = hints->memory; AF_LatinAxis laxis = &((AF_LatinMetrics)hints->metrics)->axis[dim]; -#ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = hints->metrics->globals; -#endif - AF_StyleClass style_class = hints->metrics->style_class; - AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET - [style_class->script]; + AF_ScriptClass script_class = af_script_classes[style_class->script]; FT_Bool top_to_bottom_hinting = 0; @@ -2086,9 +2141,9 @@ top_to_bottom_hinting = script_class->top_to_bottom_hinting; /* - * We ignore all segments that are less than 1 pixel in length - * to avoid many problems with serif fonts. We compute the - * corresponding threshold in font units. + * We ignore all segments that are less than 1 pixel in length + * to avoid many problems with serif fonts. We compute the + * corresponding threshold in font units. */ if ( dim == AF_DIMENSION_HORZ ) segment_length_threshold = FT_DivFix( 64, hints->y_scale ); @@ -2096,26 +2151,26 @@ segment_length_threshold = 0; /* - * Similarly, we ignore segments that have a width delta - * larger than 0.5px (i.e., a width larger than 1px). + * Similarly, we ignore segments that have a width delta + * larger than 0.5px (i.e., a width larger than 1px). */ segment_width_threshold = FT_DivFix( 32, scale ); - /*********************************************************************/ - /* */ - /* We begin by generating a sorted table of edges for the current */ - /* direction. To do so, we simply scan each segment and try to find */ - /* an edge in our table that corresponds to its position. */ - /* */ - /* If no edge is found, we create and insert a new edge in the */ - /* sorted table. Otherwise, we simply add the segment to the edge's */ - /* list which gets processed in the second step to compute the */ - /* edge's properties. */ - /* */ - /* Note that the table of edges is sorted along the segment/edge */ - /* position. */ - /* */ - /*********************************************************************/ + /********************************************************************** + * + * We begin by generating a sorted table of edges for the current + * direction. To do so, we simply scan each segment and try to find + * an edge in our table that corresponds to its position. + * + * If no edge is found, we create and insert a new edge in the + * sorted table. Otherwise, we simply add the segment to the edge's + * list which gets processed in the second step to compute the + * edge's properties. + * + * Note that the table of edges is sorted along the segment/edge + * position. + * + */ /* assure that edge distance threshold is at most 0.25px */ edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold, @@ -2237,17 +2292,17 @@ } - /******************************************************************/ - /* */ - /* Good, we now compute each edge's properties according to the */ - /* segments found on its position. Basically, these are */ - /* */ - /* - the edge's main direction */ - /* - stem edge, serif edge or both (which defaults to stem then) */ - /* - rounded edge, straight or both (which defaults to straight) */ - /* - link for edge */ - /* */ - /******************************************************************/ + /******************************************************************* + * + * Good, we now compute each edge's properties according to the + * segments found on its position. Basically, these are + * + * - the edge's main direction + * - stem edge, serif edge or both (which defaults to stem then) + * - rounded edge, straight or both (which defaults to straight) + * - link for edge + * + */ /* first of all, set the `edge' field in each segment -- this is */ /* required in order to compute edge links */ @@ -2309,9 +2364,9 @@ /* check for links -- if seg->serif is set, then seg->link must */ /* be ignored */ - is_serif = (FT_Bool)( seg->serif && - seg->serif->edge && - seg->serif->edge != edge ); + is_serif = FT_BOOL( seg->serif && + seg->serif->edge && + seg->serif->edge != edge ); if ( ( seg->link && seg->link->edge ) || is_serif ) { @@ -2546,8 +2601,8 @@ af_glyph_hints_rescale( hints, (AF_StyleMetrics)metrics ); /* - * correct x_scale and y_scale if needed, since they may have - * been modified by `af_latin_metrics_scale_dim' above + * correct x_scale and y_scale if needed, since they may have + * been modified by `af_latin_metrics_scale_dim' above */ hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale; hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta; @@ -2566,21 +2621,21 @@ other_flags = 0; /* - * We snap the width of vertical stems for the monochrome and - * horizontal LCD rendering targets only. + * We snap the width of vertical stems for the monochrome and + * horizontal LCD rendering targets only. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_HORZ_SNAP; /* - * We snap the width of horizontal stems for the monochrome and - * vertical LCD rendering targets only. + * We snap the width of horizontal stems for the monochrome and + * vertical LCD rendering targets only. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V ) other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* - * We adjust stems to full pixels unless in `light' or `lcd' mode. + * We adjust stems to full pixels unless in `light' or `lcd' mode. */ if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; @@ -2589,11 +2644,11 @@ other_flags |= AF_LATIN_HINTS_MONO; /* - * In `light' or `lcd' mode we disable horizontal hinting completely. - * We also do it if the face is italic. + * In `light' or `lcd' mode we disable horizontal hinting completely. + * We also do it if the face is italic. * - * However, if warping is enabled (which only works in `light' hinting - * mode), advance widths get adjusted, too. + * However, if warping is enabled (which only works in `light' hinting + * mode), advance widths get adjusted, too. */ if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) @@ -2936,13 +2991,8 @@ AF_Edge anchor = NULL; FT_Int has_serifs = 0; -#ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = hints->metrics->globals; -#endif - AF_StyleClass style_class = hints->metrics->style_class; - AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET - [style_class->script]; + AF_ScriptClass script_class = af_script_classes[style_class->script]; FT_Bool top_to_bottom_hinting = 0; @@ -2976,12 +3026,12 @@ edge2 = edge->link; /* - * If a stem contains both a neutral and a non-neutral blue zone, - * skip the neutral one. Otherwise, outlines with different - * directions might be incorrectly aligned at the same vertical - * position. + * If a stem contains both a neutral and a non-neutral blue zone, + * skip the neutral one. Otherwise, outlines with different + * directions might be incorrectly aligned at the same vertical + * position. * - * If we have two neutral blue zones, skip one of them. + * If we have two neutral blue zones, skip one of them. * */ if ( edge->blue_edge && edge2 && edge2->blue_edge ) @@ -3344,8 +3394,8 @@ if ( has_serifs || !anchor ) { /* - * now hint the remaining edges (serifs and single) in order - * to complete our processing + * now hint the remaining edges (serifs and single) in order + * to complete our processing */ for ( edge = edges; edge < edge_limit; edge++ ) { diff --git a/src/3rdparty/freetype/src/autofit/aflatin.h b/src/3rdparty/freetype/src/autofit/aflatin.h index 432cccce4e..40479538c2 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin.h +++ b/src/3rdparty/freetype/src/autofit/aflatin.h @@ -1,20 +1,20 @@ -/***************************************************************************/ -/* */ -/* aflatin.h */ -/* */ -/* Auto-fitter hinting routines for latin writing system */ -/* (specification). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * aflatin.h + * + * Auto-fitter hinting routines for latin writing system + * (specification). + * + * 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. + * + */ #ifndef AFLATIN_H_ @@ -45,9 +45,9 @@ FT_BEGIN_HEADER /* - * The following declarations could be embedded in the file `aflatin.c'; - * they have been made semi-public to allow alternate writing system - * hinters to re-use some of them. + * The following declarations could be embedded in the file `aflatin.c'; + * they have been made semi-public to allow alternate writing system + * hinters to re-use some of them. */ @@ -161,8 +161,8 @@ FT_BEGIN_HEADER /* - * The next functions shouldn't normally be exported. However, other - * writing systems might like to use these functions as-is. + * The next functions shouldn't normally be exported. However, other + * writing systems might like to use these functions as-is. */ FT_LOCAL( FT_Error ) af_latin_hints_compute_segments( AF_GlyphHints hints, diff --git a/src/3rdparty/freetype/src/autofit/aflatin2.c b/src/3rdparty/freetype/src/autofit/aflatin2.c index 5c71378118..c601ab8d9a 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin2.c +++ b/src/3rdparty/freetype/src/autofit/aflatin2.c @@ -3,22 +3,22 @@ /* marked as experimental. */ -/***************************************************************************/ -/* */ -/* aflatin2.c */ -/* */ -/* Auto-fitter hinting routines for latin writing system (body). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * aflatin2.c + * + * Auto-fitter hinting routines for latin writing system (body). + * + * 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. + * + */ #include FT_ADVANCES_H @@ -37,14 +37,14 @@ #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. */ - /* */ + /************************************************************************** + * + * 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_aflatin2 +#define FT_COMPONENT aflatin2 FT_LOCAL_DEF( FT_Error ) @@ -265,7 +265,7 @@ /* Avoid single-point contours since they are never rasterized. */ /* In some fonts, they correspond to mark attachment points */ /* which are way outside of the glyph's real outline. */ - if ( last == first ) + if ( last <= first ) continue; if ( AF_LATIN_IS_TOP_BLUE( bb ) ) @@ -299,6 +299,7 @@ /* now check whether the point belongs to a straight or round */ /* segment; we first need to find in which contour the extremum */ /* lies, then inspect its previous and next points */ + if ( best_point >= 0 ) { FT_Pos best_x = points[best_point].x; FT_Int start, end, prev, next; @@ -358,8 +359,8 @@ if ( num_flats == 0 && num_rounds == 0 ) { /* - * we couldn't find a single glyph to compute this blue zone, - * we will simply ignore it then + * we couldn't find a single glyph to compute this blue zone, + * we will simply ignore it then */ FT_TRACE5(( " empty\n" )); continue; @@ -632,7 +633,7 @@ /* an extra-light axis corresponds to a standard width that is */ /* smaller than 5/8 pixels */ axis->extra_light = - (FT_Bool)( FT_MulFix( axis->standard_width, scale ) < 32 + 8 ); + FT_BOOL( FT_MulFix( axis->standard_width, scale ) < 32 + 8 ); if ( dim == AF_DIMENSION_VERT ) { @@ -1108,13 +1109,13 @@ : AF_DIR_RIGHT; /* - * We want to ignore very small (mostly serif) segments, we do that - * by ignoring those that whose length is less than a given fraction - * of the standard width. If there is no standard width, we ignore - * those that are less than a given size in pixels + * We want to ignore very small (mostly serif) segments, we do that + * by ignoring those that whose length is less than a given fraction + * of the standard width. If there is no standard width, we ignore + * those that are less than a given size in pixels * - * also, unlink serif segments that are linked to segments farther - * than 50% of the standard width + * also, unlink serif segments that are linked to segments farther + * than 50% of the standard width */ if ( dim == AF_DIMENSION_HORZ ) { @@ -1126,21 +1127,21 @@ else segment_length_threshold = 0; - /*********************************************************************/ - /* */ - /* We will begin by generating a sorted table of edges for the */ - /* current direction. To do so, we simply scan each segment and try */ - /* to find an edge in our table that corresponds to its position. */ - /* */ - /* If no edge is found, we create and insert a new edge in the */ - /* sorted table. Otherwise, we simply add the segment to the edge's */ - /* list which will be processed in the second step to compute the */ - /* edge's properties. */ - /* */ - /* Note that the edges table is sorted along the segment/edge */ - /* position. */ - /* */ - /*********************************************************************/ + /********************************************************************** + * + * We will begin by generating a sorted table of edges for the + * current direction. To do so, we simply scan each segment and try + * to find an edge in our table that corresponds to its position. + * + * If no edge is found, we create and insert a new edge in the + * sorted table. Otherwise, we simply add the segment to the edge's + * list which will be processed in the second step to compute the + * edge's properties. + * + * Note that the edges table is sorted along the segment/edge + * position. + * + */ edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold, scale ); @@ -1230,17 +1231,17 @@ } - /*********************************************************************/ - /* */ - /* Good, we will now compute each edge's properties according to */ - /* segments found on its position. Basically, these are: */ - /* */ - /* - edge's main direction */ - /* - stem edge, serif edge or both (which defaults to stem then) */ - /* - rounded edge, straight or both (which defaults to straight) */ - /* - link for edge */ - /* */ - /*********************************************************************/ + /********************************************************************** + * + * Good, we will now compute each edge's properties according to + * segments found on its position. Basically, these are: + * + * - edge's main direction + * - stem edge, serif edge or both (which defaults to stem then) + * - rounded edge, straight or both (which defaults to straight) + * - link for edge + * + */ /* first of all, set the `edge' field in each segment -- this is */ /* required in order to compute edge links */ @@ -1302,9 +1303,9 @@ /* check for links -- if seg->serif is set, then seg->link must */ /* be ignored */ - is_serif = (FT_Bool)( seg->serif && - seg->serif->edge && - seg->serif->edge != edge ); + is_serif = FT_BOOL( seg->serif && + seg->serif->edge && + seg->serif->edge != edge ); if ( ( seg->link && seg->link->edge ) || is_serif ) { @@ -1524,8 +1525,8 @@ af_glyph_hints_rescale( hints, (AF_StyleMetrics)metrics ); /* - * correct x_scale and y_scale if needed, since they may have - * been modified `af_latin2_metrics_scale_dim' above + * correct x_scale and y_scale if needed, since they may have + * been modified `af_latin2_metrics_scale_dim' above */ hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale; hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta; @@ -1544,21 +1545,21 @@ other_flags = 0; /* - * We snap the width of vertical stems for the monochrome and - * horizontal LCD rendering targets only. + * We snap the width of vertical stems for the monochrome and + * horizontal LCD rendering targets only. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_HORZ_SNAP; /* - * We snap the width of horizontal stems for the monochrome and - * vertical LCD rendering targets only. + * We snap the width of horizontal stems for the monochrome and + * vertical LCD rendering targets only. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V ) other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* - * We adjust stems to full pixels unless in `light' or `lcd' mode. + * We adjust stems to full pixels unless in `light' or `lcd' mode. */ if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; @@ -1567,8 +1568,8 @@ other_flags |= AF_LATIN_HINTS_MONO; /* - * In `light' or `lcd' mode we disable horizontal hinting completely. - * We also do it if the face is italic. + * In `light' or `lcd' mode we disable horizontal hinting completely. + * We also do it if the face is italic. */ if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) @@ -2233,8 +2234,8 @@ if ( has_serifs || !anchor ) { /* - * now hint the remaining edges (serifs and single) in order - * to complete our processing + * now hint the remaining edges (serifs and single) in order + * to complete our processing */ for ( edge = edges; edge < edge_limit; edge++ ) { diff --git a/src/3rdparty/freetype/src/autofit/aflatin2.h b/src/3rdparty/freetype/src/autofit/aflatin2.h index 0129dc707e..507cef3df2 100644 --- a/src/3rdparty/freetype/src/autofit/aflatin2.h +++ b/src/3rdparty/freetype/src/autofit/aflatin2.h @@ -3,23 +3,23 @@ /* marked as experimental. */ -/***************************************************************************/ -/* */ -/* aflatin2.h */ -/* */ -/* Auto-fitter hinting routines for latin writing system */ -/* (specification). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * aflatin2.h + * + * Auto-fitter hinting routines for latin writing system + * (specification). + * + * 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. + * + */ #ifndef AFLATIN2_H_ diff --git a/src/3rdparty/freetype/src/autofit/afloader.c b/src/3rdparty/freetype/src/autofit/afloader.c index a55550b338..83743b7be1 100644 --- a/src/3rdparty/freetype/src/autofit/afloader.c +++ b/src/3rdparty/freetype/src/autofit/afloader.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afloader.c */ -/* */ -/* Auto-fitter glyph loading routines (body). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afloader.c + * + * Auto-fitter glyph loading routines (body). + * + * 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. + * + */ #include "afglobal.h" @@ -21,7 +21,6 @@ #include "afhints.h" #include "aferrors.h" #include "afmodule.h" -#include "afpic.h" #include FT_INTERNAL_CALC_H @@ -119,12 +118,12 @@ } /* - * We depend on the writing system (script analyzers) to supply - * standard widths for the script of the glyph we are looking at. If - * it can't deliver, stem darkening is disabled. + * We depend on the writing system (script analyzers) to supply + * standard widths for the script of the glyph we are looking at. If + * it can't deliver, stem darkening is disabled. */ writing_system_class = - AF_WRITING_SYSTEM_CLASSES_GET[style_metrics->style_class->writing_system]; + af_writing_system_classes[style_metrics->style_class->writing_system]; if ( writing_system_class->style_metrics_getstdw ) writing_system_class->style_metrics_getstdw( style_metrics, @@ -174,22 +173,22 @@ globals->darken_y = af_fixedToInt( darken_y ); /* - * Scale outlines down on the Y-axis to keep them inside their blue - * zones. The stronger the emboldening, the stronger the downscaling - * (plus heuristical padding to prevent outlines still falling out - * their zones due to rounding). + * Scale outlines down on the Y-axis to keep them inside their blue + * zones. The stronger the emboldening, the stronger the downscaling + * (plus heuristical padding to prevent outlines still falling out + * their zones due to rounding). * - * Reason: `FT_Outline_Embolden' works by shifting the rightmost - * points of stems farther to the right, and topmost points farther - * up. This positions points on the Y-axis outside their - * pre-computed blue zones and leads to distortion when applying the - * hints in the code further below. Code outside this emboldening - * block doesn't know we are presenting it with modified outlines the - * analyzer didn't see! + * Reason: `FT_Outline_Embolden' works by shifting the rightmost + * points of stems farther to the right, and topmost points farther + * up. This positions points on the Y-axis outside their + * pre-computed blue zones and leads to distortion when applying the + * hints in the code further below. Code outside this emboldening + * block doesn't know we are presenting it with modified outlines the + * analyzer didn't see! * - * An unfortunate side effect of downscaling is that the emboldening - * effect is slightly decreased. The loss becomes more pronounced - * versus the CFF driver at smaller sizes, e.g., at 9ppem and below. + * An unfortunate side effect of downscaling is that the emboldening + * effect is slightly decreased. The loss becomes more pronounced + * versus the CFF driver at smaller sizes, e.g., at 9ppem and below. */ globals->scale_down_factor = FT_DivFix( em_size - ( darken_by_font_units_y + af_intToFixed( 8 ) ), @@ -232,10 +231,6 @@ AF_StyleClass style_class; AF_WritingSystemClass writing_system_class; -#ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = loader->globals; -#endif - if ( !size ) return FT_THROW( Invalid_Size_Handle ); @@ -282,13 +277,13 @@ } /* - * TODO: This code currently doesn't support fractional advance widths, - * i.e., placing hinted glyphs at anything other than integer - * x-positions. This is only relevant for the warper code, which - * scales and shifts glyphs to optimize blackness of stems (hinting on - * the x-axis by nature places things on pixel integers, hinting on the - * y-axis only, i.e., LIGHT mode, doesn't touch the x-axis). The delta - * values of the scaler would need to be adjusted. + * TODO: This code currently doesn't support fractional advance widths, + * i.e., placing hinted glyphs at anything other than integer + * x-positions. This is only relevant for the warper code, which + * scales and shifts glyphs to optimize blackness of stems (hinting on + * the x-axis by nature places things on pixel integers, hinting on the + * y-axis only, i.e., LIGHT mode, doesn't touch the x-axis). The delta + * values of the scaler would need to be adjusted. */ scaler.face = face; scaler.x_scale = size_internal->autohint_metrics.x_scale; @@ -312,10 +307,10 @@ #endif /* - * Glyphs (really code points) are assigned to scripts. Script - * analysis is done lazily: For each glyph that passes through here, - * the corresponding script analyzer is called, but returns immediately - * if it has been run already. + * Glyphs (really code points) are assigned to scripts. Script + * analysis is done lazily: For each glyph that passes through here, + * the corresponding script analyzer is called, but returns immediately + * if it has been run already. */ error = af_face_globals_get_metrics( loader->globals, glyph_index, style_options, &style_metrics ); @@ -324,7 +319,7 @@ style_class = style_metrics->style_class; writing_system_class = - AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system]; + af_writing_system_classes[style_class->writing_system]; loader->metrics = style_metrics; @@ -342,11 +337,11 @@ } /* - * Do the main work of `af_loader_load_glyph'. Note that we never have - * to deal with composite glyphs as those get loaded into - * FT_GLYPH_FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function. - * In the rare cases where FT_LOAD_NO_RECURSE is set, it implies - * FT_LOAD_NO_SCALE and as such the auto-hinter is never called. + * Do the main work of `af_loader_load_glyph'. Note that we never have + * to deal with composite glyphs as those get loaded into + * FT_GLYPH_FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function. + * In the rare cases where FT_LOAD_NO_RECURSE is set, it implies + * FT_LOAD_NO_SCALE and as such the auto-hinter is never called. */ load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM | @@ -358,26 +353,26 @@ goto Exit; /* - * Apply stem darkening (emboldening) here before hints are applied to - * the outline. Glyphs are scaled down proportionally to the - * emboldening so that curve points don't fall outside their - * precomputed blue zones. + * Apply stem darkening (emboldening) here before hints are applied to + * the outline. Glyphs are scaled down proportionally to the + * emboldening so that curve points don't fall outside their + * precomputed blue zones. * - * Any emboldening done by the font driver (e.g., the CFF driver) - * doesn't reach here because the autohinter loads the unprocessed - * glyphs in font units for analysis (functions `af_*_metrics_init_*') - * and then above to prepare it for the rasterizers by itself, - * independently of the font driver. So emboldening must be done here, - * within the autohinter. + * Any emboldening done by the font driver (e.g., the CFF driver) + * doesn't reach here because the autohinter loads the unprocessed + * glyphs in font units for analysis (functions `af_*_metrics_init_*') + * and then above to prepare it for the rasterizers by itself, + * independently of the font driver. So emboldening must be done here, + * within the autohinter. * - * All glyphs to be autohinted pass through here one by one. The - * standard widths can therefore change from one glyph to the next, - * depending on what script a glyph is assigned to (each script has its - * own set of standard widths and other metrics). The darkening amount - * must therefore be recomputed for each size and - * `standard_{vertical,horizontal}_width' change. + * All glyphs to be autohinted pass through here one by one. The + * standard widths can therefore change from one glyph to the next, + * depending on what script a glyph is assigned to (each script has its + * own set of standard widths and other metrics). The darkening amount + * must therefore be recomputed for each size and + * `standard_{vertical,horizontal}_width' change. * - * Ignore errors and carry on without emboldening. + * Ignore errors and carry on without emboldening. * */ @@ -426,35 +421,39 @@ /* now load the slot image into the auto-outline */ /* and run the automatic hinting process */ if ( writing_system_class->style_hints_apply ) - writing_system_class->style_hints_apply( glyph_index, - hints, - &gloader->base.outline, - style_metrics ); + { + error = writing_system_class->style_hints_apply( + glyph_index, + hints, + &gloader->base.outline, + style_metrics ); + if ( error ) + goto Exit; + } /* we now need to adjust the metrics according to the change in */ /* width/positioning that occurred during the hinting process */ if ( scaler.render_mode != FT_RENDER_MODE_LIGHT ) { - FT_Pos old_rsb, old_lsb, new_lsb; - FT_Pos pp1x_uh, pp2x_uh; - AF_AxisHints axis = &hints->axis[AF_DIMENSION_HORZ]; - AF_Edge edge1 = axis->edges; /* leftmost edge */ - AF_Edge edge2 = edge1 + - axis->num_edges - 1; /* rightmost edge */ if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) ) { - old_rsb = loader->pp2.x - edge2->opos; + AF_Edge edge1 = axis->edges; /* leftmost edge */ + AF_Edge edge2 = edge1 + + axis->num_edges - 1; /* rightmost edge */ + + FT_Pos old_rsb = loader->pp2.x - edge2->opos; /* loader->pp1.x is always zero at this point of time */ - old_lsb = edge1->opos /* - loader->pp1.x */; - new_lsb = edge1->pos; + FT_Pos old_lsb = edge1->opos; /* - loader->pp1.x */ + FT_Pos new_lsb = edge1->pos; /* remember unhinted values to later account */ /* for rounding errors */ - pp1x_uh = new_lsb - old_lsb; - pp2x_uh = edge2->pos + old_rsb; + FT_Pos pp1x_uh = new_lsb - old_lsb; + FT_Pos pp2x_uh = edge2->pos + old_rsb; + /* prefer too much space over too little space */ /* for very small sizes */ diff --git a/src/3rdparty/freetype/src/autofit/afloader.h b/src/3rdparty/freetype/src/autofit/afloader.h index d4d72d1583..d1e0f3c093 100644 --- a/src/3rdparty/freetype/src/autofit/afloader.h +++ b/src/3rdparty/freetype/src/autofit/afloader.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afloader.h */ -/* */ -/* Auto-fitter glyph loading routines (specification). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afloader.h + * + * Auto-fitter glyph loading routines (specification). + * + * 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. + * + */ #ifndef AFLOADER_H_ @@ -27,11 +27,11 @@ FT_BEGIN_HEADER /* - * The autofitter module's (global) data structure to communicate with - * actual fonts. If necessary, `local' data like the current face, the - * current face's auto-hint data, or the current glyph's parameters - * relevant to auto-hinting are `swapped in'. Cf. functions like - * `af_loader_reset' and `af_loader_load_g'. + * The autofitter module's (global) data structure to communicate with + * actual fonts. If necessary, `local' data like the current face, the + * current face's auto-hint data, or the current glyph's parameters + * relevant to auto-hinting are `swapped in'. Cf. functions like + * `af_loader_reset' and `af_loader_load_g'. */ typedef struct AF_LoaderRec_ diff --git a/src/3rdparty/freetype/src/autofit/afmodule.c b/src/3rdparty/freetype/src/autofit/afmodule.c index dcaa17a27e..3e46a3655a 100644 --- a/src/3rdparty/freetype/src/autofit/afmodule.c +++ b/src/3rdparty/freetype/src/autofit/afmodule.c @@ -1,26 +1,25 @@ -/***************************************************************************/ -/* */ -/* afmodule.c */ -/* */ -/* Auto-fitter module implementation (body). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afmodule.c + * + * Auto-fitter module implementation (body). + * + * 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. + * + */ #include "afglobal.h" #include "afmodule.h" #include "afloader.h" #include "aferrors.h" -#include "afpic.h" #ifdef FT_DEBUG_AUTOFIT @@ -60,14 +59,14 @@ #include FT_SERVICE_PROPERTIES_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. */ - /* */ + /************************************************************************** + * + * 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_afmodule +#define FT_COMPONENT afmodule static FT_Error @@ -104,19 +103,6 @@ } -#ifdef FT_CONFIG_OPTION_PIC - -#undef AF_SCRIPT_CLASSES_GET -#define AF_SCRIPT_CLASSES_GET \ - ( GET_PIC( ft_module->library )->af_script_classes ) - -#undef AF_STYLE_CLASSES_GET -#define AF_STYLE_CLASSES_GET \ - ( GET_PIC( ft_module->library )->af_style_classes ) - -#endif - - static FT_Error af_property_set( FT_Module ft_module, const char* property_name, @@ -147,9 +133,9 @@ /* We translate the fallback script to a fallback style that uses */ /* `fallback-script' as its script and `AF_COVERAGE_NONE' as its */ /* coverage value. */ - for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) + for ( ss = 0; af_style_classes[ss]; ss++ ) { - AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss]; + AF_StyleClass style_class = af_style_classes[ss]; if ( (FT_UInt)style_class->script == *fallback_script && @@ -160,7 +146,7 @@ } } - if ( !AF_STYLE_CLASSES_GET[ss] ) + if ( !af_style_classes[ss] ) { FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'\n", fallback_script, property_name )); @@ -357,7 +343,7 @@ { FT_UInt* val = (FT_UInt*)value; - AF_StyleClass style_class = AF_STYLE_CLASSES_GET[fallback_style]; + AF_StyleClass style_class = af_style_classes[fallback_style]; *val = style_class->script; @@ -440,28 +426,16 @@ FT_DEFINE_SERVICEDESCREC1( af_services, - FT_SERVICE_ID_PROPERTIES, &AF_SERVICE_PROPERTIES_GET ) + FT_SERVICE_ID_PROPERTIES, &af_service_properties ) FT_CALLBACK_DEF( FT_Module_Interface ) af_get_interface( FT_Module module, const char* module_interface ) { - /* AF_SERVICES_GET dereferences `library' in PIC mode */ -#ifdef FT_CONFIG_OPTION_PIC - FT_Library library; - - - if ( !module ) - return NULL; - library = module->library; - if ( !library ) - return NULL; -#else FT_UNUSED( module ); -#endif - return ft_service_list_lookup( AF_SERVICES_GET, module_interface ); + return ft_service_list_lookup( af_services, module_interface ); } @@ -533,7 +507,7 @@ glyph_index, load_flags ); #ifdef FT_DEBUG_LEVEL_TRACE - if ( ft_trace_levels[FT_COMPONENT] ) + if ( ft_trace_levels[FT_TRACE_COMP( FT_COMPONENT )] ) { #endif af_glyph_hints_dump_points( hints, 0 ); @@ -589,7 +563,7 @@ 0x10000L, /* version 1.0 of the autofitter */ 0x20000L, /* requires FreeType 2.0 or above */ - (const void*)&AF_INTERFACE_GET, + (const void*)&af_autofitter_interface, (FT_Module_Constructor)af_autofitter_init, /* module_init */ (FT_Module_Destructor) af_autofitter_done, /* module_done */ diff --git a/src/3rdparty/freetype/src/autofit/afmodule.h b/src/3rdparty/freetype/src/autofit/afmodule.h index 56f64eaf23..b410809aa8 100644 --- a/src/3rdparty/freetype/src/autofit/afmodule.h +++ b/src/3rdparty/freetype/src/autofit/afmodule.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afmodule.h */ -/* */ -/* Auto-fitter module implementation (specification). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afmodule.h + * + * Auto-fitter module implementation (specification). + * + * 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. + * + */ #ifndef AFMODULE_H_ @@ -28,8 +28,8 @@ FT_BEGIN_HEADER /* - * This is the `extended' FT_Module structure that holds the - * autofitter's global data. + * This is the `extended' FT_Module structure that holds the + * autofitter's global data. */ typedef struct AF_ModuleRec_ diff --git a/src/3rdparty/freetype/src/autofit/afranges.c b/src/3rdparty/freetype/src/autofit/afranges.c index cf67fafb11..45c8bbfc95 100644 --- a/src/3rdparty/freetype/src/autofit/afranges.c +++ b/src/3rdparty/freetype/src/autofit/afranges.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afranges.c */ -/* */ -/* Auto-fitter Unicode script ranges (body). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afranges.c + * + * Auto-fitter Unicode script ranges (body). + * + * Copyright (C) 2013-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. + * + */ #include "afranges.h" @@ -664,6 +664,21 @@ }; + const AF_Script_UniRangeRec af_mong_uniranges[] = + { + AF_UNIRANGE_REC( 0x1800, 0x18AF ), /* Mongolian */ + AF_UNIRANGE_REC( 0x11660, 0x1167F ), /* Mongolian Supplement */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_mong_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0x1885, 0x1886 ), + AF_UNIRANGE_REC( 0x18A9, 0x18A9 ), + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_mymr_uniranges[] = { AF_UNIRANGE_REC( 0x1000, 0x109F ), /* Myanmar */ diff --git a/src/3rdparty/freetype/src/autofit/afranges.h b/src/3rdparty/freetype/src/autofit/afranges.h index ba3b5e7ccb..d5917aefed 100644 --- a/src/3rdparty/freetype/src/autofit/afranges.h +++ b/src/3rdparty/freetype/src/autofit/afranges.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afranges.h */ -/* */ -/* Auto-fitter Unicode script ranges (specification). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afranges.h + * + * Auto-fitter Unicode script ranges (specification). + * + * Copyright (C) 2013-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. + * + */ #ifndef AFRANGES_H_ diff --git a/src/3rdparty/freetype/src/autofit/afscript.h b/src/3rdparty/freetype/src/autofit/afscript.h index 623a1734a6..2da8c70183 100644 --- a/src/3rdparty/freetype/src/autofit/afscript.h +++ b/src/3rdparty/freetype/src/autofit/afscript.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afscript.h */ -/* */ -/* Auto-fitter scripts (specification only). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afscript.h + * + * Auto-fitter scripts (specification only). + * + * Copyright (C) 2013-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. + * + */ /* The following part can be included multiple times. */ @@ -243,6 +243,12 @@ HINTING_BOTTOM_TO_TOP, "\xE0\xB4\xA0 \xE0\xB4\xB1" ) /* ഠ റ */ + SCRIPT( mong, MONG, + "Mongolian", + HB_SCRIPT_MONGOLIAN, + HINTING_TOP_TO_BOTTOM, + "\xE1\xA1\x82 \xE1\xA0\xAA" ) /* ᡂ ᠪ */ + SCRIPT( mymr, MYMR, "Myanmar", HB_SCRIPT_MYANMAR, diff --git a/src/3rdparty/freetype/src/autofit/afshaper.c b/src/3rdparty/freetype/src/autofit/afshaper.c index f30828173c..a5191c6915 100644 --- a/src/3rdparty/freetype/src/autofit/afshaper.c +++ b/src/3rdparty/freetype/src/autofit/afshaper.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afshaper.c */ -/* */ -/* HarfBuzz interface for accessing OpenType features (body). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afshaper.c + * + * HarfBuzz interface for accessing OpenType features (body). + * + * Copyright (C) 2013-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. + * + */ #include @@ -26,14 +26,14 @@ #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. */ - /* */ + /************************************************************************** + * + * 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_afshaper +#define FT_COMPONENT afshaper /* @@ -591,14 +591,9 @@ void* af_shaper_buf_create( FT_Face face ) { - FT_Error error; - FT_Memory memory = face->memory; - FT_ULong* buf; - - - FT_MEM_ALLOC( buf, sizeof ( FT_ULong ) ); + FT_UNUSED( face ); - return (void*)buf; + return NULL; } @@ -606,10 +601,8 @@ af_shaper_buf_destroy( FT_Face face, void* buf ) { - FT_Memory memory = face->memory; - - - FT_FREE( buf ); + FT_UNUSED( face ); + FT_UNUSED( buf ); } diff --git a/src/3rdparty/freetype/src/autofit/afshaper.h b/src/3rdparty/freetype/src/autofit/afshaper.h index 7efd9f6a4e..06a1e06616 100644 --- a/src/3rdparty/freetype/src/autofit/afshaper.h +++ b/src/3rdparty/freetype/src/autofit/afshaper.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afshaper.h */ -/* */ -/* HarfBuzz interface for accessing OpenType features (specification). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afshaper.h + * + * HarfBuzz interface for accessing OpenType features (specification). + * + * Copyright (C) 2013-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. + * + */ #ifndef AFSHAPER_H_ diff --git a/src/3rdparty/freetype/src/autofit/afstyles.h b/src/3rdparty/freetype/src/autofit/afstyles.h index e2688b3fc2..8d1d70812f 100644 --- a/src/3rdparty/freetype/src/autofit/afstyles.h +++ b/src/3rdparty/freetype/src/autofit/afstyles.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afstyles.h */ -/* */ -/* Auto-fitter styles (specification only). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afstyles.h + * + * Auto-fitter styles (specification only). + * + * Copyright (C) 2013-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. + * + */ /* The following part can be included multiple times. */ @@ -322,6 +322,13 @@ AF_BLUE_STRINGSET_MLYM, AF_COVERAGE_DEFAULT ) + STYLE( mong_dflt, MONG_DFLT, + "Mongolian default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_MONG, + AF_BLUE_STRINGSET_MONG, + AF_COVERAGE_DEFAULT ) + STYLE( mymr_dflt, MYMR_DFLT, "Myanmar 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 6bd8c895b2..579003d27d 100644 --- a/src/3rdparty/freetype/src/autofit/aftypes.h +++ b/src/3rdparty/freetype/src/autofit/aftypes.h @@ -1,30 +1,30 @@ -/***************************************************************************/ -/* */ -/* aftypes.h */ -/* */ -/* Auto-fitter types (specification only). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * aftypes.h + * + * Auto-fitter types (specification only). + * + * 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. + * + */ /************************************************************************* * - * The auto-fitter is a complete rewrite of the old auto-hinter. - * Its main feature is the ability to differentiate between different - * writing systems and scripts in order to apply specific rules. + * The auto-fitter is a complete rewrite of the old auto-hinter. + * Its main feature is the ability to differentiate between different + * writing systems and scripts in order to apply specific rules. * - * The code has also been compartmentalized into several entities that - * should make algorithmic experimentation easier than with the old - * code. + * The code has also been compartmentalized into several entities that + * should make algorithmic experimentation easier than with the old + * code. * *************************************************************************/ @@ -102,9 +102,9 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * The auto-fitter doesn't need a very high angular accuracy; - * this allows us to speed up some computations considerably with a - * light Cordic algorithm (see afangles.c). + * The auto-fitter doesn't need a very high angular accuracy; + * this allows us to speed up some computations considerably with a + * light Cordic algorithm (see afangles.c). */ typedef FT_Int AF_Angle; @@ -118,7 +118,7 @@ extern void* _af_debug_hints; #if 0 /* - * compute the angle of a given 2-D vector + * compute the angle of a given 2-D vector */ FT_LOCAL( AF_Angle ) af_angle_atan( FT_Pos dx, @@ -126,8 +126,8 @@ extern void* _af_debug_hints; /* - * compute `angle2 - angle1'; the result is always within - * the range [-AF_ANGLE_PI .. AF_ANGLE_PI - 1] + * compute `angle2 - angle1'; the result is always within + * the range [-AF_ANGLE_PI .. AF_ANGLE_PI - 1] */ FT_LOCAL( AF_Angle ) af_angle_diff( AF_Angle angle1, @@ -150,8 +150,9 @@ extern void* _af_debug_hints; FT_END_STMNT - /* opaque handle to glyph-specific hints -- see `afhints.h' for more - * details + /* + * opaque handle to glyph-specific hints -- see `afhints.h' for more + * details */ typedef struct AF_GlyphHintsRec_* AF_GlyphHints; @@ -165,8 +166,8 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * A scaler models the target pixel device that will receive the - * auto-hinted glyph image. + * A scaler models the target pixel device that will receive the + * auto-hinted glyph image. */ #define AF_SCALER_FLAG_NO_HORIZONTAL 1U /* disable horizontal hinting */ @@ -197,8 +198,9 @@ extern void* _af_debug_hints; typedef struct AF_StyleMetricsRec_* AF_StyleMetrics; - /* This function parses an FT_Face to compute global metrics for - * a specific style. + /* + * This function parses an FT_Face to compute global metrics for + * a specific style. */ typedef FT_Error (*AF_WritingSystem_InitMetricsFunc)( AF_StyleMetrics metrics, @@ -237,22 +239,22 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * For the auto-hinter, a writing system consists of multiple scripts that - * can be handled similarly *in a typographical way*; the relationship is - * not based on history. For example, both the Greek and the unrelated - * Armenian scripts share the same features like ascender, descender, - * x-height, etc. Essentially, a writing system is covered by a - * submodule of the auto-fitter; it contains + * For the auto-hinter, a writing system consists of multiple scripts that + * can be handled similarly *in a typographical way*; the relationship is + * not based on history. For example, both the Greek and the unrelated + * Armenian scripts share the same features like ascender, descender, + * x-height, etc. Essentially, a writing system is covered by a + * submodule of the auto-fitter; it contains * - * - a specific global analyzer that computes global metrics specific to - * the script (based on script-specific characters to identify ascender - * height, x-height, etc.), + * - a specific global analyzer that computes global metrics specific to + * the script (based on script-specific characters to identify ascender + * height, x-height, etc.), * - * - a specific glyph analyzer that computes segments and edges for each - * glyph covered by the script, + * - a specific glyph analyzer that computes segments and edges for each + * glyph covered by the script, * - * - a specific grid-fitting algorithm that distorts the scaled glyph - * outline according to the results of the glyph analyzer. + * - a specific grid-fitting algorithm that distorts the scaled glyph + * outline according to the results of the glyph analyzer. */ #define AFWRTSYS_H_ /* don't load header files */ @@ -300,12 +302,12 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * Each script is associated with two sets of Unicode ranges to test - * whether the font face supports the script, and which non-base - * characters the script contains. + * Each script is associated with two sets of Unicode ranges to test + * whether the font face supports the script, and which non-base + * characters the script contains. * - * We use four-letter script tags from the OpenType specification, - * extended by `NONE', which indicates `no script'. + * We use four-letter script tags from the OpenType specification, + * extended by `NONE', which indicates `no script'. */ #undef SCRIPT @@ -361,41 +363,41 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * Usually, a font contains more glyphs than can be addressed by its - * character map. + * Usually, a font contains more glyphs than can be addressed by its + * character map. * - * In the PostScript font world, encoding vectors specific to a given - * task are used to select such glyphs, and these glyphs can be often - * recognized by having a suffix in its glyph names. For example, a - * superscript glyph `A' might be called `A.sup'. Unfortunately, this - * naming scheme is not standardized and thus unusable for us. + * In the PostScript font world, encoding vectors specific to a given + * task are used to select such glyphs, and these glyphs can be often + * recognized by having a suffix in its glyph names. For example, a + * superscript glyph `A' might be called `A.sup'. Unfortunately, this + * naming scheme is not standardized and thus unusable for us. * - * In the OpenType world, a better solution was invented, namely - * `features', which cleanly separate a character's input encoding from - * the corresponding glyph's appearance, and which don't use glyph names - * at all. For our purposes, and slightly generalized, an OpenType - * feature is a name of a mapping that maps character codes to - * non-standard glyph indices (features get used for other things also). - * For example, the `sups' feature provides superscript glyphs, thus - * mapping character codes like `A' or `B' to superscript glyph - * representation forms. How this mapping happens is completely - * uninteresting to us. + * In the OpenType world, a better solution was invented, namely + * `features', which cleanly separate a character's input encoding from + * the corresponding glyph's appearance, and which don't use glyph names + * at all. For our purposes, and slightly generalized, an OpenType + * feature is a name of a mapping that maps character codes to + * non-standard glyph indices (features get used for other things also). + * For example, the `sups' feature provides superscript glyphs, thus + * mapping character codes like `A' or `B' to superscript glyph + * representation forms. How this mapping happens is completely + * uninteresting to us. * - * For the auto-hinter, a `coverage' represents all glyphs of an OpenType - * feature collected in a set (as listed below) that can be hinted - * together. To continue the above example, superscript glyphs must not - * be hinted together with normal glyphs because the blue zones - * completely differ. + * For the auto-hinter, a `coverage' represents all glyphs of an OpenType + * feature collected in a set (as listed below) that can be hinted + * together. To continue the above example, superscript glyphs must not + * be hinted together with normal glyphs because the blue zones + * completely differ. * - * Note that FreeType itself doesn't compute coverages; it only provides - * the glyphs addressable by the default Unicode character map. Instead, - * we use the HarfBuzz library (if available), which has many functions - * exactly for this purpose. + * Note that FreeType itself doesn't compute coverages; it only provides + * the glyphs addressable by the default Unicode character map. Instead, + * we use the HarfBuzz library (if available), which has many functions + * exactly for this purpose. * - * AF_COVERAGE_DEFAULT is special: It should cover everything that isn't - * listed separately (including the glyphs addressable by the character - * map). In case HarfBuzz isn't available, it exactly covers the glyphs - * addressable by the character map. + * AF_COVERAGE_DEFAULT is special: It should cover everything that isn't + * listed separately (including the glyphs addressable by the character + * map). In case HarfBuzz isn't available, it exactly covers the glyphs + * addressable by the character map. * */ @@ -423,8 +425,8 @@ extern void* _af_debug_hints; /*************************************************************************/ /* - * The topmost structure for modelling the auto-hinter glyph input data - * is a `style class', grouping everything together. + * The topmost structure for modelling the auto-hinter glyph input data + * is a `style class', grouping everything together. */ #undef STYLE @@ -486,8 +488,6 @@ extern void* _af_debug_hints; /* Declare and define vtables for classes */ -#ifndef FT_CONFIG_OPTION_PIC - #define AF_DECLARE_WRITING_SYSTEM_CLASS( writing_system_class ) \ FT_CALLBACK_TABLE const AF_WritingSystemClassRec \ writing_system_class; @@ -562,87 +562,9 @@ extern void* _af_debug_hints; coverage \ }; -#else /* FT_CONFIG_OPTION_PIC */ - -#define AF_DECLARE_WRITING_SYSTEM_CLASS( writing_system_class ) \ - FT_LOCAL( void ) \ - FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac ); - -#define AF_DEFINE_WRITING_SYSTEM_CLASS( \ - writing_system_class, \ - system, \ - m_size, \ - m_init, \ - m_scale, \ - m_done, \ - m_stdw, \ - h_init, \ - h_apply ) \ - FT_LOCAL_DEF( void ) \ - FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac ) \ - { \ - ac->writing_system = system; \ - \ - ac->style_metrics_size = m_size; \ - \ - ac->style_metrics_init = m_init; \ - ac->style_metrics_scale = m_scale; \ - ac->style_metrics_done = m_done; \ - ac->style_metrics_getstdw = m_stdw; \ - \ - ac->style_hints_init = h_init; \ - ac->style_hints_apply = h_apply; \ - } - - -#define AF_DECLARE_SCRIPT_CLASS( script_class ) \ - FT_LOCAL( void ) \ - FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ); - -#define AF_DEFINE_SCRIPT_CLASS( \ - script_class, \ - script_, \ - ranges, \ - nonbase_ranges, \ - top_to_bottom, \ - std_charstring ) \ - FT_LOCAL_DEF( void ) \ - FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \ - { \ - ac->script = script_; \ - ac->script_uni_ranges = ranges; \ - ac->script_uni_nonbase_ranges = nonbase_ranges; \ - ac->top_to_bottom_hinting = top_to_bottom; \ - ac->standard_charstring = std_charstring; \ - } - - -#define AF_DECLARE_STYLE_CLASS( style_class ) \ - FT_LOCAL( void ) \ - FT_Init_Class_ ## style_class( AF_StyleClassRec* ac ); - -#define AF_DEFINE_STYLE_CLASS( \ - style_class, \ - style_, \ - writing_system_, \ - script_, \ - blue_stringset_, \ - coverage_ ) \ - FT_LOCAL_DEF( void ) \ - FT_Init_Class_ ## style_class( AF_StyleClassRec* ac ) \ - { \ - ac->style = style_; \ - ac->writing_system = writing_system_; \ - ac->script = script_; \ - ac->blue_stringset = blue_stringset_; \ - ac->coverage = coverage_; \ - } - -#endif /* FT_CONFIG_OPTION_PIC */ - - /* */ + FT_END_HEADER #endif /* AFTYPES_H_ */ diff --git a/src/3rdparty/freetype/src/autofit/afwarp.c b/src/3rdparty/freetype/src/autofit/afwarp.c index 2a75ea7b35..84e9753ad9 100644 --- a/src/3rdparty/freetype/src/autofit/afwarp.c +++ b/src/3rdparty/freetype/src/autofit/afwarp.c @@ -1,40 +1,40 @@ -/***************************************************************************/ -/* */ -/* afwarp.c */ -/* */ -/* Auto-fitter warping algorithm (body). */ -/* */ -/* Copyright 2006-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afwarp.c + * + * Auto-fitter warping algorithm (body). + * + * Copyright (C) 2006-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. + * + */ /* - * The idea of the warping code is to slightly scale and shift a glyph - * within a single dimension so that as much of its segments are aligned - * (more or less) on the grid. To find out the optimal scaling and - * shifting value, various parameter combinations are tried and scored. + * The idea of the warping code is to slightly scale and shift a glyph + * within a single dimension so that as much of its segments are aligned + * (more or less) on the grid. To find out the optimal scaling and + * shifting value, various parameter combinations are tried and scored. */ #include "afwarp.h" #ifdef AF_CONFIG_OPTION_USE_WARPER - /*************************************************************************/ - /* */ - /* 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. */ - /* */ + /************************************************************************** + * + * 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_afwarp +#define FT_COMPONENT afwarp /* The weights cover the range 0/64 - 63/64 of a pixel. Obviously, */ diff --git a/src/3rdparty/freetype/src/autofit/afwarp.h b/src/3rdparty/freetype/src/autofit/afwarp.h index 520b1be907..9a2c9a42c1 100644 --- a/src/3rdparty/freetype/src/autofit/afwarp.h +++ b/src/3rdparty/freetype/src/autofit/afwarp.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afwarp.h */ -/* */ -/* Auto-fitter warping algorithm (specification). */ -/* */ -/* Copyright 2006-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afwarp.h + * + * Auto-fitter warping algorithm (specification). + * + * Copyright (C) 2006-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. + * + */ #ifndef AFWARP_H_ @@ -47,12 +47,14 @@ FT_BEGIN_HEADER } AF_WarperRec, *AF_Warper; +#ifdef AF_CONFIG_OPTION_USE_WARPER FT_LOCAL( void ) af_warper_compute( AF_Warper warper, AF_GlyphHints hints, AF_Dimension dim, FT_Fixed *a_scale, - FT_Fixed *a_delta ); + FT_Pos *a_delta ); +#endif FT_END_HEADER diff --git a/src/3rdparty/freetype/src/autofit/afwrtsys.h b/src/3rdparty/freetype/src/autofit/afwrtsys.h index 4675f3242d..5611cf441a 100644 --- a/src/3rdparty/freetype/src/autofit/afwrtsys.h +++ b/src/3rdparty/freetype/src/autofit/afwrtsys.h @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* afwrtsys.h */ -/* */ -/* Auto-fitter writing systems (specification only). */ -/* */ -/* Copyright 2013-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * afwrtsys.h + * + * Auto-fitter writing systems (specification only). + * + * Copyright (C) 2013-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. + * + */ #ifndef AFWRTSYS_H_ diff --git a/src/3rdparty/freetype/src/autofit/autofit.c b/src/3rdparty/freetype/src/autofit/autofit.c index c1605160a1..facfec1744 100644 --- a/src/3rdparty/freetype/src/autofit/autofit.c +++ b/src/3rdparty/freetype/src/autofit/autofit.c @@ -1,19 +1,19 @@ -/***************************************************************************/ -/* */ -/* autofit.c */ -/* */ -/* Auto-fitter module (body). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ +/**************************************************************************** + * + * autofit.c + * + * Auto-fitter module (body). + * + * 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. + * + */ #define FT_MAKE_OPTION_SINGLE_OBJECT @@ -30,7 +30,6 @@ #include "aflatin2.c" #include "afloader.c" #include "afmodule.c" -#include "afpic.c" #include "afranges.c" #include "afshaper.c" #include "afwarp.c" diff --git a/src/3rdparty/freetype/src/autofit/module.mk b/src/3rdparty/freetype/src/autofit/module.mk index ff05f83e7e..cf77b169f7 100644 --- a/src/3rdparty/freetype/src/autofit/module.mk +++ b/src/3rdparty/freetype/src/autofit/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2018 by +# 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, diff --git a/src/3rdparty/freetype/src/autofit/rules.mk b/src/3rdparty/freetype/src/autofit/rules.mk index 75171b412c..c59da33a55 100644 --- a/src/3rdparty/freetype/src/autofit/rules.mk +++ b/src/3rdparty/freetype/src/autofit/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2003-2018 by +# 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, @@ -38,7 +38,6 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \ $(AUTOF_DIR)/aflatin.c \ $(AUTOF_DIR)/afloader.c \ $(AUTOF_DIR)/afmodule.c \ - $(AUTOF_DIR)/afpic.c \ $(AUTOF_DIR)/afranges.c \ $(AUTOF_DIR)/afshaper.c \ $(AUTOF_DIR)/afwarp.c -- cgit v1.2.3