API:LabelSetFont
From RoR Wiki
UI Lua API · Label functions
Version: WAR 1.4.8
Changes the font of a Label.
LabelSetFont(labelName, fontName, lineSpacing)
Arguments
- labelName
string– Name of a Label window.- fontName
string– Name of the font, for example"font_default_text_large". These are the names used with thefontattribute in XML.- lineSpacing
number– Required, but not used by the client. The stock UI passesWindowUtils.FONT_DEFAULT_TEXT_LINESPACING(20).
Returns
Nothing.
Details
- All three arguments must be given.
lineSpacingis checked to be a number and then ignored. - If the font is the one the label already uses, nothing happens. Otherwise the label's text is laid out again with the new font.
- If no font has the given name, the label is left unchanged and the client reports
ERROR: Invalid font definition for Label %s (%s)(label name, font name).
Errors
Error in function call 'LabelSetFont': Window %s does not existError in function call 'LabelSetFont': Window %s is not a LabelERROR: Invalid font definition for Label %s (%s)
Example
From easystem_eventtext/source/system_eventtext.lua:
LabelSetFont( self:GetName(), "font_default_text_huge", WindowUtils.FONT_DEFAULT_TEXT_LINESPACING )
