summaryrefslogtreecommitdiffstats
path: root/core/jni/android/graphics/TextLayoutCache.cpp
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2012-05-01 09:41:50 -0700
committerRaph Levien <raph@google.com>2012-05-01 13:49:18 -0700
commitb294435b5c6e0fee8c431ed3f6d77427d3d79dde (patch)
treee2a24ca402ed97c0e4355c1647de2e692c584958 /core/jni/android/graphics/TextLayoutCache.cpp
parent8ccfbdddabf3387a1ac9d46bd057bea64eb30ef3 (diff)
downloadframeworks_base-b294435b5c6e0fee8c431ed3f6d77427d3d79dde.zip
frameworks_base-b294435b5c6e0fee8c431ed3f6d77427d3d79dde.tar.gz
frameworks_base-b294435b5c6e0fee8c431ed3f6d77427d3d79dde.tar.bz2
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
Diffstat (limited to 'core/jni/android/graphics/TextLayoutCache.cpp')
-rw-r--r--core/jni/android/graphics/TextLayoutCache.cpp4
1 files changed, 4 insertions, 0 deletions
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 @@ size_t TextLayoutShaper::shapeFontRun(const SkPaint* paint, bool isRTL) {
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;
}