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

Unified Diff: Source/platform/fonts/shaping/HarfBuzzShaper.cpp

Issue 1310803003: Fix handling of word-spacing and nbsp for complex text (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | « LayoutTests/fast/text/word-spacing-nbsp-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/shaping/HarfBuzzShaper.cpp
diff --git a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
index 8063039c306b8fae8f5c4976c7b12c593c1ef51c..981a642c5be9cb3e9214488357af0c6f49528679 100644
--- a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
+++ b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
@@ -602,7 +602,7 @@ static void normalizeCharacters(const TextRun& run, unsigned length, UChar* dest
// Don't normalize tabs as they are not treated as spaces for word-end.
if (run.normalizeSpace() && Character::isNormalizedCanvasSpaceCharacter(character))
character = spaceCharacter;
- else if (Character::treatAsSpace(character))
+ else if (Character::treatAsSpace(character) && character != noBreakSpaceCharacter)
character = spaceCharacter;
else if (Character::treatAsZeroWidthSpaceInComplexScript(character))
character = zeroWidthSpaceCharacter;
@@ -1172,7 +1172,7 @@ float HarfBuzzShaper::adjustSpacing(ShapeResult::RunInfo* run, size_t glyphIndex
spacing += m_letterSpacing;
bool treatAsSpace = Character::treatAsSpace(character);
- if (treatAsSpace && currentCharacterIndex && (character != '\t' || !m_textRun.allowTabs()))
+ if (treatAsSpace && (currentCharacterIndex || character == noBreakSpaceCharacter) && (character != '\t' || !m_textRun.allowTabs()))
pdr. 2015/08/22 02:29:46 This change took me a while to understand, but I'm
spacing += m_wordSpacingAdjustment;
if (!m_expansionOpportunityCount)
« no previous file with comments | « LayoutTests/fast/text/word-spacing-nbsp-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698