// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
namespace SixLabors.Fonts {
///
/// Represents one coalesced grapheme in final layout order.
///
public readonly struct GraphemeMetrics
{
///
/// Initializes a new instance of the struct.
///
/// The positioned logical advance rectangle for the grapheme in pixel units.
/// The rendered glyph bounds for the grapheme in pixel units.
/// The union of the positioned logical advance bounds and rendered glyph bounds in pixel units.
/// The font used to shape and render the grapheme.
/// The grapheme index in the original text.
/// The UTF-16 index in the original text where the grapheme begins.
/// The resolved bidi embedding level.
/// Whether the grapheme represents a line break.
internal GraphemeMetrics(
FontRectangle advance,
FontRectangle bounds,
FontRectangle renderableBounds,
Font font,
int graphemeIndex,
int stringIndex,
int bidiLevel,
bool isLineBreak)
{
this.Advance = advance;
this.Bounds = bounds;
this.RenderableBounds = renderableBounds;
this.Font = font;
this.GraphemeIndex = graphemeIndex;
this.StringIndex = stringIndex;
this.BidiLevel = bidiLevel;
this.IsLineBreak = isLineBreak;
}
///
/// Gets the positioned logical advance rectangle for the grapheme in pixel units.
///
public FontRectangle Advance { get; }
///
/// Gets the rendered glyph bounds for the grapheme in pixel units.
///
public FontRectangle Bounds { get; }
///
/// Gets the union of the positioned logical advance bounds and rendered glyph bounds in pixel units.
///
public FontRectangle RenderableBounds { get; }
///
/// Gets the font used to shape and render the grapheme.
///
public Font Font { get; }
///
/// Gets the zero-based grapheme index in the original text.
///
public int GraphemeIndex { get; }
///
/// Gets the zero-based UTF-16 code unit index in the original text.
///
public int StringIndex { get; }
///
/// Gets the resolved bidi embedding level.
///
internal int BidiLevel { get; }
///
/// Gets a value indicating whether this grapheme represents a line break.
///
public bool IsLineBreak { get; }
}
}