Skip to main content

FontFamily

Overrides the default font family inherited by descendent components with text.

modifier FontFamily
import { FontFamily, Text, VStack, load_font } from ui

var custom_font = load_font(["Nunito-Regular.ttf"])

export var main = VStack {
Text("Default")

VStack {
Text("Overriden")
Text("Overriden")
} with {
FontFamily(custom_font)
}
}

FontFamily Example

Constructors

(_ family)

_ family: FontFamilyName?

An optional font family. To let text inherit the default font family defined above this modifier provide nil.