summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-01-17 14:52:13 -0800
committerRomain Guy <romainguy@google.com>2012-01-17 14:53:26 -0800
commit62b6eaa7f3a8111311a7ee097f278eb55865a499 (patch)
treec41da021e65907a60607fac87c1c7f3172139a73 /core
parent7677d8f006b94c76dcad6f551bf14f983f58dc14 (diff)
downloadframeworks_base-62b6eaa7f3a8111311a7ee097f278eb55865a499.zip
frameworks_base-62b6eaa7f3a8111311a7ee097f278eb55865a499.tar.gz
frameworks_base-62b6eaa7f3a8111311a7ee097f278eb55865a499.tar.bz2
Fix text encoding when drawing with drawPosText in software
Change-Id: I0cd8ee526189c38c50953a1a08b50e0b31c55d8c
Diffstat (limited to 'core')
-rw-r--r--core/jni/android/graphics/Canvas.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 4aa13f9..3e9ab86 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -820,7 +820,12 @@ public:
posPtr[indx].fX = SkFloatToScalar(posArray[indx << 1]);
posPtr[indx].fY = SkFloatToScalar(posArray[(indx << 1) + 1]);
}
+
+ SkPaint::TextEncoding encoding = paint->getTextEncoding();
+ paint->setTextEncoding(SkPaint::kUTF16_TextEncoding);
canvas->drawPosText(textArray + index, count << 1, posPtr, *paint);
+ paint->setTextEncoding(encoding);
+
if (text) {
env->ReleaseCharArrayElements(text, textArray, 0);
}
@@ -844,7 +849,12 @@ public:
posPtr[indx].fX = SkFloatToScalar(posArray[indx << 1]);
posPtr[indx].fY = SkFloatToScalar(posArray[(indx << 1) + 1]);
}
+
+ SkPaint::TextEncoding encoding = paint->getTextEncoding();
+ paint->setTextEncoding(SkPaint::kUTF16_TextEncoding);
canvas->drawPosText(text_, byteLength << 1, posPtr, *paint);
+ paint->setTextEncoding(encoding);
+
if (text) {
env->ReleaseStringChars(text, (const jchar*) text_);
}