DRAWING FUNCTIONS

PushFont

Sets the active font for subsequent text calls.

Syntax

ONYX.PushFont(fontId)

Parameters

  • fontId (number) — Handle returned by LoadFont or LoadFontFromBuffer.

Return(s)

None

Behavior

  • Pushes the font onto the per-coroutine font stack.
  • Affects subsequent DrawText, DrawTextCentered and GetTextWidth calls.
  • Use size_px 0 in DrawText to render at the font native size.

Example(s)

local fontId = ONYX.LoadFont("C:/fonts/Inter.ttf", 18)
ONYX.PushFont(fontId)
ONYX.BeginFrame()
ONYX.DrawText(100, 100, "ONYXS", 0, 1, 1, 1, 1)
ONYX.SubmitFrame()
ONYX.PopFont()