GuiSetFont: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__
__NOTOC__
This function sets the font of a GUI element to be used when drawing text.
This function sets the font of a [[GUI_widgets|GUI element]] to be used when drawing text.


==Syntax==  
==Syntax==  
Line 10: Line 10:
===Required Arguments===
===Required Arguments===
*'''guiElement:''' The GUI element you wish to change the font of
*'''guiElement:''' The GUI element you wish to change the font of
*'''font:''' The font name. See [[GUI Fonts]]
*'''font:''' The font name. See [[Standard GUI Font Names]]
{{New feature|3.0110|1.1|
{{New feature|3.0110|1.1|
*'''font:''' can also be a custom [[Gui_Font|GUI font]] [[element]] created with [[guiCreateFont]].
*'''font:''' can also be a custom [[Gui_Font|GUI font]] element created with [[guiCreateFont]].
}}
}}
===Returns===
===Returns===
Line 18: Line 18:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
<!-- Explain what the example is in a single sentence -->
This example sets and gets the font of a pre-made gui element and outputs it to chat box.
This example sets and gets the font of a pre-made gui element and outputs it to chat box.
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->

Revision as of 19:31, 24 June 2011

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

Syntax

bool guiSetFont ( element guiElement, string font )

Required Arguments

Returns

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

Example

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

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows