API - EgoMooseOldProjects/Rbx_CustomFont GitHub Wiki

Functions

If you have ever used normal Roblox text objects then Rbx_Custom font should be very familiar. Simply treat the required module as set of functions used to create Rbx_CustomFont text objects.

The functions are as follows:

Rbx_CustomFont.Label(string fontName) -- Creates a Rbx_CustomFont TextLabel
Rbx_CustomFont.Box(string fontName) -- Creates a Rbx_CustomFont TextBox
Rbx_CustomFont.Button(string fontName) -- Creates a Rbx_CustomFont TextButton
Rbx_CustomFont.Replace(string fontName, instance child) -- Replaces a normal text object with and Rbx_CustomFont object

The font name property is simple. Simply give the name of the font module (placed underneath the Rbx_CustomFont module) that you want to use.

If you are using "Rbx_CustomFont.Replace" you must include a pre-existing object such as a TextLabel, TextBox, or TextButton for the "child" parameter.

All four of the above functions will return a Rbx_CustomFont object.

Methods

All Rbx_CustomFont objects have these methods:

  • self:Revert() Used to convert a Rbx_CustomFont object back to a normal text object. Note that you will have to update your variable so this is best used in an example like so:
local font = require(game.Workspace.Rbx_CustomFont);
local label = font.Label("Roboto");
label.Parent = script.Parent;

label = label:Revert();
  • self:GetChildren() Since Rbx_CustomFont object stores objects that are important to rendering custom fonts are their children using the standard :GetChildren() method might lead to some problems. As a result using the method directly attached to the custom object will give the results you actually want.

  • self:ClearAllChildren() Since Rbx_CustomFont object stores objects that are important to rendering custom fonts are their children using the standard :ClearAllChildren() method might lead to some problems. As a result using the method directly attached to the custom object will give the results you actually want.

  • self:Destroy() Since Rbx_CustomFont is doing a lot of stuff in the background it is important to use the method directly attached to the custom object so that everything is properly stopped and removed.

  • Other methods? If you want to use any other methods simply call the custom object like you would a function. This will return to you the text object that Rbx_CustomFont is using to hold everything. For example:

local font = require(game.Workspace.Rbx_CustomFont);
local label = font.Label("Roboto");
label.Parent = script.Parent;

label():FindFirstChild("someItem");

Properties

Accessing properties is very easy. Simply set them as you normally would in script. However, there are a few extra properties that do special things:

  • Scale This property can be used to multiply the base width, height, and position of the text. To be honest it usually doesn't look great, but it's there if you want it.

  • FullText The normal text property has a limited length, but if you want to render a very long string simply use the FullText property. Please note, this is a in-script feature only. There is not physical property for this.

  • FontName You can change this property to a different font module name.

  • FontPx You must use this property if you are not using the default font sizes listed here: http://wiki.roblox.com/index.php?title=API:Enum/FontSize

  • Style If your font supports things like bold or italic you can switch between those by adjusting this property