eclipse-platform / eclipse.platform.swt

Eclipse SWT
https://www.eclipse.org/swt/
Eclipse Public License 2.0
118 stars 139 forks source link

Strange line breaking behavior when using the SWT.WRAP flag in a SWT Label #1392

Open selundqma opened 3 months ago

selundqma commented 3 months ago

Describe the bug Strange line breaking behavior when using the SWT.WRAP flag in a SWT Label and the text contains Swedish characters (åäö). Seen so far only on Windows (11). I expected the wrapping to happen only on white spaces and not on "special characters" like åäö (or similar extra chars in other languages). Could it be that all the line breaking functionality is handled by OS calls and that we have no control over how it happens in the Java code? Or, is it possible to understand why the line break happens?

Environment JRE/JDK version 21.0.4.7.1 Eclipse 4.31 (2023-03)

Screenshots Please see screenshots for clarification. The screenshot with the arrows shows where the unwanted line break happens. Taken from Windows 11.

wrong

The screenshot without any arrows where it looks ok is taken from MacOS Sonoma.

correct

laeubi commented 3 months ago

Sadly WRAP is not really specified the API only says https://github.com/eclipse-platform/eclipse.platform.swt/blob/90111e3594cf0be9f6d56146884c88190939dc14/bundles/org.eclipse.swt/Eclipse%20SWT/common/org/eclipse/swt/SWT.java#L1543-L1554

so all one can expect is that some wrapping is performed but not how exactly.

mickaelistria commented 3 months ago

Seen so far only on Windows (11)

Do other win32-API based software show the same issue?

selundqma commented 1 month ago

I was hoping to get hold of someone who knows about the "strange" line breaking behavior. I am sadly not as educated in this matter to answer any technical questions back.

selundqma commented 1 month ago

Seems to work better in Text and StyledText components. We will take that road instead of using the Label class.