guiGetFont | Multi Theft Auto: Wiki Skip to content

guiGetFont

Client-side
Server-side
Shared

Pair: guiSetFont

This function is used to get the current font that is used to draw text in GUI elements.

OOP Syntax Help! I don't understand this!

Syntax

string|false, ​gui-font guiGetFont ( ​gui-element guiElement )
Required arguments
  • guiElement: Element you wish to get the font of.

Returns

Returns a string containing the name of the element's current font and the custom GUI font that is used, or nil for default fonts. Returns false if the gui element passed to the function is invalid.

  • string|false: font name
  • gui-font: font element

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