display_modpack/font_lib/API.md

1.1 KiB

Font Lib API

This document describes Font Lib API. Font Lib creates textures for font display on entities.

Provided methods

get_line_width

font_lib.get_line_width(text)

Computes line width for a given font height and text text: Text to be rendered

Returns: rendered text width

make_line_texture

font_lib.make_line_texture(text, texturew, x, y)

Builds texture part for a text line

text: Text to be rendered

texturew: Width of the texture (extra text is not rendered)

x: Starting x position in texture

y: Vertical position of the line in texture

Returns: Texture string

make_multiline_texture

font_lib.make_multiline_texture(text, texturew, textureh, maxlines, valign, color)

Builds texture for a multiline colored text

text: Text to be rendered

texturew: Width of the texture (extra text will be truncated)

textureh: Height of the texture

maxlines: Maximum number of lines

valign: Vertical text align ("top" or "center")

color: Color of the text

Returns: Texture string