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

NAME

6       load_font - Loads a font from a file. Allegro game programming library.
7

SYNOPSIS

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

DESCRIPTION

15       Loads  a font from a file. At present, this supports loading fonts from
16       a GRX format .fnt file, a 8x8 or 8x16 BIOS format .fnt file, a datafile
17       or any bitmap format that can be loaded by load_bitmap().
18
19       If  the font contains palette information, then the palette is returned
20       in the second parameter, which should be an array of 256 RGB structures
21       (a  PALETTE).  The  pal argument may be NULL. In this case, the palette
22       data, if present, is simply not returned.
23
24       The third parameter can be used to pass specific information to a  cus‐
25       tom  loader  routine.  Normally,  you can just leave this as NULL. Note
26       that another way of loading fonts is embedding them into a datafile and
27       using the datafile related functions.
28
29       Example:
30
31          FONT *myfont;
32          PALETTE palette;
33          ...
34          myfont = load_font("my_font.pcx", palette, NULL);
35          if (!myfont)
36             abort_on_error("Couldn't load font!");
37          ...
38          textout_centre_ex(screen, myfont, "This is my own pretty font!",
39                            SCREEN_W / 2, SCREEN_H / 2, white, black);
40          ...
41          destroy_font(myfont);
42

RETURN VALUE

44       Returns  a  pointer to the font or NULL on error. Remember that you are
45       responsible for destroying the font when you are finished  with  it  to
46       avoid memory leaks.
47
48

SEE ALSO

50       register_font_file_type(3),      load_bitmap(3),      load_dat_font(3),
51       load_bios_font(3),     load_grx_font(3),      load_grx_or_bios_font(3),
52       load_bitmap_font(3), load_txt_font(3), destroy_font(3), exfont(3)
53
54
55
56Allegro                          version 4.2.2                    load_font(3)
Impressum