Skip to content

Indented lines in wrapped RTL text #17175

Closed
@dme-compunet

Description

@dme-compunet

Describe the bug

Several issues with processing right-to-left texts.
avalonia-rtl-bugs

As you can see, the picture describes two bugs:

  1. Wrapped RTL text adds an unnecessary empty line to the desired size of the control.
  2. The first line is slightly indented (possibly due to incorrect handling of the space after the word).

To Reproduce

XAML code:

<StackPanel Width="100"
            Spacing="6"
            Orientation="Vertical">

    <TextBox Name="Input"
             Text="aaa bbb ccc ddd eee"
             TextWrapping="Wrap"/>

    <Label Content="RightToLeft:"/>

        <TextBlock Text="{Binding #Input.Text}"
                   TextWrapping="Wrap"
                   Background="LightGray"
                   FlowDirection="RightToLeft"/>

    <Label Content="LeftToRight:"/>

        <TextBlock Text="{Binding #Input.Text}"
                   TextWrapping="Wrap"
                   Background="LightGray"
                   FlowDirection="LeftToRight"/>

</StackPanel>

Expected behavior

RTL text should be processed and laid out correctly.

Avalonia version

11.2.0-beta2

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