Text
Command:
Parameters:
size:
Specifies the size of the text to be rendered.
text-to-draw:
The text string that needs to be displayed.
Description:
The text
command displays the given text at the current cursor position, applying the specified size for rendering.
Example:
Explanation:
In this example, the text "Hello, World!" is rendered at the current draw cursor position with a font size of 16. The text
command allows for direct rendering of text strings on the screen.
Additionally, the text
command can be used to set the font for subsequent text rendering by providing the URL or file path of a text file containing font data along with the setfont
parameter. This command provides a simple and effective way to display text within the UI, allowing for customization of text appearance and font selection when needed.
Using the Font System
Changing Line Height
The line height can be adjusted using the configtext
command with the lineheight
parameter. The default line height is 23.
Example:
Changing Character Spacing
The space between characters can be adjusted as a multiple of the size of the text using the configtext
command with the spacing
parameter.
Example:
Selecting a Font
To select a font to use, use the configtext
command with the usefont
parameter and specify the font name.
Example:
Loading a Font from a URL
To load a font from a URL, use the configtext
command with the importfont
parameter, specifying the font name and URL.
Example:
Reverting to Default Font
To revert to the default font, use the configtext
command with the usedefault
parameter.
Example:
Practical Examples
Rendering Text with Custom Font Size
To render text with a custom font size of 20:
Adjusting Line Height and Character Spacing
To set the line height to 30 and character spacing to 1.5 times the size of the text:
Using a Custom Font
To use a custom font named "Roboto":
Loading and Using a Font from a URL
To load a font from a URL and use it for rendering text:
Last updated