LavaUI docs GitHub

struct FontFallback

Swift

struct FontFallback

A fallback face named rather than loaded.

The chain a primary consults is spelled as file paths because loading one is the expensive part of starting up, and most of it is never needed: opening a face reads the whole file and hashes it for its content address, which for the two faces a terminal wants — a 12 MiB Nerd Font and a 19 MiB CJK collection — was ~250 ms spent twice, once in the client to shape with and once in the compositor to rasterize with, before the window existed. A shell prompt needs none of it.

So the chain is names, and UIFont.fallbackFace turns one into a face the first time a character misses everything ahead of it. A terminal that never prints braille never loads Iosevka; one that never prints Chinese never loads Noto CJK.

Sources/LavaUI/Font.swift:907

Constructors

init(path: String, pixelSize: Float)

Names a fallback face; nothing is read until a character needs it.

Sources/LavaUI/Font.swift:914

Properties

var name: String { get }

Just the file name, for logs.

Sources/LavaUI/Font.swift:920

let path: String

The font file.

Sources/LavaUI/Font.swift:909

let pixelSize: Float

The size to load it at, in pixels.

Sources/LavaUI/Font.swift:911