Table of Contents

Class StylesheetFont

Namespace
Myra.Graphics2D.UI.Styles
Assembly
Myra.dll

Represents a font definition within a stylesheet, including file path and optional size.

[XmlName("Font")]
public class StylesheetFont : IItemWithId
Inheritance
StylesheetFont
Implements
Inherited Members

Properties

File

Gets or sets the file path to the font file.

public string File { get; set; }

Property Value

string

Font

Gets or sets the loaded sprite font instance.

public SpriteFontBase Font { get; }

Property Value

SpriteFontBase

Id

Gets or sets the identifier for this font.

public string Id { get; set; }

Property Value

string

Size

Gets or sets the font size (only used for TTF and OTF fonts).

public float? Size { get; set; }

Property Value

float?

Methods

BuildFontFileKey()

Builds a font file key combining the file name and size.

public string BuildFontFileKey()

Returns

string

The font file key for caching and lookup.

Clone()

Creates a deep copy of this stylesheet font.

public StylesheetFont Clone()

Returns

StylesheetFont

A new StylesheetFont instance with the same properties.

ToString()

Returns the font identifier.

public override string ToString()

Returns

string

The font ID.

Validate()

Validates that all required properties are set and valid for the font type.

public void Validate()

Exceptions

Exception

Thrown when required properties are missing or invalid.