Skip to content

Writting Text

GNamimates edited this page Oct 25, 2024 · 1 revision

text rendering is complex under the hood, but ive tried my best to make it as similar to vanilla Minecraft as possible

Note

Emojis do not work on GNUI at the moment. sorry for the inconvinience

why dont emojis work with GNUI?

because emojis are automatically done by Figura, the GNUI text system has no way of cooperating with that unless an API is made that processes strings into emojis in figura.

GNUI preprocesses raw json texts to allow word wrapping / clipping.

Setting Text

Box.setText(text)

you can simply just slap a normal string into the method. or if you want to pass in a raw json, it has to be a table:
Box.setText({text="Hello World \n I am alive",color="yellow"})
and any type of data can be passed in as text, it will get converted into a string.

Text Alignment

Text in GNUI can be aligned to any parts of the box. you can imagine it like Box.Anchor but for texts.

Box:setTextAlign(x,y) img

you can also shift the text using Box:setTextOffset(x,y)

Text Behavior

by default, GNUI just renders the text regardles of size. but you can tell it what to do when the text is out of bounds.

Box:setTextBehavior(behavior)

the behavior can be one of the following: img

Text Effects

Figura has built in text styles you can use along side text tasks, GNUI allows you to use them.

Box:setTextEffect(effect)

in case you dont know what they look like, here is an example of each effect img

Clone this wiki locally