From: Carlos Garcia Campos Date: Fri, 10 May 2019 09:39:42 +0000 (+0100) Subject: Fix rendering of white space with noto CJK font X-Git-Tag: archive/raspbian/2.24.2-1+rpi1^2~1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e4617e6456a6e8855e02fddb040d1ee19f63a8ba;p=webkit2gtk.git Fix rendering of white space with noto CJK font =================================================================== Gbp-Pq: Name fix-cjk-white-space.patch --- diff --git a/Source/WebCore/platform/graphics/Font.cpp b/Source/WebCore/platform/graphics/Font.cpp index b6c116423f..29bfdac6b4 100644 --- a/Source/WebCore/platform/graphics/Font.cpp +++ b/Source/WebCore/platform/graphics/Font.cpp @@ -102,14 +102,20 @@ void Font::initCharWidths() void Font::platformGlyphInit() { - auto* glyphPageZero = glyphPage(0); +#if USE(FREETYPE) + auto* glyphPageZeroWidthSpace = glyphPage(GlyphPage::pageNumberForCodePoint(zeroWidthSpace)); + UChar32 zeroWidthSpaceCharacter = zeroWidthSpace; +#else + // Ask for the glyph for 0 to avoid paging in ZERO WIDTH SPACE. Control characters, including 0, + // are mapped to the ZERO WIDTH SPACE glyph for non FreeType based ports. + auto* glyphPageZeroWidthSpace = glyphPage(0); + UChar32 zeroWidthSpaceCharacter = 0; +#endif auto* glyphPageCharacterZero = glyphPage(GlyphPage::pageNumberForCodePoint('0')); auto* glyphPageSpace = glyphPage(GlyphPage::pageNumberForCodePoint(space)); - // Ask for the glyph for 0 to avoid paging in ZERO WIDTH SPACE. Control characters, including 0, - // are mapped to the ZERO WIDTH SPACE glyph. - if (glyphPageZero) - m_zeroWidthSpaceGlyph = glyphPageZero->glyphDataForCharacter(0).glyph; + if (glyphPageZeroWidthSpace) + m_zeroWidthSpaceGlyph = glyphPageZeroWidthSpace->glyphDataForCharacter(zeroWidthSpaceCharacter).glyph; // Nasty hack to determine if we should round or ceil space widths. // If the font is monospace or fake monospace we ceil to ensure that