1al_do_multiline_text(3)                                al_do_multiline_text(3)
2
3
4

NAME

6       al_do_multiline_text - Allegro 5 API
7

SYNOPSIS

9              #include <allegro5/allegro_font.h>
10
11              void al_do_multiline_text(const ALLEGRO_FONT *font,
12                 float max_width, const char *text,
13                 bool (*cb)(int line_num, const char *line, int size, void *extra),
14                 void *extra)
15

DESCRIPTION

17       This   function  processes  the  text  and  splits  it  into  lines  as
18       al_draw_multiline_text(3) would, and then calls the  callback  cb  once
19       for  every  line.  This is useful for custom drawing of multiline text,
20       or for calculating the size of multiline text ahead of time.   See  the
21       documentation  on  al_draw_multiline_text(3)  for an explanation of the
22       splitting algorithm.
23
24       For every line that this function splits text into the callback cb will
25       be called once with the following parameters:
26
27       • line_num - the number of the line starting from zero and counting up
28
29       • line - a pointer to the beginning character of the line (see below)
30
31       • size - the size of the line (0 for empty lines)
32
33       • extra - the same pointer that was passed to al_do_multiline_text
34
35       Note  that  line  is  not guaranteed to be a NUL-terminated string, but
36       will merely point to a character within text or to an empty  string  in
37       case  of  an empty line.  If you need a NUL-terminated string, you will
38       have to copy line to a buffer and NUL-terminate it yourself.  You  will
39       also  have to make your own copy if you need the contents of line after
40       cb has returned, as line is not guaranteed to be valid after that.
41
42       If the callback cb returns false, al_do_multiline_text will stop  imme‐
43       diately, otherwise it will continue on to the next line.
44

SINCE

46       5.1.9
47

SEE ALSO

49       al_draw_multiline_text(3)
50
51
52
53Allegro reference manual                               al_do_multiline_text(3)
Impressum