lovr.graphics.newFont

Creates a new Font.


Creates a new Font from a TTF file.

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

Arguments

NameTypeDefaultDescription
filenamestring A path to a TTF file.
sizenumber32 The size of the Font in pixels. Larger sizes are slower to initialize and use more memory, but have better quality.
spreadnumber4 For signed distance field fonts (currently all fonts), the width of the SDF, in pixels. The greater the distance the font is viewed from, the larger this value needs to be for the font to remain properly antialiased. Increasing this will have a performance penalty similar to increasing the size of the font.

Returns

NameTypeDescription
fontFont The new Font.

Creates a new Font from TTF data.

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

Arguments

NameTypeDefaultDescription
blobBlob A Blob containing TTF file data.
sizenumber32 The size of the Font in pixels. Larger sizes are slower to initialize and use more memory, but have better quality.
spreadnumber4 For signed distance field fonts (currently all fonts), the width of the SDF, in pixels. The greater the distance the font is viewed from, the larger this value needs to be for the font to remain properly antialiased. Increasing this will have a performance penalty similar to increasing the size of the font.

Returns

NameTypeDescription
fontFont The new Font.

Creates a new Font using the default typeface (Varela Round).

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

Arguments

NameTypeDefaultDescription
sizenumber32 The size of the Font in pixels. Larger sizes are slower to initialize and use more memory, but have better quality.
spreadnumber4 For signed distance field fonts (currently all fonts), the width of the SDF, in pixels. The greater the distance the font is viewed from, the larger this value needs to be for the font to remain properly antialiased. Increasing this will have a performance penalty similar to increasing the size of the font.

Returns

NameTypeDescription
fontFont The new Font.

Creates a new Font from an existing Rasterizer.

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

Arguments

NameTypeDefaultDescription
rasterizerRasterizer An existing Rasterizer to use to load glyph images.
spreadnumber4 For signed distance field fonts (currently all fonts), the width of the SDF, in pixels. The greater the distance the font is viewed from, the larger this value needs to be for the font to remain properly antialiased. Increasing this will have a performance penalty similar to increasing the size of the font.

Returns

NameTypeDescription
fontFont The new Font.

See also