DgsSetFont: Difference between revisions
Jump to navigation
Jump to search
m (Thisdp moved page DgsDxGUISetFont to DgsSetFont) |
m (DGS OOP Syntax changing) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Client function}} | {{Client function}} | ||
__NOTOC__ | __NOTOC__ | ||
This function sets the font of a dgs element to be used when drawing text. | This function sets the font of a dgs element to be used when drawing text. '''a dgs font can be affected by [[dgsSetSystemFont]]''' | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool | bool dgsSetFont( element dgsElement, mixed font ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{DGS/OOP| | |||
Method = DGSElement:setFont| | |||
Variable = font| | |||
Counterpart = dgsGetFont | |||
}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''dgsElement:''' The DGS element you wish to change the font of | *'''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 ( | *'''font:''' Either a custom dx font element or the name of a built-in dx font (see here [[Standard_DGS_Font_Names]]) | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the font has been successfully set on the dgs element, ''false'' otherwise. | Returns ''true'' if the font has been successfully set on the dgs element, ''false'' otherwise. | ||
Line 19: | Line 25: | ||
DGS = exports.dgs | DGS = exports.dgs | ||
-- We create a dummy gui label to get text of | -- We create a dummy gui label to get text of | ||
local dummyGUIElement = DGS: | local dummyGUIElement = DGS:dgsCreateLabel ( 0.45, 0.48, 0.10, 0.04, "Hello world", true ) | ||
DGS: | DGS:dgsSetFont ( dummyGUIElement, "clear" ) | ||
-- Output the font of the label to chat box | -- Output the font of the label to chat box | ||
outputChatBox ( "Font used in the DGS label: " .. DGS: | outputChatBox ( "Font used in the DGS label: " .. DGS:dgsGetFont ( dummyGuiElement ) ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=See Also= | |||
{{ | |||
==<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}} |
Latest revision as of 21:19, 3 May 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!
- 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
- dgsGetPosition
- dgsSetPosition
- dgsSetParent
- dgsGetParent
- dgsGetChild
- dgsGetChildren
- dgsGetSize
- dgsSetSize
- dgsGetType
- dgsSetLayer
- dgsGetLayer
- dgsSetCurrentLayerIndex
- dgsGetCurrentLayerIndex
- dgsGetLayerElements
- dgsGetProperty
- dgsSetProperty
- dgsSetPropertyInherit
- dgsGetProperties
- dgsSetProperties
- dgsGetVisible
- dgsSetVisible
- dgsGetEnabled
- dgsSetEnabled
- dgsGetPositionAlignment
- dgsSetPositionAlignment
- dgsGetAlpha
- dgsSetAlpha
- dgsGetFont
- dgsSetFont
- dgsGetText
- dgsSetText
- dgsGetPostGUI
- dgsSetPostGUI
- dgsGetInputEnabled
- dgsSetInputEnabled
- dgsGetInputMode
- dgsSetInputMode
- dgsAttachToAutoDestroy
- dgsDetachFromAutoDestroy
- dgsFocus
- dgsBlur
- dgsCreateFont
- dgsBringToFront
- dgsMoveToBack
- dgsGetScreenSize
- dgsGetCursorPosition
- dgsGetMouseEnterGUI
- dgsGetMouseLeaveGUI
- dgsIsMouseWithinGUI
- dgsSetSystemFont
- dgsGetSystemFont
- dgsGetElementsInLayer
- dgsGetElementsFromResource
- dgsGetFocusedGUI
- dgsImportFunction
- dgsImportOOPClass
- dgsG2DLoadHooker
- dgsSetRenderSetting
- dgsGetRenderSetting
- dgsSimulateClick
- dgsGetRootElement
- dgsAddMoveHandler
- dgsRemoveMoveHandler
- dgsIsMoveHandled
- dgsAddSizeHandler
- dgsRemoveSizeHandler
- dgsIsSizeHandled
- dgsAttachElements
- dgsDetachElements
- dgsElementIsAttached
- dgsAddPropertyListener
- dgsRemovePropertyListener
- dgsGetListenedProperties
- dgsSetMultiClickInterval
- dgsGetMultiClickInterval
- dgsSetMouseStayDelay
- dgsGetMouseStayDelay
- dgsCenterElement
- dgsSetElementKeeperEnabled
- dgsGetElementKeeperEnabled
- dgsSetClickingSound
- dgsGetClickingSound
- dgsSetClickingSoundVolume
- dgsGetClickingSoundVolume
General Events
- onDgsBlur
- onDgsCreate
- onDgsCursorTypeChange
- onDgsCursorStateChange
- onDgsDestroy
- onDgsElementRender
- onDgsElementMove
- onDgsElementSize
- onDgsElementEnter
- onDgsElementLeave
- onDgsFocus
- onDgsKey
- onDgsPositionChange
- onDgsPreRender
- onDgsRender
- onDgsElementScroll
- onDgsSizeChange
- onDgsTextChange
- onDgsWindowClose
- onDgsPropertyChange