You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
make android.text.Layout.draw() compatible custom Canvas classes
TextAndroidCanvas is a proxy canvas class which prevents us from accessing the GtkSnapshot of the real canvas. To solve this problem, we call Canvas.drawText() for each line.
This commit is contained in:
@@ -104,7 +104,7 @@ JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawText(JNIEnv *
|
||||
(*env)->ReleaseStringUTFChars(env, text, str);
|
||||
PangoRectangle rect;
|
||||
pango_layout_get_pixel_extents(layout, NULL, &rect);
|
||||
y -= rect.height;
|
||||
y -= (float)pango_layout_get_baseline(layout) / PANGO_SCALE;
|
||||
if (paint->alignment == PANGO_ALIGN_CENTER)
|
||||
x -= rect.width / 2.f;
|
||||
else if (paint->alignment == PANGO_ALIGN_RIGHT)
|
||||
|
||||
Reference in New Issue
Block a user