diff --git a/api/Avalonia.Headless.XUnit.nupkg.xml b/api/Avalonia.Headless.XUnit.nupkg.xml
index 15a56561b9..c87cf909fe 100644
--- a/api/Avalonia.Headless.XUnit.nupkg.xml
+++ b/api/Avalonia.Headless.XUnit.nupkg.xml
@@ -1,4 +1,4 @@
-
+
@@ -73,4 +73,4 @@
baseline/Avalonia.Headless.XUnit/lib/net8.0/Avalonia.Headless.XUnit.dll
current/Avalonia.Headless.XUnit/lib/net8.0/Avalonia.Headless.XUnit.dll
-
\ No newline at end of file
+
diff --git a/api/Avalonia.Headless.nupkg.xml b/api/Avalonia.Headless.nupkg.xml
index 435df92d13..229047057a 100644
--- a/api/Avalonia.Headless.nupkg.xml
+++ b/api/Avalonia.Headless.nupkg.xml
@@ -1,4 +1,4 @@
-
+
@@ -37,4 +37,4 @@
baseline/Avalonia.Headless/lib/net8.0/Avalonia.Headless.dll
current/Avalonia.Headless/lib/net8.0/Avalonia.Headless.dll
-
\ No newline at end of file
+
diff --git a/api/Avalonia.LinuxFramebuffer.nupkg.xml b/api/Avalonia.LinuxFramebuffer.nupkg.xml
index 10c927a203..0fa6ef4e03 100644
--- a/api/Avalonia.LinuxFramebuffer.nupkg.xml
+++ b/api/Avalonia.LinuxFramebuffer.nupkg.xml
@@ -1,4 +1,4 @@
-
+
@@ -37,4 +37,4 @@
baseline/Avalonia.LinuxFramebuffer/lib/net8.0/Avalonia.LinuxFramebuffer.dll
current/Avalonia.LinuxFramebuffer/lib/net8.0/Avalonia.LinuxFramebuffer.dll
-
\ No newline at end of file
+
diff --git a/api/Avalonia.Skia.nupkg.xml b/api/Avalonia.Skia.nupkg.xml
index c1afe2f966..b73745af8e 100644
--- a/api/Avalonia.Skia.nupkg.xml
+++ b/api/Avalonia.Skia.nupkg.xml
@@ -1,4 +1,4 @@
-
+
@@ -169,4 +169,4 @@
baseline/Avalonia.Skia/lib/net8.0/Avalonia.Skia.dll
current/Avalonia.Skia/lib/net8.0/Avalonia.Skia.dll
-
\ No newline at end of file
+
diff --git a/api/Avalonia.Win32.Interoperability.nupkg.xml b/api/Avalonia.Win32.Interoperability.nupkg.xml
index 33fc2ac062..3672bb9b99 100644
--- a/api/Avalonia.Win32.Interoperability.nupkg.xml
+++ b/api/Avalonia.Win32.Interoperability.nupkg.xml
@@ -1,4 +1,4 @@
-
+
@@ -37,4 +37,4 @@
baseline/Avalonia.Win32.Interoperability/lib/net8.0-windows7.0/Avalonia.Win32.Interoperability.dll
current/Avalonia.Win32.Interoperability/lib/net8.0-windows7.0/Avalonia.Win32.Interoperability.dll
-
\ No newline at end of file
+
diff --git a/api/Avalonia.nupkg.xml b/api/Avalonia.nupkg.xml
index 5fe2e48f60..44617ccf64 100644
--- a/api/Avalonia.nupkg.xml
+++ b/api/Avalonia.nupkg.xml
@@ -1,4 +1,4 @@
-
+
@@ -163,6 +163,12 @@
baseline/Avalonia/lib/net10.0/Avalonia.Base.dll
current/Avalonia/lib/net10.0/Avalonia.Base.dll
+
+ CP0001
+ T:Avalonia.Media.TextFormatting.TextRange
+ baseline/Avalonia/lib/net10.0/Avalonia.Base.dll
+ current/Avalonia/lib/net10.0/Avalonia.Base.dll
+
CP0001
T:Avalonia.Platform.IGeometryContext2
@@ -631,6 +637,12 @@
baseline/Avalonia/lib/net8.0/Avalonia.Base.dll
current/Avalonia/lib/net8.0/Avalonia.Base.dll
+
+ CP0001
+ T:Avalonia.Media.TextFormatting.TextRange
+ baseline/Avalonia/lib/net8.0/Avalonia.Base.dll
+ current/Avalonia/lib/net8.0/Avalonia.Base.dll
+
CP0001
T:Avalonia.Platform.IGeometryContext2
@@ -5221,4 +5233,4 @@
baseline/Avalonia/lib/netstandard2.0/Avalonia.Base.dll
current/Avalonia/lib/netstandard2.0/Avalonia.Base.dll
-
\ No newline at end of file
+
diff --git a/src/Avalonia.Base/Media/TextFormatting/FormattedTextSource.cs b/src/Avalonia.Base/Media/TextFormatting/FormattedTextSource.cs
index 1586639fbd..13fc22b3e5 100644
--- a/src/Avalonia.Base/Media/TextFormatting/FormattedTextSource.cs
+++ b/src/Avalonia.Base/Media/TextFormatting/FormattedTextSource.cs
@@ -132,5 +132,71 @@ namespace Avalonia.Media.TextFormatting
return Math.Min(length, text.Length);
}
+
+ ///
+ /// References a portion of a text buffer.
+ ///
+ private readonly record struct TextRange
+ {
+ public TextRange(int start, int length)
+ {
+ Start = start;
+ Length = length;
+ }
+
+ ///
+ /// Gets the start.
+ ///
+ ///
+ /// The start.
+ ///
+ public int Start { get; }
+
+ ///
+ /// Gets the length.
+ ///
+ ///
+ /// The length.
+ ///
+ public int Length { get; }
+
+ ///
+ /// Gets the end.
+ ///
+ ///
+ /// The end.
+ ///
+ public int End => Start + Length - 1;
+
+ ///
+ /// Returns a specified number of contiguous elements from the start of the slice.
+ ///
+ /// The number of elements to return.
+ /// A that contains the specified number of elements from the start of this slice.
+ public TextRange Take(int length)
+ {
+ if (length > Length)
+ {
+ throw new ArgumentOutOfRangeException(nameof(length));
+ }
+
+ return new TextRange(Start, length);
+ }
+
+ ///
+ /// Bypasses a specified number of elements in the slice and then returns the remaining elements.
+ ///
+ /// The number of elements to skip before returning the remaining elements.
+ /// A that contains the elements that occur after the specified index in this slice.
+ public TextRange Skip(int length)
+ {
+ if (length > Length)
+ {
+ throw new ArgumentOutOfRangeException(nameof(length));
+ }
+
+ return new TextRange(Start + length, Length - length);
+ }
+ }
}
}
diff --git a/src/Avalonia.Base/Media/TextFormatting/TextRange.cs b/src/Avalonia.Base/Media/TextFormatting/TextRange.cs
deleted file mode 100644
index e8bab55aff..0000000000
--- a/src/Avalonia.Base/Media/TextFormatting/TextRange.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using System;
-
-namespace Avalonia.Media.TextFormatting
-{
- ///
- /// References a portion of a text buffer.
- ///
- public readonly record struct TextRange
- {
- public TextRange(int start, int length)
- {
- Start = start;
- Length = length;
- }
-
- ///
- /// Gets the start.
- ///
- ///
- /// The start.
- ///
- public int Start { get; }
-
- ///
- /// Gets the length.
- ///
- ///
- /// The length.
- ///
- public int Length { get; }
-
- ///
- /// Gets the end.
- ///
- ///
- /// The end.
- ///
- public int End => Start + Length - 1;
-
- ///
- /// Returns a specified number of contiguous elements from the start of the slice.
- ///
- /// The number of elements to return.
- /// A that contains the specified number of elements from the start of this slice.
- public TextRange Take(int length)
- {
- if (length > Length)
- {
- throw new ArgumentOutOfRangeException(nameof(length));
- }
-
- return new TextRange(Start, length);
- }
-
- ///
- /// Bypasses a specified number of elements in the slice and then returns the remaining elements.
- ///
- /// The number of elements to skip before returning the remaining elements.
- /// A that contains the elements that occur after the specified index in this slice.
- public TextRange Skip(int length)
- {
- if (length > Length)
- {
- throw new ArgumentOutOfRangeException(nameof(length));
- }
-
- return new TextRange(Start + length, Length - length);
- }
- }
-}
diff --git a/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/MultiBufferTextSource.cs b/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/MultiBufferTextSource.cs
index 7bde885502..0d2da06a05 100644
--- a/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/MultiBufferTextSource.cs
+++ b/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/MultiBufferTextSource.cs
@@ -1,4 +1,5 @@
-using Avalonia.Media.TextFormatting;
+using System;
+using Avalonia.Media.TextFormatting;
namespace Avalonia.Skia.UnitTests.Media.TextFormatting
{
@@ -14,8 +15,6 @@ namespace Avalonia.Skia.UnitTests.Media.TextFormatting
_runTexts = new[] { "A123456789", "B123456789", "C123456789", "D123456789", "E123456789" };
}
- public static TextRange TextRange => new TextRange(0, 50);
-
public TextRun? GetTextRun(int textSourceIndex)
{
if (textSourceIndex >= 50)