// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System;
namespace SixLabors.Fonts.Unicode {
///
/// Represents a segment between two Unicode word boundaries.
///
public readonly ref struct WordSegment
{
///
/// Initializes a new instance of the struct.
///
/// The UTF-16 span containing the word-boundary segment.
/// The UTF-16 offset of the segment in the original source.
/// The code point offset of the segment in the original source.
/// The number of Unicode scalar values in the segment.
public WordSegment(
ReadOnlySpan span,
int utf16Offset,
int codePointOffset,
int codePointCount)
{
this.Span = span;
this.Utf16Offset = utf16Offset;
this.Utf16Length = span.Length;
this.CodePointOffset = codePointOffset;
this.CodePointCount = codePointCount;
}
///
/// Gets the UTF-16 span containing the word-boundary segment.
///
public ReadOnlySpan Span { get; }
///
/// Gets the UTF-16 offset of the segment in the original source.
///
public int Utf16Offset { get; }
///
/// Gets the UTF-16 length of the segment.
///
public int Utf16Length { get; }
///
/// Gets the code point offset of the segment in the original source.
///
public int CodePointOffset { get; }
///
/// Gets the number of Unicode scalar values in the segment.
///
public int CodePointCount { get; }
}
}