Skip to content

Commit b294435

Browse files
committed
Make Arabic script runs longer (for performance) - bug 6426451.
This change avoids selecting the incorrect font for drawing characters when the first character in a run is a space. Change-Id: Ibc672560d364b8de8c3e21de1c738c6dc5639395
1 parent 8ccfbdd commit b294435

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/jni/android/graphics/TextLayoutCache.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,11 @@ size_t TextLayoutShaper::shapeFontRun(const SkPaint* paint, bool isRTL) {
849849
case HB_Script_Tamil:
850850
case HB_Script_Thai:{
851851
const uint16_t* text16 = (const uint16_t*)(mShaperItem.string + mShaperItem.item.pos);
852+
const uint16_t* text16End = text16 + mShaperItem.item.length;
852853
SkUnichar firstUnichar = SkUTF16_NextUnichar(&text16);
854+
while (firstUnichar == ' ' && text16 < text16End) {
855+
firstUnichar = SkUTF16_NextUnichar(&text16);
856+
}
853857
baseGlyphCount = paint->getBaseGlyphCount(firstUnichar);
854858
break;
855859
}

0 commit comments

Comments
 (0)