-
-
Notifications
You must be signed in to change notification settings - Fork 17
OSL ‐ Text
The text
command renders text at the draw cursor with a specified size.
-
"text-to-draw"
: The text string to be rendered. -
size
: The size of the text to be rendered.
text "Hello, World!" 16
// Renders the text "Hello, World!" at the current draw cursor position with a font size of 16
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.
The line height can be adjusted using the configtext
command with the lineheight
parameter. The default line height is 23.
configtext "lineheight" 23
# Sets the line height to 23
The space between characters can be adjusted as a multiple of the size of the text using the configtext
command with the spacing
parameter.
configtext "spacing" 1
# Sets the spacing between characters to 1 times the size of the text
To select a font to use, use the configtext
command with the usefont
parameter and specify the font name.
configtext "usefont" "Llama"
// Selects the "Llama" font for text rendering
To load a font from a URL, use the configtext
command with the importfont
parameter, specifying the font name and URL.
configtext "importfont" "CustomFont" "https://example.com/fonts/customfont.ojff"
// Loads the "CustomFont" from the specified URL
To revert to the default font, use the configtext
command with the usedefault
parameter.
configtext "usedefault"
// Reverts to the default font
To render text with a custom font size of 20:
text "Welcome to the system!" 20
// Renders the text "Welcome to the system!" with a font size of 20
To set the line height to 30 and character spacing to 1.5 times the size of the text:
configtext "lineheight" 1.5
configtext "spacing" 1.5
// Sets the line height to 1.5x normal and character spacing to 1.5x the size of the text
To use a custom font named "Roboto":
configtext "usefont" "Llama"
// Selects the "Llama" font for text rendering
To load a font from a URL and use it for rendering text:
configtext "importfont" "CoolFont" "https://example.com/fonts/coolfont.ojff"
configtext "usefont" "CoolFont"
// Loads the "CoolFont" from the specified URL and selects it for text rendering
To revert to the default font:
configtext "usedefault"
// Reverts to the default font
originOS is a web desktop gui with a self contained file system, programming languages, internet system and a whole lot of stuff an os should be able to do Use originOS here