DgsSetFont: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(DGS (OOP Syntax)/(Template Organization) Mission)
Line 6: Line 6:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dgsSetFont( element dgsElement, mixed font )
bool dgsSetFont( element dgsElement, mixed font )
</syntaxhighlight>  
</syntaxhighlight>
{{DGS/OOP||DGSElement:setFont||font|dgsGetFont}}


===Required Arguments===
===Required Arguments===
Line 26: Line 27:
</syntaxhighlight>
</syntaxhighlight>


==See Also==
=See Also=
{{DGSFUNCTIONS}}
 
==<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Functions</span>==
{{DGS General Functions}}
 
==<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Events</span>==
{{DGS Events/General}}

Revision as of 18:13, 19 April 2021

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!

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