ImageTrans-docs icon indicating copy to clipboard operation
ImageTrans-docs copied to clipboard

Spaces interfering with center alignment

Open xulihang opened this issue 2 years ago • 4 comments

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

xulihang avatar Aug 10 '23 13:08 xulihang

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

xulihang avatar Aug 14 '23 12:08 xulihang

The pull request: https://github.com/openjdk/jfx/pull/1236

xulihang avatar Nov 05 '23 09:11 xulihang

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.

xulihang avatar Nov 05 '23 09:11 xulihang

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.

xulihang avatar May 02 '24 12:05 xulihang

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/

xulihang avatar May 19 '24 13:05 xulihang

Fixed in 3.0.0 by using JavaFX 23.

xulihang avatar Jun 08 '24 08:06 xulihang