Merge "Make Arabic script runs longer (for performance) - bug 6426451." into jb-dev
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp
index a33b46a..0d36edf 100644
--- a/core/jni/android/graphics/TextLayoutCache.cpp
+++ b/core/jni/android/graphics/TextLayoutCache.cpp
@@ -849,7 +849,11 @@
case HB_Script_Tamil:
case HB_Script_Thai:{
const uint16_t* text16 = (const uint16_t*)(mShaperItem.string + mShaperItem.item.pos);
+ const uint16_t* text16End = text16 + mShaperItem.item.length;
SkUnichar firstUnichar = SkUTF16_NextUnichar(&text16);
+ while (firstUnichar == ' ' && text16 < text16End) {
+ firstUnichar = SkUTF16_NextUnichar(&text16);
+ }
baseGlyphCount = paint->getBaseGlyphCount(firstUnichar);
break;
}