Text+
DevForum Topic
  • Welcome
  • Installation
  • Fundamentals
    • Introduction
    • Line breaks
    • Customization
      • Fonts
      • Scale-size
        • Minimum- and maximum-size
      • Truncation
      • Dynamic
      • Custom defaults
    • Modification
    • Text bounds
    • Signals
      • Update
  • Fine-control
    • Introduction
    • Full iteration
  • Specific access
  • Transform and style
  • Custom fonts
    • Introduction
    • Data module
    • Font to XML
    • XML to Lua
    • Upload font image
    • Import font data
Powered by GitBook
On this page
  1. Custom fonts

Import font data

Open the fonts data module.

Add your font like this:

return {
	MyFont = -- Paste converted XML here.
}

Add your image id for the font in the same table as the Size and Characters, like this:

MyFont = {
	Image = 0, -- Image id.
	-- Converted XML:
	Size = 32,
	Characters = {
		
	}
}

For fonts that have multiple weights and/or styles, it's recommended to use the following format:

return {
	-- Fonts.
	MyFont = {
		-- Weights.
		Bold = {
			-- Styles.
			Italic = {
				Image = 0, -- Image id.
				-- Converted XML:
				Size = 32,
				Characters = {
					
				}
			}
		}
	}
}

You will automatically be warned, in the output, about any mistakes you make in the font data module.

Use the font

Using custom fonts is extremely simple.

Instead of providing a Font object, directly reference the font table like this:

TextPlus.Create(
	frame,
	"Text",
	{
		Font = TextPlus.Fonts.MyFont
	}
)
PreviousUpload font image

Last updated 6 days ago