font

This type represents a font object. Internally, this type uses FreeType library to rasterize font glyphs.

This type inherits font_base type. All of its base methods and fields are also available in this type.

__callīģŋ

Constructs a font object.

Arguments

1. From file.

Name

Type

Description

path

string

Path to a ttf/otf file.

size

float

Font height, in pixels.

fl

Font flags. Use bit library to construct them. Defaults to 0.

mi

int

Starting codepoint. Defaults to 0.

ma

int

Ending codepoint. Defaults to 255 (entire ASCII code page).

1. From memory.

Name

Type

Description

mem

Pointer to a font file in memory.

sz

int

Font file size, in bytes.

size

float

Font height, in pixels.

fl

Font flags. Use bit library to construct them. Defaults to 0.

mi

int

Starting codepoint. Defaults to 0.

ma

int

Ending codepoint. Defaults to 255 (entire ASCII code page).

1. From memory, with codepoint pairs.

Name

Type

Description

mem

Pointer to a font file in memory.

sz

int

Font file size, in bytes.

size

float

Font height, in pixels.

fl

Font flags. Use bit library to construct them. Defaults to 0.

pairs

table[{int, int}...]

Min/max pairs. This is a standard array, consisting of {int, int} pairs.

Returns

Type

Description

font

Font object.

Example

local cool_font = draw.font('myfont.ttf', 16);

Last updated