DgsSetFont

From Multi Theft Auto: Wiki
(Redirected from DgsDxGUISetFont)
Jump to navigation Jump to search

This function sets the font of a dgs element to be used when drawing text. a dgs font can be affected by dgsSetSystemFont

Syntax

bool dgsSetFont( element dgsElement, mixed font )

DGS OOP Syntax Help! I don't understand this!

Method: DGSElement:setFont(...)
Variable: .font
Counterpart: dgsGetFont

Required Arguments

  • dgsElement: The DGS element you wish to change the font of
  • font: Either a custom dx font element or the name of a built-in dx font (see here Standard_DGS_Font_Names)

Returns

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

Example

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

DGS = exports.dgs
-- We create a dummy gui label to get text of
local dummyGUIElement = DGS:dgsCreateLabel ( 0.45, 0.48, 0.10, 0.04, "Hello world", true )
DGS:dgsSetFont ( dummyGUIElement, "clear" )
-- Output the font of the label to chat box
outputChatBox ( "Font used in the DGS label: " .. DGS:dgsGetFont ( dummyGuiElement ) )

See Also

General Functions

General Events