guiSetFont | Multi Theft Auto: Wiki Skip to content

guiSetFont

Client-side
Server-side
Shared

Pair: guiGetFont

This function sets the font of a gui element to be used when drawing text.

OOP Syntax Help! I don't understand this!

Syntax

bool guiSetFont ( ​gui-element guiElement, ​gui-font/string font )
Required arguments
  • guiElement: The GUI element you wish to change the font of.
  • font: Either a custom GUI font element or the name of a built-in GUI font.
    • default-normal
    • default-small
    • default-bold-small
    • clear-normal
    • sa-header
    • sa-gothic

Returns

Returns true if the font has been successfully set on the gui element, false otherwise.

  • bool: result

Code Examples

client

This example sets and gets the font of a pre-made gui element and outputs it to chat box.

-- We create a dummy gui label to get text of
local dummyGUIElement = guiCreateLabel(0.45, 0.48, 0.10, 0.04, "Hello world", true)
guiSetFont(dummyGUIElement, "sa-gothic")
-- Output the font of the label to chat box
outputChatBox("Font used in the GUI label: " .. guiGetFont(dummyGuiElement))

See Also

GUI Functions