### Retrieve text bounds in Lua Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/text-bounds.md Use this function to get the dimensions of a text frame as a Vector2. ```lua Text.GetBounds(frame) ``` -------------------------------- ### Calculate SurfaceGui Size Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/options/scale-size/README.md Run this in the command bar while a SurfaceGui is selected to calculate the Size value for maintaining aspect ratio. ```lua local scaleSize = "X" local textLabelSize = 14 local surfaceGui = game.Selection:Get()[1] local adornee = surfaceGui.Adornee if not adornee then adornee = surfaceGui.Parent end local viewportSize = nil local face = surfaceGui.Face local pixelsPerStud = surfaceGui.PixelsPerStud local partSize = adornee.Size if face == Enum.NormalId.Front or face == Enum.NormalId.Back then viewportSize = Vector2.new(partSize.X*pixelsPerStud, partSize.Y*pixelsPerStud) elseif face == Enum.NormalId.Left or face == Enum.NormalId.Right then viewportSize = Vector2.new(partSize.Z*pixelsPerStud, partSize.Y*pixelsPerStud) else viewportSize = Vector2.new(partSize.X*pixelsPerStud, partSize.Z*pixelsPerStud) end if scaleSize == "XY" then viewportSize = (viewportSize.X + viewportSize.Y)/2 else viewportSize = viewportSize[scaleSize] end warn(math.round(textLabelSize/viewportSize*100*1000)/1000) ``` -------------------------------- ### Retrieve Current Options Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/options/README.md Use Text.GetOptions to fetch the current configuration state of a frame. ```lua Text.GetOptions(frame) ``` -------------------------------- ### Enable line and word sorting in Text.Create Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/advanced-control/introduction.md Configures sorting options within the Text.Create constructor. Both properties default to false if not specified. ```lua Text.Create( "This text is awesome!", frame, { LineSorting = true, WordSorting = true } ) ``` -------------------------------- ### Create Text with Options Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/options/README.md Pass an optional table to the Text.Create function to customize text appearance. Unspecified options will revert to their default values. ```lua Text.Create( frame, "This text is awesome!", { -- Options (optional). Size = 24, Color = Color3.fromRGB(255, 255, 255), XAlignment = "Center", YAlignment = "Center" } ) ``` -------------------------------- ### Calculate ScreenGui Size Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/options/scale-size/README.md Run this in the command bar to find the Size value that maintains the aspect ratio for a ScreenGui. ```lua local scaleSize = "X" local textLabelSize = 14 local viewportSize = workspace.CurrentCamera.ViewportSize if scaleSize == "XY" then viewportSize = (viewportSize.X + viewportSize.Y)/2 else viewportSize = viewportSize[scaleSize] end warn(math.round(textLabelSize/viewportSize*100*1000)/1000) ``` -------------------------------- ### Apply a built-in font using Font.new Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/options/fonts.md Use the Font.new constructor to define a font family, weight, and style within the Text.Create options. ```lua Text.Create( frame, "This text is awesome!", { Font = Font.new( "rbxasset://fonts/families/Arial.json", -- Family. Enum.FontWeight.Regular, -- Weight. Enum.FontStyle.Normal -- Style. ) } ) ``` -------------------------------- ### Define Module Return Table Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/custom-fonts/data-module.md The module must return an empty table to be correctly initialized by the system. ```lua return { } ``` -------------------------------- ### Defining Multi-Weight and Multi-Style Fonts Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/custom-fonts/import-font-data.md Recommended structure for fonts containing multiple weights and styles. ```lua return { -- Fonts. MyFont = { -- Weights. Bold = { -- Styles. Italic = { Image = 0, -- Image id. -- Converted XML: Size = 32, Characters = { } } } } } ``` -------------------------------- ### Basic Font Module Structure Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/custom-fonts/import-font-data.md The foundational structure for the font data module. ```lua return { MyFont = -- Paste converted XML here. } ``` -------------------------------- ### Reference Default Text Options Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/options/custom-defaults.md This table displays the default configuration values used by the library. Only include the properties you wish to override in your custom module. ```lua return { Font = Font.new("rbxasset://fonts/families/SourceSansPro.json"), Size = 14, ScaleSize = nil, MinimumSize = nil, MaximumSize = nil, Color = Color3.fromRGB(0, 0, 0), Transparency = 0, Offset = Vector2.zero, Rotation = 0, StrokeSize = 5, StrokeColor = Color3.fromRGB(0, 0, 0), ShadowOffset = Vector2.new(0, 20), ShadowColor = Color3.fromRGB(50, 50, 50), LineHeight = 1, CharacterSpacing = 1, Truncate = false, XAlignment = "Left", YAlignment = "Top", WordSorting = false, LineSorting = false, Dynamic = false } ``` -------------------------------- ### Create text within a GUI frame Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/readme.md Initializes text inside a specified GUI object, which acts as a container for wrapping. ```lua local Text = require(script.TextPlus) local frame = script.frame Text.Create( frame, -- Parent and boundary. "This text is awesome!" -- Text. ) ``` -------------------------------- ### Reference custom font in Text.Create Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/custom-fonts/using-the-fonts.md Directly reference the font data table within the Text.Create configuration table. ```lua local fonts = require(path.to.Fonts) Text.Create( frame, "Text", { Font = fonts.MyFont } ) ``` -------------------------------- ### Access a Word Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/advanced-control/specific-access.md Retrieve a word using word or line+word sorting, then iterate through its children. ```lua local word = frame["1"] -- (Word-1) — Word sorting. local word = frame["1"]["1"] -- (Line-1 -> Word-1) — Line+word sorting. for characterNumber, character in word:GetChildren() do -- For Roblox fonts, 'character' will be a TextLabel. -- For custom fonts, 'character' will be an ImageLabel. end ``` -------------------------------- ### Basic Indexing Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/advanced-control/specific-access.md Access a specific element using direct indexing. ```lua frame["1"] ``` -------------------------------- ### Retrieve raw text content Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/readme.md Fetches the current raw text string stored within a specific GUI frame. ```lua Text.GetText(frame) ``` -------------------------------- ### Create multiline strings Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/line-breaks.md Use double square brackets [[]] to define a string that spans multiple lines without needing escape characters. ```lua [[First line Second line]] ``` -------------------------------- ### Access a Line Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/advanced-control/specific-access.md Retrieve a line using line sorting and iterate through its contents. ```lua local line = frame["1"] -- (Line-1) -- Line and word sorting: for wordNumber, word in line:GetChildren() do -- 'word' will be a folder. for characterNumber, character in word:GetChildren() do -- For Roblox fonts, 'character' will be a TextLabel. -- For custom fonts, 'character' will be an ImageLabel. end end -- Line sorting: for characterNumber, character in line:GetChildren() do -- For Roblox fonts, 'character' will be a TextLabel. -- For custom fonts, 'character' will be an ImageLabel. end ``` -------------------------------- ### Manually iterate with full sorting Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/advanced-control/full-iteration.md Performs manual iteration through lines, words, and characters when full sorting is enabled. ```lua for lineNumber, line in frame:GetChildren() do -- 'line' will be a folder. for wordNumber, word in line:GetChildren() do -- 'word' will be a folder. for characterNumber, character in word:GetChildren() do -- For Roblox fonts, 'character' will be a TextLabel. -- For custom fonts, 'character' will be an ImageLabel. end end end ``` -------------------------------- ### Retrieve a Creator Store font asset ID Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/options/fonts.md Run this command in the Roblox Studio command bar while a TextLabel with the desired font is selected to print its asset ID. ```lua print(game.Selection:Get()[1].FontFace.Family) ``` -------------------------------- ### Manually iterate with single sorting Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/advanced-control/full-iteration.md Performs manual iteration through words and characters when only one sorting type is enabled. ```lua for wordNumber, word in frame:GetChildren() do -- 'word' will be a folder. for characterNumber, character in word:GetChildren() do -- For Roblox fonts, 'character' will be a TextLabel. -- For custom fonts, 'character' will be an ImageLabel. end end ``` -------------------------------- ### Modify Text Options Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/modification.md Updates text content while providing new options. Only the provided options are overwritten, while others are retained. ```lua Text.Create( frame, "This text has been modified!", { -- New options (optional). Size = 12 -- Overwrite size. -- Everything else will stay like before! } ) ``` -------------------------------- ### Defining Font Image ID Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/custom-fonts/import-font-data.md Adding the image ID to the font configuration table. ```lua MyFont = { Image = 0, -- Image id. -- Converted XML: Size = 32, Characters = { } } ``` -------------------------------- ### Retrieve Update Signal Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/signals/update.md Access the update signal for a specific text frame using the Text library. ```lua Text.GetUpdateSignal(frame) ``` -------------------------------- ### Text.GetBounds(frame) Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/text-bounds.md Retrieves the automatically calculated bounds of a specified text frame. ```APIDOC ## Text.GetBounds(frame) ### Description Retrieves the automatically calculated bounds of a text frame. The bounds are returned as a Vector2. ### Parameters - **frame** (object) - Required - The text frame instance to query. ### Returns - **Vector2** - The dimensions of the text frame. ``` -------------------------------- ### Text.GetUpdateSignal(frame) Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/signals/update.md Retrieves the update signal for a specific text frame. This signal is triggered whenever the text is rendered. ```APIDOC ## Text.GetUpdateSignal ### Description Retrieves the update signal associated with a text frame. This signal fires every time the text is rendered in the frame. ### Signature `Text.GetUpdateSignal(frame)` ### Parameters - **frame** (Object) - Required - The text frame instance to retrieve the signal from. ``` -------------------------------- ### Modify Text Content Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/modification.md Updates the text content of an existing frame. The frame must already have text created within it. ```lua Text.Create( frame, -- Frame that already has text created within it. "This text has been modified!" -- New text. ) ``` -------------------------------- ### Create line breaks with newline symbol Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/fundamentals/line-breaks.md Use the \n escape sequence to insert a line break within a standard string. Ensure the backslash is used, not a forward slash. ```lua "First line\nSecond line" ``` -------------------------------- ### Access a Character Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/advanced-control/specific-access.md Retrieve a character when no sorting is enabled. The returned object type depends on the font type. ```lua local character = frame["1"] -- (Character-1) -- For Roblox fonts, 'character' will be a TextLabel. -- For custom fonts, 'character' will be an ImageLabel. ``` -------------------------------- ### Iterate characters with GetCharacters Source: https://github.com/alexanderlindholt/textplus/blob/main/documentation/advanced-control/full-iteration.md Uses the optimized GetCharacters function to iterate through all characters while respecting sorting. ```lua for characterNumber, character in Text.GetCharacters(frame) do -- For Roblox fonts, 'character' will be a TextLabel. -- For custom fonts, 'character' will be an ImageLabel. end ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.