// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System; namespace SixLabors.Fonts.Unicode { /// /// Represents a Unicode grapheme cluster and metadata derived while enumerating it. /// public readonly ref struct GraphemeCluster { /// /// Initializes a new instance of the struct. /// /// The UTF-16 span containing the grapheme cluster. /// The UTF-16 offset of the cluster in the original source. /// The number of Unicode scalar values in the cluster. /// The policy-resolved terminal cell width of the cluster. /// The cluster flags derived while scanning the cluster. /// The first code point in the cluster. public GraphemeCluster( ReadOnlySpan span, int utf16Offset, int codePointCount, int terminalCellWidth, GraphemeClusterFlags flags, CodePoint firstCodePoint) { this.Span = span; this.Utf16Offset = utf16Offset; this.CodePointCount = codePointCount; this.Utf16Length = span.Length; this.TerminalCellWidth = terminalCellWidth; this.Flags = flags; this.FirstCodePoint = firstCodePoint; } /// /// Gets the UTF-16 span containing the grapheme cluster. /// public ReadOnlySpan Span { get; } /// /// Gets the UTF-16 offset of the cluster in the original source. /// public int Utf16Offset { get; } /// /// Gets the UTF-16 length of the cluster. /// public int Utf16Length { get; } /// /// Gets the number of Unicode scalar values in the cluster. /// public int CodePointCount { get; } /// /// Gets the policy-resolved terminal cell width of the cluster. /// public int TerminalCellWidth { get; } /// /// Gets the cluster flags derived while scanning the cluster. /// public GraphemeClusterFlags Flags { get; } /// /// Gets the first code point in the cluster. /// public CodePoint FirstCodePoint { get; } } }