On Mon, 25 Aug 2025 18:59:39 GMT, Volker Simonis <simo...@openjdk.org> wrote:

> I think this is a little too simplistic. Single characters on a line may be 
> fine, as long as they don't break a cluster.

Sure, but it doesn't appear to happen with this specific text until you resize 
down to 70 pixels or so.

Another behavioral difference pre- and post-fix seems to be that pre-fix some 
lines (excluding the final line) take up < 50% of the available width at 
various times when resizing down from full width to 100 pixels or so, while 
this doesn't appear to happen when line breaks are calculated correctly.

See below a small test program, you may be able to resize the window width a 
bit to find a behavioral difference that you're comfortable checking for in 
your test (keeping in mind that it only needs to apply to your test string, it 
doesn't need to apply more generally).


import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JTextArea;

public class KhmerTestSwing2 {
  public static void main(String[] args) throws Exception {
    JFrame frame = new JFrame("Test");
    String text = "បានស្នើសុំនៅតែត្រូវបានបដិសេធ";
    JTextArea textArea = new JTextArea(text);
    textArea.setFont(new Font(Font.DIALOG, Font.PLAIN, 30));
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    frame.add(textArea);
    frame.pack();
    frame.setVisible(true);
  }
}

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26825#issuecomment-3221689006

Reply via email to