Skip to content

Commit e5c67bf

Browse files
Fabrice Di MeglioAndroid (Google) Code Review
authored andcommitted
Merge "Make Arabic script runs longer (for performance) - bug 6426451." into jb-dev
2 parents a1f084e + b294435 commit e5c67bf

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)