lovr.graphics.newFont

Creates a new Font. It can be used to render text with lovr.graphics.print.

Currently, the only supported font format is TTF.

font = lovr.graphics.newFont(filename, size, padding, spread)

Arguments

NameTypeDefaultDescription
filenamestringThe filename of the font file.
sizenumber32The size of the font, in pixels.
paddingnumber2The number of pixels of padding around each glyph.
spreadnumber4.0The range of the distance field, in pixels.

Returns

NameTypeDescription
fontFontThe new Font.

Creates a new Font from the default font included with LÖVR (Varela Round).

font = lovr.graphics.newFont(size, padding, spread)

Arguments

NameTypeDefaultDescription
sizenumber32The size of the font, in pixels.
paddingnumber2The number of pixels of padding around each glyph.
spreadnumber4.0The range of the distance field, in pixels.

Returns

NameTypeDescription
fontFontThe new Font.

font = lovr.graphics.newFont(rasterizer, padding, spread)

Arguments

NameTypeDefaultDescription
rasterizerRasterizerThe existing Rasterizer object used to render the glyphs.
paddingnumber2The number of pixels of padding around each glyph.
spreadnumber4.0The range of the distance field, in pixels.

Returns

NameTypeDescription
fontFontThe new Font.

Notes

Larger font sizes will lead to more detailed curves at the cost of performance.

See also