Index: Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
diff --git a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
index 535e173526421151cab4f1cda52923fdc6747fea..760edf85b04ea5c5c8be51ae77a02d0bc7544011 100644 |
--- a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
+++ b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
@@ -623,6 +623,10 @@ static inline bool collectCandidateRuns(const UChar* normalizedBuffer, |
if (!iterator.consume(character, clusterLength)) |
return false; |
+ bool collectionForHeadingZWS = false; |
+ if (Character::treatAsZeroWidthSpace(character)) |
+ collectionForHeadingZWS = true; |
+ |
const SimpleFontData* nextFontData = font->glyphDataForCharacter(character, false, isSpaceNormalize).fontData; |
UErrorCode errorCode = U_ZERO_ERROR; |
UScriptCode nextScript = uscript_getScript(character, &errorCode); |
@@ -651,8 +655,13 @@ static inline bool collectCandidateRuns(const UChar* normalizedBuffer, |
return false; |
if (lastCharacter == zeroWidthJoiner) |
currentFontData = nextFontData; |
- if ((nextFontData != currentFontData) || ((currentScript != nextScript) && (nextScript != USCRIPT_INHERITED) && (!uscript_hasScript(character, currentScript)))) |
- break; |
+ if ((nextFontData != currentFontData) || ((currentScript != nextScript) && (nextScript != USCRIPT_INHERITED) && (!uscript_hasScript(character, currentScript)))) { |
+ if (!collectionForHeadingZWS) |
+ break; |
+ currentFontData = nextFontData; |
+ currentScript = nextScript; |
+ collectionForHeadingZWS = false; |
+ } |
currentCharacterPosition = iterator.characters(); |
lastCharacter = character; |
} |