Chromium Code Reviews| Index: Source/platform/fonts/WidthIterator.cpp |
| diff --git a/Source/platform/fonts/WidthIterator.cpp b/Source/platform/fonts/WidthIterator.cpp |
| index 8723a13836f98a5cc4e50433c37be96e2f08ac7f..8262997a6414fd8515e59be9ade6f15574ea4642 100644 |
| --- a/Source/platform/fonts/WidthIterator.cpp |
| +++ b/Source/platform/fonts/WidthIterator.cpp |
| @@ -188,14 +188,24 @@ unsigned WidthIterator::advanceInternal(TextIterator& textIterator, GlyphBuffer* |
| while (textIterator.consume(charData.character, charData.clusterLength)) { |
| charData.characterOffset = textIterator.currentCharacter(); |
| - const GlyphData glyphData = glyphDataForCharacter(charData, normalizeSpace); |
| + GlyphData glyphData = glyphDataForCharacter(charData, normalizeSpace); |
| + |
| + // Some fonts do not have a glyph for zero-width-space, |
| + // in that case use the space character and override the width. |
| + float width; |
| + if (!glyphData.glyph && Character::treatAsZeroWidthSpaceInComplexScript(charData.character)) { |
| + charData.character = space; |
| + glyphData = glyphDataForCharacter(charData); |
| + width = 0; |
| + } else { |
| + width = characterWidth(charData.character, glyphData); |
| + } |
| + |
| Glyph glyph = glyphData.glyph; |
| const SimpleFontData* fontData = glyphData.fontData; |
| ASSERT(fontData); |
| // Now that we have a glyph and font data, get its width. |
|
Dominik Röttsches
2014/09/26 12:56:31
This redundant comment can go away now.
|
| - float width = characterWidth(charData.character, glyphData); |
| - |
| if (m_fallbackFonts && lastFontData != fontData && width) { |
| lastFontData = fontData; |
| cacheFallbackFont(fontData, primaryFont); |