Browse Source

[Text] a bit better usage of Codepoint.ReadAt

pull/9928/head
Sergey Mikolaitis 4 years ago
parent
commit
80972e5f5b
  1. 2
      src/Avalonia.Base/Media/TextFormatting/Unicode/Codepoint.cs
  2. 2
      src/Avalonia.Base/Media/TextFormatting/Unicode/CodepointEnumerator.cs
  3. 2
      src/Avalonia.Base/Media/TextFormatting/Unicode/GraphemeEnumerator.cs
  4. 2
      tests/Avalonia.UnitTests/MockTextShaperImpl.cs

2
src/Avalonia.Base/Media/TextFormatting/Unicode/Codepoint.cs

@ -231,7 +231,7 @@ namespace Avalonia.Media.TextFormatting.Unicode
/// <param name="index">The index to read at.</param>
/// <param name="count">The count of character that were read.</param>
/// <returns></returns>
public static Codepoint ReadAt(ReadOnlySpan<char> text, int index, out int count)
public static Codepoint ReadAt(CharacterBufferRange text, int index, out int count)
{
count = 1;

2
src/Avalonia.Base/Media/TextFormatting/Unicode/CodepointEnumerator.cs

@ -30,7 +30,7 @@ namespace Avalonia.Media.TextFormatting.Unicode
return false;
}
Current = Codepoint.ReadAt(_text.Span, 0, out var count);
Current = Codepoint.ReadAt(_text, 0, out var count);
_text = _text.Skip(count);

2
src/Avalonia.Base/Media/TextFormatting/Unicode/GraphemeEnumerator.cs

@ -245,7 +245,7 @@ namespace Avalonia.Media.TextFormatting.Unicode
if (CurrentCodeUnitOffset < _buffer.Length)
{
CurrentCodepoint = Codepoint.ReadAt(_buffer.Span, CurrentCodeUnitOffset,
CurrentCodepoint = Codepoint.ReadAt(_buffer, CurrentCodeUnitOffset,
out _codeUnitLengthOfCurrentScalar);
}
else

2
tests/Avalonia.UnitTests/MockTextShaperImpl.cs

@ -18,7 +18,7 @@ namespace Avalonia.UnitTests
{
var glyphCluster = i + text.OffsetToFirstChar;
var codepoint = Codepoint.ReadAt(characterBufferRange.Span, i, out var count);
var codepoint = Codepoint.ReadAt(characterBufferRange, i, out var count);
var glyphIndex = typeface.GetGlyph(codepoint);

Loading…
Cancel
Save