// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System.Numerics; namespace SixLabors.Fonts { /// /// Encapsulates measured metrics for a single laid-out text line. /// public readonly struct LineMetrics { /// /// Initializes a new instance of the struct. /// /// The ascender line position within the line box. /// The baseline position within the line box. /// The descender line position within the line box. /// The total line-box size for this line. /// The logical line box start position in pixel units. /// The logical line box extent in pixel units. /// The UTF-16 index in the original text where this line begins. /// The grapheme index in the original text where this line begins. /// The number of graphemes in the line. /// The offset of this line's first grapheme metrics entry. internal LineMetrics( float ascender, float baseline, float descender, float lineHeight, Vector2 start, Vector2 extent, int stringIndex, int graphemeIndex, int graphemeCount, int graphemeOffset) { this.Ascender = ascender; this.Baseline = baseline; this.Descender = descender; this.LineHeight = lineHeight; this.Start = start; this.Extent = extent; this.StringIndex = stringIndex; this.GraphemeIndex = graphemeIndex; this.GraphemeCount = graphemeCount; this.GraphemeOffset = graphemeOffset; } /// /// Gets the ascender line position within the line box. /// /// /// This is a position value (not a baseline-relative distance). /// Use this value to draw the ascender guide line relative to the current line origin. /// public float Ascender { get; } /// /// Gets the baseline position within the line box. /// /// /// Use this value as the guide-line position for drawing a baseline relative to the current line origin. /// public float Baseline { get; } /// /// Gets the descender line position within the line box. /// /// /// This is a position value (not a baseline-relative distance). /// Use this value to draw the descender guide line relative to the current line origin. /// public float Descender { get; } /// /// Gets the total line-box size for this line. /// public float LineHeight { get; } /// /// Gets the logical line box start position in pixel units. /// public Vector2 Start { get; } /// /// Gets the logical line box extent in pixel units. /// public Vector2 Extent { get; } /// /// Gets the zero-based UTF-16 code unit index in the original text. /// public int StringIndex { get; } /// /// Gets the zero-based grapheme index in the original text. /// public int GraphemeIndex { get; } /// /// Gets the number of graphemes in the line. /// public int GraphemeCount { get; } /// /// Gets the offset of this line's first entry in the flattened grapheme metrics buffer. /// internal int GraphemeOffset { get; } } }