瀏覽代碼

Fixed TextShaperImpl when the text is backed by an array

Julien Lebosquain 2 年之前
父節點
當前提交
7fcfc82be0

+ 2 - 0
src/Skia/Avalonia.Skia/TextShaperImpl.cs

@@ -161,6 +161,8 @@ namespace Avalonia.Skia
 
             if (MemoryMarshal.TryGetArray(memory, out var segment))
             {
+                start = segment.Offset;
+                length = segment.Count;
                 return segment.Array.AsMemory();
             }
 

+ 2 - 0
src/Windows/Avalonia.Direct2D1/Media/TextShaperImpl.cs

@@ -161,6 +161,8 @@ namespace Avalonia.Direct2D1.Media
 
             if (MemoryMarshal.TryGetArray(memory, out var segment))
             {
+                start = segment.Offset;
+                length = segment.Count;
                 return segment.Array.AsMemory();
             }
 

+ 2 - 0
tests/Avalonia.UnitTests/HarfBuzzTextShaperImpl.cs

@@ -161,6 +161,8 @@ namespace Avalonia.UnitTests
 
             if (MemoryMarshal.TryGetArray(memory, out var segment))
             {
+                start = segment.Offset;
+                length = segment.Count;
                 return segment.Array.AsMemory();
             }