Benedikt Stebner
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
24 additions and
2 deletions
-
src/Avalonia.Base/Media/GlyphRun.cs
-
tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLayoutTests.cs
|
|
|
@ -574,7 +574,10 @@ namespace Avalonia.Media |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
nextCluster = _glyphInfos[currentIndex].GlyphCluster; |
|
|
|
if (_glyphInfos.Count > 0 && currentIndex <= _glyphInfos.Count) |
|
|
|
{ |
|
|
|
nextCluster = _glyphInfos[currentIndex].GlyphCluster; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var clusterLength = Math.Max(0, nextCluster - cluster); |
|
|
|
@ -639,7 +642,7 @@ namespace Avalonia.Media |
|
|
|
{ |
|
|
|
int firstCluster, lastCluster; |
|
|
|
|
|
|
|
if (Characters.IsEmpty) |
|
|
|
if (Characters.IsEmpty || _glyphInfos.Count == 0) |
|
|
|
{ |
|
|
|
firstCluster = 0; |
|
|
|
lastCluster = 0; |
|
|
|
|
|
|
|
@ -1127,6 +1127,25 @@ namespace Avalonia.Skia.UnitTests.Media.TextFormatting |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Win32Fact("Font only available on Windows")] |
|
|
|
public void Should_Handle_TextStyle_With_Ligature() |
|
|
|
{ |
|
|
|
using (Start()) |
|
|
|
{ |
|
|
|
var text = "fi"; |
|
|
|
|
|
|
|
var typeface = new Typeface("Calibri"); |
|
|
|
|
|
|
|
var textLayout = new TextLayout(text, typeface, 12, Brushes.Black, |
|
|
|
textStyleOverrides: new[] |
|
|
|
{ |
|
|
|
new ValueSpan<TextRunProperties>(1, 1, |
|
|
|
new GenericTextRunProperties(typeface, foregroundBrush: Brushes.White)) |
|
|
|
}); |
|
|
|
|
|
|
|
Assert.NotNull(textLayout); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static IDisposable Start() |
|
|
|
{ |
|
|
|
|