Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

API FontString GetStringHeight

Last wiki revision 2020-04-05

Returns how tall the string would be, in pixels, without wrapping: Height= MyFontString:GetStringHeight;

  • The height of the text will take into account manually set line breaks ("\n" characters).
  • This does not necessarily correlate with the height of the FontString object, see the FontString object information for details.
  • If you want to use this to set the height of a FontString object after setting its text, you will need to make sure the initial size of the FontString object is big enough to allow the text. EXAMPLE: If the object will fit 2 lines, and you set the text to a 4 line string, the string will be truncated with "..." when it is set by SetText, and this function will return the height of 2 lines of text instead of 4.

MyFrameText:SetHeight(1000); -- Arbitrary number, this is about 83 lines of text, assuming ~12 pixels each MyFrameText:SetText("This\nIs\Four\nLines"); MyFrameText:SetHeight(MyFrameText:GetStringHeight); print(MyFrameText:GetHeight; -- We will see that the new frame height is about 48.

Source

https://warcraft.wiki.gg/wiki/API_FontString_GetStringHeight · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.