FontString

From Warcraft Wiki
Jump to navigation Jump to search
Instantiation Frame:CreateFontString()

Example

Shows "Hello world" on the screen.

local fs = UIParent:CreateFontString(nil, "OVERLAY", "GameTooltipText")
fs:SetPoint("CENTER")
fs:SetText("Hello world")

API Frame CreateFontString 01.png

Methods

FontString:CalculateScreenAreaFromCharacterSpan(leftIndex, rightIndex) : areas
FontString:CanNonSpaceWrap() : wrap
FontString:CanWordWrap() : wrap
FontString:FindCharacterIndexAtCoordinate(x, y) : characterIndex, inside
FontString:GetFieldSize() : fieldSize
FontString:GetLineHeight() : lineHeight
FontString:GetMaxLines() : maxLines
FontString:GetNumLines() : numLines
FontString:GetRotation() : radians
FontString:GetStringHeight() : height
FontString:GetStringWidth() : width
FontString:GetText() : text
FontString:GetTextScale() : textScale
FontString:GetUnboundedStringWidth() : width
FontString:GetWrappedWidth() : width
FontString:IsTruncated() : isTruncated
FontString:SetAlphaGradient(start, length) : isWithinText
FontString:SetFixedColor(fixedColor)
FontString:SetFormattedText(text)
FontString:SetMaxLines(maxLines)
FontString:SetNonSpaceWrap(wrap)
FontString:SetRotation(radians)
FontString:SetText([text])
FontString:SetTextHeight(height)
FontString:SetTextScale(textScale)
FontString:SetWordWrap(wrap)
FontInstance:GetFont() : fontFile, height, flags - Returns the font path, height, and flags.
FontInstance:GetFontObject() : font - Returns the "parent" font object.
FontInstance:GetIndentedWordWrap() : wordWrap - Returns the indentation when text wraps beyond the first line.
FontInstance:GetJustifyH() : justifyH - Returns the horizontal text justification.
FontInstance:GetJustifyV() : justifyV - Returns the vertical text justification.
FontInstance:GetShadowColor() : colorR, colorG, colorB, colorA - Sets the text shadow color.
FontInstance:GetShadowOffset() : offsetX, offsetY - Returns the text shadow offset.
FontInstance:GetSpacing() : spacing - Returns the line spacing.
FontInstance:GetTextColor() : colorR, colorG, colorB, colorA - Returns the default text color.
FontInstance:SetFont(fontFile, height, flags) - Sets the basic font properties.
FontInstance:SetFontObject(font) - Sets the "parent" font object from which this object inherits properties.
FontInstance:SetIndentedWordWrap(wordWrap) - Sets the indentation when text wraps beyond the first line.
FontInstance:SetJustifyH(justifyH) - Sets the horizontal text justification
FontInstance:SetJustifyV(justifyV) - Sets the vertical text justification.
FontInstance:SetShadowColor(colorR, colorG, colorB [, a]) - Returns the color of text shadow.
FontInstance:SetShadowOffset(offsetX, offsetY) - Sets the text shadow offset.
FontInstance:SetSpacing(spacing) - Sets the spacing between lines of text in the object.
FontInstance:SetTextColor(colorR, colorG, colorB [, a]) - Sets the default text color.
Collapse
Region:GetAlpha() : alpha - Returns the region's opacity.
Region:GetDrawLayer() : layer, sublayer - Returns the layer in which the region is drawn.
Region:GetEffectiveScale() : effectiveScale - Returns the scale of the region after propagating from its parents.
Region:GetScale() : scale - Returns the scale of the region.
Region:GetVertexColor() : colorR, colorG, colorB, colorA - Returns the vertex color shading of the region.
Region:IsIgnoringParentAlpha() : isIgnoring - Returns true if the region is ignoring parent alpha.
Region:IsIgnoringParentScale() : isIgnoring - Returns true if the region is ignoring parent scale.
Region:IsObjectLoaded() : isLoaded - Returns true if the region is fully loaded.
Region:SetAlpha(alpha) - Sets the opacity of the region.
Region:SetDrawLayer(layer [, sublevel]) - Sets the layer in which the region is drawn.
Region:SetIgnoreParentAlpha(ignore) - Sets whether the region should ignore its parent's alpha.
Region:SetIgnoreParentScale(ignore) - Sets whether the region should ignore its parent's scale.
Region:SetScale(scale) - Sets the size scaling of the region.
Region:SetVertexColor(colorR, colorG, colorB [, a]) - Sets the vertex shading color of the region.
ScriptRegion:CanChangeProtectedState() : canChange - Returns true if protected properties of the region can be changed by non-secure scripts.
ScriptRegion:EnableMouse([enable]) - Sets whether the region should receive mouse input.
ScriptRegion:EnableMouseMotion([enable]) - Sets whether the region should receive mouse hover events.
ScriptRegion:EnableMouseWheel([enable]) - Sets whether the region should receive mouse wheel input.
ScriptRegion:GetBottom() : bottom #restrictedframe - Returns the offset to the bottom edge of the region.
ScriptRegion:GetCenter() : x, y #restrictedframe - Returns the offset to the center of the region.
ScriptRegion:GetHeight([ignoreRect]) : height - Returns the height of the region.
ScriptRegion:GetLeft() : left #restrictedframe - Returns the offset to the left edge of the region.
ScriptRegion:GetRect() : left, bottom, width, height #restrictedframe - Returns the coords and size of the region.
ScriptRegion:GetRight() : right #restrictedframe - Returns the offset to the right edge of the region.
ScriptRegion:GetScaledRect() : left, bottom, width, height - Returns the scaled coords and size of the region.
ScriptRegion:GetSize([ignoreRect]) : width, height - Returns the width and height of the region.
ScriptRegion:GetSourceLocation() : location - Returns the script name and line number where the region was created.
ScriptRegion:GetTop() : top #restrictedframe - Returns the offset to the top edge of the region.
ScriptRegion:GetWidth([ignoreRect]) : width - Returns the width of the region.
ScriptRegion:Hide() #secureframe - Hides the region.
ScriptRegion:IsAnchoringRestricted() : isRestricted - Returns true if the region has cross-region anchoring restrictions applied.
ScriptRegion:IsDragging() : isDragging - Returns true if the region is being dragged.
ScriptRegion:IsMouseClickEnabled() : enabled - Returns true if the region can receive mouse clicks.
ScriptRegion:IsMouseEnabled() : enabled - Returns true if the region can receive mouse input.
ScriptRegion:IsMouseMotionEnabled() : enabled - Returns true if the region can receive mouse hover events.
ScriptRegion:IsMouseMotionFocus() : isMouseMotionFocus - Returns true if the mouse cursor is hovering over the region.
ScriptRegion:IsMouseOver([offsetTop, offsetBottom, offsetLeft, offsetRight]) : isMouseOver - Returns true if the mouse cursor is hovering over the region.
ScriptRegion:IsMouseWheelEnabled() : enabled - Returns true if the region can receive mouse wheel input.
ScriptRegion:IsProtected() : isProtected, isProtectedExplicitly - Returns whether the region is currently protected.
ScriptRegion:IsRectValid() : isValid - Returns true if the region can be positioned on the screen.
ScriptRegion:IsShown() : isShown - Returns true if the region should be shown; it depends on the parents if it's visible.
ScriptRegion:IsVisible() : isVisible - Returns true if the region and its parents are shown.
ScriptRegion:SetMouseClickEnabled([enabled]) - Sets whether the region should receive mouse clicks.
ScriptRegion:SetMouseMotionEnabled([enabled]) - Sets whether the region should receive mouse hover events.
ScriptRegion:SetParent([parent]) - Sets the parent of the region.
ScriptRegion:SetPassThroughButtons([button1, ...]) #nocombat - Allows the region to propagate mouse clicks to underlying regions or the world frame.
ScriptRegion:SetProtected()
ScriptRegion:SetShown([show]) #secureframe - Shows or hides the region.
ScriptRegion:Show() #secureframe - Shows the region.
ScriptRegionResizing:AdjustPointsOffset(x, y) #secureframe - Adjusts the x and y offset of the region.
ScriptRegionResizing:ClearAllPoints() - Removes all anchor points from the region.
ScriptRegionResizing:ClearPoint(point) - Removes an anchor point from the region by name.
ScriptRegionResizing:ClearPointsOffset() #secureframe - Resets the x and y offset on the region to zero.
ScriptRegionResizing:GetNumPoints() : numPoints - Returns the number of anchor points for the region.
ScriptRegionResizing:GetPoint([anchorIndex]) : point, relativeTo, relativePoint, offsetX, offsetY #restrictedframe - Returns an anchor point for the region.
ScriptRegionResizing:GetPointByName(point) : point, relativeTo, relativePoint, offsetX, offsetY - Returns an anchor point by name for the region.
ScriptRegionResizing:SetAllPoints(relativeTo [, doResize]) - Positions the region the same as another region.
ScriptRegionResizing:SetHeight(height) - Sets the height of the region.
ScriptRegionResizing:SetPoint(point, relativeTo, relativePoint, offsetX, offsetY) #anchorfamily - Sets an anchor point for the region.
ScriptRegionResizing:SetSize(x, y) - Sets the width and height of the region.
ScriptRegionResizing:SetWidth(width) - Sets the width of the region.
AnimatableObject:CreateAnimationGroup([name, templateName]) : group - Creates an animation group.
AnimatableObject:GetAnimationGroups() : scriptObject, ... - Returns the animation groups of this region.
AnimatableObject:StopAnimating() - Stops any active animations on this region.
ScriptObject:GetScript(scriptTypeName [, bindingType]) : script - Returns the widget script handler.
ScriptObject:HasScript(scriptName) : hasScript - Returns true if the region supports the given script type.
ScriptObject:HookScript(scriptTypeName, script [, bindingType]) - Securely post-hooks a widget script handler.
ScriptObject:SetScript(scriptTypeName [, script]) - Sets the widget script handler.
Object:ClearParentKey() - Clears the parent key.
Object:GetDebugName([preferParentKey]) : debugName - Returns the object's debug name.
Object:GetParent() : parent - Returns the parent object.
Object:GetParentKey() : parentKey - Returns the key on the parent that references this object.
Object:SetParentKey(parentKey [, clearOtherKeys]) - Sets a key on the parent to the child object.
FrameScriptObject:GetName() : name - Returns the object's global name.
FrameScriptObject:GetObjectType() : objectType - Returns the object's widget type.
FrameScriptObject:IsForbidden() : isForbidden - Returns true if insecure interaction with the object is forbidden.
FrameScriptObject:IsObjectType(objectType) : isType - Returns true if the object belongs to a given widget type or its subtypes.
FrameScriptObject:SetForbidden() #protected - Sets the object to be forbidden from an insecure execution path.

Script Types

OnShow(self) - Invoked when the widget is shown.
OnHide(self) - Invoked when the widget is hidden.
OnEnter(self, motion) - Invoked when the cursor enters the widget's interactive area.
OnLeave(self, motion) - Invoked when the mouse cursor leaves the widget's interactive area.
OnMouseDown(self, button) - Invoked when a mouse button is pressed while the cursor is over the widget.
OnMouseUp(self, button, upInside) - Invoked when the mouse button is released following a mouse down action in the widget.
OnMouseWheel(self, delta) - Invoked when the widget receives a mouse wheel scrolling action.
OnLoad(self) - Invoked when the widget is created.