crystal.ui.font

Returns a previously registered font.

This function will error if no font has been registered under the requested name.

Usage

crystal.ui.font(name)

Arguments

Name Type Description
name string Font name.

Returns

Name Type Description
font love.Font Font object.

Examples

Registering and retrieving custom fonts:

crystal.ui.register_font("dialog_xs", love.graphics.newFont("assets/comic_sans.ttf", 12));
crystal.ui.register_font("dialog_sm", love.graphics.newFont("assets/comic_sans.ttf", 14));
crystal.ui.register_font("dialog_md", love.graphics.newFont("assets/comic_sans.ttf", 16));

local font = crystal.ui.font("dialog_md");

Retrieving a built-in font:

local font = crystal.ui.font("crystal_regular_sm");

This site uses Just the Docs, a documentation theme for Jekyll.