Skip to content

Font

Font registration and loading helpers for Lilia UI and HUD text.


Overview

The font library centralizes registered font definitions under `lia.font`. It registers default Montserrat faces, creates configurable Lilia UI and HUD font aliases, exposes available font faces for configuration, reloads stored fonts on the client, and lazily creates missing `surface.SetFont` font variants when they are first requested.

lia.font.loadFonts()View Source

Purpose

Recreates every stored font definition on the client using `surface.CreateFont`.

Realm

Client

Example Usage

  lia.font.loadFonts()

lia.font.register(fontName, fontData)View Source

Purpose

Registers a font definition under `lia.font.stored` and creates it immediately on the client.

Realm

Shared

Parameters

string fontName The name used to reference the font through Garry's Mod font APIs.

table fontData The font definition table passed to `surface.CreateFont` on the client.

Returns

nil|any Returns the result of `lia.error(L("invalidFont"))` when the font name or data is invalid. Otherwise, this function has no explicit return value.

Example Usage

  lia.font.register("LiliaCustomFont", {
      font = "Montserrat Medium",
      size = 20,
      extended = true,
      antialias = true,
      weight = 500
  })

lia.font.getAvailableFonts()View Source

Purpose

Returns unique registered font face names that can be shown as selectable font configuration options.

Realm

Shared

Returns

table A sorted list of unique font face names, excluding Lilia-generated configuration aliases.

Example Usage

  local fonts = lia.font.getAvailableFonts()

lia.font.getBoldFontName(fontName)View Source

Purpose

Derives the bold font face name for a given font name.

Realm

Shared

Parameters

string fontName The base font face name to convert to its bold variant.

Returns

string The derived bold font face name.

Example Usage

  local boldFont = lia.font.getBoldFontName("Montserrat Medium")

lia.font.registerFonts(fontName)View Source

Purpose

Registers the default Montserrat faces, core Lilia font aliases, HUD font aliases, and generated size variants.

Realm

Shared

Parameters

string fontName optional Optional main interface font. When omitted, the value from the `Font` configuration is used.

Example Usage

  lia.font.registerFonts("Montserrat Medium")

Hooks

Library-specific hooks documented for this library.


PostLoadFonts(mainFont, fontName)View Source

Purpose

Runs after `lia.font.registerFonts` finishes registering the standard font aliases and generated size variants.

Realm

Shared

Parameters

string mainFont The configured main interface font used for Lilia font aliases.

string fontName The second font argument passed by this library. It currently receives the same value as `mainFont`.


RefreshFonts()View Source

Purpose

Runs when font-dependent UI should reload or repaint after font configuration is initialized or changed.

Realm

Client