Skip to content

Issue with TextTrimming="PrefixCharacterEllipsis" when using emoji / Japane characters #19339

@SiMet

Description

@SiMet

Describe the bug

Text is incorrectly trimmed when I use emoji or Japanes characters and TextTrimming is set to PrefixCharacterElipsis

To Reproduce

MainWindow.axaml:

<StackPanel>
    <TextBox Text="{Binding Greeting}" />
    <TextBlock Text="{Binding Greeting}" MaxWidth="200" TextTrimming="PrefixCharacterEllipsis" Background="Red"/>
</StackPanel>

MainWindowViewModel.cs:

    public partial class MainWindowViewModel : ViewModelBase
    {
        [ObservableProperty]
        private string _greeting = "Welcome to Avalonia! どうもありがとうございます";
    }
Image

When I do not use special characters it looks good:

Image

Adding Emoji cause issues:

Image

With the text: טקסט בשפה עברית אמור להיות מוצג מימין לשמאל is even worse:

Image

Expected behavior

Text is trimmed correctly. We see begining and end of the text

Avalonia version

11.2.3, 11.3.0, 11.3.2, 12.0.999-cibuild0057790-alpha

OS

Windows

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions