GuiCreateFont: Difference between revisions
Jump to navigation
Jump to search
OpenIDUser32 (talk | contribs) No edit summary |
mNo edit summary |
||
(7 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{Client function}} | {{Client function}} | ||
__NOTOC__ | __NOTOC__ | ||
This function creates a [[GUI font]] element that can be used in [[guiSetFont]]. Successful font creation is not guaranteed, and may fail due to hardware or memory limitations. | This function creates a [[GUI font]] element that can be used in [[guiSetFont]]. Successful font creation is not guaranteed, and may fail due to hardware or memory limitations. | ||
To see if creation is likely to fail, use [[dxGetStatus]]. (When ''' | To see if creation is likely to fail, use [[dxGetStatus]]. (When '''VideoMemoryFreeForMTA''' is zero, failure ''is'' guaranteed.) | ||
=====It is highly recommended that [[dxSetTestMode]] is used when writing and testing scripts using guiCreateFont .===== | =====It is highly recommended that [[dxSetTestMode]] is used when writing and testing scripts using guiCreateFont .===== | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
element guiCreateFont ( string filepath[ | element guiCreateFont ( string filepath, [ int size = 9 ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[Element/GUI font|GuiFont]]||}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''filepath:''' the name of the file containing the font | *'''filepath:''' the name of the file containing the font. | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
*'''size:''' size of the font | *'''size:''' size of the font. | ||
===Returns=== | ===Returns=== | ||
Line 44: | Line 44: | ||
==See Also== | ==See Also== | ||
{{GUI_functions}} | {{GUI_functions}} | ||
{{GUI_events}} | |||
[[en:guiCreateFont]] | |||
[[ru:guiCreateFont]] | |||
[[hu:guiCreateFont]] |
Latest revision as of 08:03, 30 October 2023
This function creates a GUI font element that can be used in guiSetFont. Successful font creation is not guaranteed, and may fail due to hardware or memory limitations.
To see if creation is likely to fail, use dxGetStatus. (When VideoMemoryFreeForMTA is zero, failure is guaranteed.)
It is highly recommended that dxSetTestMode is used when writing and testing scripts using guiCreateFont .
Syntax
element guiCreateFont ( string filepath, [ int size = 9 ] )
OOP Syntax Help! I don't understand this!
- Method: GuiFont(...)
Required Arguments
- filepath: the name of the file containing the font.
Optional Arguments
- size: size of the font.
Returns
Returns a GUI font element if successful, false if invalid arguments were passed to the function, or there is insufficient resources available.
You should always check to see if this function has returned false.
Example
-- Display a gui label local myLabel = guiCreateLabel( 100, 300, 400, 50, "GUI label", false ) -- Use 'toggle' command to switch custom font on and off addCommandHandler( "toggle", function() if not myFont then myFont = guiCreateFont( "segoeui.ttf", 20 ) -- Create GUI custom font guiSetFont( myLabel, myFont ) -- Apply font to a widget else destroyElement( myFont ) -- Destroy custom font myFont = nil end end )
See Also
General functions
- guiBringToFront
- getChatboxLayout
- getChatboxCharacterLimit
- guiCreateFont
- guiBlur
- guiFocus
- guiGetAlpha
- guiGetCursorType
- guiGetEnabled
- guiGetFont
- guiGetInputEnabled
- guiGetInputMode
- guiGetPosition
- guiGetProperties
- guiGetProperty
- guiGetScreenSize
- guiGetSize
- guiGetText
- guiGetVisible
- guiMoveToBack
- guiSetAlpha
- guiSetEnabled
- guiSetFont
- guiSetInputEnabled
- guiSetInputMode
- guiSetPosition
- guiSetProperty
- guiSetSize
- guiSetText
- guiSetVisible
- isChatBoxInputActive
- isConsoleActive
- isDebugViewActive
- isMainMenuActive
- isMTAWindowActive
- isTransferBoxActive
- setChatboxCharacterLimit
- setDebugViewActive
Browsers
Buttons
Checkboxes
Comboboxes
- guiCreateComboBox
- guiComboBoxAddItem
- guiComboBoxClear
- guiComboBoxGetItemCount
- guiComboBoxGetItemText
- guiComboBoxGetSelected
- guiComboBoxIsOpen
- guiComboBoxRemoveItem
- guiComboBoxSetItemText
- guiComboBoxSetOpen
- guiComboBoxSetSelected
Edit Boxes
- guiCreateEdit
- guiEditGetCaretIndex
- guiEditGetMaxLength
- guiEditIsMasked
- guiEditIsReadOnly
- guiEditSetCaretIndex
- guiEditSetMasked
- guiEditSetMaxLength
- guiEditSetReadOnly
Gridlists
- guiCreateGridList
- guiGridListAddColumn
- guiGridListAddRow
- guiGridListAutoSizeColumn
- guiGridListClear
- guiGridListGetColumnCount
- guiGridListGetColumnTitle
- guiGridListGetColumnWidth
- guiGridListGetHorizontalScrollPosition
- guiGridListGetItemColor
- guiGridListGetItemData
- guiGridListGetItemText
- guiGridListGetRowCount
- guiGridListGetSelectedCount
- guiGridListGetSelectedItem
- guiGridListGetSelectedItems
- guiGridListGetSelectionMode
- guiGridListIsSortingEnabled
- guiGridListGetVerticalScrollPosition
- guiGridListInsertRowAfter
- guiGridListRemoveColumn
- guiGridListRemoveRow
- guiGridListSetColumnTitle
- guiGridListSetColumnWidth
- guiGridListSetHorizontalScrollPosition
- guiGridListSetItemColor
- guiGridListSetItemData
- guiGridListSetItemText
- guiGridListSetScrollBars
- guiGridListSetSelectedItem
- guiGridListSetSelectionMode
- guiGridListSetSortingEnabled
- guiGridListSetVerticalScrollPosition
Memos
- guiCreateMemo
- guiMemoGetCaretIndex
- guiMemoGetVerticalScrollPosition
- guiMemoSetVerticalScrollPosition
- guiMemoIsReadOnly
- guiMemoSetCaretIndex
- guiMemoSetReadOnly
Progressbars
Radio Buttons
Scrollbars
Scrollpanes
- guiCreateScrollPane
- guiScrollPaneGetHorizontalScrollPosition
- guiScrollPaneGetVerticalScrollPosition
- guiScrollPaneSetHorizontalScrollPosition
- guiScrollPaneSetScrollBars
- guiScrollPaneSetVerticalScrollPosition
Static Images
Tab Panels
Tabs
Text Labels
- guiCreateLabel
- guiLabelGetColor
- guiLabelGetFontHeight
- guiLabelGetTextExtent
- guiLabelSetColor
- guiLabelSetHorizontalAlign
- guiLabelSetVerticalAlign
Windows
Input
GUI
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel