Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ jobs:
**/msbuild.binlog

- name: Codecov Update
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
if: matrix.options.codecov == true && startsWith(github.repository, 'SixLabors')
with:
flags: unittests

token: ${{ secrets.CODECOV_TOKEN }}

Publish:
needs: [Build]
Expand Down
83 changes: 83 additions & 0 deletions src/SixLabors.Fonts/LineMetrics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.

namespace SixLabors.Fonts;

/// <summary>
/// Encapsulates measured metrics for a single laid-out text line.
/// </summary>
/// <remarks>
/// <para>This type is layout-mode agnostic:</para>
/// <list type="bullet">
/// <item><description>Horizontal layouts: <see cref="Start"/> is the X start position and <see cref="Extent"/> is the width.</description></item>
/// <item><description>Vertical layouts: <see cref="Start"/> is the Y start position and <see cref="Extent"/> is the height.</description></item>
/// </list>
/// </remarks>
public readonly struct LineMetrics
{
/// <summary>
/// Initializes a new instance of the <see cref="LineMetrics"/> struct.
/// </summary>
/// <param name="ascender">Ascender line position within the line box.</param>
/// <param name="baseline">Baseline position within the line box.</param>
/// <param name="descender">Descender line position within the line box.</param>
/// <param name="lineHeight">Total line-box size (includes effective line spacing).</param>
/// <param name="start">Line start position in the primary layout flow direction after alignment.</param>
/// <param name="extent">Line extent in the primary layout flow direction.</param>
public LineMetrics(
float ascender,
float baseline,
float descender,
float lineHeight,
float start,
float extent)
{
this.Ascender = ascender;
this.Baseline = baseline;
this.Descender = descender;
this.LineHeight = lineHeight;
this.Start = start;
this.Extent = extent;
}

/// <summary>
/// Gets the ascender line position within the line box.
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
public float Ascender { get; }

/// <summary>
/// Gets the baseline position within the line box.
/// </summary>
/// <remarks>
/// Use this value as the guide-line position for drawing a baseline relative to the current line origin.
/// </remarks>
public float Baseline { get; }

/// <summary>
/// Gets the descender line position within the line box.
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
public float Descender { get; }

/// <summary>
/// Gets the total line-box size for this line.
/// </summary>
public float LineHeight { get; }

/// <summary>
/// Gets the line start position in the primary layout flow direction.
/// </summary>
public float Start { get; }

/// <summary>
/// Gets the line extent in the primary layout flow direction.
/// </summary>
public float Extent { get; }
}
Loading
Loading