You could try to use only one Run as a line to avoid CR LF issues between </Run> and the next <Run> element. Also here is reference you can refer to.
How to retain cursive style in TextBlock with Inlines?
Emon Haque
3,176
Reputation points
This is what I've in MainWindow.xaml
:
<Grid>
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="FlowDirection" Value="RightToLeft"/>
<Setter Property="FontSize" Value="60"/>
<Setter Property="FontFamily" Value="Amiri"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock FontFamily="Arial" Text="bialGuyb"/>
<TextBlock Grid.Row="1" Text="بِالغَيب"/>
<TextBlock Grid.Row="2"
Typography.StandardLigatures="True">
<Run Text="بِ"/>
<Run Text="الغَيب"/>
</TextBlock>
<TextBlock Grid.Row="3"
Typography.DiscretionaryLigatures="True">
<Run Text="بِ"/>
<Run Text="ال"/>
<Run Text="غَيب"/>
</TextBlock>
</Grid>
and it produces this:
so when I type bialGuyb in Text
property of the TextBlock
with arabic phonetic keyboard on, I get the drawing in second row and that is the correct and expected format. When I separate bi from alGuyb, as in third row, or bi as well as al from Guyb, as in fourth row, it doesn't work although I don't have any leading or trailing spaces in any of those Run
.
How to get the correct format?
Accepted answer
-
Hui Liu-MSFT 38,256 Reputation points Microsoft Vendor
2021-08-13T09:29:19.157+00:00