Spaces interfering with center alignment
As discussed here: https://github.com/xulihang/ImageTrans-docs/issues/21
The trailing spaces before line breaks will interfere with the center alignment. This is the behavior of JavaFX's TextFlow and I cannot do much about it. To avoid the interference, we have to manually cut the text into lines.
I am thinking about using another text engine like using WebView to render horizontal text.
In Photoshop, adding a space will not affect the centering behavior, which is the desired effect.
https://github.com/xulihang/ImageTrans-docs/assets/5462205/f5fc64cd-7848-484f-91a5-dbc07069e418
I've reported it to java bug system here: https://bugs.openjdk.org/browse/JDK-8314215
A similar issue of flutter: https://github.com/flutter/flutter/issues/86668
The pull request: https://github.com/openjdk/jfx/pull/1236
Using a webview to render text images and passing them to Java are not very efficiently. I am waiting for the updates on the JavaFX side.
The pull request: openjdk/jfx#1236
This fix has been merged. But I don't know how to build JRE with JavaFX. I am waiting for a third-party build like Liberica JRE with the fix included.
The builds with the fix has come out. But liberica jdk hasn't provided such a build.
We can use the latest JDK 23 and JavaFX 23 following this thread: https://www.b4x.com/android/forum/threads/trying-to-use-the-latest-java-23-and-javafx-23.161167/
Fixed in 3.0.0 by using JavaFX 23.