Commit 1083609e authored by kochi@chromium.org's avatar kochi@chromium.org

Fix   fallback glyph lookup

On Japanese locale Android which has Motoya Maruberi
as the system default font (up until 5.1), the font
fallback path mistakenly picked up ".notdef" glyph
for   (U+00A0).

This happened because in the fallback path it still
ended up in looking up non-existent glyph in the same
font file and fell back to the "missingGlyphData".

This is because Blink looks up the glyph in
normalized codepoint (for U+00A0, normalized to U+0020)
but still it tries to look up the original codepoint.

This bug was exposed by the following change, to make
not to normalize   to space before looking up glyph.
https://codereview.chromium.org/705163003

BUG=454108

Review URL: https://codereview.chromium.org/1317833003

git-svn-id: svn://svn.chromium.org/blink/trunk@201348 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4dee8bcd
......@@ -524,14 +524,15 @@ GlyphData Font::glyphDataForCharacter(UChar32& c, bool mirror, bool normalizeSpa
}
if (characterFontData) {
// Got the fallback glyph and font.
GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterFontData.get(), pageNumber)->page();
GlyphData data = fallbackPage && fallbackPage->glyphForCharacter(c) ? fallbackPage->glyphDataForCharacter(c) : characterFontData->missingGlyphData();
unsigned pageNumberForRendering = characterToRender / GlyphPage::size;
GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterFontData.get(), pageNumberForRendering)->page();
GlyphData data = fallbackPage && fallbackPage->glyphForCharacter(characterToRender) ? fallbackPage->glyphDataForCharacter(characterToRender) : characterFontData->missingGlyphData();
// Cache it so we don't have to do system fallback again next time.
if (variant == NormalVariant) {
page->setGlyphDataForCharacter(c, data.glyph, data.fontData);
data.fontData->setMaxGlyphPageTreeLevel(std::max(data.fontData->maxGlyphPageTreeLevel(), node->level()));
if (data.fontData->platformData().isVerticalAnyUpright() && !data.fontData->isTextOrientationFallback() && !Character::isCJKIdeographOrSymbol(c))
return glyphDataForNonCJKCharacterWithGlyphOrientation(c, m_fontDescription.isVerticalUpright(c), data, pageNumber);
if (data.fontData->platformData().isVerticalAnyUpright() && !data.fontData->isTextOrientationFallback() && !Character::isCJKIdeographOrSymbol(characterToRender))
return glyphDataForNonCJKCharacterWithGlyphOrientation(characterToRender, m_fontDescription.isVerticalUpright(characterToRender), data, pageNumberForRendering);
}
return data;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment