text_params

This type is used to determine text alignment.

Line alignment only makes sense if you have multiple lines in your text. By default, all next lines will start from the left side of the text. You can change this behavior by using one of the functions that take line as a parameter. For example, if you pass right to the line alignment, all next lines will start from the right side. Text alignment will remain as dictated by v and h parameters.

with_v

Creates text_params instance with vertical alignment.

Arguments

Name

Type

Description

v

Vertical alignment.

Returns

Type

Description

text_params

Created text params.

Example

local align_top = draw.text_params.with_v(draw.text_alignment.top);

with_h

Creates text_params instance with horizontal alignment.

Arguments

Name

Type

Description

h

Horizontal alignment.

Returns

Type

Description

text_params

Created text params.

Example

local align_right = draw.text_params.with_h(draw.text_alignment.right);

with_line

Creates text_params instance with line alignment.

Arguments

Name

Type

Description

line

Line alignment.

Returns

Type

Description

text_params

Created text params.

Example

local lines_center = draw.text_params.with_line(draw.text_alignment.center);

with_vh

Creates text_params instance with vertical and horizontal alignments.

Arguments

Name

Type

Description

v

Vertical alignment.

h

Horizontal alignment.

Returns

Type

Description

text_params

Created text params.

Example

local align_bottom_right = draw.text_params.with_vh(draw.text_alignment.bottom, draw.text_alignment.right);

with_vline

Creates text_params instance with vertical alignment and line alignment.

Arguments

Name

Type

Description

v

Vertical alignment.

line

Line alignment.

Returns

Type

Description

text_params

Created text params.

Example

local align = draw.text_params.with_vline(draw.text_alignment.bottom, draw.text_alignment.center);

with_hline

Creates text_params instance with horizontal alignment and line alignment.

Arguments

Name

Type

Description

h

Horizontal alignment.

line

Line alignment.

Returns

Type

Description

text_params

Created text params.

Example

local align = draw.text_params.with_hline(draw.text_alignment.center, draw.text_alignment.center);

with_vhline

Creates text_params instance with vertical, horizontal and line alignments.

Arguments

Name

Type

Description

v

Vertical alignment.

h

Horizontal alignment.

line

Line alignment.

Returns

Type

Description

text_params

Created text params.

Example

local align = draw.text_params.with_vhline(draw.text_alignment.center, draw.text_alignment.center, draw.text_alignment.center);

Last updated