Skip to content
Permalink
Browse files
[GTK] Bump freetype version to 2.8.0
https://bugs.webkit.org/show_bug.cgi?id=176351

Source/WebCore:

Patch by Dominik Röttsches <dominik.rottsches@intel.com> on 2017-09-06
Reviewed by Carlos Alberto Lopez Perez.

Retrieving line spacing info without metrics hinting - FreeType's metric hinting
uses rounding which results in the sum of ascent and descent being larger
than the line height. To work around this without globally disabling font metrics
hinting, I am temporarily creating a new cairo scaled font with metrics hinting
off and retrieving the height values from this one.

* platform/graphics/freetype/SimpleFontDataFreeType.cpp:
(WebCore::scaledFontWithoutMetricsHinting): New function to clone the existing font, only with metrics hinting
disabled.
(WebCore::Font::platformInit): Get height info from non-metrics hinted font, disable rounding for linespacing.

Tools:

Reviewed by Carlos Alberto Lopez Perez.

Remove the patch we were using since it was reverted upstream.

* gtk/jhbuild.modules:
* gtk/patches/freetype6-2.4.11-truetype-font-height-fix.patch: Removed.

Canonical link: https://commits.webkit.org/193031@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Dominik Röttsches authored and carlosgcampos committed Sep 6, 2017
1 parent d5fb007 commit 8b7f5f8a84a1959c1a967a28263e580749b24045
Showing 5 changed files with 52 additions and 48 deletions.
@@ -1,3 +1,21 @@
2017-09-06 Dominik Röttsches <dominik.rottsches@intel.com>

[GTK] Bump freetype version to 2.8.0
https://bugs.webkit.org/show_bug.cgi?id=176351

Reviewed by Carlos Alberto Lopez Perez.

Retrieving line spacing info without metrics hinting - FreeType's metric hinting
uses rounding which results in the sum of ascent and descent being larger
than the line height. To work around this without globally disabling font metrics
hinting, I am temporarily creating a new cairo scaled font with metrics hinting
off and retrieving the height values from this one.

* platform/graphics/freetype/SimpleFontDataFreeType.cpp:
(WebCore::scaledFontWithoutMetricsHinting): New function to clone the existing font, only with metrics hinting
disabled.
(WebCore::Font::platformInit): Get height info from non-metrics hinted font, disable rounding for linespacing.

2017-09-06 Frédéric Wang <fwang@igalia.com>

Introduce ScrollingTreeScrollingNodeDelegateIOS to share code between overflow and frame scrolling
@@ -33,13 +33,15 @@
#include "config.h"
#include "Font.h"

#include "CairoUniquePtr.h"
#include "CairoUtilities.h"
#include "FloatConversion.h"
#include "FloatRect.h"
#include "FontCache.h"
#include "FontDescription.h"
#include "GlyphBuffer.h"
#include "OpenTypeTypes.h"
#include "RefPtrCairo.h"
#include "UTF16UChar32Iterator.h"
#include <cairo-ft.h>
#include <cairo.h>
@@ -52,14 +54,30 @@

namespace WebCore {

static RefPtr<cairo_scaled_font_t> scaledFontWithoutMetricsHinting(cairo_scaled_font_t* scaledFont)
{
CairoUniquePtr<cairo_font_options_t> fontOptions(cairo_font_options_create());
cairo_scaled_font_get_font_options(scaledFont, fontOptions.get());
cairo_font_options_set_hint_metrics(fontOptions.get(), CAIRO_HINT_METRICS_OFF);
cairo_matrix_t fontMatrix;
cairo_scaled_font_get_font_matrix(scaledFont, &fontMatrix);
cairo_matrix_t fontCTM;
cairo_scaled_font_get_ctm(scaledFont, &fontCTM);
return adoptRef(cairo_scaled_font_create(cairo_scaled_font_get_font_face(scaledFont), &fontMatrix, &fontCTM, fontOptions.get()));
}

void Font::platformInit()
{
if (!m_platformData.size())
return;

ASSERT(m_platformData.scaledFont());
// Temporarily create a clone that doesn't have metrics hinting in order to avoid incorrect
// rounding resulting in incorrect baseline positioning since the sum of ascent and descent
// becomes larger than the line height.
auto fontWithoutMetricsHinting = scaledFontWithoutMetricsHinting(m_platformData.scaledFont());
cairo_font_extents_t fontExtents;
cairo_scaled_font_extents(m_platformData.scaledFont(), &fontExtents);
cairo_scaled_font_extents(fontWithoutMetricsHinting.get(), &fontExtents);

float ascent = narrowPrecisionToFloat(fontExtents.ascent);
float descent = narrowPrecisionToFloat(fontExtents.descent);
@@ -88,9 +106,7 @@ void Font::platformInit()
m_fontMetrics.setAscent(ascent);
m_fontMetrics.setDescent(descent);
m_fontMetrics.setCapHeight(capHeight);

// Match CoreGraphics metrics.
m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
m_fontMetrics.setLineSpacing(ascent + descent + lineGap);
m_fontMetrics.setLineGap(lineGap);

cairo_text_extents_t textExtents;
@@ -1,3 +1,15 @@
2017-09-06 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] Bump freetype version to 2.8.0
https://bugs.webkit.org/show_bug.cgi?id=176351

Reviewed by Carlos Alberto Lopez Perez.

Remove the patch we were using since it was reverted upstream.

* gtk/jhbuild.modules:
* gtk/patches/freetype6-2.4.11-truetype-font-height-fix.patch: Removed.

2017-09-06 Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com>

[Win] Tools/TestWebKitAPI/Tests/WTF/PriorityQueue.cpp fails to compile with MSVC 2015
@@ -119,12 +119,9 @@
</autotools>

<autotools id="freetype6" autogen-sh="configure">
<branch module="freetype/freetype-2.4.11.tar.bz2" version="2.4.11"
<branch module="freetype/freetype-2.8.tar.bz2" version="2.8"
repo="savannah.gnu.org"
hash="sha256:ef9d0bcb64647d9e5125dc7534d7ca371c98310fec87677c410f397f71ffbe3f"
md5sum="b93435488942486c8d0ca22e8f768034">
<patch file="freetype6-2.4.11-truetype-font-height-fix.patch" strip="1"/>
</branch>
hash="sha256:a3c603ed84c3c2495f9c9331fe6bba3bb0ee65e06ec331e0a0fb52158291b40b"/>
</autotools>

<autotools id="harfbuzz" autogen-sh="configure">

This file was deleted.

0 comments on commit 8b7f5f8

Please sign in to comment.