Font System

Core Systems Updated: Dec 10, 2025

Font System

Create resolution-aware fonts that scale properly on all screen sizes.

cLib.CreateFont

cLib.CreateFont(fontID, fontName, size, weight, is3D2D)

Parameters:

ParameterTypeDescription
fontIDstringUnique identifier
fontNamestringSystem font name
sizenumber0-1 for screen %, or absolute
weightnumberFont weight (default: 500)
is3D2DbooleanUse absolute size for 3D2D

Screen-Relative Fonts

For UI fonts, use values between 0 and 1 representing percentage of screen height:

-- 3% of screen height (large title)
cLib.CreateFont("MyAddon.Title", "Roboto", 0.03, 600)

-- 2% of screen height (subtitle)
cLib.CreateFont("MyAddon.Subtitle", "Roboto", 0.02, 500)

-- 1.5% of screen height (body text)
cLib.CreateFont("MyAddon.Text", "Roboto", 0.015)

-- 1.2% of screen height (small text)
cLib.CreateFont("MyAddon.Small", "Roboto", 0.012)

Size Reference (at 1080p)

PercentagePixelsUse Case
0.03~32pxLarge titles
0.025~27pxSection headers
0.02~22pxSubtitles
0.016~17pxBody text
0.014~15pxInput text
0.012~13pxSmall text

3D2D Fonts

For 3D2D rendering (world text), use absolute pixel sizes:

-- Fixed size for 3D2D text
cLib.CreateFont("MyAddon.WorldTitle", "Bebas Neue", 90, 500, true)
cLib.CreateFont("MyAddon.WorldText", "Arial", 48, 400, true)

Usage

-- In paint functions
draw.SimpleText("Hello World", "MyAddon.Title", x, y, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)

-- Get text size
surface.SetFont("MyAddon.Title")
local w, h = surface.GetTextSize("Hello World")

Built-in Fonts

"cLib.FrameTitle"   -- Bebas Neue, 3%
"cLib.Title"        -- Roboto, 2.2%, weight 600
"cLib.SubTitle"     -- Roboto, 1.6%, weight 500
"cLib.Text"         -- Roboto, 1.4%
"cLib.Small"        -- Roboto, 1.2%
"cLib.Input"        -- Roboto, 1.4%
"cLib.Button"       -- Roboto, 1.5%, weight 500
"cLib.Toggle"       -- Roboto, 1.0%, weight 500

Included Font

cLib includes Bebas Neue font automatically:

cLib.CreateFont("MyAddon.BigTitle", "Bebas Neue", 0.05)