Add Paint.setTextLocale()
- will be used for better shaping CJK and other goodies
Change-Id: If64945a337edd915f5ebb88f04b6fd18e92ca587
diff --git a/core/jni/android/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp
index 376c841..a65262c 100644
--- a/core/jni/android/graphics/Paint.cpp
+++ b/core/jni/android/graphics/Paint.cpp
@@ -254,6 +254,13 @@
obj->setTextAlign(align);
}
+ static void setTextLocale(JNIEnv* env, jobject clazz, SkPaint* obj, jstring locale) {
+ const char* localeArray = env->GetStringUTFChars(locale, NULL);
+ SkString skLocale(localeArray);
+ obj->setTextLocale(skLocale);
+ env->ReleaseStringUTFChars(locale, localeArray);
+ }
+
static jfloat getTextSize(JNIEnv* env, jobject paint) {
NPE_CHECK_RETURN_ZERO(env, paint);
return SkScalarToFloat(GraphicsJNI::getNativePaint(env, paint)->getTextSize());
@@ -817,6 +824,7 @@
{"native_setRasterizer","(II)I", (void*) SkPaintGlue::setRasterizer},
{"native_getTextAlign","(I)I", (void*) SkPaintGlue::getTextAlign},
{"native_setTextAlign","(II)V", (void*) SkPaintGlue::setTextAlign},
+ {"native_setTextLocale","(ILjava/lang/String;)V", (void*) SkPaintGlue::setTextLocale},
{"getTextSize","()F", (void*) SkPaintGlue::getTextSize},
{"setTextSize","(F)V", (void*) SkPaintGlue::setTextSize},
{"getTextScaleX","()F", (void*) SkPaintGlue::getTextScaleX},