[Webkit-unassigned] [Bug 20237] Zero width and space characters are displayed incorrectly if not contained in a fallback font.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 6 07:42:02 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=20237





------- Comment #5 from marv.decker at gmail.com  2008-08-06 07:42 PDT -------
With our CJK optimization, it looks like this:

SimpleFontData::widthForGlyph(UChar32 c, Glyph glyph) const
{
    bool is_CJK = IsCJKCodePoint(c);
    float width = is_CJK ? m_cjkGlyphWidth :
m_glyphToWidthMap.widthForGlyph(glyph);

#ifndef NDEBUG
    // Test our optimization that assuming all CGK glyphs have the same width
    if (is_CJK) {
        const float actual_width = platformWidthForGlyph(glyph);
        ASSERT((cGlyphWidthUnknown == width) || (actual_width == width));
    }
#endif

    if (c > ' ' && Font::treatAsZeroWidthSpace(c))
        return 0.0f;

    if (width != cGlyphWidthUnknown)
        return width;

    width = platformWidthForGlyph(glyph);

    if (is_CJK) {
        m_cjkGlyphWidth = width;
    } else {
        m_glyphToWidthMap.setWidthForGlyph(glyph, width);
    }

    return width;
}

So basically, this caches the widths of the first CJK character seen in a font,
and uses that for all subsequent ones. If I recall correctly, this, along with
making the widths 16-bit fixed point, saves us ~150MB for a page cycler run
with a lot of different CJK pages in it.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list