lovr.graphics.newFont

Edit

Creates a new Font.





Creates a new Font from a font file.

Arguments

NameTypeDefaultDescription
filenamestring A path to a TTF or BMFont file.
sizenumber32 The size of the Font in pixels (TTF only). 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 font data.

Arguments

NameTypeDefaultDescription
blobBlob A Blob containing TTF or BMFont file data.
sizenumber32 The size of the Font in pixels (TTF only). 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).

Arguments

NameTypeDefaultDescription
sizenumber32 The size of the Font in pixels (TTF only). 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.

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