From 8d9deda0abc81ebc983f9417588d2df5ee29fe0a Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Mon, 3 Apr 2017 17:11:22 +0200 Subject: [PATCH] Allow linear scaling for unhinted rendering Resolves: #1437999 --- freetype-2.7.1-linear-scaling.patch | 71 +++++++++++++++++++++++++++++ freetype.spec | 11 ++++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 freetype-2.7.1-linear-scaling.patch diff --git a/freetype-2.7.1-linear-scaling.patch b/freetype-2.7.1-linear-scaling.patch new file mode 100644 index 0000000..b04c0a1 --- /dev/null +++ b/freetype-2.7.1-linear-scaling.patch @@ -0,0 +1,71 @@ +From bcc74f4dafee25ea89f1d3144646cba7e30f9908 Mon Sep 17 00:00:00 2001 +From: Werner Lemberg +Date: Thu, 30 Mar 2017 13:14:43 +0200 +Subject: [truetype] Allow linear scaling for unhinted rendering (#50470). + +* src/truetype/ttdriver.c (tt_size_request): Revert change from +2011-07-16; the intended metrics fix seems now to be implemented in +a different way, making the patch unnecessary. Note that this +change was usually patched out by all major GNU/Linux distributions +due to heavy side effects. + +* src/truetype/ttgload.c (compute_glyph_metrics, TT_Load_Glyph): +Refer to the metrics of the `TT_Size' object. + +diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c +index 4ec78e2f..9bf0f84f 100644 +--- a/src/truetype/ttdriver.c ++++ b/src/truetype/ttdriver.c +@@ -355,7 +355,6 @@ + if ( FT_IS_SCALABLE( size->face ) ) + { + error = tt_size_reset( ttsize ); +- ttsize->root.metrics = ttsize->metrics; + + #ifdef TT_USE_BYTECODE_INTERPRETER + /* for the `MPS' bytecode instruction we need the point size */ +diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c +index 35b62d0e..b225190a 100644 +--- a/src/truetype/ttgload.c ++++ b/src/truetype/ttgload.c +@@ -2035,7 +2035,7 @@ + + y_scale = 0x10000L; + if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) +- y_scale = size->root.metrics.y_scale; ++ y_scale = size->metrics.y_scale; + + if ( glyph->format != FT_GLYPH_FORMAT_COMPOSITE ) + FT_Outline_Get_CBox( &glyph->outline, &bbox ); +@@ -2067,7 +2067,7 @@ + + + widthp = tt_face_get_device_metrics( face, +- size->root.metrics.x_ppem, ++ size->metrics.x_ppem, + glyph_index ); + + #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY +@@ -2634,11 +2634,11 @@ + if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance ) + glyph->metrics.horiAdvance = + FT_MulFix( glyph->linearHoriAdvance, +- size->root.metrics.x_scale ); ++ size->metrics.x_scale ); + if ( !glyph->metrics.vertAdvance && glyph->linearVertAdvance ) + glyph->metrics.vertAdvance = + FT_MulFix( glyph->linearVertAdvance, +- size->root.metrics.y_scale ); ++ size->metrics.y_scale ); + } + + return FT_Err_Ok; +@@ -2728,7 +2728,7 @@ + /* TrueType glyphs at all sizes using the bytecode interpreter. */ + /* */ + if ( !( load_flags & FT_LOAD_NO_SCALE ) && +- size->root.metrics.y_ppem < 24 ) ++ size->metrics.y_ppem < 24 ) + glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; + + return error; diff --git a/freetype.spec b/freetype.spec index c21ff4a..dc1e595 100644 --- a/freetype.spec +++ b/freetype.spec @@ -7,7 +7,7 @@ Summary: A free and portable font rendering engine Name: freetype Version: 2.7.1 -Release: 2%{?dist} +Release: 3%{?dist} License: (FTL or GPLv2+) and BSD and MIT and Public Domain and zlib with acknowledgement Group: System Environment/Libraries URL: http://www.freetype.org @@ -31,6 +31,9 @@ Patch92: freetype-2.5.3-freetype-config-prefix.patch Patch93: freetype-2.6.5-libtool.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1437999 +Patch94: freetype-2.7.1-linear-scaling.patch + BuildRequires: libX11-devel BuildRequires: libpng-devel BuildRequires: zlib-devel @@ -94,6 +97,8 @@ popd %patch93 -p1 -b .libtool +%patch94 -p1 -b .linear-scaling + %build %configure --disable-static \ @@ -208,6 +213,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.{a,la} %{_mandir}/man1/* %changelog +* Mon Apr 3 2017 Marek Kasik - 2.7.1-3 +- Allow linear scaling for unhinted rendering +- Resolves: #1437999 + * Fri Feb 10 2017 Fedora Release Engineering - 2.7.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild