Changeset 221670 in webkit
- Timestamp:
- Sep 6, 2017 8:10:56 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r221669 r221670 1 2017-09-06 Dominik Röttsches <dominik.rottsches@intel.com> 2 3 [GTK] Bump freetype version to 2.8.0 4 https://bugs.webkit.org/show_bug.cgi?id=176351 5 6 Reviewed by Carlos Alberto Lopez Perez. 7 8 Retrieving line spacing info without metrics hinting - FreeType's metric hinting 9 uses rounding which results in the sum of ascent and descent being larger 10 than the line height. To work around this without globally disabling font metrics 11 hinting, I am temporarily creating a new cairo scaled font with metrics hinting 12 off and retrieving the height values from this one. 13 14 * platform/graphics/freetype/SimpleFontDataFreeType.cpp: 15 (WebCore::scaledFontWithoutMetricsHinting): New function to clone the existing font, only with metrics hinting 16 disabled. 17 (WebCore::Font::platformInit): Get height info from non-metrics hinted font, disable rounding for linespacing. 18 1 19 2017-09-06 Frédéric Wang <fwang@igalia.com> 2 20 -
trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
r216896 r221670 34 34 #include "Font.h" 35 35 36 #include "CairoUniquePtr.h" 36 37 #include "CairoUtilities.h" 37 38 #include "FloatConversion.h" … … 41 42 #include "GlyphBuffer.h" 42 43 #include "OpenTypeTypes.h" 44 #include "RefPtrCairo.h" 43 45 #include "UTF16UChar32Iterator.h" 44 46 #include <cairo-ft.h> … … 53 55 namespace WebCore { 54 56 57 static RefPtr<cairo_scaled_font_t> scaledFontWithoutMetricsHinting(cairo_scaled_font_t* scaledFont) 58 { 59 CairoUniquePtr<cairo_font_options_t> fontOptions(cairo_font_options_create()); 60 cairo_scaled_font_get_font_options(scaledFont, fontOptions.get()); 61 cairo_font_options_set_hint_metrics(fontOptions.get(), CAIRO_HINT_METRICS_OFF); 62 cairo_matrix_t fontMatrix; 63 cairo_scaled_font_get_font_matrix(scaledFont, &fontMatrix); 64 cairo_matrix_t fontCTM; 65 cairo_scaled_font_get_ctm(scaledFont, &fontCTM); 66 return adoptRef(cairo_scaled_font_create(cairo_scaled_font_get_font_face(scaledFont), &fontMatrix, &fontCTM, fontOptions.get())); 67 } 68 55 69 void Font::platformInit() 56 70 { … … 59 73 60 74 ASSERT(m_platformData.scaledFont()); 75 // Temporarily create a clone that doesn't have metrics hinting in order to avoid incorrect 76 // rounding resulting in incorrect baseline positioning since the sum of ascent and descent 77 // becomes larger than the line height. 78 auto fontWithoutMetricsHinting = scaledFontWithoutMetricsHinting(m_platformData.scaledFont()); 61 79 cairo_font_extents_t fontExtents; 62 cairo_scaled_font_extents( m_platformData.scaledFont(), &fontExtents);80 cairo_scaled_font_extents(fontWithoutMetricsHinting.get(), &fontExtents); 63 81 64 82 float ascent = narrowPrecisionToFloat(fontExtents.ascent); … … 89 107 m_fontMetrics.setDescent(descent); 90 108 m_fontMetrics.setCapHeight(capHeight); 91 92 // Match CoreGraphics metrics. 93 m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap)); 109 m_fontMetrics.setLineSpacing(ascent + descent + lineGap); 94 110 m_fontMetrics.setLineGap(lineGap); 95 111 -
trunk/Tools/ChangeLog
r221666 r221670 1 2017-09-06 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Bump freetype version to 2.8.0 4 https://bugs.webkit.org/show_bug.cgi?id=176351 5 6 Reviewed by Carlos Alberto Lopez Perez. 7 8 Remove the patch we were using since it was reverted upstream. 9 10 * gtk/jhbuild.modules: 11 * gtk/patches/freetype6-2.4.11-truetype-font-height-fix.patch: Removed. 12 1 13 2017-09-06 Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com> 2 14 -
trunk/Tools/gtk/jhbuild.modules
r221371 r221670 120 120 121 121 <autotools id="freetype6" autogen-sh="configure"> 122 <branch module="freetype/freetype-2. 4.11.tar.bz2" version="2.4.11"122 <branch module="freetype/freetype-2.8.tar.bz2" version="2.8" 123 123 repo="savannah.gnu.org" 124 hash="sha256:ef9d0bcb64647d9e5125dc7534d7ca371c98310fec87677c410f397f71ffbe3f" 125 md5sum="b93435488942486c8d0ca22e8f768034"> 126 <patch file="freetype6-2.4.11-truetype-font-height-fix.patch" strip="1"/> 127 </branch> 124 hash="sha256:a3c603ed84c3c2495f9c9331fe6bba3bb0ee65e06ec331e0a0fb52158291b40b"/> 128 125 </autotools> 129 126
Note: See TracChangeset
for help on using the changeset viewer.