p5.js Typography is used to do the draw or animation operation on the text. There are some specific attributes to do these kinds of operations and some functions to load or display the text, mentioned below.
Attributes |
Description |
---|---|
textAlign() | textAlign() function is used to set the alignment for the drawing the text. |
textLeading() | textAlign() function is used to set the spacing, in pixels, between lines of text. |
textSize() | textSize() function is used to set or return the font size of text. |
textStyle() | It is used to set or return the style of the text for system fonts to NORMAL, ITALIC, BOLD, or BOLDITALIC. |
textWidth() | textWidth() function is used to calculate the width of the text given as parameter. |
textAscent() | textAscent() function is used to find out the ascent of the current font at its current size. |
textDescent() | textDescent() function is used to find out the descent of the current font at its current size. |
Loading & Displaying |
Description |
---|---|
loadFont() | loadFont() function is used to load a font from file or an URL, and return it as a PFont Object. |
textFont() | textFont() function is used to specify the font that will be used to draw text using the text() function. |
textBounds() | It returns a tight bounding box for the given string using the font it is used upon. |