Add HyphenEdit support to Paint
This adds HyphenEdit on the C++ and also to Java via JNI. HyphenEdit is
a Minikin feature for adding hyphens to text without having to edit the
string on the client side.
Change-Id: Icfb228407c1d11a716d055f813da7507acb38fbf
diff --git a/core/jni/android/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp
index 83021e9..a92a9ac 100644
--- a/core/jni/android/graphics/Paint.cpp
+++ b/core/jni/android/graphics/Paint.cpp
@@ -453,6 +453,16 @@
}
}
+ static jint getHyphenEdit(JNIEnv* env, jobject clazz, jlong paintHandle, jint hyphen) {
+ Paint* paint = reinterpret_cast<Paint*>(paintHandle);
+ return paint->getHyphenEdit();
+ }
+
+ static void setHyphenEdit(JNIEnv* env, jobject clazz, jlong paintHandle, jint hyphen) {
+ Paint* paint = reinterpret_cast<Paint*>(paintHandle);
+ paint->setHyphenEdit((uint32_t)hyphen);
+ }
+
static SkScalar getMetricsInternal(JNIEnv* env, jobject jpaint, Paint::FontMetrics *metrics) {
const int kElegantTop = 2500;
const int kElegantBottom = -1000;
@@ -1009,6 +1019,8 @@
{"native_getLetterSpacing","!(J)F", (void*) PaintGlue::getLetterSpacing},
{"native_setLetterSpacing","!(JF)V", (void*) PaintGlue::setLetterSpacing},
{"native_setFontFeatureSettings","(JLjava/lang/String;)V", (void*) PaintGlue::setFontFeatureSettings},
+ {"native_getHyphenEdit", "!(J)I", (void*) PaintGlue::getHyphenEdit},
+ {"native_setHyphenEdit", "!(JI)V", (void*) PaintGlue::setHyphenEdit},
{"ascent","!()F", (void*) PaintGlue::ascent},
{"descent","!()F", (void*) PaintGlue::descent},