Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
selundqma opened this issue Aug 8, 2024 · 4 comments

Comments

@selundqma
Copy link

selundqma commented Aug 8, 2024

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
Copy link
Contributor

laeubi commented Aug 11, 2024

Sadly WRAP is not really specified the API only says

/**
* Style constant for automatic line wrap behavior (value is 1<<6).
* <p><b>Used By:</b></p>
* <ul>
* <li><code>Button</code></li>
* <li><code>Label</code></li>
* <li><code>Text</code></li>
* <li><code>ToolBar</code></li>
* <li><code>Spinner</code></li>
* </ul>
*/
public static final int WRAP = 1 << 6;

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

@mickaelistria
Copy link
Contributor

Seen so far only on Windows (11)

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

@selundqma
Copy link
Author

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants