---@meta

---@class rect
---@field left number
---@field right number
---@field top number
---@field bottom number

---@class FontString : Region, FontInstance
FontString = {
	--- Returns localized text depending on the specified gender.
	--- @param self FontString
	--- @param token string? Reputation index.
	--- @param gender number? Optional. Gender ID (1 for male, 2 for female, etc.).
	--- @param ordinal unknown? Optional. Used for ordinal numbers.
	--- @return string # The localized text.
	--- @example
	--- local text = GetText("FACTION_STANDING_LABEL1") -- Returns "Hated"
	--- local femaleText = GetText("FACTION_STANDING_LABEL1", 3) -- Returns "Hated" for female
	GetText = function(self, token, gender, ordinal) end,

	--- Sets the text to be displayed in the fontstring.
	--- @param self FontString
	--- @param text string The text to display. Can include escape sequences for color and formatting.
	--- Note: FontString has a limit of approximately 4000 characters.
	--- @example
	--- myFontString:SetText('|cff000000This text is black,|r |cffff0000while this text will be red.|r')
	SetText = function(self, text) end,

	--- Calculates the screen area covered by the characters between the specified indices.
	--- @param leftIndex number The starting index of the character span.
	--- @param rightIndex number The ending index of the character span.
	--- @return rect areas The calculated screen area.
	--- @example
	--- local area = myFontString:CalculateScreenAreaFromCharacterSpan(1, 5)
	CalculateScreenAreaFromCharacterSpan = function(self, leftIndex, rightIndex) end,

	--- Checks if the fontstring can wrap non-space characters.
	--- @return boolean wrap True if it can wrap non-space characters.
	--- @example
	--- local canWrap = myFontString:CanNonSpaceWrap()
	CanNonSpaceWrap = function(self) end,

	--- Checks if the fontstring can wrap words.
	--- @return boolean wrap True if it can wrap words.
	--- @example
	--- local canWrap = myFontString:CanWordWrap()
	CanWordWrap = function(self) end,

	--- Finds the character index at the specified screen coordinates.
	--- @param x number The x-coordinate.
	--- @param y number The y-coordinate.
	--- @return number characterIndex The index of the character at the specified coordinates.
	--- @return boolean inside True if the coordinates are inside the fontstring.
	--- @example
	--- local index, isInside = myFontString:FindCharacterIndexAtCoordinate(100, 200)
	FindCharacterIndexAtCoordinate = function(self, x, y) end,

	--- Gets the field size of the fontstring.
	--- @return number fieldSize The size of the field.
	--- @example
	--- local size = myFontString:GetFieldSize()
	GetFieldSize = function(self) end,

	--- Gets the font settings of the fontstring.
	--- @return string fontFile The font file used.
	--- @return number fontHeight The height of the font.
	--- @return string flags The font flags.
	--- @example
	--- local fontFile, fontHeight, flags = myFontString:GetFont()
	GetFont = function(self) end,

	--- Gets the font object of the fontstring.
	--- @return FontObject font The font object.
	--- @example
	--- local font = myFontString:GetFontObject()
	GetFontObject = function(self) end,

	--- Gets the indented word wrap setting.
	--- @return boolean wrap True if indented word wrap is enabled.
	--- @example
	--- local indentedWrap = myFontString:GetIndentedWordWrap()
	GetIndentedWordWrap = function(self) end,

	--- Gets the horizontal justification of the fontstring.
	--- @return string justifyH The horizontal justification.
	--- @example
	--- local justifyH = myFontString:GetJustifyH()
	GetJustifyH = function(self) end,

	--- Gets the vertical justification of the fontstring.
	--- @return string justifyV The vertical justification.
	--- @example
	--- local justifyV = myFontString:GetJustifyV()
	GetJustifyV = function(self) end,

	--- Gets the line height of the fontstring.
	--- @return number lineHeight The height of a line.
	--- @example
	--- local lineHeight = myFontString:GetLineHeight()
	GetLineHeight = function(self) end,

	--- Gets the maximum number of lines for the fontstring.
	--- @return number maxLines The maximum number of lines.
	--- @example
	--- local maxLines = myFontString:GetMaxLines()
	GetMaxLines = function(self) end,

	--- Gets the number of lines currently displayed in the fontstring.
	--- @return number numLines The number of lines.
	--- @example
	--- local numLines = myFontString:GetNumLines()
	GetNumLines = function(self) end,

	--- Gets the rotation of the fontstring.
	--- @return number radians The rotation in radians.
	--- @example
	--- local rotation = myFontString:GetRotation()
	GetRotation = function(self) end,

	--- Gets the shadow color of the fontstring.
	--- @return number colorR The red component of the shadow color.
	--- @return number colorG The green component of the shadow color.
	--- @return number colorB The blue component of the shadow color.
	--- @return number? colorA Optional. The alpha component of the shadow color.
	--- @example
	--- local r, g, b, a = myFontString:GetShadowColor()
	GetShadowColor = function(self) end,

	--- Gets the shadow offset of the fontstring.
	--- @return number offsetX The x offset of the shadow.
	--- @return number offsetY The y offset of the shadow.
	--- @example
	--- local offsetX, offsetY = myFontString:GetShadowOffset()
	GetShadowOffset = function(self) end,

	--- Gets the spacing between lines in the fontstring.
	--- @return number spacing The spacing value.
	--- @example
	--- local spacing = myFontString:GetSpacing()
	GetSpacing = function(self) end,

	--- Gets the height of the string displayed in the fontstring.
	--- @return number height The height of the string.
	--- @example
	--- local height = myFontString:GetStringHeight()
	GetStringHeight = function(self) end,

	--- Gets the width of the string displayed in the fontstring.
	--- @return number width The width of the string.
	--- @example
	--- local width = myFontString:GetStringWidth()
	GetStringWidth = function(self) end,

	--- Gets the text color of the fontstring.
	--- @return number colorR The red component of the text color.
	--- @return number colorG The green component of the text color.
	--- @return number colorB The blue component of the text color.
	--- @return number? colorA Optional. The alpha component of the text color.
	--- @example
	--- local r, g, b, a = myFontString:GetTextColor()
	GetTextColor = function(self) end,

	--- Gets the text scale of the fontstring.
	--- @return number textScale The scale of the text.
	--- @example
	--- local textScale = myFontString:GetTextScale()
	GetTextScale = function(self) end,

	--- Gets the unbounded width of the string displayed in the fontstring.
	--- @return number width The unbounded width.
	--- @example
	--- local width = myFontString:GetUnboundedStringWidth()
	GetUnboundedStringWidth = function(self) end,

	--- Gets the wrapped width of the string displayed in the fontstring.
	--- @return number width The wrapped width.
	--- @example
	--- local width = myFontString:GetWrappedWidth()
	GetWrappedWidth = function(self) end,

	--- Checks if the text in the fontstring is truncated.
	--- @return boolean isTruncated True if the text is truncated.
	--- @example
	--- local isTruncated = myFontString:IsTruncated()
	IsTruncated = function(self) end,

	--- Sets a gradient alpha for the fontstring.
	--- @param start number The starting alpha value.
	--- @param length number The length of the gradient.
	--- @return boolean isWithinText True if the gradient is within the text.
	--- @example
	--- local isWithin = myFontString:SetAlphaGradient(0, 1)
	SetAlphaGradient = function(self, start, length) end,

	--- Sets a fixed color for the fontstring.
	--- @param fixedColor boolean True to set a fixed color.
	--- @example
	--- myFontString:SetFixedColor(true)
	SetFixedColor = function(self, fixedColor) end,

	--- Sets the font of the fontstring.
	--- @param fontFile string The font file to use.
	--- @param fontHeight number The height of the font.
	--- @param flags string The font flags.
	--- @example
	--- myFontString:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
	SetFont = function(self, fontFile, fontHeight, flags) end,

	--- Sets the font object of the fontstring.
	--- @param font FontObject The font object to set.
	--- @example
	--- myFontString:SetFontObject(myFontObject)
	SetFontObject = function(self, font) end,

	--- Sets formatted text for the fontstring.
	--- @param text string The formatted text to set.
	--- @example
	--- myFontString:SetFormattedText("Hello %s", "World")
	SetFormattedText = function(self, text) end,

	--- Sets the indented word wrap setting.
	--- @param wrap boolean True to enable indented word wrap.
	--- @example
	--- myFontString:SetIndentedWordWrap(true)
	SetIndentedWordWrap = function(self, wrap) end,

	--- Sets the horizontal justification of the fontstring.
	--- @param justifyH string The horizontal justification to set.
	--- @example
	--- myFontString:SetJustifyH("CENTER")
	SetJustifyH = function(self, justifyH) end,

	--- Sets the vertical justification of the fontstring.
	--- @param justifyV string The vertical justification to set.
	--- @example
	--- myFontString:SetJustifyV("MIDDLE")
	SetJustifyV = function(self, justifyV) end,

	--- Sets the maximum number of lines for the fontstring.
	--- @param maxLines number The maximum number of lines to set.
	--- @example
	--- myFontString:SetMaxLines(3)
	SetMaxLines = function(self, maxLines) end,

	--- Sets the non-space wrap setting.
	--- @param wrap boolean True to enable non-space wrap.
	--- @example
	--- myFontString:SetNonSpaceWrap(true)
	SetNonSpaceWrap = function(self, wrap) end,

	--- Sets the rotation of the fontstring.
	--- @param radians number The rotation in radians.
	--- @example
	--- myFontString:SetRotation(math.rad(45))
	SetRotation = function(self, radians) end,

	--- Sets the shadow color of the fontstring.
	--- @param colorR number The red component of the shadow color.
	--- @param colorG number The green component of the shadow color.
	--- @param colorB number The blue component of the shadow color.
	--- @param a number? Optional. The alpha component of the shadow color.
	--- @example
	--- myFontString:SetShadowColor(0, 0, 0, 1) -- Black shadow
	SetShadowColor = function(self, colorR, colorG, colorB, a) end,

	--- Sets the shadow offset of the fontstring.
	--- @param offsetX number The x offset of the shadow.
	--- @param offsetY number The y offset of the shadow.
	--- @example
	--- myFontString:SetShadowOffset(1, -1)
	SetShadowOffset = function(self, offsetX, offsetY) end,

	--- Sets the spacing between lines in the fontstring.
	--- @param spacing number The spacing value to set.
	--- @example
	--- myFontString:SetSpacing(2)
	SetSpacing = function(self, spacing) end,

	--- Sets the text color of the fontstring.
	--- @param colorR number The red component of the text color.
	--- @param colorG number The green component of the text color.
	--- @param colorB number The blue component of the text color.
	--- @param a number? Optional. The alpha component of the text color.
	--- @example
	--- myFontString:SetTextColor(1, 1, 1) -- White text
	SetTextColor = function(self, colorR, colorG, colorB, a) end,

	--- Sets the height of the text in the fontstring.
	--- @param height number The height to set.
	--- @example
	--- myFontString:SetTextHeight(14)
	SetTextHeight = function(self, height) end,

	--- Sets the scale of the text in the fontstring.
	--- @param textScale number The scale to set.
	--- @example
	--- myFontString:SetTextScale(1.5)
	SetTextScale = function(self, textScale) end,

	--- Sets the word wrap setting for the fontstring.
	--- @param wrap boolean True to enable word wrap.
	--- @example
	--- myFontString:SetWordWrap(true)
	SetWordWrap = function(self, wrap) end,
}

---@alias FontObject
---| 'GameFontNormal'
---| 'GameFontNormalSmall'
---| 'GameFontNormalLarge'
---| 'GameFontHighlight'
---| 'GameFontHighlightSmall'
---| 'GameFontHighlightSmallOutline'
---| 'GameFontHighlightLarge'
---| 'GameFontDisable'
---| 'GameFontDisableSmall'
---| 'GameFontDisableLarge'
---| 'GameFontGreen'
---| 'GameFontGreenSmall'
---| 'GameFontGreenLarge'
---| 'GameFontRed'
---| 'GameFontRedSmall'
---| 'GameFontRedLarge'
---| 'GameFontWhite'
---| 'GameFontDarkGraySmall'
---| 'NumberFontNormalYellow'
---| 'NumberFontNormalSmallGray'
---| 'QuestFontNormalSmall'
---| 'DialogButtonHighlightText'
---| 'ErrorFont'
---| 'TextStatusBarText'
---| 'CombatLogFont'
---| string
