FontStrings are one of the two types of Region that is visible on the screen. It draws a block of text on the screen using the characteristics in an associated FontObject. You can change the text contents of it, set it to use a new FontObject, and set how it handles text that doesn't fit in its normal dimensions, such as how to wrap the text and whether to indent subsequent lines.
FontStrings are used widely through the UI, to display labels on controls, the names of units, keybindings on action buttons, health and mana values, and most other text data.
Defined Methods
- enabled = FontString:CanNonSpaceWrap() - Returns whether long lines of text will wrap within or between words
- enabled = FontString:CanWordWrap() - Returns whether long lines of text in the font string can wrap onto subsequent lines
- FontString:GetFieldSize() - This function is not yet documented
- FontString:GetIndentedWordWrap() - This function is not yet documented
- FontString:GetMaxLines() - This function is not yet documented
- height = FontString:GetStringHeight() - Returns the height of the text displayed in the font string
- width = FontString:GetStringWidth() - Returns the width of the text displayed in the font string
- text = FontString:GetText() - Returns the text currently set for display in the font string
- FontString:GetWrappedWidth() - This function is not yet documented
- FontString:IsTruncated() - Returns true if the text is truncated
- FontString:SetAlphaGradient(start, length) - Creates an opacity gradient over the text in the font string
- FontString:SetFormattedText("formatString", ...) - Sets the text displayed in the font string using format specifiers
- FontString:SetIndentedWordWrap() - This function is not yet documented
- FontString:SetMaxLines() - This function is not yet documented
- FontString:SetNonSpaceWrap(enable) - Sets whether long lines of text will wrap within or between words
- FontString:SetShown() - This function is not yet documented
- FontString:SetText("text") - Sets the text to be displayed in the font string
- FontString:SetTextHeight(height) - Scales the font string's rendered text to a different height
- FontString:SetWordWrap(enable) - Sets whether long lines of text in the font string can wrap onto subsequent lines
Inherited Methods
- canChange = FontString:CanChangeProtectedState() - Returns whether protected properties of the region can be changed by non-secure scripts
- FontString:ClearAllPoints() - Removes all anchor points from the region
- animationGroup = FontString:CreateAnimationGroup(["name" [, "inheritsFrom"]]) - Creates a new AnimationGroup as a child of the region
- alpha = FontString:GetAlpha() - Returns the opacity of the region relative to its parent
- ... = FontString:GetAnimationGroups() - Returns a list of animation groups belonging to the region
- bottom = FontString:GetBottom() - Returns the distance from the bottom of the screen to the bottom of the region
- x, y = FontString:GetCenter() - Returns the screen coordinates of the region's center
- layer, sublayer = FontString:GetDrawLayer() - Returns the layer at which the region's graphics are drawn relative to others in its frame
- filename, fontHeight, flags = FontString:GetFont() - Returns the font instance's basic font properties
- font = FontString:GetFontObject() - Returns the `Font` object from which the font instance's properties are inherited
- height = FontString:GetHeight() - Returns the height of the region
- justify = FontString:GetJustifyH() - Returns the font instance's horizontal text alignment style
- justify = FontString:GetJustifyV() - Returns the font instance's vertical text alignment style
- left = FontString:GetLeft() - Returns the distance from the left edge of the screen to the left edge of the region
- name = FontString:GetName() - Returns the widget object's name
- numPoints = FontString:GetNumPoints() - Returns the number of anchor points defined for the region
- type = FontString:GetObjectType() - Returns the object's widget type
- parent = FontString:GetParent() - Returns the object's parent object
- point, relativeTo, relativePoint, xOffset, yOffset = FontString:GetPoint(index) - Returns information about one of the region's anchor points
- left, bottom, width, height = FontString:GetRect() - Returns the position and dimensions of the region
- right = FontString:GetRight() - Returns the distance from the left edge of the screen to the right edge of the region
- shadowR, shadowG, shadowB, shadowAlpha = FontString:GetShadowColor() - Returns the color of the font's text shadow
- xOffset, yOffset = FontString:GetShadowOffset() - Returns the offset of the font instance's text shadow from its text
- width, height = FontString:GetSize() - Returns the width and height of the region
- spacing = FontString:GetSpacing() - Returns the font instance's amount of spacing between lines
- textR, textG, textB, textAlpha = FontString:GetTextColor() - Returns the font instance's default text color
- top = FontString:GetTop() - Returns the distance from the bottom of the screen to the top of the region
- width = FontString:GetWidth() - Returns the width of the region
- FontString:Hide() - Hides the region
- isDragging = FontString:IsDragging() - Returns whether the region is currently being dragged
- isOver = FontString:IsMouseOver([topOffset [, leftOffset [, bottomOffset [, rightOffset]]]]) - Returns whether the mouse cursor is over the given region
- isType = FontString:IsObjectType("type") - Returns whether the object belongs to a given widget type
- isProtected, explicit = FontString:IsProtected() - Returns whether the region is protected
- shown = FontString:IsShown() - Returns whether the region is shown
- visible = FontString:IsVisible() - Returns whether the region is visible
- FontString:SetAllPoints([region]) or FontString:SetAllPoints(["name"]) - Sets all anchor points of the region to match those of another region
- FontString:SetAlpha(alpha) - Sets the opacity of the region relative to its parent
- FontString:SetDrawLayer("layer", sublayer) - Sets the layer at which the region's graphics are drawn relative to others in its frame
- isValid = FontString:SetFont("filename", fontHeight, "flags") - Sets the font instance's basic font properties
- FontString:SetFontObject(object) or FontString:SetFontObject("name") - Sets the `Font` object from which the font instance's properties are inherited
- FontString:SetHeight(height) - Sets the region's height
- FontString:SetJustifyH("justify") - Sets the font instance's horizontal text alignment style
- FontString:SetJustifyV("justify") - Sets the font instance's vertical text alignment style
- FontString:SetParent(frame) or FontString:SetParent("name") - Makes another frame the parent of this region
- FontString:SetPoint("point" [, relativeTo [, "relativePoint" [, xOffset [, yOffset]]]]) - Sets an anchor point for the region
- FontString:SetShadowColor(shadowR, shadowG, shadowB, shadowAlpha) - Sets the color of the font's text shadow
- FontString:SetShadowOffset(xOffset, yOffset) - Sets the offset of the font instance's text shadow from its text
- FontString:SetSize(width, height) - Sets the size of the region to the specified values
- FontString:SetSpacing(spacing) - Sets the font instance's amount of spacing between lines
- FontString:SetTextColor(textR, textG, textB, textAlpha) - Sets the font instance's default text color
- FontString:SetVertexColor(red, green, blue [, alpha]) - Sets a color shading for the region's graphics
- FontString:SetWidth(width) - Sets the region's width
- FontString:Show() - Shows the region
- FontString:StopAnimating() - Stops any active animations involving the region or its children