Collapse Sidebar




The Font property selects one of several pre-defined Enum/Font|fonts with which the UI element will render its text. Some fonts have bold, italic and/or light variants (as there is no font-weight or font-style properties).

With the exception of the “Legacy” font, each font will render text with the line height equal to the TextBox/TextSize property. The “Code” font is the only monospace font. It has the unique property that each character has the exact same width and height ratio of 1:2. The width of each character is approximately half the TextBox/TextSize property.

Code Samples

Cycle Font

This code sample sets a parent TextLabel’s Font and Text properties to all the different fonts available.

local textLabel = script.Parent

while true do
	-- Iterate over all the different fonts
	for i, font in pairs(Enum.Font:GetEnumItems()) do
		textLabel.Font = font
		textLabel.Text = font.Name

Show All Fonts

This code sample renders a list of all the available fonts.

local frame = script.Parent

-- Create a TextLabel displaying each font
for i, font in pairs(Enum.Font:GetEnumItems()) do
	local tl = Instance.new("TextLabel")
	tl.Name = font.Name
	-- Set the text properties
	tl.Text = font.Name
	tl.Font = font
	-- Some rendering properties
	tl.TextSize = 24
	tl.TextXAlignment = Enum.TextXAlignment.Left
	-- Size the frame equal to the height of the text
	tl.Size = UDim2.new(1, 0, 0, tl.TextSize)
	-- Add to the parent frame
	tl.Parent = frame

-- Layout the frames in a list (if they aren't already)
if not frame:FindFirstChildOfClass("UIListLayout") then
	Instance.new("UIListLayout", frame)