aboutsummaryrefslogtreecommitdiff
path: root/font_lib/API.md
blob: 7ec499bf1a4b7ce41bfa4d5dadb054cc2285e885 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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