Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(944)

Unified Diff: Source/platform/fonts/WidthIterator.cpp

Issue 602203005: Handle fonts with missing ZWS glyph in simple text path (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698