summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiviu Solcovenco2021-12-11 00:22:41 +0200
committerLiviu Solcovenco2021-12-11 00:22:41 +0200
commit90f3032a216fc1abc74efaeab0e8c84cd2bf28cc (patch)
treeaf009a98bde7cfb26e3296b6d75f6198e56ac005
parentdf451552b2358ae7002e9911fcd0a8d817808242 (diff)
downloadaur-90f3032a216fc1abc74efaeab0e8c84cd2bf28cc.tar.gz
Update freetype2-infinality-remix to 2.11.1-1
-rw-r--r--.SRCINFO19
-rw-r--r--0002-infinality-2.11.1-2021.12.10.patch (renamed from 0002-infinality-2.10.1-2019.08.21.patch)1531
-rw-r--r--0006-infinality-remix-tweaks.patch139
-rw-r--r--PKGBUILD22
4 files changed, 825 insertions, 886 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a45c752cf507..a1790db1efcf 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = freetype2-infinality-remix
pkgdesc = TrueType font rendering library with Infinality Remix patches
- pkgver = 2.10.1
- pkgrel = 2
+ pkgver = 2.11.1
+ pkgrel = 1
url = http://www.freetype.org/
install = freetype2.install
arch = i686
@@ -10,22 +10,20 @@ pkgbase = freetype2-infinality-remix
makedepends = libx11
makedepends = libpng
makedepends = harfbuzz
- source = https://download-mirror.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.xz
- source = https://download-mirror.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.xz.sig
+ source = https://download-mirror.savannah.gnu.org/releases/freetype/freetype-2.11.1.tar.xz
+ source = https://download-mirror.savannah.gnu.org/releases/freetype/freetype-2.11.1.tar.xz.sig
source = 0001-Enable-table-validation-modules.patch
- source = 0002-infinality-2.10.1-2019.08.21.patch
+ source = 0002-infinality-2.11.1-2021.12.10.patch
source = 0004-Enable-long-PCF-family-names.patch
- source = 0006-infinality-remix-tweaks.patch
source = freetype2.sh
source = infinality-settings.sh
source = xft-settings.sh
validpgpkeys = 58E0C111E39F5408C5D3EC76C1A60EACE707FDA5
- sha256sums = 16dbfa488a21fe827dc27eaf708f42f7aa3bb997d745d31a19781628c36ba26f
+ sha256sums = 3333ae7cfda88429c97a7ae63b7d01ab398076c3b67182e960e5684050f2c5c8
sha256sums = SKIP
sha256sums = ac11a24b62a6c044cc245ea9fa2a0cbd9e2e62f2371873dd33084c28a76e7176
- sha256sums = afdc909def9d7e839f227a83a4e3b58d4060a28861739f9e1ab5540e60929cc8
+ sha256sums = 6d563b1f9f9ef52379818ff3ede26b44e0b4cb6e3cf46ea44ca5d36b6d29ae9d
sha256sums = 54800d4da18611cf9232aad8b63d74a83153a51bb56dd39191678c738ffc8b53
- sha256sums = 94493ed2865fd32e5ef8ef3493fcb2ccaaf8be4c9e0eaa7b417fcbc47fe4314d
sha256sums = f7f8e09c44f7552c883846e9a6a1efc50377c4932234e74adc4a8ff750606467
sha256sums = 1a5c12aa96e2ee66f7316b8ccb7012520b231a2d8ee21cfe4064aa28db35a57c
sha256sums = 4842d1461c240cd0f60a7247ee038271fdb1067107bea9024be6bdbb218d1bd4
@@ -37,10 +35,9 @@ pkgname = freetype2-infinality-remix
depends = sh
depends = libpng
depends = harfbuzz
- provides = freetype2=2.10.1
+ provides = freetype2=2.11.1
provides = freetype2-infinality
provides = libfreetype.so
conflicts = freetype2
conflicts = freetype2-infinality
conflicts = freetype2-infinality-ultimate
-
diff --git a/0002-infinality-2.10.1-2019.08.21.patch b/0002-infinality-2.11.1-2021.12.10.patch
index 2eb0f0d44e48..91c48dc01103 100644
--- a/0002-infinality-2.10.1-2019.08.21.patch
+++ b/0002-infinality-2.11.1-2021.12.10.patch
@@ -1,19 +1,72 @@
-diff --git a/builds/freetype.mk b/builds/freetype.mk
-index 2b0ffaedd..a2bc85ba4 100644
---- a/builds/freetype.mk
-+++ b/builds/freetype.mk
-@@ -164,6 +164,7 @@ FT_CFLAGS = $(CPPFLAGS) \
- $(CFLAGS) \
- $DFT2_BUILD_LIBRARY \
- $DFT_CONFIG_MODULES_H="<ftmodule.h>" \
-+ $D_GNU_SOURCE \
- $(FTOPTION_FLAG)
-
-
-diff --git a/configure b/configure
-index 9a64f69c4..6161c0f3a 100755
---- a/configure
-+++ b/configure
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/config.mk a/config.mk
+--- b/config.mk 1970-01-01 03:00:00.000000000 +0300
++++ a/config.mk 2021-09-16 09:19:40.891396586 +0300
+@@ -0,0 +1,62 @@
++#
++# FreeType 2 configuration rules for UNIX platforms
++#
++
++
++# Copyright (C) 1996-2021 by
++# David Turner, Robert Wilhelm, and Werner Lemberg.
++#
++# This file is part of the FreeType project, and may only be used, modified,
++# and distributed under the terms of the FreeType project license,
++# LICENSE.TXT. By continuing to use, modify, or distribute this file you
++# indicate that you have read the license and understand and accept it
++# fully.
++
++# We need these declarations here since unix-def.mk is a generated file.
++PLATFORM_DIR := $(TOP_DIR)/builds/unix
++PLATFORM := unix
++
++have_mk := $(wildcard $(OBJ_DIR)/unix-def.mk)
++ifneq ($(have_mk),)
++ # We are building FreeType 2 not in the src tree.
++ include $(OBJ_DIR)/unix-def.mk
++ include $(OBJ_DIR)/unix-cc.mk
++else
++ include $(PLATFORM_DIR)/unix-def.mk
++ include $(PLATFORM_DIR)/unix-cc.mk
++endif
++
++ifdef BUILD_PROJECT
++
++ .PHONY: clean_project distclean_project
++
++ # Now include the main sub-makefile. It contains all the rules used to
++ # build the library with the previous variables defined.
++ #
++ include $(TOP_DIR)/builds/$(PROJECT).mk
++
++
++ # The cleanup targets.
++ #
++ clean_project: clean_project_unix
++ distclean_project: distclean_project_unix
++
++
++ # This final rule is used to link all object files into a single library.
++ # It is part of the system-specific sub-Makefile because not all
++ # librarians accept a simple syntax like
++ #
++ # librarian library_file {list of object files}
++ #
++ $(PROJECT_LIBRARY): $(OBJECTS_LIST)
++ ifdef CLEAN_LIBRARY
++ -$(CLEAN_LIBRARY) $(NO_OUTPUT)
++ endif
++ $(LINK_LIBRARY)
++
++ include $(TOP_DIR)/builds/unix/install.mk
++
++endif
++
++
++# EOF
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/configure a/configure
+--- b/configure 2021-02-13 10:16:54.000000000 +0200
++++ a/configure 2021-09-16 09:15:05.050379727 +0300
@@ -13,6 +13,8 @@
# Call the `configure' script located in `builds/unix'.
#
@@ -23,11 +76,10 @@ index 9a64f69c4..6161c0f3a 100755
rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk
# respect GNUMAKE environment variable for backward compatibility
-diff --git a/devel/ftoption.h b/devel/ftoption.h
-index 16cf4e126..f75552db5 100644
---- a/devel/ftoption.h
-+++ b/devel/ftoption.h
-@@ -601,6 +601,16 @@ FT_BEGIN_HEADER
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/devel/ftoption.h a/devel/ftoption.h
+--- b/devel/ftoption.h 2021-07-15 13:09:04.000000000 +0300
++++ a/devel/ftoption.h 2021-09-16 09:15:05.050379727 +0300
+@@ -629,6 +629,16 @@
*/
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -44,11 +96,10 @@ index 16cf4e126..f75552db5 100644
/**************************************************************************
*
-diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
-index 12f47a82e..946a2fb93 100644
---- a/include/freetype/config/ftoption.h
-+++ b/include/freetype/config/ftoption.h
-@@ -113,20 +113,21 @@ FT_BEGIN_HEADER
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/include/freetype/config/ftoption.h a/include/freetype/config/ftoption.h
+--- b/include/freetype/config/ftoption.h 2021-07-15 13:09:04.000000000 +0300
++++ a/include/freetype/config/ftoption.h 2021-09-16 09:15:05.051379735 +0300
+@@ -112,18 +112,21 @@
#define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
@@ -60,10 +111,8 @@ index 12f47a82e..946a2fb93 100644
- * mitigate color fringes inherent to this technology, you also need to
- * explicitly set up LCD filtering.
- *
-- * Note that this feature is covered by several Microsoft patents and
-- * should not be activated in any default build of the library. When this
-- * macro is not defined, FreeType offers alternative LCD rendering
-- * technology that produces excellent output without LCD filtering.
+- * When this macro is not defined, FreeType offers alternative LCD
+- * rendering technology that produces excellent output.
- */
-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+ /*************************************************************************/
@@ -84,7 +133,7 @@ index 12f47a82e..946a2fb93 100644
/**************************************************************************
-@@ -601,6 +602,17 @@ FT_BEGIN_HEADER
+@@ -631,6 +634,17 @@
*/
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -102,7 +151,7 @@ index 12f47a82e..946a2fb93 100644
/**************************************************************************
*
-@@ -658,8 +670,8 @@ FT_BEGIN_HEADER
+@@ -688,8 +702,8 @@
* https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
*/
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
@@ -113,11 +162,10 @@ index 12f47a82e..946a2fb93 100644
/**************************************************************************
-diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
-index 0c1d3e5bf..3acde2406 100644
---- a/include/freetype/internal/ftobjs.h
-+++ b/include/freetype/internal/ftobjs.h
-@@ -278,12 +278,14 @@ FT_BEGIN_HEADER
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/include/freetype/internal/ftobjs.h a/include/freetype/internal/ftobjs.h
+--- b/include/freetype/internal/ftobjs.h 2021-02-13 10:16:54.000000000 +0200
++++ a/include/freetype/internal/ftobjs.h 2021-09-16 09:15:05.051379735 +0300
+@@ -278,12 +278,14 @@
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,
@@ -132,7 +180,7 @@ index 0c1d3e5bf..3acde2406 100644
FT_LcdFiveTapFilter weights );
#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-@@ -908,6 +910,7 @@ FT_BEGIN_HEADER
+@@ -908,6 +910,7 @@
FT_DebugHook_Func debug_hooks[4];
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
@@ -140,11 +188,10 @@ index 0c1d3e5bf..3acde2406 100644
FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
#else
-diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
-index 27d402488..ac1488dcb 100644
---- a/src/autofit/aflatin.c
-+++ b/src/autofit/aflatin.c
-@@ -23,7 +23,10 @@
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/autofit/aflatin.c a/src/autofit/aflatin.c
+--- b/src/autofit/aflatin.c 2021-07-12 15:07:00.000000000 +0300
++++ a/src/autofit/aflatin.c 2021-09-16 09:15:05.051379735 +0300
+@@ -22,7 +22,10 @@
#include "afglobal.h"
#include "aflatin.h"
#include "aferrors.h"
@@ -154,9 +201,9 @@ index 27d402488..ac1488dcb 100644
+#include "../base/ftinf.h"
+#endif
- #ifdef AF_CONFIG_OPTION_USE_WARPER
- #include "afwarp.h"
-@@ -39,6 +42,10 @@
+ /**************************************************************************
+ *
+@@ -33,6 +36,10 @@
#undef FT_COMPONENT
#define FT_COMPONENT aflatin
@@ -167,7 +214,7 @@ index 27d402488..ac1488dcb 100644
/* needed for computation of round vs. flat segments */
#define FLAT_THRESHOLD( x ) ( x / 14 )
-@@ -1181,7 +1188,10 @@
+@@ -1174,7 +1181,10 @@
FT_Pos delta;
AF_LatinAxis axis;
FT_UInt nn;
@@ -179,7 +226,7 @@ index 27d402488..ac1488dcb 100644
if ( dim == AF_DIMENSION_HORZ )
{
-@@ -1209,7 +1219,7 @@
+@@ -1202,7 +1212,7 @@
{
AF_LatinAxis Axis = &metrics->axis[AF_DIMENSION_VERT];
AF_LatinBlue blue = NULL;
@@ -188,7 +235,7 @@ index 27d402488..ac1488dcb 100644
for ( nn = 0; nn < Axis->blue_count; nn++ )
{
-@@ -1219,7 +1229,12 @@
+@@ -1212,7 +1222,12 @@
break;
}
}
@@ -202,7 +249,7 @@ index 27d402488..ac1488dcb 100644
if ( blue )
{
FT_Pos scaled;
-@@ -1375,7 +1390,13 @@
+@@ -1369,7 +1384,13 @@
/* a blue zone is only active if it is less than 3/4 pixels tall */
dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale );
@@ -216,7 +263,7 @@ index 27d402488..ac1488dcb 100644
{
#if 0
FT_Pos delta1;
-@@ -1426,7 +1447,12 @@
+@@ -1420,7 +1441,12 @@
delta2 = -delta2;
blue->ref.fit = FT_PIX_ROUND( blue->ref.cur );
@@ -229,7 +276,7 @@ index 27d402488..ac1488dcb 100644
#endif
-@@ -2564,7 +2590,10 @@
+@@ -2583,7 +2609,10 @@
dist = edge->fpos - blue->shoot.org;
if ( dist < 0 )
dist = -dist;
@@ -241,12 +288,10 @@ index 27d402488..ac1488dcb 100644
dist = FT_MulFix( dist, scale );
if ( dist < best_dist )
{
-@@ -2740,8 +2769,17 @@
+@@ -2748,8 +2777,17 @@
FT_Pos dist = width;
FT_Int sign = 0;
FT_Int vertical = ( dim == AF_DIMENSION_VERT );
--
--
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+ FT_Int infinality_dist = 0;
+ FT_UInt autohint_snap_stem_height = 0;
@@ -255,13 +300,14 @@ index 27d402488..ac1488dcb 100644
+ autohint_snap_stem_height = 100;
+ else if ( autohint_snap_stem_height < 0 )
+ autohint_snap_stem_height = 0;
-+
+
+-
+ if ( autohint_snap_stem_height == 0 )
+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */
if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) ||
axis->extra_light )
return width;
-@@ -2751,9 +2789,76 @@
+@@ -2759,9 +2797,76 @@
dist = -width;
sign = 1;
}
@@ -314,8 +360,7 @@ index 27d402488..ac1488dcb 100644
+ infinality_dist = 254;
+ else infinality_dist = ( infinality_dist + 16 ) & ~63;
+ }
-
-- if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) ||
++
+ }
+ if ( infinality_dist < 52 )
+ {
@@ -332,14 +377,14 @@ index 27d402488..ac1488dcb 100644
+ ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) ||
+ ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) )
+#else
-+
-+ if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) ||
+
+ if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) ||
( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) )
+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */
{
/* smooth hinting process: very lightly quantize the stem width */
-@@ -2845,6 +2950,9 @@
+@@ -2853,6 +2958,9 @@
}
}
else
@@ -349,7 +394,7 @@ index 27d402488..ac1488dcb 100644
{
/* strong hinting process: snap the stem width to integer pixels */
-@@ -2852,7 +2960,10 @@
+@@ -2860,7 +2968,10 @@
dist = af_latin_snap_width( axis->widths, axis->width_count, dist );
@@ -361,7 +406,7 @@ index 27d402488..ac1488dcb 100644
if ( vertical )
{
/* in the case of vertical hinting, always round */
-@@ -2915,6 +3026,32 @@
+@@ -2923,6 +3034,32 @@
}
Done_Width:
@@ -394,7 +439,7 @@ index 27d402488..ac1488dcb 100644
if ( sign )
dist = -dist;
-@@ -2933,6 +3070,8 @@
+@@ -2941,6 +3078,8 @@
FT_Pos dist, base_delta;
FT_Pos fitted_width;
@@ -403,7 +448,7 @@ index 27d402488..ac1488dcb 100644
dist = stem_edge->opos - base_edge->opos;
base_delta = base_edge->pos - base_edge->opos;
-@@ -3540,8 +3679,11 @@
+@@ -3548,8 +3687,11 @@
int dim;
AF_LatinAxis axis;
@@ -417,7 +462,7 @@ index 27d402488..ac1488dcb 100644
error = af_glyph_hints_reload( hints, outline );
if ( error )
goto Exit;
-@@ -3605,7 +3747,11 @@
+@@ -3595,7 +3737,11 @@
}
af_glyph_hints_save( hints, outline );
@@ -430,11 +475,10 @@ index 27d402488..ac1488dcb 100644
Exit:
return error;
}
-diff --git a/src/autofit/aflatin.h b/src/autofit/aflatin.h
-index 40479538c..c86ea813f 100644
---- a/src/autofit/aflatin.h
-+++ b/src/autofit/aflatin.h
-@@ -64,6 +64,9 @@ FT_BEGIN_HEADER
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/autofit/aflatin.h a/src/autofit/aflatin.h
+--- b/src/autofit/aflatin.h 2021-02-13 10:16:54.000000000 +0200
++++ a/src/autofit/aflatin.h 2021-09-16 09:15:05.051379735 +0300
+@@ -64,6 +64,9 @@
#define AF_LATIN_MAX_WIDTHS 16
@@ -444,10 +488,9 @@ index 40479538c..c86ea813f 100644
#define AF_LATIN_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */
#define AF_LATIN_BLUE_TOP ( 1U << 1 ) /* we have a top blue zone */
-diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
-index 3e46a3655..9d35874d3 100644
---- a/src/autofit/afmodule.c
-+++ b/src/autofit/afmodule.c
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/autofit/afmodule.c a/src/autofit/afmodule.c
+--- b/src/autofit/afmodule.c 2021-07-12 15:07:00.000000000 +0300
++++ a/src/autofit/afmodule.c 2021-09-16 09:15:05.051379735 +0300
@@ -21,6 +21,10 @@
#include "afloader.h"
#include "aferrors.h"
@@ -459,9 +502,9 @@ index 3e46a3655..9d35874d3 100644
#ifdef FT_DEBUG_AUTOFIT
#ifndef FT_MAKE_OPTION_SINGLE_OBJECT
-@@ -451,6 +455,9 @@
- module->warping = 0;
- #endif
+@@ -405,6 +409,9 @@
+ module->fallback_style = AF_STYLE_FALLBACK;
+ module->default_script = AF_SCRIPT_DEFAULT;
module->no_stem_darkening = TRUE;
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+ if(ftinf) module->no_stem_darkening = !ftinf->stem_darkening_autofit;
@@ -469,23 +512,10 @@ index 3e46a3655..9d35874d3 100644
module->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
module->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1;
-diff --git a/src/base/Jamfile b/src/base/Jamfile
-index 8e1ec4275..f6f60e677 100644
---- a/src/base/Jamfile
-+++ b/src/base/Jamfile
-@@ -59,6 +59,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ;
- ftglyph
- ftgxval
- ftinit
-+ ftinf
- ftmm
- ftotval
- ftpatent
-diff --git a/src/base/ftbase.c b/src/base/ftbase.c
-index fb8cbfcc2..6db31550f 100644
---- a/src/base/ftbase.c
-+++ b/src/base/ftbase.c
-@@ -37,6 +37,9 @@
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftbase.c a/src/base/ftbase.c
+--- b/src/base/ftbase.c 2021-02-13 10:16:54.000000000 +0200
++++ a/src/base/ftbase.c 2021-09-16 09:15:05.051379735 +0300
+@@ -36,6 +36,9 @@
#include "ftstream.c"
#include "fttrigon.c"
#include "ftutil.c"
@@ -495,11 +525,9 @@ index fb8cbfcc2..6db31550f 100644
/* END */
-diff --git a/src/base/ftinf.c b/src/base/ftinf.c
-new file mode 100644
-index 000000000..5d6b7f682
---- /dev/null
-+++ b/src/base/ftinf.c
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftinf.c a/src/base/ftinf.c
+--- b/src/base/ftinf.c 1970-01-01 03:00:00.000000000 +0300
++++ a/src/base/ftinf.c 2021-09-16 09:15:05.052379743 +0300
@@ -0,0 +1,363 @@
+#include <stdlib.h>
+#include "ftinf.h"
@@ -864,11 +892,9 @@ index 000000000..5d6b7f682
+ /* point to the combined and checked settings */
+ ftinf=&_env;
+}
-diff --git a/src/base/ftinf.h b/src/base/ftinf.h
-new file mode 100644
-index 000000000..fbe1bd19d
---- /dev/null
-+++ b/src/base/ftinf.h
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftinf.h a/src/base/ftinf.h
+--- b/src/base/ftinf.h 1970-01-01 03:00:00.000000000 +0300
++++ a/src/base/ftinf.h 2021-09-16 09:15:05.052379743 +0300
@@ -0,0 +1,66 @@
+#ifndef _FTINF_H_
+#define _FTINF_H_
@@ -936,11 +962,9 @@ index 000000000..fbe1bd19d
+extern void ftinf_env();
+
+#endif
-diff --git a/src/base/ftinf_rh.c b/src/base/ftinf_rh.c
-new file mode 100644
-index 000000000..606b5671a
---- /dev/null
-+++ b/src/base/ftinf_rh.c
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftinf_rh.c a/src/base/ftinf_rh.c
+--- b/src/base/ftinf_rh.c 1970-01-01 03:00:00.000000000 +0300
++++ a/src/base/ftinf_rh.c 2021-09-16 09:15:05.052379743 +0300
@@ -0,0 +1,626 @@
+/* ANSI-C code produced by gperf version 3.1 */
+/* Command-line: gperf --output-file=ftinf_rh.c ftinf_rh.gperf */
@@ -1568,11 +1592,9 @@ index 000000000..606b5671a
+/*
+ gperf --output-file=ftinf_rh.c ftinf_rh.gperf
+*/
-diff --git a/src/base/ftinf_rh.gperf b/src/base/ftinf_rh.gperf
-new file mode 100644
-index 000000000..9fd8aab95
---- /dev/null
-+++ b/src/base/ftinf_rh.gperf
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftinf_rh.gperf a/src/base/ftinf_rh.gperf
+--- b/src/base/ftinf_rh.gperf 1970-01-01 03:00:00.000000000 +0300
++++ a/src/base/ftinf_rh.gperf 2021-09-16 09:15:05.052379743 +0300
@@ -0,0 +1,283 @@
+%struct-type
+%define slot-name name
@@ -1857,11 +1879,9 @@ index 000000000..9fd8aab95
+/*
+ gperf --output-file=ftinf_rh.c ftinf_rh.gperf
+*/
-diff --git a/src/base/ftinf_sh.c b/src/base/ftinf_sh.c
-new file mode 100644
-index 000000000..87d2ff8bd
---- /dev/null
-+++ b/src/base/ftinf_sh.c
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftinf_sh.c a/src/base/ftinf_sh.c
+--- b/src/base/ftinf_sh.c 1970-01-01 03:00:00.000000000 +0300
++++ a/src/base/ftinf_sh.c 2021-09-16 09:15:05.052379743 +0300
@@ -0,0 +1,463 @@
+/* ANSI-C code produced by gperf version 3.1 */
+/* Command-line: gperf --output-file=ftinf_sh.c ftinf_sh.gperf */
@@ -2326,11 +2346,9 @@ index 000000000..87d2ff8bd
+/*
+ gperf --output-file=ftinf_sh.c ftinf_sh.gperf
+*/
-diff --git a/src/base/ftinf_sh.gperf b/src/base/ftinf_sh.gperf
-new file mode 100644
-index 000000000..5f6e0ae62
---- /dev/null
-+++ b/src/base/ftinf_sh.gperf
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftinf_sh.gperf a/src/base/ftinf_sh.gperf
+--- b/src/base/ftinf_sh.gperf 1970-01-01 03:00:00.000000000 +0300
++++ a/src/base/ftinf_sh.gperf 2021-09-16 09:15:05.052379743 +0300
@@ -0,0 +1,264 @@
+%struct-type
+%define slot-name name
@@ -2596,13 +2614,12 @@ index 000000000..5f6e0ae62
+/*
+ gperf --output-file=ftinf_sh.c ftinf_sh.gperf
+*/
-diff --git a/src/base/ftinit.c b/src/base/ftinit.c
-index c73cd78b8..7f07928c0 100644
---- a/src/base/ftinit.c
-+++ b/src/base/ftinit.c
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftinit.c a/src/base/ftinit.c
+--- b/src/base/ftinit.c 2021-02-13 10:16:54.000000000 +0200
++++ a/src/base/ftinit.c 2021-09-16 09:15:05.052379743 +0300
@@ -43,6 +43,10 @@
- #include FT_INTERNAL_DEBUG_H
- #include FT_MODULE_H
+ #include <freetype/internal/ftdebug.h>
+ #include <freetype/ftmodapi.h>
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+#include "ftinf.h"
@@ -2611,7 +2628,7 @@ index c73cd78b8..7f07928c0 100644
/**************************************************************************
*
-@@ -220,10 +224,14 @@
+@@ -224,10 +228,14 @@
error = FT_New_Library( memory, alibrary );
if ( error )
FT_Done_Memory( memory );
@@ -2619,8 +2636,7 @@ index c73cd78b8..7f07928c0 100644
+ else {
FT_Add_Default_Modules( *alibrary );
-
-- FT_Set_Default_Properties( *alibrary );
-+ FT_Set_Default_Properties( *alibrary );
+ FT_Set_Default_Properties( *alibrary );
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+ /* get Infinality settings */
+ ftinf_env();
@@ -2629,23 +2645,27 @@ index c73cd78b8..7f07928c0 100644
return error;
}
-diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c
-index d9f4af429..e03fbc081 100644
---- a/src/base/ftlcdfil.c
-+++ b/src/base/ftlcdfil.c
-@@ -22,7 +22,10 @@
- #include FT_LCD_FILTER_H
- #include FT_IMAGE_H
- #include FT_INTERNAL_OBJECTS_H
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftlcdfil.c a/src/base/ftlcdfil.c
+--- b/src/base/ftlcdfil.c 2021-07-05 06:41:53.000000000 +0300
++++ a/src/base/ftlcdfil.c 2021-09-16 09:15:05.052379743 +0300
+@@ -17,11 +17,15 @@
+
+
+ #include <freetype/internal/ftdebug.h>
-
+ #include <freetype/ftlcdfil.h>
+ #include <freetype/ftimage.h>
+ #include <freetype/internal/ftobjs.h>
+
+#include <math.h>
+#include <string.h>
+#include <strings.h>
+#include "ftinf.h"
++
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-@@ -77,13 +80,13 @@
+@@ -76,13 +80,13 @@
/* FIR filter used by the default and light filters */
FT_BASE_DEF( void )
ft_lcd_filter_fir( FT_Bitmap* bitmap,
@@ -2660,7 +2680,7 @@ index d9f4af429..e03fbc081 100644
/* take care of bitmap flow */
-@@ -91,7 +94,7 @@
+@@ -90,7 +94,7 @@
origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place FIR filter */
@@ -2669,7 +2689,7 @@ index d9f4af429..e03fbc081 100644
{
FT_Byte* line = origin;
-@@ -134,7 +137,7 @@
+@@ -133,7 +137,7 @@
}
/* vertical in-place FIR filter */
@@ -2678,7 +2698,7 @@ index d9f4af429..e03fbc081 100644
{
FT_Byte* column = origin;
-@@ -183,13 +186,13 @@
+@@ -182,13 +186,13 @@
/* intra-pixel filter used by the legacy filter */
static void
_ft_lcd_filter_legacy( FT_Bitmap* bitmap,
@@ -2693,7 +2713,7 @@ index d9f4af429..e03fbc081 100644
static const unsigned int filters[3][3] =
{
-@@ -206,7 +209,7 @@
+@@ -205,7 +209,7 @@
origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place intra-pixel filter */
@@ -2702,7 +2722,7 @@ index d9f4af429..e03fbc081 100644
{
FT_Byte* line = origin;
-@@ -243,7 +246,7 @@
+@@ -242,7 +246,7 @@
}
}
}
@@ -2711,7 +2731,7 @@ index d9f4af429..e03fbc081 100644
{
FT_Byte* column = origin;
-@@ -299,6 +302,7 @@
+@@ -298,6 +302,7 @@
ft_memcpy( library->lcd_weights, weights, FT_LCD_FILTER_FIVE_TAPS );
library->lcd_filter_func = ft_lcd_filter_fir;
@@ -2719,7 +2739,7 @@ index d9f4af429..e03fbc081 100644
return FT_Err_Ok;
}
-@@ -310,11 +314,37 @@
+@@ -309,11 +314,37 @@
FT_Library_SetLcdFilter( FT_Library library,
FT_LcdFilter filter )
{
@@ -2759,7 +2779,7 @@ index d9f4af429..e03fbc081 100644
if ( !library )
return FT_THROW( Invalid_Library_Handle );
-@@ -323,6 +353,7 @@
+@@ -322,6 +353,7 @@
{
case FT_LCD_FILTER_NONE:
library->lcd_filter_func = NULL;
@@ -2767,7 +2787,7 @@ index d9f4af429..e03fbc081 100644
break;
case FT_LCD_FILTER_DEFAULT:
-@@ -330,6 +361,7 @@
+@@ -329,6 +361,7 @@
default_weights,
FT_LCD_FILTER_FIVE_TAPS );
library->lcd_filter_func = ft_lcd_filter_fir;
@@ -2775,7 +2795,7 @@ index d9f4af429..e03fbc081 100644
break;
case FT_LCD_FILTER_LIGHT:
-@@ -337,6 +369,7 @@
+@@ -336,6 +369,7 @@
light_weights,
FT_LCD_FILTER_FIVE_TAPS );
library->lcd_filter_func = ft_lcd_filter_fir;
@@ -2783,7 +2803,7 @@ index d9f4af429..e03fbc081 100644
break;
#ifdef USE_LEGACY
-@@ -344,6 +377,7 @@
+@@ -343,6 +377,7 @@
case FT_LCD_FILTER_LEGACY:
case FT_LCD_FILTER_LEGACY1:
library->lcd_filter_func = _ft_lcd_filter_legacy;
@@ -2791,11 +2811,10 @@ index d9f4af429..e03fbc081 100644
break;
#endif
-diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
-index e301f8f11..7654c9458 100644
---- a/src/base/ftobjs.c
-+++ b/src/base/ftobjs.c
-@@ -46,7 +46,9 @@
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftobjs.c a/src/base/ftobjs.c
+--- b/src/base/ftobjs.c 2021-07-15 13:09:04.000000000 +0300
++++ a/src/base/ftobjs.c 2021-09-16 09:15:05.053379751 +0300
+@@ -45,7 +45,9 @@
#ifdef FT_CONFIG_OPTION_MAC_FONTS
#include "ftbase.h"
#endif
@@ -2806,7 +2825,7 @@ index e301f8f11..7654c9458 100644
#ifdef FT_DEBUG_LEVEL_TRACE
-@@ -96,6 +98,11 @@
+@@ -99,6 +101,11 @@
#define GRID_FIT_METRICS
@@ -2818,7 +2837,7 @@ index e301f8f11..7654c9458 100644
/* forward declaration */
static FT_Error
-@@ -739,6 +746,25 @@
+@@ -777,6 +784,25 @@
ft_lookup_glyph_renderer( FT_GlyphSlot slot );
@@ -2844,7 +2863,7 @@ index e301f8f11..7654c9458 100644
#ifdef GRID_FIT_METRICS
static void
ft_glyphslot_grid_fit_metrics( FT_GlyphSlot slot,
-@@ -805,8 +831,18 @@
+@@ -843,8 +869,18 @@
FT_Bool autohint = FALSE;
FT_Module hinter;
TT_Face ttface = (TT_Face)face;
@@ -2863,7 +2882,7 @@ index e301f8f11..7654c9458 100644
if ( !face || !face->size || !face->glyph )
return FT_THROW( Invalid_Face_Handle );
-@@ -908,6 +944,18 @@
+@@ -946,6 +982,18 @@
{
FT_AutoHinter_Interface hinting;
@@ -2882,7 +2901,7 @@ index e301f8f11..7654c9458 100644
/* try to load embedded bitmaps first if available */
/* */
-@@ -953,6 +1001,18 @@
+@@ -991,6 +1039,18 @@
if ( error )
goto Exit;
@@ -2901,7 +2920,7 @@ index e301f8f11..7654c9458 100644
if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
{
/* check that the loaded outline is correct */
-@@ -5292,6 +5352,11 @@
+@@ -5353,6 +5413,11 @@
/* That's ok now */
*alibrary = library;
@@ -2913,31 +2932,25 @@ index e301f8f11..7654c9458 100644
return FT_Err_Ok;
}
-diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
-index 0e2ba3475..8c6888a39 100644
---- a/src/base/ftoutln.c
-+++ b/src/base/ftoutln.c
-@@ -22,7 +22,9 @@
- #include FT_INTERNAL_CALC_H
- #include FT_INTERNAL_DEBUG_H
- #include FT_TRIGONOMETRY_H
--
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftoutln.c a/src/base/ftoutln.c
+--- b/src/base/ftoutln.c 2021-02-13 10:16:54.000000000 +0200
++++ a/src/base/ftoutln.c 2021-09-16 09:15:05.053379751 +0300
+@@ -22,6 +22,9 @@
+ #include <freetype/internal/ftdebug.h>
+ #include <freetype/fttrigon.h>
+
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+#include "ftinf.h"
+#endif
/**************************************************************************
*
-@@ -906,10 +908,16 @@
- FT_Pos xstrength,
- FT_Pos ystrength )
+@@ -907,8 +910,14 @@
{
-- FT_Vector* points;
-- FT_Int c, first, last;
+ FT_Vector* points;
+ FT_Int c, first, last;
- FT_Orientation orientation;
-
-+ FT_Vector* points;
-+ FT_Int c, first, last;
+ FT_Int orientation;
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+ FT_Bool use_various_tweaks = FALSE;
@@ -2949,22 +2962,20 @@ index 0e2ba3475..8c6888a39 100644
if ( !outline )
return FT_THROW( Invalid_Outline );
-diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
-index f87ed65e7..620d57f07 100644
---- a/src/base/ftsynth.c
-+++ b/src/base/ftsynth.c
-@@ -22,7 +22,9 @@
- #include FT_INTERNAL_OBJECTS_H
- #include FT_OUTLINE_H
- #include FT_BITMAP_H
--
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/ftsynth.c a/src/base/ftsynth.c
+--- b/src/base/ftsynth.c 2021-02-13 10:16:54.000000000 +0200
++++ a/src/base/ftsynth.c 2021-09-16 09:15:05.053379751 +0300
+@@ -22,6 +22,9 @@
+ #include <freetype/ftoutln.h>
+ #include <freetype/ftbitmap.h>
+
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+#include "ftinf.h"
+#endif
/**************************************************************************
*
-@@ -93,7 +95,10 @@
+@@ -92,7 +95,10 @@
FT_Face face;
FT_Error error;
FT_Pos xstr, ystr;
@@ -2976,7 +2987,7 @@ index f87ed65e7..620d57f07 100644
if ( !slot )
return;
-@@ -111,8 +116,16 @@
+@@ -110,8 +116,16 @@
ystr = xstr;
if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
@@ -2994,7 +3005,7 @@ index f87ed65e7..620d57f07 100644
else /* slot->format == FT_GLYPH_FORMAT_BITMAP */
{
/* round to full pixels */
-@@ -150,6 +163,9 @@
+@@ -149,6 +163,9 @@
slot->metrics.width += xstr;
slot->metrics.height += ystr;
@@ -3004,11 +3015,10 @@ index f87ed65e7..620d57f07 100644
slot->metrics.horiAdvance += xstr;
slot->metrics.vertAdvance += ystr;
slot->metrics.horiBearingY += ystr;
-diff --git a/src/base/rules.mk b/src/base/rules.mk
-index 4b24c6dce..b8771b9ca 100644
---- a/src/base/rules.mk
-+++ b/src/base/rules.mk
-@@ -44,6 +44,7 @@ BASE_SRC := $(BASE_DIR)/ftadvanc.c \
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/base/rules.mk a/src/base/rules.mk
+--- b/src/base/rules.mk 2021-02-13 10:16:54.000000000 +0200
++++ a/src/base/rules.mk 2021-09-16 09:15:05.053379751 +0300
+@@ -44,6 +44,7 @@
$(BASE_DIR)/ftfntfmt.c \
$(BASE_DIR)/ftgloadr.c \
$(BASE_DIR)/fthash.c \
@@ -3016,13 +3026,12 @@ index 4b24c6dce..b8771b9ca 100644
$(BASE_DIR)/ftlcdfil.c \
$(BASE_DIR)/ftobjs.c \
$(BASE_DIR)/ftoutln.c \
-diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
-index f76245f30..4b573d695 100644
---- a/src/cff/cffobjs.c
-+++ b/src/cff/cffobjs.c
-@@ -43,6 +43,9 @@
- #include FT_INTERNAL_POSTSCRIPT_AUX_H
- #include FT_SERVICE_CFF_TABLE_LOAD_H
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/cff/cffobjs.c a/src/cff/cffobjs.c
+--- b/src/cff/cffobjs.c 2021-02-13 10:16:54.000000000 +0200
++++ a/src/cff/cffobjs.c 2021-09-16 09:15:05.053379751 +0300
+@@ -42,6 +42,9 @@
+ #include <freetype/internal/psaux.h>
+ #include <freetype/internal/services/svcfftl.h>
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+#include "../base/ftinf.h"
@@ -3030,8 +3039,8 @@ index f76245f30..4b573d695 100644
/**************************************************************************
*
-@@ -1170,6 +1173,9 @@
- #endif
+@@ -1177,6 +1180,9 @@
+ driver->hinting_engine = FT_HINTING_ADOBE;
driver->no_stem_darkening = TRUE;
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
@@ -3040,47 +3049,10 @@ index f76245f30..4b573d695 100644
driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1;
-diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
-index cd034d2b4..e82c15c25 100644
---- a/src/smooth/ftsmooth.c
-+++ b/src/smooth/ftsmooth.c
-@@ -1,19 +1,19 @@
--/****************************************************************************
-- *
-- * ftsmooth.c
-- *
-- * Anti-aliasing renderer interface (body).
-- *
-- * Copyright (C) 2000-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.
-- *
-- */
-+/***************************************************************************/
-+/* */
-+/* ftsmooth.c */
-+/* */
-+/* Anti-aliasing renderer interface (body). */
-+/* */
-+/* Copyright 2000-2017 by */
-+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-+/* */
-+/* This file is part of the FreeType project, and may only be used, */
-+/* modified, and distributed under the terms of the FreeType project */
-+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-+/* this file you indicate that you have read the license and */
-+/* understand and accept it fully. */
-+/* */
-+/***************************************************************************/
-
-
- #include <ft2build.h>
-@@ -25,88 +25,2293 @@
+diff -Nbur --exclude builds --exclude '*.orig' --exclude objs b/src/smooth/ftsmooth.c a/src/smooth/ftsmooth.c
+--- b/src/smooth/ftsmooth.c 2021-02-13 10:16:54.000000000 +0200
++++ a/src/smooth/ftsmooth.c 2021-09-16 09:19:36.749340217 +0300
+@@ -24,6 +24,28 @@
#include "ftsmerrs.h"
@@ -3096,78 +3068,41 @@ index cd034d2b4..e82c15c25 100644
+#define STVALUES if (verbose) \
+ printf ( "scale:%f translate:%ld ", *scale_value, *translate_value );
+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */
-
- /* initialize renderer -- init its raster */
- static FT_Error
- ft_smooth_init( FT_Renderer render )
- {
-+ render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
-+
-+ return 0;
-+ }
-+
-+
-+ /* sets render-specific mode */
-+ static FT_Error
-+ ft_smooth_set_mode( FT_Renderer render,
-+ FT_ULong mode_tag,
-+ FT_Pointer data )
-+ {
-+ /* we simply pass it to the raster */
-+ return render->clazz->raster_class->raster_set_mode( render->raster,
-+ mode_tag,
-+ data );
-+ }
+
-+ /* transform a given glyph image */
++ /* initialize renderer -- init its raster */
+ static FT_Error
-+ ft_smooth_transform( FT_Renderer render,
-+ FT_GlyphSlot slot,
-+ const FT_Matrix* matrix,
-+ const FT_Vector* delta )
++ ft_smooth_init( FT_Renderer render )
+ {
-+ FT_Error error = FT_Err_Ok;
-+
-+
-+ if ( slot->format != render->glyph_format )
-+ {
-+ error = FT_THROW( Invalid_Argument );
-+ goto Exit;
-+ }
-+
-+ if ( matrix )
-+ FT_Outline_Transform( &slot->outline, matrix );
-+
-+ if ( delta )
-+ FT_Outline_Translate( &slot->outline, delta->x, delta->y );
-+
-+ Exit:
-+ return error;
-+ }
-+
-+
-+ /* return the glyph's control box */
-+ static void
-+ ft_smooth_get_cbox( FT_Renderer render,
-+ FT_GlyphSlot slot,
-+ FT_BBox* cbox )
-+ {
-+ FT_ZERO( cbox );
++ render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
+
-+ if ( slot->format == render->glyph_format )
-+ FT_Outline_Get_CBox( &slot->outline, cbox );
++ return 0;
+ }
+
+
+ /* sets render-specific mode */
+ static FT_Error
+@@ -76,367 +98,2440 @@
+ FT_Outline_Get_CBox( &slot->outline, cbox );
+ }
+
+- typedef struct TOrigin_
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+ static FT_Fixed FT_FixedFromFloat(float f)
-+ {
+ {
+- unsigned char* origin; /* pixmap origin at the bottom-left */
+- int pitch; /* pitch to go down one row */
+ short value = f;
+ unsigned short fract = (f - value) * 0xFFFF;
-+
-+
+
+- } TOrigin;
+
+-#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+ return (FT_Fixed)((long)value << 16 | (unsigned long)fract );
+ }
-+
+
+- /* initialize renderer -- init its raster */
+- static FT_Error
+- ft_smooth_init( FT_Renderer render )
+
+ /* ChromeOS sharpening algorithm */
+ /* soften the sub-pixel anti-aliasing and sharpen */
@@ -3198,15 +3133,25 @@ index cd034d2b4..e82c15c25 100644
+
+ /* horizontal in-place sub-pixel sharpening filter */
+ if ( mode == FT_RENDER_MODE_LCD )
-+ {
+ {
+- FT_Vector* sub = render->root.library->lcd_geometry;
+ FT_Byte* line = bitmap->buffer;
-+
-+
+
+
+- /* set up default subpixel geometry for striped RGB panels. */
+- sub[0].x = -21;
+- sub[0].y = 0;
+- sub[1].x = 0;
+- sub[1].y = 0;
+- sub[2].x = 21;
+- sub[2].y = 0;
+ for ( ; height > 0; height--, line += bitmap->pitch )
+ {
+ FT_UInt xx;
-+
-+
+
+- render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
+
+- return 0;
+ for ( xx = 0; xx < width; xx++ )
+ line[xx] = gamma_ramp[line[xx]];
+ }
@@ -3291,12 +3236,17 @@ index cd034d2b4..e82c15c25 100644
+ }
+ }
+ return TRUE;
-+ }
-+
-+
+ }
+
+
+- /* This function writes every third byte in direct rendering mode */
+ /* Filter to mimic Windows-style sharpening */
+ /* Determined via 100% experimentation. */
-+ static void
+ static void
+- ft_smooth_lcd_spans( int y,
+- int count,
+- const FT_Span* spans,
+- TOrigin* target )
+ _ft_lcd_windows_sharpen( FT_Bitmap* bitmap,
+ FT_Render_Mode mode,
+ FT_UInt strength,
@@ -3326,7 +3276,10 @@ index cd034d2b4..e82c15c25 100644
+ FT_Byte* new_nextline = new_line + bitmap->pitch;
+
+ for ( xx = 1; xx < width - 1; xx += 1 )
-+ {
+ {
+- unsigned char* dst_line = target->origin - y * target->pitch;
+- unsigned char* dst;
+- unsigned short w;
+ /* subpixel grid sp11 sp21 sp31 */
+ /* where sp22 is sp12 sp22 sp32 */
+ /* current subpixel. sp13 sp23 sp33 */
@@ -3338,7 +3291,7 @@ index cd034d2b4..e82c15c25 100644
+ sp12 = line [xx-1];
+ sp22 = line [xx];
+ sp32 = line [xx+1];
-+
+
+ if ( height == bitmap->rows )
+ {
+ prevtotal = sp11 = sp21 = sp31 = 0;
@@ -3356,7 +3309,10 @@ index cd034d2b4..e82c15c25 100644
+ lefttotal = sp11 + sp12 + sp13;
+ righttotal = sp31 + sp32 + sp33;
+ }
-+
+
+- for ( ; count--; spans++ )
+- for ( dst = dst_line + spans->x * 3, w = spans->len; w--; dst += 3 )
+- *dst = spans->coverage;
+ if ( height == 1 )
+ {
+ nexttotal = sp13 = sp23 = sp33 = 0;
@@ -3373,10 +3329,14 @@ index cd034d2b4..e82c15c25 100644
+ nextdiff = sp23 - sp22;
+ lefttotal = sp11 + sp12 + sp13;
+ righttotal = sp31 + sp32 + sp33;
-+ }
-+
+ }
+
+ sidesdiff = lefttotal - righttotal;
-+
+
+- static FT_Error
+- ft_smooth_raster_lcd( FT_Renderer render,
+- FT_Outline* outline,
+- FT_Bitmap* bitmap )
+ if ( sidesdiff < 0 )
+ sidesdiff *= -1;
+
@@ -3388,7 +3348,10 @@ index cd034d2b4..e82c15c25 100644
+
+ /* if the current pixel is less than threshold, and greater than 0 */
+ if ( sp22 <= threshold && sp22 > 0 )
-+ {
+ {
+- FT_Error error = FT_Err_Ok;
+- FT_Vector* sub = render->root.library->lcd_geometry;
+- FT_Pos x, y;
+ /* A pixel is horizontally isolated if: */
+ /* 1: All upper adjecent pixels are >= threshold */
+ if ( prevtotal >= nexttotal &&
@@ -3404,13 +3367,43 @@ index cd034d2b4..e82c15c25 100644
+ if ( height != (FT_UInt)bitmap->rows )
+ new_prevline[xx] += ( ( 255 - new_prevline[xx] )
+ * strength ) / 100 ;
-+
+
+- FT_Raster_Params params;
+- TOrigin target;
+ new_line[xx] -= ( new_line[xx] * strength ) / 100;
-+
+
+ if ( height != 1 && height != (FT_UInt)bitmap->rows )
+ if ( new_nextline[xx] > 155 + ( 100 - strength ) )
+ new_prevline[xx] = 255;
-+
+
+- /* Render 3 separate coverage bitmaps, shifting the outline. */
+- /* Set up direct rendering to record them on each third byte. */
+- params.source = outline;
+- params.flags = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT;
+- params.gray_spans = (FT_SpanFunc)ft_smooth_lcd_spans;
+- params.user = &target;
+-
+- params.clip_box.xMin = 0;
+- params.clip_box.yMin = 0;
+- params.clip_box.xMax = bitmap->width;
+- params.clip_box.yMax = bitmap->rows;
+-
+- if ( bitmap->pitch < 0 )
+- target.origin = bitmap->buffer;
+- else
+- target.origin = bitmap->buffer
+- + ( bitmap->rows - 1 ) * (unsigned int)bitmap->pitch;
+-
+- target.pitch = bitmap->pitch;
+-
+- FT_Outline_Translate( outline,
+- -sub[0].x,
+- -sub[0].y );
+- error = render->raster_render( render->raster, &params );
+- x = sub[0].x;
+- y = sub[0].y;
+- if ( error )
+- goto Exit;
+ }
+ else if ( nexttotal > prevtotal &&
+ abs( sp13 - sp12 ) > 5 &&
@@ -3425,13 +3418,31 @@ index cd034d2b4..e82c15c25 100644
+ /* darken lower adjacent subpixel; lighten current */
+ if ( height != 1 )
+ new_nextline[xx] += ( 255 - new_nextline[xx] ) * strength / 100;
-+
+
+- target.origin++;
+- FT_Outline_Translate( outline,
+- sub[0].x - sub[1].x,
+- sub[0].y - sub[1].y );
+- error = render->raster_render( render->raster, &params );
+- x = sub[1].x;
+- y = sub[1].y;
+- if ( error )
+- goto Exit;
+ new_line[xx] -= ( new_line[xx] * strength ) / 100;
-+
+
+- target.origin++;
+- FT_Outline_Translate( outline,
+- sub[1].x - sub[2].x,
+- sub[1].y - sub[2].y );
+- error = render->raster_render( render->raster, &params );
+- x = sub[2].x;
+- y = sub[2].y;
+ if ( height != 1 )
+ if ( new_nextline[xx] > 155 + ( 100 - strength ) )
+ new_nextline[xx] = 255;
-+
+
+- Exit:
+- FT_Outline_Translate( outline, x, y );
+ }
+ }
+ else if ( sp22 > threshold && sp22 < 255 )
@@ -3447,10 +3458,11 @@ index cd034d2b4..e82c15c25 100644
+ {
+ /* bring this subpixel 1/3 of the way to 255 at 100% strength */
+ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100;
-+
+
+- return error;
+ if ( height != (FT_UInt)bitmap->rows )
+ new_prevline[xx] -= ( new_prevline[xx] * strength ) / 300;
-+ }
+ }
+ else if ( sp13 <= threshold &&
+ abs( sp11 - sp12 ) > 5 &&
+ abs( sp21 - sp22 ) > 5 &&
@@ -3461,7 +3473,7 @@ index cd034d2b4..e82c15c25 100644
+ abs( sp23 - sp22 ) > 15 )
+ {
+ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100;
-+
+
+ if ( height != 1 )
+ new_nextline[xx] -= ( new_nextline[xx] * strength ) / 300;
+ }
@@ -3471,15 +3483,24 @@ index cd034d2b4..e82c15c25 100644
+ FT_Bitmap_Copy( library, &new_bitmap, bitmap);
+ FT_Bitmap_Done( library, &new_bitmap );
+ }
-+
+
+- static FT_Error
+- ft_smooth_raster_lcdv( FT_Renderer render,
+- FT_Outline* outline,
+- FT_Bitmap* bitmap )
+
+ static void
+ _ft_lcd_darken_x ( FT_Bitmap* bitmap,
+ FT_Render_Mode mode,
+ FT_UInt strength,
+ FT_Library library )
-+ {
-+
+ {
+- FT_Error error = FT_Err_Ok;
+- int pitch = bitmap->pitch;
+- FT_Vector* sub = render->root.library->lcd_geometry;
+- FT_Pos x, y;
+
+- FT_Raster_Params params;
+ FT_UInt width = (FT_UInt)bitmap->width;
+ FT_UInt height = (FT_UInt)bitmap->rows;
+ FT_Byte* new_line;
@@ -3487,12 +3508,29 @@ index cd034d2b4..e82c15c25 100644
+ FT_Bitmap new_bitmap;
+ int factor1, factor2;
+ int bias = 0;
-+
+
+ FT_Bitmap_Init( &new_bitmap );
-+
+
+- params.target = bitmap;
+- params.source = outline;
+- params.flags = FT_RASTER_FLAG_AA;
+ FT_Bitmap_Copy( library, bitmap, &new_bitmap );
+ new_line = (&new_bitmap)->buffer;
-+
+
+- /* Render 3 separate coverage bitmaps, shifting the outline. */
+- /* Notice that the subpixel geometry vectors are rotated. */
+- /* Triple the pitch to render on each third row. */
+- bitmap->pitch *= 3;
+- bitmap->rows /= 3;
+-
+- FT_Outline_Translate( outline,
+- -sub[0].y,
+- sub[0].x );
+- error = render->raster_render( render->raster, &params );
+- x = sub[0].y;
+- y = -sub[0].x;
+- if ( error )
+- goto Exit;
+ if ( strength > 0 )
+ for ( height = (FT_UInt)bitmap->rows;
+ height > 0;
@@ -3501,19 +3539,41 @@ index cd034d2b4..e82c15c25 100644
+ FT_UInt xx;
+ FT_Byte* prevline = line - bitmap->pitch;
+ FT_Byte* nextline = line + bitmap->pitch;
-+
+
+- bitmap->buffer += pitch;
+- FT_Outline_Translate( outline,
+- sub[0].y - sub[1].y,
+- sub[1].x - sub[0].x );
+- error = render->raster_render( render->raster, &params );
+- x = sub[1].y;
+- y = -sub[1].x;
+- bitmap->buffer -= pitch;
+- if ( error )
+- goto Exit;
+ for ( xx = 1; xx < width - 1; xx += 1 )
+ {
+ /* subpixel grid sp11 sp21 sp31 */
+ /* where sp22 is sp12 sp22 sp32 */
+ /* current subpixel. sp13 sp23 sp33 */
-+
+
+- bitmap->buffer += 2 * pitch;
+- FT_Outline_Translate( outline,
+- sub[1].y - sub[2].y,
+- sub[2].x - sub[1].x );
+- error = render->raster_render( render->raster, &params );
+- x = sub[2].y;
+- y = -sub[2].x;
+- bitmap->buffer -= 2 * pitch;
+ FT_Int sp21, sp12, sp22, sp32, sp23;
-+
+
+- Exit:
+- FT_Outline_Translate( outline, x, y );
+ sp12 = line [xx-1];
+ sp22 = line [xx];
+ sp32 = line [xx+1];
-+
+
+- bitmap->pitch /= 3;
+- bitmap->rows *= 3;
+ if ( height == bitmap->rows )
+ sp21 = 0;
+ else
@@ -3540,27 +3600,36 @@ index cd034d2b4..e82c15c25 100644
+ if ( new_line[xx] < ( strength * 255 ) / 100 )
+ new_line[xx] = (strength * 255 ) / 100
+ + bias * ( 255 - ( strength * 255 ) / 100 ) / 3;
-+
+
+- return error;
+ }
+ }
+ FT_Bitmap_Copy( library, &new_bitmap, bitmap );
+ FT_Bitmap_Done( library, &new_bitmap );
-+ }
-+
-+
+ }
+
+-#else /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
+- /* initialize renderer -- init its raster */
+- static FT_Error
+- ft_smooth_init( FT_Renderer render )
+ static void
+ _ft_lcd_darken_y ( FT_Bitmap* bitmap,
+ FT_Render_Mode mode,
+ FT_UInt strength,
+ FT_Library library )
-+ {
-+
+ {
+- /* set up default LCD filtering */
+- FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT );
+
+- render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
+ FT_UInt width = (FT_UInt)bitmap->width;
+ FT_UInt height = (FT_UInt)bitmap->rows;
+ FT_Byte* new_line;
+ FT_Byte* line = bitmap->buffer;
+ FT_Bitmap new_bitmap;
-+
+
+- return 0;
+
+ FT_Bitmap_Init( &new_bitmap );
+ FT_Bitmap_Copy( library, bitmap, &new_bitmap );
@@ -3587,35 +3656,55 @@ index cd034d2b4..e82c15c25 100644
+ }
+ FT_Bitmap_Copy( library, &new_bitmap, bitmap );
+ FT_Bitmap_Done( library, &new_bitmap );
-+ }
-+
-+
+ }
+
+
+- static FT_Error
+- ft_smooth_raster_lcd( FT_Renderer render,
+- FT_Outline* outline,
+- FT_Bitmap* bitmap )
+ static void
+ _ft_bitmap_cap ( FT_Bitmap* bitmap,
+ FT_UInt strength,
+ FT_Library library )
-+ {
-+
+ {
+- FT_Error error = FT_Err_Ok;
+- FT_Vector* points = outline->points;
+- FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
+- FT_Vector* vec;
+
+- FT_Raster_Params params;
+ FT_UInt width = (FT_UInt)bitmap->width;
+ FT_UInt height = (FT_UInt)bitmap->rows;
+ FT_Byte* new_line;
+ FT_Byte* line = bitmap->buffer;
+ FT_UInt cur_value = 0;
+ FT_Bitmap new_bitmap;
-+
-+
+
+
+- params.target = bitmap;
+- params.source = outline;
+- params.flags = FT_RASTER_FLAG_AA;
+ FT_Bitmap_Init( &new_bitmap );
+ FT_Bitmap_Copy( library, bitmap, &new_bitmap );
+ new_line = (&new_bitmap)->buffer;
-+
+
+- /* implode outline */
+- for ( vec = points; vec < points_end; vec++ )
+- vec->x *= 3;
+ if ( strength > 0 )
+ for ( height = (FT_UInt)bitmap->rows;
+ height > 0;
+ height--, line += bitmap->pitch, new_line += bitmap->pitch )
+ {
+ FT_UInt xx;
-+
-+
+
+- /* render outline into the bitmap */
+- error = render->raster_render( render->raster, &params );
+
+- /* deflate outline */
+- for ( vec = points; vec < points_end; vec++ )
+- vec->x /= 3;
+ for ( xx = 1; xx < width - 1; xx += 1 )
+ {
+ cur_value = ( new_line[xx-1] + new_line[xx] + new_line[xx+1] ) / 3;
@@ -3631,20 +3720,25 @@ index cd034d2b4..e82c15c25 100644
+ FT_Bitmap_Copy( library, &new_bitmap, bitmap );
+ FT_Bitmap_Done( library, &new_bitmap );
+ }
-+
+
+- return error;
+ static int
+ pseudo_gamma ( int val, float value )
+ {
+ return 256 * ( 1.0f - powf( ( 1.0f - val * (1.0f/256.0f) ), 1.0f / value ) );
-+ }
-+
+ }
+
+#if(0)
+ static void
+ _ft_bitmap_embolden ( FT_Bitmap* bitmap,
+ FT_UInt strength,
+ FT_Library library )
+ {
-+
+
+- static FT_Error
+- ft_smooth_raster_lcdv( FT_Renderer render,
+- FT_Outline* outline,
+- FT_Bitmap* bitmap )
+ FT_UInt width = (FT_UInt)bitmap->width;
+ FT_UInt height = (FT_UInt)bitmap->rows;
+ FT_Byte* new_line;
@@ -3661,32 +3755,49 @@ index cd034d2b4..e82c15c25 100644
+ for ( height = (FT_UInt)bitmap->rows;
+ height > 0;
+ height--, line += bitmap->pitch, new_line += bitmap->pitch )
-+ {
+ {
+- FT_Error error = FT_Err_Ok;
+- FT_Vector* points = outline->points;
+- FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
+- FT_Vector* vec;
+ for ( xx = 1; xx < width - 1; xx += 1 )
+ {
+ FT_Int new_value = 0;
-+
-+
+
+- FT_Raster_Params params;
+
+ new_value = ( strength * line [xx-1] ) / 100
+ + pseudo_gamma( line [xx], .75 )
+ + (strength * line [xx+1] ) / 100;
+ if ( new_value > 255 )
+ new_value = 255;
-+
+
+- params.target = bitmap;
+- params.source = outline;
+- params.flags = FT_RASTER_FLAG_AA;
+ new_line[xx] = new_value;
+ }
+ }
+ FT_Bitmap_Copy( library, &new_bitmap, bitmap );
+ FT_Bitmap_Done( library, &new_bitmap );
+ }
-+
-+
-+
+
+- /* implode outline */
+- for ( vec = points; vec < points_end; vec++ )
+- vec->y *= 3;
+
+- /* render outline into the bitmap */
+- error = render->raster_render( render->raster, &params );
+
+- /* deflate outline */
+- for ( vec = points; vec < points_end; vec++ )
+- vec->y /= 3;
+ static void
+ _ft_bitmap_gamma ( FT_Bitmap* bitmap,
+ float strength )
+ {
-+
+
+- return error;
+ FT_UInt width = (FT_UInt)bitmap->width;
+ FT_UInt height = (FT_UInt)bitmap->rows;
+ FT_Byte* line = bitmap->buffer;
@@ -3888,7 +3999,7 @@ index cd034d2b4..e82c15c25 100644
+ new_line[xx] += ( ( 255 - new_line[xx] ) * strength ) / 100;
+
+ }
-+ }
+ }
+ }
+ FT_Bitmap_Copy( library, &new_bitmap, bitmap );
+ FT_Bitmap_Done( library, &new_bitmap );
@@ -3913,8 +4024,11 @@ index cd034d2b4..e82c15c25 100644
+ height--, line += bitmap->pitch )
+ {
+ FT_UInt xx;
-+
-+
+
+-#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
+-/* Oversampling scale to be used in rendering overlaps */
+-#define SCALE ( 1 << 2 )
+ for ( xx = 0; xx < width - 1; xx += 3 )
+ {
+ FT_UInt total = line [xx] + line [xx + 1] + line [xx + 2];
@@ -3961,10 +4075,18 @@ index cd034d2b4..e82c15c25 100644
+ FT_Short zone; /* 1 2 or 3 */
+ FT_Bool generated;
+ } Stem;
-+
-+ static void
+
+- /* This function averages inflated spans in direct rendering mode */
+ static void
+- ft_smooth_overlap_spans( int y,
+- int count,
+- const FT_Span* spans,
+- TOrigin* target )
+ swap_stem ( Stem* s1, Stem* s2 )
-+ {
+ {
+- unsigned char* dst = target->origin - ( y / SCALE ) * target->pitch;
+- unsigned short x;
+- unsigned int cover, sum;
+ Stem s;
+ s.center = s1->center;
+ s.count = s1->count;
@@ -4672,14 +4794,22 @@ index cd034d2b4..e82c15c25 100644
+ }
+ }
+ }
-+
+
+ else if ( stem_matches > possible_stems[1].height &&
+ set_center_to != 0 )
+ {
-+
+
+- /* When accumulating the oversampled spans we need to assure that */
+- /* fully covered pixels are equal to 255 and do not overflow. */
+- /* It is important that the SCALE is a power of 2, each subpixel */
+- /* cover can also reach a power of 2 after rounding, and the total */
+- /* is clamped to 255 when it adds up to 256. */
+- for ( ; count--; spans++ )
+ /* make sure it doesn't match the first stem */
+ if ( abs ( set_center_to - possible_stems[0].center ) >= one_pixel * 2 )
-+ {
+ {
+- cover = ( spans->coverage + SCALE * SCALE / 2 ) / ( SCALE * SCALE );
+- for ( x = 0; x < spans->len; x++ )
+
+ /* if this is the second stem */
+ if ( valid_possible_stems == 1 )
@@ -4692,18 +4822,20 @@ index cd034d2b4..e82c15c25 100644
+ /* with the third. if it does, replace it */
+ if ( abs ( set_center_to - possible_stems[1].center )
+ >= one_pixel * 2 )
-+ {
+ {
+- sum = dst[( spans->x + x ) / SCALE] + cover;
+- dst[( spans->x + x ) / SCALE] = (unsigned char)( sum - ( sum >> 8 ) );
+ swap_stem ( &possible_stems[1], &possible_stems[2] );
+ valid_possible_stems +=1;
-+ }
-+ }
+ }
+ }
+ possible_stems[1].center = set_center_to;
+ possible_stems[1].count = stem_matches;
+ possible_stems[1].width = set_width_to;
+ possible_stems[1].height = stem_matches;
+ }
-+ }
-+
+ }
+
+ else if ( stem_matches > possible_stems[2].height &&
+ set_center_to != 0 )
+ {
@@ -4713,7 +4845,11 @@ index cd034d2b4..e82c15c25 100644
+ {
+ if ( valid_possible_stems == 2 )
+ valid_possible_stems += 1;
-+
+
+- static FT_Error
+- ft_smooth_raster_overlap( FT_Renderer render,
+- FT_Outline* outline,
+- FT_Bitmap* bitmap )
+ possible_stems[2].center = set_center_to;
+ possible_stems[2].count = stem_matches;
+ possible_stems[2].width = set_width_to;
@@ -4729,7 +4865,11 @@ index cd034d2b4..e82c15c25 100644
+
+ /* promote to stem */
+ if ( valid_possible_stems > 0 )
-+ {
+ {
+- FT_Error error = FT_Err_Ok;
+- FT_Vector* points = outline->points;
+- FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
+- FT_Vector* vec;
+ stems[0].center = possible_stems[0].center;
+ stems[0].count = possible_stems[0].count;
+ stems[0].width = possible_stems[0].width;
@@ -4737,7 +4877,9 @@ index cd034d2b4..e82c15c25 100644
+ stems[0].generated = FALSE;
+ valid_stems++;
+ }
-+
+
+- FT_Raster_Params params;
+- TOrigin target;
+ if ( valid_stems == 1 &&
+ valid_possible_stems > 1 )
+ {
@@ -4748,7 +4890,7 @@ index cd034d2b4..e82c15c25 100644
+ stems[1].generated = FALSE;
+ valid_stems++;
+ }
-+
+
+ if ( valid_stems == 2 &&
+ valid_possible_stems > 2 &&
+ possible_stems[2].center != 0 )
@@ -4760,13 +4902,22 @@ index cd034d2b4..e82c15c25 100644
+ stems[2].generated = FALSE;
+ valid_stems++;
+ }
-+
+
+- /* Reject outlines that are too wide for 16-bit FT_Span. */
+- /* Other limits are applied upstream with the same error code. */
+- if ( bitmap->width * SCALE > 0x7FFF )
+- return FT_THROW( Raster_Overflow );
+ /* sort stems in x direction */
+ if ( valid_stems == 3 )
+ {
+ if ( stems[0].center > stems[1].center )
+ swap_stem ( &stems[0], &stems[1] );
-+
+
+- /* Set up direct rendering to average oversampled spans. */
+- params.source = outline;
+- params.flags = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT;
+- params.gray_spans = (FT_SpanFunc)ft_smooth_overlap_spans;
+- params.user = &target;
+ if ( stems[0].center > stems[2].center )
+ swap_stem ( &stems[1], &stems[2] );
+
@@ -4881,16 +5032,24 @@ index cd034d2b4..e82c15c25 100644
+ / (float)(stem_distance) - stems[main_stem].center)
+
+#define proposed_translated_point(point) point + *translate_value * 12
-+
+
+- params.clip_box.xMin = 0;
+- params.clip_box.yMin = 0;
+- params.clip_box.xMax = bitmap->width * SCALE;
+- params.clip_box.yMax = bitmap->rows * SCALE;
+ center_offset = one_pixel / 2; /* half pixel */
+ modulus = one_pixel; /* whole pixel */
-+
+
+- if ( bitmap->pitch < 0 )
+- target.origin = bitmap->buffer;
+ /* Determine center_offset via known values */
+ if ( known_stem_values->stem_width >= 0 )
+ {
+ if ( known_stem_values->stem_width % 2 == 0 )
+ center_offset = 0;
-+ else
+ else
+- target.origin = bitmap->buffer
+- + ( bitmap->rows - 1 ) * (unsigned int)bitmap->pitch;
+ center_offset = one_pixel / 2;
+ }
+ /* otherwise do intelligent guessing, if set */
@@ -4928,7 +5087,8 @@ index cd034d2b4..e82c15c25 100644
+ /* snap right */
+ *translate_value = ( modulus - delta ) / ( columns_per_pixel * 4 );
+ }
-+
+
+- target.pitch = bitmap->pitch;
+ if ( strategy_use_d_correction )
+ {
+ /* if the only stem is in the last 1/3 of glyph width, the advance */
@@ -4943,9 +5103,12 @@ index cd034d2b4..e82c15c25 100644
+ *translate_value = ( modulus - delta ) / ( columns_per_pixel * 4 );
+ }
--#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+- /* inflate outline */
+- for ( vec = points; vec < points_end; vec++ )
+ if ( strategy_use_strengths )
-+ {
+ {
+- vec->x *= SCALE;
+- vec->y *= SCALE;
+ /* consider 1/2 pixel the max when strength is at 100%,
+ unless translate is already greater than that */
+ FT_Int strength_cutoff = 32;
@@ -4958,15 +5121,18 @@ index cd034d2b4..e82c15c25 100644
+ *translate_value = -max_strength;
+ else if ( *translate_value > max_strength )
+ *translate_value = max_strength;
-+ }
+ }
-- FT_Vector* sub = render->root.library->lcd_geometry;
+- /* render outline into the bitmap */
+- error = render->raster_render( render->raster, &params );
+ /* If 2 stems is detected, scale distance
+ between in order to land on pixels */
+ if ( valid_stems >= 2 )
+ {
+ stem_distance = abs ( stems[1].center - stems[0].center );
-+
+
+- /* deflate outline */
+- for ( vec = points; vec < points_end; vec++ )
+ delta = stem_distance % modulus;
+ new_distance = stem_distance - delta;
+
@@ -5032,13 +5198,16 @@ index cd034d2b4..e82c15c25 100644
+ }
+
+ if ( known_stem_values->m >= 0 )
-+ {
+ {
+- vec->x /= SCALE;
+- vec->y /= SCALE;
+ if ( known_stem_values->m == 0 )
+ new_distance = distance_floor;
+ else
+ new_distance = distance_ceiling;
-+ }
-+
+ }
+
+- return error;
+ if ( ( rightmost_point - leftmost_point) -
+ ( ( rightmost_point * *scale_value)
+ - ( leftmost_point * *scale_value ) ) >= one_pixel * 1.5 )
@@ -5047,7 +5216,7 @@ index cd034d2b4..e82c15c25 100644
+ *translate_value = 0;
+ goto Exit;
+ }
-
++
+ }
+ else if ( columns_per_pixel == 1 &&
+ valid_stems == 3 &&
@@ -5117,14 +5286,7 @@ index cd034d2b4..e82c15c25 100644
+ *translate_value = 0;
+ goto Exit;
+ }
-
-- /* set up default subpixel geometry for striped RGB panels. */
-- sub[0].x = -21;
-- sub[0].y = 0;
-- sub[1].x = 0;
-- sub[1].y = 0;
-- sub[2].x = 21;
-- sub[2].y = 0;
++
+ }
+ else
+ {
@@ -5224,65 +5386,37 @@ index cd034d2b4..e82c15c25 100644
+ new_distance = distance_ceiling;
+ }
+ }
-
--#elif 0 /* or else, once ClearType patents expire */
++
+ if ( strategy_use_strengths )
+ {
+ FT_Int strength_cutoff = center_offset;
-
-- FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT );
-
--#endif
++
++
+ delta2 = new_distance - stem_distance;
-
-- render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
++
+ if ( abs ( delta2 ) > strength_cutoff )
+ strength_cutoff = delta2;
-
-- return 0;
-- }
++
+ max_strength = ( strength_cutoff * fitting_strength ) / 100;
-
++
+ if ( delta2 < -max_strength )
+ new_distance = stem_distance - max_strength;
+ else if ( delta2 > max_strength )
+ new_distance = stem_distance + max_strength;
+ }
-
-- /* sets render-specific mode */
-- static FT_Error
-- ft_smooth_set_mode( FT_Renderer render,
-- FT_ULong mode_tag,
-- FT_Pointer data )
-- {
-- /* we simply pass it to the raster */
-- return render->clazz->raster_class->raster_set_mode( render->raster,
-- mode_tag,
-- data );
-- }
++
+ *scale_value = (float)( new_distance ) / (float)( stem_distance );
+ *translate_value = *translate_value
+ - ( (float)( stems[main_stem].center * (float)new_distance )
+ / (float)stem_distance - stems[main_stem].center ) / 12;
-
-- /* transform a given glyph image */
-- static FT_Error
-- ft_smooth_transform( FT_Renderer render,
-- FT_GlyphSlot slot,
-- const FT_Matrix* matrix,
-- const FT_Vector* delta )
-- {
-- FT_Error error = FT_Err_Ok;
++
+ if ( valid_stems == 2 )
+ *embolden_value = ( 64.0 / *scale_value - 64.0 );
-
++
+ if ( valid_stems == 3 )
+ *embolden_value = ( 64.0 / *scale_value - 64.0 ) / 1.5;
+ }
-
-- if ( slot->format != render->glyph_format )
-- {
-- error = FT_THROW( Invalid_Argument );
++
+ if ( verbose )
+ printf ( "%lu stems:", valid_stems );
+
@@ -5329,19 +5463,13 @@ index cd034d2b4..e82c15c25 100644
+ printf ( "TRANSLATING -64 " );
+ }
+ }
- goto Exit;
- }
-
-- if ( matrix )
-- FT_Outline_Transform( &slot->outline, matrix );
++ goto Exit;
++ }
++
+ Exit:
-
-- if ( delta )
-- FT_Outline_Translate( &slot->outline, delta->x, delta->y );
++
+#define transformed_point( point ) point * *scale_value + *translate_value * 12
-
-- Exit:
-- return error;
++
+ if ( strategy_correct_out_of_bounds_outlines )
+ {
+ /* Correct if outside bitmap */
@@ -5365,29 +5493,23 @@ index cd034d2b4..e82c15c25 100644
+ free ( leftmost_segment );
}
+-#undef SCALE
-- /* return the glyph's control box */
+ /* Gamma correction */
- static void
-- ft_smooth_get_cbox( FT_Renderer render,
-- FT_GlyphSlot slot,
-- FT_BBox* cbox )
++ static void
+ _ft_lcd_gamma_correction_correction ( FT_Bitmap* bitmap,
+ FT_Render_Mode mode,
+ FT_GlyphSlot slot,
+ float gamma_correction_lt,
+ float gamma_correction_value )
- {
-- FT_ZERO( cbox );
++ {
+ if ( gamma_correction_value != 1.0 )
+ {
+ FT_UInt width = (FT_UInt)bitmap->width;
+ FT_UInt height = (FT_UInt)bitmap->rows;
+ FT_Byte* line = bitmap->buffer;
+ float ppem = (float)slot->face->size->metrics.x_ppem;
-
-- if ( slot->format == render->glyph_format )
-- FT_Outline_Get_CBox( &slot->outline, cbox );
++
+
+ if ( !slot->face || !slot->face->size ) return;
+
@@ -5418,15 +5540,19 @@ index cd034d2b4..e82c15c25 100644
+ }
+ }
+ }
- }
-
++ }
++
+#endif
-
- /* convert a slot's glyph image into a bitmap */
++
++ /* convert a slot's glyph image into a bitmap */
static FT_Error
-@@ -116,17 +2321,218 @@
- const FT_Vector* origin,
- FT_Render_Mode required_mode )
+- ft_smooth_render( FT_Renderer render,
++ ft_smooth_render_generic( FT_Renderer render,
+ FT_GlyphSlot slot,
+ FT_Render_Mode mode,
+- const FT_Vector* origin )
++ const FT_Vector* origin,
++ FT_Render_Mode required_mode )
{
- FT_Error error = FT_Err_Ok;
- FT_Outline* outline = &slot->outline;
@@ -5440,16 +5566,14 @@ index cd034d2b4..e82c15c25 100644
+#endif
FT_Bitmap* bitmap = &slot->bitmap;
FT_Memory memory = render->root.memory;
-- FT_Pos x_shift = 0;
-- FT_Pos y_shift = 0;
- FT_Int hmul = ( mode == FT_RENDER_MODE_LCD );
- FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V );
-+ FT_Pos x_shift = 0;
-+ FT_Pos y_shift = 0;
++ FT_Int hmul = ( mode == FT_RENDER_MODE_LCD );
++ FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V );
+ FT_Pos x_shift = 0;
+ FT_Pos y_shift = 0;
+ FT_Pos x_left, y_top;
-
- FT_Raster_Params params;
-
++
++ FT_Raster_Params params;
++
+ FT_Bool have_translated_origin = FALSE;
+ FT_Bool have_outline_shifted = FALSE;
+ FT_Bool have_buffer = FALSE;
@@ -5543,7 +5667,7 @@ index cd034d2b4..e82c15c25 100644
+ ( ( windows_style_sharpening_strength
+ * windows_style_sharpening_strength ) / 100
+ + windows_style_sharpening_strength ) / 2;
-+
+
+ gamma_correction_lt = f[0];
+ gamma_correction_value = f[1] / 100.0f;
+
@@ -5647,7 +5771,17 @@ index cd034d2b4..e82c15c25 100644
/* check glyph image format */
if ( slot->format != render->glyph_format )
-@@ -142,6 +2548,128 @@
+@@ -446,15 +2541,134 @@
+ }
+
+ /* check mode */
+- if ( mode != FT_RENDER_MODE_NORMAL &&
+- mode != FT_RENDER_MODE_LIGHT &&
+- mode != FT_RENDER_MODE_LCD &&
+- mode != FT_RENDER_MODE_LCD_V )
++ if ( mode != required_mode )
+ {
+ error = FT_THROW( Cannot_Render_Glyph );
goto Exit;
}
@@ -5776,7 +5910,7 @@ index cd034d2b4..e82c15c25 100644
/* release old bitmap buffer */
if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
{
-@@ -149,34 +2677,85 @@
+@@ -462,109 +2676,427 @@
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
}
@@ -5791,24 +5925,20 @@ index cd034d2b4..e82c15c25 100644
+ pitch = FT_PAD_CEIL( width, 4 );
}
-- /* allocate new one */
-- if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) )
+- if ( !bitmap->rows || !bitmap->pitch )
- goto Exit;
+ if ( vmul )
+ height *= 3;
-- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
+- /* allocate new one */
+- if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) )
+- goto Exit;
+ x_shift = cbox.xMin;
+ y_shift = cbox.yMin;
+ x_left = cbox.xMin >> 6;
+ y_top = cbox.yMax >> 6;
-- x_shift = 64 * -slot->bitmap_left;
-- y_shift = 64 * -slot->bitmap_top;
-- if ( bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V )
-- y_shift += 64 * (FT_Int)bitmap->rows / 3;
-- else
-- y_shift += 64 * (FT_Int)bitmap->rows;
+- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
+#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+ if ( lcd_filter_func )
+ {
@@ -5820,7 +5950,12 @@ index cd034d2b4..e82c15c25 100644
+ pitch = FT_PAD_CEIL( width, 4 );
+ }
-- if ( origin )
+- x_shift = 64 * -slot->bitmap_left;
+- y_shift = 64 * -slot->bitmap_top;
+- if ( bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V )
+- y_shift += 64 * (FT_Int)bitmap->rows / 3;
+- else
+- y_shift += 64 * (FT_Int)bitmap->rows;
+ if ( vmul )
+ {
+ y_shift -= 64 * ( lcd_extra >> 1 );
@@ -5832,7 +5967,8 @@ index cd034d2b4..e82c15c25 100644
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+ }
+#endif
-+
+
+- if ( origin )
+
+ /* Required check is (pitch * height < FT_ULONG_MAX), */
+ /* but we care realistic cases only. Always pitch <= width. */
@@ -5846,18 +5982,24 @@ index cd034d2b4..e82c15c25 100644
+ goto Exit;
}
+- /* translate outline to render it into the bitmap */
+- if ( x_shift || y_shift )
+- FT_Outline_Translate( outline, x_shift, y_shift );
+ bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
+ bitmap->num_grays = 256;
+ bitmap->width = (unsigned int)width;
+ bitmap->rows = (unsigned int)height;
+ bitmap->pitch = pitch;
-+
- /* translate outline to render it into the bitmap */
-- if ( x_shift || y_shift )
-- FT_Outline_Translate( outline, x_shift, y_shift );
+
+- if ( mode == FT_RENDER_MODE_NORMAL ||
+- mode == FT_RENDER_MODE_LIGHT )
++ /* translate outline to render it into the bitmap */
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+ if ( align_called == 0 )
-+ {
+ {
+- if ( outline->flags & FT_OUTLINE_OVERLAP )
+- error = ft_smooth_raster_overlap( render, outline, bitmap );
+- else
+#endif
+ FT_Outline_Translate( outline, -x_shift, -y_shift );
+ have_outline_shifted = TRUE;
@@ -5866,35 +6008,79 @@ index cd034d2b4..e82c15c25 100644
+#endif
+ /* release old bitmap buffer */
+ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
-+ {
+ {
+- FT_Raster_Params params;
+ FT_FREE( bitmap->buffer );
+ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
+ }
-+
+
+ if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) )
+ goto Exit;
+ else
+ have_buffer = TRUE;
-+
+
+ slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
++
++ /* set up parameters */
+ params.target = bitmap;
+ params.source = outline;
+ params.flags = FT_RASTER_FLAG_AA;
- /* set up parameters */
- params.target = bitmap;
-@@ -223,159 +2802,240 @@
- if ( error )
- goto Exit;
+- error = render->raster_render( render->raster, &params );
+- }
+- }
+- else
++#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
++
++ /* implode outline if needed */
+ {
+- if ( mode == FT_RENDER_MODE_LCD )
+- error = ft_smooth_raster_lcd ( render, outline, bitmap );
+- else if ( mode == FT_RENDER_MODE_LCD_V )
+- error = ft_smooth_raster_lcdv( render, outline, bitmap );
++ FT_Vector* points = outline->points;
++ FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
++ FT_Vector* vec;
+
+-#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+
+- /* finally apply filtering */
++ if ( hmul )
++ for ( vec = points; vec < points_end; vec++ )
++ vec->x *= 3;
++
++ if ( vmul )
++ for ( vec = points; vec < points_end; vec++ )
++ vec->y *= 3;
++ }
++
++ /* render outline into the bitmap */
++ error = render->raster_render( render->raster, &params );
++
++ /* deflate outline if needed */
+ {
+- FT_Byte* lcd_weights;
+- FT_Bitmap_LcdFilterFunc lcd_filter_func;
++ FT_Vector* points = outline->points;
++ FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
++ FT_Vector* vec;
++
++
++ if ( hmul )
++ for ( vec = points; vec < points_end; vec++ )
++ vec->x /= 3;
++
++ if ( vmul )
++ for ( vec = points; vec < points_end; vec++ )
++ vec->y /= 3;
++ }
++
++ if ( error )
++ goto Exit;
-- /* finally apply filtering */
-- if ( hmul || vmul )
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+ if ( ppem <= MAX_PPEM && ppem >= MIN_PPEM )
- {
-- FT_Byte* lcd_weights;
-- FT_Bitmap_LcdFilterFunc lcd_filter_func;
--
--
-- /* Per-face LCD filtering takes priority if set up. */
-- if ( slot->face && slot->face->internal->lcd_filter_func )
++ {
+ if ( align_called == 0 && cur_width / ppem < 10 &&
+ ( alignment_strength > 0 || fitting_strength > 0 ) )
+ _lcd_stem_align ( bitmap,
@@ -5905,26 +6091,24 @@ index cd034d2b4..e82c15c25 100644
+ alignment_strength,
+ fitting_strength,
+ &embolden_value );
-+
+
+- /* Per-face LCD filtering takes priority if set up. */
+- if ( slot->face && slot->face->internal->lcd_filter_func )
+ if ( align_called == 0 &&
+ ( translate_value != 0 || scale_value != 1.0 ) )
- {
-- lcd_weights = slot->face->internal->lcd_weights;
-- lcd_filter_func = slot->face->internal->lcd_filter_func;
+ {
+- lcd_weights = slot->face->internal->lcd_weights;
+- lcd_filter_func = slot->face->internal->lcd_filter_func;
+ align_called = 1;
+ goto RERENDER;
- }
-- else
+ }
+- else
+
+ if ( mode == FT_RENDER_MODE_LCD )
- {
-- lcd_weights = slot->library->lcd_weights;
-- lcd_filter_func = slot->library->lcd_filter_func;
-- }
-
-- if ( lcd_filter_func )
-- lcd_filter_func( bitmap, lcd_weights );
-- }
+ {
+- lcd_weights = slot->library->lcd_weights;
+- lcd_filter_func = slot->library->lcd_filter_func;
++
+ if ( fringe_filter_strength > 0 /*&& autohinted*/ )
+ _ft_lcd_fringe_filter( bitmap,
+ mode,
@@ -6016,42 +6200,32 @@ index cd034d2b4..e82c15c25 100644
+ _ft_bitmap_cap ( bitmap,
+ ( cur_width * 150 ) / 64,
+ slot->library );
-+ }
+ }
+ }
+ }
++
--#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-
-- if ( hmul ) /* lcd */
-- {
-- FT_Byte* line;
-- FT_Byte* temp = NULL;
-- FT_UInt i, j;
-+ if ( lcd_filter_func )
+ if ( lcd_filter_func )
+- lcd_filter_func( bitmap, lcd_weights );
+ lcd_filter_func( bitmap, mode, lcd_weights );
-
-- unsigned int height = bitmap->rows;
-- unsigned int width = bitmap->width;
-- int pitch = bitmap->pitch;
++
+ if ( grayscale_filter_strength > 0 )
+ _ft_lcd_grayscale_filter( bitmap,
+ mode,
+ grayscale_filter_strength,
+ slot->library );
++
+ }
-- FT_Vector* sub = slot->library->lcd_geometry;
-+ }
-
+-#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+ /* Global values */
+ if ( brightness_value != 0 || contrast_value != 0 )
+ _ft_bitmap_bc ( bitmap,
+ (float)brightness_value / 300.0,
+ (float)contrast_value / 300.0);
-- /* Render 3 separate monochrome bitmaps, shifting the outline. */
-- width /= 3;
+ FT_Outline_Done( slot->library, outline_orig );
-+ }
+ }
+ else if ( mode == FT_RENDER_MODE_LCD &&
+ lcd_filter_func )
+ lcd_filter_func( bitmap, mode, lcd_weights );
@@ -6060,63 +6234,32 @@ index cd034d2b4..e82c15c25 100644
+ lcd_filter_func( bitmap, mode, lcd_weights );
+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */
-- FT_Outline_Translate( outline,
-- -sub[0].x,
-- -sub[0].y );
-- error = render->raster_render( render->raster, &params );
-- if ( error )
-- goto Exit;
+- Exit:
+- if ( !error )
+#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-
-- bitmap->buffer += width;
-- FT_Outline_Translate( outline,
-- sub[0].x - sub[1].x,
-- sub[0].y - sub[1].y );
-- error = render->raster_render( render->raster, &params );
-- bitmap->buffer -= width;
-- if ( error )
-- goto Exit;
++
+ /* render outline into bitmap */
+ error = render->raster_render( render->raster, &params );
+ if ( error )
+ goto Exit;
-
-- bitmap->buffer += 2 * width;
-- FT_Outline_Translate( outline,
-- sub[1].x - sub[2].x,
-- sub[1].y - sub[2].y );
-- error = render->raster_render( render->raster, &params );
-- bitmap->buffer -= 2 * width;
-- if ( error )
-- goto Exit;
++
+ /* expand it horizontally */
+ if ( hmul )
-+ {
+ {
+- /* everything is fine; the glyph is now officially a bitmap */
+- slot->format = FT_GLYPH_FORMAT_BITMAP;
+ FT_Byte* line = bitmap->buffer;
+ FT_UInt hh;
-
-- x_shift -= sub[2].x;
-- y_shift -= sub[2].y;
-
-- /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */
-- /* XXX: It is more efficient to render every third byte above. */
++
++
+ for ( hh = height_org; hh > 0; hh--, line += pitch )
+ {
+ FT_UInt xx;
+ FT_Byte* end = line + width;
-
-- if ( FT_ALLOC( temp, (FT_ULong)pitch ) )
-- goto Exit;
-
-- for ( i = 0; i < height; i++ )
-- {
-- line = bitmap->buffer + i * (FT_ULong)pitch;
-- for ( j = 0; j < width; j++ )
++
++
+ for ( xx = width_org; xx > 0; xx-- )
- {
-- temp[3 * j ] = line[j];
-- temp[3 * j + 1] = line[j + width];
-- temp[3 * j + 2] = line[j + width + width];
++ {
+ FT_UInt pixel = line[xx-1];
+
+
@@ -6124,67 +6267,35 @@ index cd034d2b4..e82c15c25 100644
+ end[-2] = (FT_Byte)pixel;
+ end[-1] = (FT_Byte)pixel;
+ end -= 3;
- }
-- FT_MEM_COPY( line, temp, pitch );
- }
--
-- FT_FREE( temp );
- }
-- else if ( vmul ) /* lcd_v */
++ }
++ }
++ }
+
+ /* expand it vertically */
+ if ( vmul )
- {
-- int pitch = bitmap->pitch;
++ {
+ FT_Byte* read = bitmap->buffer + ( height - height_org ) * pitch;
+ FT_Byte* write = bitmap->buffer;
+ FT_UInt hh;
-
-- FT_Vector* sub = slot->library->lcd_geometry;
-
++
++
+ for ( hh = height_org; hh > 0; hh-- )
+ {
+ ft_memcpy( write, read, pitch );
+ write += pitch;
-
-- /* Render 3 separate monochrome bitmaps, shifting the outline. */
-- /* Notice that the subpixel geometry vectors are rotated. */
-- /* Triple the pitch to render on each third row. */
-- bitmap->pitch *= 3;
-- bitmap->rows /= 3;
++
+ ft_memcpy( write, read, pitch );
+ write += pitch;
-
-- FT_Outline_Translate( outline,
-- -sub[0].y,
-- sub[0].x );
-- error = render->raster_render( render->raster, &params );
-- if ( error )
-- goto Exit;
++
+ ft_memcpy( write, read, pitch );
+ write += pitch;
+ read += pitch;
+ }
-+ }
-
-- bitmap->buffer += pitch;
-- FT_Outline_Translate( outline,
-- sub[0].y - sub[1].y,
-- sub[1].x - sub[0].x );
-- error = render->raster_render( render->raster, &params );
-- bitmap->buffer -= pitch;
-- if ( error )
-- goto Exit;
+ }
+- else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
++
+#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-
-- bitmap->buffer += 2 * pitch;
-- FT_Outline_Translate( outline,
-- sub[1].y - sub[2].y,
-- sub[2].x - sub[1].x );
-- error = render->raster_render( render->raster, &params );
-- bitmap->buffer -= 2 * pitch;
-- if ( error )
-- goto Exit;
++
+ /*
+ * XXX: on 16bit system, we return an error for huge bitmap
+ * to prevent an overflow.
@@ -6194,31 +6305,17 @@ index cd034d2b4..e82c15c25 100644
+ error = FT_THROW( Invalid_Pixel_Size );
+ goto Exit;
+ }
-
-- x_shift -= sub[2].y;
-- y_shift += sub[2].x;
++
+ slot->format = FT_GLYPH_FORMAT_BITMAP;
+ slot->bitmap_left = (FT_Int)x_left;
+ slot->bitmap_top = (FT_Int)y_top;
-
-- bitmap->pitch /= 3;
-- bitmap->rows *= 3;
-- }
-- else /* grayscale */
-- error = render->raster_render( render->raster, &params );
++
+ /* everything is fine; don't deallocate buffer */
+ have_buffer = FALSE;
-
--#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
++
+ error = FT_Err_Ok;
-
- Exit:
-- if ( !error )
-- {
-- /* everything is fine; the glyph is now officially a bitmap */
-- slot->format = FT_GLYPH_FORMAT_BITMAP;
-- }
-- else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
++
++ Exit:
+ if ( have_outline_shifted )
+ FT_Outline_Translate( outline, x_shift, y_shift );
+ if ( have_translated_origin )
@@ -6231,33 +6328,36 @@ index cd034d2b4..e82c15c25 100644
- if ( x_shift || y_shift )
- FT_Outline_Translate( outline, -x_shift, -y_shift );
--
- return error;
- }
-
-@@ -402,8 +3062,14 @@
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
-- return ft_smooth_render_generic( render, slot, mode, origin,
-- FT_RENDER_MODE_LCD );
++ return error;
++ }
++
++
++
++ /* convert a slot's glyph image into a horizontal LCD bitmap */
++ static FT_Error
++ ft_smooth_render_lcd( FT_Renderer render,
++ FT_GlyphSlot slot,
++ FT_Render_Mode mode,
++ const FT_Vector* origin )
++ {
+ FT_Error error;
+
+ error = ft_smooth_render_generic( render, slot, mode, origin,
+ FT_RENDER_MODE_LCD );
+ if ( !error )
+ slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD;
-+
-+ return error;
+
+ return error;
}
-@@ -414,8 +3080,14 @@
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
-- return ft_smooth_render_generic( render, slot, mode, origin,
-- FT_RENDER_MODE_LCD_V );
++ /* convert a slot's glyph image into a vertical LCD bitmap */
++ static FT_Error
++ ft_smooth_render_lcd_v( FT_Renderer render,
++ FT_GlyphSlot slot,
++ FT_Render_Mode mode,
++ const FT_Vector* origin )
++ {
+ FT_Error error;
+
+ error = ft_smooth_render_generic( render, slot, mode, origin,
@@ -6266,45 +6366,30 @@ index cd034d2b4..e82c15c25 100644
+ slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD_V;
+
+ return error;
- }
-
-
-@@ -442,7 +3114,7 @@
- (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */
- (FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */
-
-- (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */
-+ (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */
- )
-
-
-@@ -469,7 +3141,7 @@
- (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */
- (FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */
-
-- (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */
-+ (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */
- )
-
-
-@@ -496,7 +3168,7 @@
- (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */
- (FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */
-
-- (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */
-+ (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */
- )
-
-
-diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
-index 70434e172..1d84e6618 100644
---- a/src/truetype/ttinterp.c
-+++ b/src/truetype/ttinterp.c
-@@ -5901,6 +5901,7 @@
++ }
++
++
++
++ /* convert a slot's glyph image into a bitmap */
++ static FT_Error
++ ft_smooth_render( FT_Renderer render,
++ FT_GlyphSlot slot,
++ FT_Render_Mode mode,
++ const FT_Vector* origin )
++ {
++ switch (mode) {
++ case FT_RENDER_MODE_LIGHT:
++ case FT_RENDER_MODE_NORMAL:
++ return ft_smooth_render_generic( render, slot, mode, origin,
++ FT_RENDER_MODE_NORMAL );
++ case FT_RENDER_MODE_LCD:
++ return ft_smooth_render_lcd( render, slot, mode, origin);
++ case FT_RENDER_MODE_LCD_V:
++ return ft_smooth_render_lcd_v( render, slot, mode, origin);
++ }
++ }
++
++
+ FT_DEFINE_RENDERER(
+ ft_smooth_renderer_class,
- if ( exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
-+ exc->GS.freeVector.y == 0 &&
- !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
- control_value_cutin = 0;
- }
diff --git a/0006-infinality-remix-tweaks.patch b/0006-infinality-remix-tweaks.patch
deleted file mode 100644
index 063b2efd2ac8..000000000000
--- a/0006-infinality-remix-tweaks.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-diff --git a/src/base/ftinf_sh.c b/src/base/ftinf_sh.c
-index 87d2ff8bd..5a350f8f2 100644
---- a/src/base/ftinf_sh.c
-+++ b/src/base/ftinf_sh.c
-@@ -250,7 +250,8 @@ _settings_get (register const char *str, register unsigned int len)
- .stem_alignment_strength=15,
- .stem_fitting_strength=15,
- .use_various_tweaks=true,
-- .windows_style_sharpening_strength=25
-+ .windows_style_sharpening_strength=25,
-+ .stem_darkening_cff=true
- },
- #line 197 "ftinf_sh.gperf"
- { .name="windows7",
-@@ -300,7 +301,8 @@ _settings_get (register const char *str, register unsigned int len)
- .stem_alignment_strength=15,
- .stem_fitting_strength=15,
- .use_various_tweaks=true,
-- .windows_style_sharpening_strength=25
-+ .windows_style_sharpening_strength=25,
-+ .stem_darkening_cff=true
- },
- #line 87 "ftinf_sh.gperf"
- { .name="push",
-@@ -324,7 +326,8 @@ _settings_get (register const char *str, register unsigned int len)
- .stem_alignment_strength=15,
- .stem_fitting_strength=15,
- .use_various_tweaks=true,
-- .windows_style_sharpening_strength=25
-+ .windows_style_sharpening_strength=25,
-+ .stem_darkening_cff=true
- },
- #line 162 "ftinf_sh.gperf"
- { .name="ultimate4",
-@@ -334,7 +337,8 @@ _settings_get (register const char *str, register unsigned int len)
- .stem_alignment_strength=15,
- .stem_fitting_strength=15,
- .use_various_tweaks=true,
-- .windows_style_sharpening_strength=25
-+ .windows_style_sharpening_strength=25,
-+ .stem_darkening_cff=true
- },
- #line 153 "ftinf_sh.gperf"
- { .name="ultimate3",
-@@ -344,7 +348,8 @@ _settings_get (register const char *str, register unsigned int len)
- .stem_alignment_strength=15,
- .stem_fitting_strength=15,
- .use_various_tweaks=true,
-- .windows_style_sharpening_strength=25
-+ .windows_style_sharpening_strength=25,
-+ .stem_darkening_cff=true
- }
- };
-
-diff --git a/src/base/ftinf_sh.gperf b/src/base/ftinf_sh.gperf
-index 5f6e0ae62..f694fb374 100644
---- a/src/base/ftinf_sh.gperf
-+++ b/src/base/ftinf_sh.gperf
-@@ -139,7 +139,8 @@ struct ftinf_s;
- .stem_alignment_strength=15,
- .stem_fitting_strength=15,
- .use_various_tweaks=true,
-- .windows_style_sharpening_strength=25
-+ .windows_style_sharpening_strength=25,
-+ .stem_darkening_cff=true
- },
- { .name="ultimate2",
- .filter_params={on, 6, 22, 36, 22, 6},
-@@ -148,7 +149,8 @@ struct ftinf_s;
- .stem_alignment_strength=15,
- .stem_fitting_strength=15,
- .use_various_tweaks=true,
-- .windows_style_sharpening_strength=25
-+ .windows_style_sharpening_strength=25,
-+ .stem_darkening_cff=true
- },
- { .name="ultimate3",
- .filter_params={on, 8, 24, 36, 24, 8},
-@@ -157,7 +159,8 @@ struct ftinf_s;
- .stem_alignment_strength=15,
- .stem_fitting_strength=15,
- .use_various_tweaks=true,
-- .windows_style_sharpening_strength=25
-+ .windows_style_sharpening_strength=25,
-+ .stem_darkening_cff=true
- },
- { .name="ultimate4",
- .filter_params={on, 10, 25, 37, 25, 10},
-@@ -166,7 +169,8 @@ struct ftinf_s;
- .stem_alignment_strength=15,
- .stem_fitting_strength=15,
- .use_various_tweaks=true,
-- .windows_style_sharpening_strength=25
-+ .windows_style_sharpening_strength=25,
-+ .stem_darkening_cff=true
- },
- { .name="ultimate5",
- .filter_params={on, 12, 28, 42, 28, 12},
-@@ -175,7 +179,8 @@ struct ftinf_s;
- .stem_alignment_strength=15,
- .stem_fitting_strength=15,
- .use_various_tweaks=true,
-- .windows_style_sharpening_strength=25
-+ .windows_style_sharpening_strength=25,
-+ .stem_darkening_cff=true
- },
- { .name="vanilla",
- .filter_params={on, 6, 25, 38, 25, 6},
-diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
-index d8fd36c81..ef10506d0 100644
---- a/src/base/ftobjs.c
-+++ b/src/base/ftobjs.c
-@@ -938,6 +938,13 @@
- ttface->cvt_program_size == 0 ) )
- autohint = TRUE;
- }
-+
-+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
-+ if ( use_various_tweaks )
-+ {
-+ autohint = TRUE;
-+ }
-+#endif
- }
-
- if ( autohint )
-diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
-index e82c15c25..99df34a3c 100644
---- a/src/smooth/ftsmooth.c
-+++ b/src/smooth/ftsmooth.c
-@@ -42,6 +42,8 @@
- static FT_Error
- ft_smooth_init( FT_Renderer render )
- {
-+ FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT );
-+
- render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
-
- return 0;
diff --git a/PKGBUILD b/PKGBUILD
index 07736ba53ebd..2a7b43065677 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,10 +1,10 @@
-# Maintainer: Philip Deljanov <philip dot deljanov at gmail dot com>
+# Maintainer: Liviu Solcovenco <solcovenco dot liviu at gmail dot com>
+# Contributor: Philip Deljanov <philip dot deljanov at gmail dot com>
# Contributor: bohoomil <bohoomil at zoho dot com>
pkgname=freetype2-infinality-remix
-pkgver=2.10.1
-pkgrel=2
-_patchrel=2019.08.21
+pkgver=2.11.1
+pkgrel=1
pkgdesc="TrueType font rendering library with Infinality Remix patches"
arch=(i686 x86_64)
license=('GPL')
@@ -18,19 +18,17 @@ install=freetype2.install
source=(https://download-mirror.savannah.gnu.org/releases/freetype/freetype-${pkgver}.tar.xz{,.sig}
0001-Enable-table-validation-modules.patch
- 0002-infinality-${pkgver}-${_patchrel}.patch
+ 0002-infinality-2.11.1-2021.12.10.patch
0004-Enable-long-PCF-family-names.patch
- 0006-infinality-remix-tweaks.patch
freetype2.sh
infinality-settings.sh
xft-settings.sh)
-sha256sums=('16dbfa488a21fe827dc27eaf708f42f7aa3bb997d745d31a19781628c36ba26f'
+sha256sums=('3333ae7cfda88429c97a7ae63b7d01ab398076c3b67182e960e5684050f2c5c8'
'SKIP'
'ac11a24b62a6c044cc245ea9fa2a0cbd9e2e62f2371873dd33084c28a76e7176'
- 'afdc909def9d7e839f227a83a4e3b58d4060a28861739f9e1ab5540e60929cc8'
+ '6d563b1f9f9ef52379818ff3ede26b44e0b4cb6e3cf46ea44ca5d36b6d29ae9d'
'54800d4da18611cf9232aad8b63d74a83153a51bb56dd39191678c738ffc8b53'
- '94493ed2865fd32e5ef8ef3493fcb2ccaaf8be4c9e0eaa7b417fcbc47fe4314d'
'f7f8e09c44f7552c883846e9a6a1efc50377c4932234e74adc4a8ff750606467'
'1a5c12aa96e2ee66f7316b8ccb7012520b231a2d8ee21cfe4064aa28db35a57c'
'4842d1461c240cd0f60a7247ee038271fdb1067107bea9024be6bdbb218d1bd4')
@@ -39,13 +37,11 @@ validpgpkeys=('58E0C111E39F5408C5D3EC76C1A60EACE707FDA5')
prepare() {
mv freetype-${pkgver} freetype2
-
# Patching FreeType
cd freetype2
patch -Np1 -i ../0001-Enable-table-validation-modules.patch
- patch -Np1 --verbose -i ../0002-infinality-${pkgver}-${_patchrel}.patch
+ patch -Np1 -i ../0002-infinality-2.11.1-2021.12.10.patch
patch -Np1 -i ../0004-Enable-long-PCF-family-names.patch
- patch -Np1 --verbose -i ../0006-infinality-remix-tweaks.patch
}
build() {
@@ -73,4 +69,4 @@ package() {
install -Dm755 ../xft-settings.sh "${pkgdir}/etc/X11/xinit/xinitrc.d/xft-settings.sh"
# Configures global default Infinality settings.
install -Dm755 ../infinality-settings.sh "${pkgdir}/etc/X11/xinit/xinitrc.d/infinality-settings.sh"
-} \ No newline at end of file
+}