diff --git a/src/Avalonia.Visuals/Media/TextFormatting/TextFormatterImpl.cs b/src/Avalonia.Visuals/Media/TextFormatting/TextFormatterImpl.cs index 4a7282af27..394dae8253 100644 --- a/src/Avalonia.Visuals/Media/TextFormatting/TextFormatterImpl.cs +++ b/src/Avalonia.Visuals/Media/TextFormatting/TextFormatterImpl.cs @@ -126,7 +126,15 @@ namespace Avalonia.Media.TextFormatting var lastCluster = glyphRun.GlyphClusters[glyphCount]; - count = lastCluster - firstCluster; + if (glyphRun.IsLeftToRight) + { + count = lastCluster - firstCluster; + } + else + { + count = firstCluster - lastCluster; + } + return count > 0; } diff --git a/src/Skia/Avalonia.Skia/TextShaperImpl.cs b/src/Skia/Avalonia.Skia/TextShaperImpl.cs index 61075171fe..31724bfee9 100644 --- a/src/Skia/Avalonia.Skia/TextShaperImpl.cs +++ b/src/Skia/Avalonia.Skia/TextShaperImpl.cs @@ -64,7 +64,8 @@ namespace Avalonia.Skia new ReadOnlySlice(glyphAdvances), new ReadOnlySlice(glyphOffsets), text, - new ReadOnlySlice(clusters)); + new ReadOnlySlice(clusters), + buffer.Direction == Direction.LeftToRight ? 0 : 1); } }