Browse Source
Merge pull request #4834 from Gillibald/fixes/RightToLeftTextRendering
Make sure we don't crash when RTL text is wrapped
pull/4852/head
Benedikt Stebner
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
11 additions and
2 deletions
-
src/Avalonia.Visuals/Media/TextFormatting/TextFormatterImpl.cs
-
src/Skia/Avalonia.Skia/TextShaperImpl.cs
|
|
@ -126,7 +126,15 @@ namespace Avalonia.Media.TextFormatting |
|
|
|
|
|
|
|
|
var lastCluster = glyphRun.GlyphClusters[glyphCount]; |
|
|
var lastCluster = glyphRun.GlyphClusters[glyphCount]; |
|
|
|
|
|
|
|
|
count = lastCluster - firstCluster; |
|
|
if (glyphRun.IsLeftToRight) |
|
|
|
|
|
{ |
|
|
|
|
|
count = lastCluster - firstCluster; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
count = firstCluster - lastCluster; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return count > 0; |
|
|
return count > 0; |
|
|
} |
|
|
} |
|
|
|
|
|
@ -64,7 +64,8 @@ namespace Avalonia.Skia |
|
|
new ReadOnlySlice<double>(glyphAdvances), |
|
|
new ReadOnlySlice<double>(glyphAdvances), |
|
|
new ReadOnlySlice<Vector>(glyphOffsets), |
|
|
new ReadOnlySlice<Vector>(glyphOffsets), |
|
|
text, |
|
|
text, |
|
|
new ReadOnlySlice<ushort>(clusters)); |
|
|
new ReadOnlySlice<ushort>(clusters), |
|
|
|
|
|
buffer.Direction == Direction.LeftToRight ? 0 : 1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|