- Revision
- 221909
- Author
- carlo...@webkit.org
- Date
- 2017-09-12 04:21:36 -0700 (Tue, 12 Sep 2017)
Log Message
[Freetype] Doesn't support coloured fonts
https://bugs.webkit.org/show_bug.cgi?id=156579
Source/WebCore:
Patch by Fujii Hironori <hironori.fu...@sony.com> on 2017-09-12
Reviewed by Michael Catanzaro.
Covered by existing tests. This needs a large rebaseline that will be done in follow up commits.
* platform/graphics/FontCascade.h: Enable advance text rendering mode by default.
(WebCore::FontCascade::advancedTextRenderingMode const):
(WebCore::FontCascade::computeRequiresShaping const):
* platform/graphics/freetype/SimpleFontDataFreeType.cpp:
(WebCore::Font::platformInit): Do not get metrics from OS/2 table for non-scalable fonts.
* platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
(WebCore::harfBuzzGetGlyph): Use U8_APPEND_UNSAFE() instead of converting to a String and then encoding it with
UTF8Encoding().
Tools:
Reviewed by Michael Catanzaro.
Bump webkitgtk-test-fonts to 0.0.6 version that includes the EmijoOne font.
* gtk/jhbuild.modules:
* wpe/jhbuild.modules:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (221908 => 221909)
--- trunk/Source/WebCore/ChangeLog 2017-09-12 07:36:57 UTC (rev 221908)
+++ trunk/Source/WebCore/ChangeLog 2017-09-12 11:21:36 UTC (rev 221909)
@@ -1,3 +1,21 @@
+2017-09-12 Fujii Hironori <hironori.fu...@sony.com>
+
+ [Freetype] Doesn't support coloured fonts
+ https://bugs.webkit.org/show_bug.cgi?id=156579
+
+ Reviewed by Michael Catanzaro.
+
+ Covered by existing tests. This needs a large rebaseline that will be done in follow up commits.
+
+ * platform/graphics/FontCascade.h: Enable advance text rendering mode by default.
+ (WebCore::FontCascade::advancedTextRenderingMode const):
+ (WebCore::FontCascade::computeRequiresShaping const):
+ * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
+ (WebCore::Font::platformInit): Do not get metrics from OS/2 table for non-scalable fonts.
+ * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
+ (WebCore::harfBuzzGetGlyph): Use U8_APPEND_UNSAFE() instead of converting to a String and then encoding it with
+ UTF8Encoding().
+
2017-09-12 Frederic Wang <fw...@igalia.com>
Remove unnecessary virtual keyword from JS test files
Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (221908 => 221909)
--- trunk/Source/WebCore/platform/graphics/FontCascade.h 2017-09-12 07:36:57 UTC (rev 221908)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h 2017-09-12 11:21:36 UTC (rev 221909)
@@ -275,7 +275,7 @@
return true;
if (textRenderingMode == OptimizeSpeed)
return false;
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) || USE(FREETYPE)
return true;
#else
return false;
@@ -294,7 +294,7 @@
bool computeRequiresShaping() const
{
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) || USE(FREETYPE)
if (!m_fontDescription.variantSettings().isAllNormal())
return true;
if (m_fontDescription.featureSettings().size())
Modified: trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp (221908 => 221909)
--- trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp 2017-09-12 07:36:57 UTC (rev 221908)
+++ trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp 2017-09-12 11:21:36 UTC (rev 221909)
@@ -89,16 +89,17 @@
// If the USE_TYPO_METRICS flag is set in the OS/2 table then we use typo metrics instead.
FT_Face freeTypeFace = cairoFtFaceLocker.ftFace();
- TT_OS2* OS2Table = freeTypeFace ? static_cast<TT_OS2*>(FT_Get_Sfnt_Table(freeTypeFace, ft_sfnt_os2)) : nullptr;
- if (OS2Table) {
- const FT_Short kUseTypoMetricsMask = 1 << 7;
- if (OS2Table->fsSelection & kUseTypoMetricsMask) {
- // FT_Size_Metrics::y_scale is in 16.16 fixed point format.
- // Its (fractional) value is a factor that converts vertical metrics from design units to units of 1/64 pixels.
- double yscale = (freeTypeFace->size->metrics.y_scale / 65536.0) / 64.0;
- ascent = narrowPrecisionToFloat(yscale * OS2Table->sTypoAscender);
- descent = -narrowPrecisionToFloat(yscale * OS2Table->sTypoDescender);
- lineGap = narrowPrecisionToFloat(yscale * OS2Table->sTypoLineGap);
+ if (freeTypeFace && freeTypeFace->face_flags & FT_FACE_FLAG_SCALABLE) {
+ if (auto* OS2Table = static_cast<TT_OS2*>(FT_Get_Sfnt_Table(freeTypeFace, ft_sfnt_os2))) {
+ const FT_Short kUseTypoMetricsMask = 1 << 7;
+ if (OS2Table->fsSelection & kUseTypoMetricsMask) {
+ // FT_Size_Metrics::y_scale is in 16.16 fixed point format.
+ // Its (fractional) value is a factor that converts vertical metrics from design units to units of 1/64 pixels.
+ double yscale = (freeTypeFace->size->metrics.y_scale / 65536.0) / 64.0;
+ ascent = narrowPrecisionToFloat(yscale * OS2Table->sTypoAscender);
+ descent = -narrowPrecisionToFloat(yscale * OS2Table->sTypoDescender);
+ lineGap = narrowPrecisionToFloat(yscale * OS2Table->sTypoLineGap);
+ }
}
}
}
Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp (221908 => 221909)
--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp 2017-09-12 07:36:57 UTC (rev 221908)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp 2017-09-12 11:21:36 UTC (rev 221909)
@@ -99,9 +99,10 @@
if (result.isNewEntry) {
cairo_glyph_t* glyphs = 0;
int numGlyphs = 0;
- UChar ch = unicode;
- CString utf8Codepoint = UTF8Encoding().encode(StringView(&ch, 1), QuestionMarksForUnencodables);
- if (cairo_scaled_font_text_to_glyphs(scaledFont, 0, 0, utf8Codepoint.data(), utf8Codepoint.length(), &glyphs, &numGlyphs, 0, 0, 0) != CAIRO_STATUS_SUCCESS)
+ char buffer[U8_MAX_LENGTH];
+ size_t bufferLength = 0;
+ U8_APPEND_UNSAFE(buffer, bufferLength, unicode);
+ if (cairo_scaled_font_text_to_glyphs(scaledFont, 0, 0, buffer, bufferLength, &glyphs, &numGlyphs, nullptr, nullptr, nullptr) != CAIRO_STATUS_SUCCESS)
return false;
if (!numGlyphs)
return false;
Modified: trunk/Tools/ChangeLog (221908 => 221909)
--- trunk/Tools/ChangeLog 2017-09-12 07:36:57 UTC (rev 221908)
+++ trunk/Tools/ChangeLog 2017-09-12 11:21:36 UTC (rev 221909)
@@ -1,3 +1,15 @@
+2017-09-12 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [Freetype] Doesn't support coloured fonts
+ https://bugs.webkit.org/show_bug.cgi?id=156579
+
+ Reviewed by Michael Catanzaro.
+
+ Bump webkitgtk-test-fonts to 0.0.6 version that includes the EmijoOne font.
+
+ * gtk/jhbuild.modules:
+ * wpe/jhbuild.modules:
+
2017-09-11 Wenson Hsieh <wenson_hs...@apple.com>
[iOS DnD] Support DataTransfer.setDragImage when starting a drag on iOS
Modified: trunk/Tools/gtk/jhbuild.modules (221908 => 221909)
--- trunk/Tools/gtk/jhbuild.modules 2017-09-12 07:36:57 UTC (rev 221908)
+++ trunk/Tools/gtk/jhbuild.modules 2017-09-12 11:21:36 UTC (rev 221909)
@@ -110,7 +110,7 @@
<autotools id="fonts" supports-non-srcdir-builds="no"
skip-autogen="true">
- <branch repo="github.com" module="mrobinson/webkitgtk-test-fonts.git" checkoutdir="webkitgtk-test-fonts" tag="0.0.5"/>
+ <branch repo="github.com" module="WebKitGTK/webkitgtk-test-fonts.git" checkoutdir="webkitgtk-test-fonts" tag="0.0.6"/>
</autotools>
<autotools id="dicts" supports-non-srcdir-builds="no"
Modified: trunk/Tools/wpe/jhbuild.modules (221908 => 221909)
--- trunk/Tools/wpe/jhbuild.modules 2017-09-12 07:36:57 UTC (rev 221908)
+++ trunk/Tools/wpe/jhbuild.modules 2017-09-12 11:21:36 UTC (rev 221909)
@@ -92,7 +92,7 @@
<autotools id="fonts" supports-non-srcdir-builds="no"
skip-autogen="true">
- <branch repo="github.com" module="mrobinson/webkitgtk-test-fonts.git" checkoutdir="webkitgtk-test-fonts" tag="0.0.5"/>
+ <branch repo="github.com" module="WebKitGTK/webkitgtk-test-fonts.git" checkoutdir="webkitgtk-test-fonts" tag="0.0.6"/>
</autotools>
<autotools id="dicts" supports-non-srcdir-builds="no"