Font objects are used to render text with Pass:text. The active font can be changed using Pass:setFont. The default font is Varela Round, which is used when no font is active, and can be retrieved using Custom fonts can be loaded from TTF files using

Each Font uses a Rasterizer to load the TTF file and create images for each glyph. As text is drawn, the Font uploads images from the Rasterizer to a GPU texture atlas as needed. The Font also performs text layout and mesh generation for strings of text.

LÖVR uses a text rendering technique called "multichannel signed distance fields" (MSDF), which makes the font rendering remain crisp when text is viewed up close.

Constructors a new Font. the default Font.


Font:getAscentGet the ascent of the Font.
Font:getDescentGet the descent of the Font.
Font:getHeightGet the height of the Font.
Font:getKerningGet the kerning between 2 glyphs.
Font:getLineSpacingGet the line spacing of the Font.
Font:getLinesWrap a string into a sequence of lines.
Font:getPixelDensityGet the pixel density of the Font.
Font:getRasterizerGet the Font's Rasterizer.
Font:getVerticesGet the vertices for a piece of text.
Font:getWidthGet the width of rendered text.
Font:setLineSpacingSet the line spacing of the Font.
Font:setPixelDensitySet the pixel density of the Font.


MSDF text requires a special shader to work. LÖVR will automatically switch to this shader if no shader is active on the Pass. This font shader is also available as a DefaultShader.

See also