Vixen
02b45cc4
csharp
public sealed class FontDocument

A font asset, open for editing.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ The face is loaded here and disposed with the document. FontFace owns native memory, a panel's factory runs again on every reopen, and a face loaded by a view would leak one per reopen — which for a font is megabytes.

⚠ A face that will not load is reported and the document still opens. Editing the chain of a font whose primary has been deleted is exactly when somebody needs this panel.

Fields and properties (7)

  • public const string Extension

    What a font asset is written as.

  • public string AssetPath

    Where the file is, absolute.

  • public FontAsset Font

    The asset.

  • public string? LoadError

    Why the file would not read, or .

  • public FontFace? Face

    The primary face, or when it would not load.

  • public IReadOnlyList<FontFace> Fallbacks

    The fallback faces that loaded, in order.

  • public IReadOnlyList<string> Problems

    What loading the faces had to say.

Events (1)

  • public Action<FontDocument>? Changed

    Raised after anything changes the asset.

Methods (8)

  • public FontDocument(EditorProject project, AssetId asset, string path)

    Opens a font asset.

  • public void Resolve()

    Loads the faces the asset names, replacing whatever was loaded before.

  • public void Edit(string name, Action<FontAsset> change, bool reloads = false)

    Replaces the asset, undoably.

  • public IReadOnlyList<FontCoverage> Coverage(bool includeFallbacks = true)

    How much of each Unicode block the chain covers.

  • public bool Supports(int codePoint, bool includeFallbacks = true)

    Whether the chain has a glyph for a code point.

  • public int Resolves(int codePoint)

    Which face in the chain draws a code point, or −1 for none.

  • protected override void SaveCore()

    Writes the document back to wherever it came from.

  • protected override void OnClosed()

    Called once when the document leaves the project.

Used by (3)

  • FontAtlasViewVixen.Editor.AssetEditors
  • FontEditorFactoryVixen.Editor.AssetEditors
  • FontViewVixen.Editor.AssetEditors