AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.63k stars 2.22k forks source link

When text does not fit, TextBlock does not always correctly show ellipsis #13395

Open rickvanderheijden opened 1 year ago

rickvanderheijden commented 1 year ago

Describe the bug

When placing a long line of text in a TextBlock the ellipsis isn't correctly placed, depending on the font size. Textbox properties are set:

TextTrimming="CharacterEllipsis" TextWrapping="Wrap"

The same setting behaves correctly in Avalonia 0.10.22. Using a the most recent nightly build (1.1.999-cibuild0041289-beta) has the same behavior.

Windows display scaling is set to 100%.

To Reproduce

Steps to reproduce the behavior:

Use attached zip file with sample project. Change font size settings if needed. Build and run. MyApp.zip

Expected behavior

When the text does not fit and the properties are set (TextTrimming and TextWrapping), the text should be cut off using ellipsis.

Screenshots

Avalonia 11.0.5, font size 14: image

Avalonia 11.0.5, font size 15: image

Avalonia 0.10.22, font size 14 image

Avalonia 0.10.22, font size 15 image

Environment

Gillibald commented 1 year ago

I can't see the issue with Avalonia 11.0.5 What is wrong with the result?

rickvanderheijden commented 1 year ago

In the second screenshot (with font size 15) you can see that the ellipsis are not placed, while they are there when the font size is 14..

image

Older Avalonia does show them in both font sizes

Gillibald commented 1 year ago

I see. So only 3 lines fit into the height and not ellipsis is shown in that case.

rickvanderheijden commented 1 year ago

Correct... the original text is "Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text."

StipecMV commented 6 months ago

Hi guys, I have a similar problem to @rickvanderheijden. I tested it with 11.0.10 Avalonia and the result is the same. Why TextTrimming does not work in some cases together with TextWrapping @Gillibald ?

Note that the text "Some text." is written there 16 times and only 9 times does it fit into TextBlock, so I expect that text will be trimmed as that property is set!

sanders-ict commented 1 month ago

Hi all,

Just retested @rickvanderheijden 's test app with the latest Avalonia release (11.1.3) after updating the app to NET8. Still the same behavior can be seen. Any news on in which release this is planned to be fixed ?

image

timunie commented 1 month ago

No due date yet. You can ask for priority in case you have a support agreement.