Skip to main content

FontModule

Description:

  Allows you to work with fonts.

newImageRasterizer

Type: Function.

Description:

  Creates a new Image Rasterizer. Overload details:

  1. Create an ImageRasterizer from the image data.

Signature:

newImageRasterizer: function(image_data: ImageData, glyphs: string, extra_spacing?: integer, dpi_scale?: number): Rasterizer

Parameters:

ParameterTypeDescription
image_dataImageDataFont image data.
glyphsstringString containing font glyphs.
extra_spacingintegerFont extra spacing. (Default: 0.)
dpi_scalenumberFont DPI scale. (Default: 1.)

Returns:

Return TypeDescription
RasterizerThe rasterizer.

newBMFontRasterizer

Type: Function.

Description:

  Creates a new BMFont Rasterizer.

Signature:

newBMFontRasterizer: function(filename_or_file_data: string | FileData, images?: ImageData | string | FileData | {ImageData | string | FileData}, dpi_scale?: number): Rasterizer

Parameters:

ParameterTypeDescription
filename_or_file_datastring or FileDataThe image data containing the drawable pictures of font glyphs. Depending on the
imagesImageData or string or FileData or {ImageData or string or FileData}The sequence of glyphs in the ImageData.
dpi_scalenumberDPI scale. (Default: 1.)

Returns:

Return TypeDescription
RasterizerThe rasterizer.

newTrueTypeRasterizer

Type: Function.

Description:

  Creates a new TrueType Rasterizer.

Signature:

newTrueTypeRasterizer: function(size?: number, hinting?: string, dpi_scale?: number): Rasterizer

Parameters:

ParameterTypeDescription
sizenumberThe font size. (Default: 12.)
hintingstringTrue Type hinting mode. (Default: 'normal'.)
dpi_scalenumberThe font DPI scale. (Default: love.window.getDPIScale().)

Returns:

Return TypeDescription
Rasterizerrasterizer — The rasterizer.

newTrueTypeRasterizer

Type: Function.

Description:

  Creates a new TrueType Rasterizer.

Signature:

newTrueTypeRasterizer: function(filename_or_data: string | Data, size?: number, hinting?: string, dpi_scale?: number): Rasterizer

Parameters:

ParameterTypeDescription
filename_or_datastringData
sizenumberThe font size. (Default: 12.)
hintingstringTrue Type hinting mode. (Default: 'normal'.)
dpi_scalenumberThe font DPI scale. (Default: love.window.getDPIScale().)

Returns:

Return TypeDescription
Rasterizerrasterizer — The rasterizer.

newRasterizer

Type: Function.

Description:

  Creates a new Rasterizer.

Signature:

newRasterizer: function(size?: number, hinting?: string, dpi_scale?: number): Rasterizer

Parameters:

ParameterTypeDescription
sizenumberThe font size. (Default: 12.)
hintingstringTrue Type hinting mode. (Default: 'normal'.)
dpi_scalenumberThe font DPI scale. (Default: love.window.getDPIScale().)

Returns:

Return TypeDescription
Rasterizerrasterizer — The rasterizer.

newRasterizer

Type: Function.

Description:

  Creates a new Rasterizer.

Signature:

newRasterizer: function(filename_or_data: string | Data, size?: number, hinting?: string, dpi_scale?: number): Rasterizer

Parameters:

ParameterTypeDescription
filename_or_datastringData
sizenumberThe font size. (Default: 12.)
hintingstringTrue Type hinting mode. (Default: 'normal'.)
dpi_scalenumberDPI scale. (Default: 1.)

Returns:

Return TypeDescription
Rasterizerrasterizer — The rasterizer.

newGlyphData

Type: Function.

Description:

  Creates a new GlyphData.

Signature:

newGlyphData: function(rasterizer: Rasterizer, glyph: string | integer): GlyphData

Parameters:

ParameterTypeDescription
rasterizerRasterizerThe Rasterizer containing the font.
glyphstring or integerThe character code of the glyph.