1load_dat_font(3)                Allegro manual                load_dat_font(3)
2
3
4

NAME

6       load_dat_font - Loads a FONT from an Allegro datafile.
7

SYNOPSIS

9       #include <allegro.h>
10
11
12       FONT *load_dat_font(const char *filename, RGB *pal, void *param)
13

DESCRIPTION

15       Loads  a  FONT from an Allegro datafile. You can set param parameter to
16       point to an array that holds two strings that identify the font and the
17       palette  in the datafile by name.  The first string in this list is the
18       name of the font. You can pass NULL here to just load  the  first  font
19       found  in  the  datafile.  The second string can be used to specify the
20       name of the palette associated with the font.  This is only returned if
21       the  pal  parameter  is  not NULL. If you pass NULL for the name of the
22       palette, the last palette found before the font was found is  returned.
23       You can also pass NULL for param, which is treated as if you had passed
24       NULL for both strings separately. In this case, the function will  sim‐
25       ply load the first font it finds from the datafile and the palette that
26       precedes it.
27
28       For example, suppose you have a datafile  named  `fonts.dat'  with  the
29       following contents:
30
31          FONT  FONT_1_DATA
32          FONT  FONT_2_DATA
33          FONT  FONT_3_DATA
34          PAL   FONT_1_PALETTE
35          PAL   FONT_2_PALETTE
36
37       Then  the  following  code  will  load FONT_1_DATA as a FONT and return
38       FONT_1_PALETTE as the palette:
39
40          FONT *f;
41          PALETTE pal;
42          char *names[] = { "FONT_1_DATA", "FONT_1_PALETTE" }
43
44          f = load_dat_font("fonts.dat", pal, names);
45
46       If instead you want to load the second font, FONT_2, from the datafile,
47       you would use:
48
49          FONT *f;
50          PALETTE pal;
51          char *names[] = { "FONT_2_DATA", "FONT_2_PALETTE" }
52
53          f = load_dat_font("fonts.dat", pal, names);
54
55       If you want to load the third font, but not bother with a palette, use:
56
57          FONT *f;
58          char *names[] = { "FONT_3_DATA", NULL }
59
60          f = load_dat_font("fonts.dat", NULL, names);
61

RETURN VALUE

63       Returns  a  pointer to the font or NULL on error. Remember that you are
64       responsible for destroying the font when you are finished  with  it  to
65       avoid memory leaks.
66
67

SEE ALSO

69       register_font_file_type(3), load_font(3)
70
71
72
73Allegro                          version 4.2.3                load_dat_font(3)
Impressum