// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System; using System.Diagnostics; namespace SixLabors.Fonts { /// /// Represents a single variation axis setting for a variable font, /// consisting of a four-character tag and a value. /// /// /// Follows CSS font-variation-settings semantics. /// Values are clamped to the axis range defined in the font's fvar table. /// [DebuggerDisplay("Tag: {Tag}, Value: {Value}")] public readonly struct FontVariation { /// /// Initializes a new instance of the struct. /// /// The four-character axis tag (e.g. "wght", "wdth", "opsz"). /// The axis value in design-space units. public FontVariation(string tag, float value) { Guard.NotNullOrWhiteSpace(tag, nameof(tag)); if (tag.Length != 4) { throw new ArgumentException("Variation axis tag must be exactly 4 characters.", nameof(tag)); } this.Tag = tag; this.Value = value; } /// /// Gets the four-character axis tag identifying the design variation. /// public string Tag { get; } /// /// Gets the axis value in design-space units. /// public float Value { get; } } }