WoW:API FontString SetText: Difference between revisions
Jump to navigation
Jump to search
(Updated with new information) |
m (Move page script moved page API FontString SetText to API FontString SetText without leaving a redirect) |
||
(One intermediate revision by one other user not shown) | |||
Line 7: | Line 7: | ||
== Description == | == Description == | ||
Sets the text to be displayed in the fontstring. The text will have the color given to it via the fontinstance definition (or a FontString:SetTextColor call). You may however use [[UI_Escape_Sequences|escape sequences]] to modify the string's appearance. | Sets the text to be displayed in the fontstring. The text will have the color given to it via the fontinstance definition (or a [[API_FontString_SetTextColor|FontString:SetTextColor]] call). You may however use [[UI_Escape_Sequences|escape sequences]] to modify the string's appearance. | ||
NOTE: FontString has a limit of ~4000 chars. | NOTE: FontString has a limit of ~4000 chars. |
Latest revision as of 04:45, 15 August 2023
← Widget API ← FontString < SetText
Synopsis[edit]
FontString:SetText(string text)
Description[edit]
Sets the text to be displayed in the fontstring. The text will have the color given to it via the fontinstance definition (or a FontString:SetTextColor call). You may however use escape sequences to modify the string's appearance.
NOTE: FontString has a limit of ~4000 chars.
Examples[edit]
FontString:SetText('|cff000000This text is black,|r |cffff0000while this text will be red.|r')
will return
This text is black, while this text will be red.
- Notes
- The Font must be set before calling this function. This is not done for you if the FontString is created via Frame:CreateFontString. There are 3 ways to ensure the Font is set:
- Send in an inheritsFrom value to Frame:CreateFontString.
- Set the inheritsFrom via FontInstance:SetFontObject.
- Set the font directly via FontInstance:SetFont.