text(str, x, y);Draw text on the screen.
Arguments
strString to renderxThe x position of the start of the textyThe y position of the top of the textFonts are not yet implemented
function setup()
createWindow(200, 200);
end
function draw()
background('purple');
text('Hello from lu5!', 25, 110);
endOutput
textFont(font);Set a font family.
Arguments
fontThe font value returned when using loadFontfunction setup()
createWindow(200, 200);
end
function draw()
background('purple');
textFont('Monospace');
text('Hello from lu5!', 5, 110);
endOutput
loadFont(path);Load a font.
Arguments
pathThe font path on the local systemReturns
fontThe image reference-- For Web
function setup()
createWindow(200, 200);
-- loadFont is not needed here...
end
function draw()
background('purple');
textFont('Verdana');
text('Hello from lu5!', 35, 110);
end Output
-- For native
function setup()
createWindow(200, 200);
font = loadFont('/path/to/myfont.ttf');
end
function draw()
background('purple');
textFont(font);
text('Hello from lu5!', 35, 110);
end textSize(size);Set a font size.
Arguments
sizeThe size of the font in pixelsIf this is called using fonts, make sure to call textSize after calling textFont
function setup()
createWindow(200, 200);
end
function draw()
background('purple');
textSize(48); -- Larger text
text('Hello lu5!', 0, 120);
endOutput
textAlign(mode);Set a font alignment.
Arguments
modeCENTER, LEFT, RIGHTfunction setup()
createWindow(200, 200);
textAlign(CENTER);
end
function draw()
background('purple');
text('Hello lu5!', width/2, height/2);
point(width/2, height/2);
endOutput