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

NAME

6       load_bitmap_font  -  Grabs a font from a bitmap file. Allegro game pro‐
7       gramming library.
8

SYNOPSIS

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

DESCRIPTION

16       Tries to grab a font from a bitmap. The bitmap can  be  in  any  format
17       that load_bitmap understands.
18
19       The  size  of  each character is determined by the layout of the image,
20       which should be a rectangular grid containing all the ASCII  characters
21       from space (32) up to the tilde (126). The way the characters are sepa‐
22       rated depends on the color depth of the image file:
23
24       paletted (8 bit) image file Use color 0 for the transparent portions of
25       the characters and fill the spaces between each letter with color 255.
26
27       High  (15/16 bit) and true (24/32 bit) color image file Use bright pink
28       (maximum red and blue, zero green) for the transparent portions of  the
29       characters  and  fill the spaces between each letter with bright yellow
30       (maximum red and green, zero blue).
31
32
33       Note that in each horizontal row the bounding boxes around the  charac‐
34       ters should align and have the same height.
35
36       Probably the easiest way to get to grips with how this works is to load
37       up the `demo.dat' file and export the TITLE_FONT into a PCX file.  Have
38       a look at the resulting picture in your paint program: that is the for‐
39       mat a font should be in.
40
41       Take care with high and true color fonts: Allegro will convert these to
42       the  current  color  depth  when you load the font. If you try to use a
43       font on a bitmap with a different color depth  Allegro  will  do  color
44       conversions  on the fly, which will be rather slow. For optimal perfor‐
45       mance you should set the color depth to the color depth you want to use
46       before loading any fonts.
47

RETURN VALUE

49       Returns  a  pointer to the font or NULL on error. Remember that you are
50       responsible for destroying the font when you are finished  with  it  to
51       avoid memory leaks.
52
53

SEE ALSO

55       register_font_file_type(3),        load_font(3),        load_bitmap(3),
56       set_color_depth(3), grab_font_from_bitmap(3)
57
58
59
60Allegro                          version 4.4.3             load_bitmap_font(3)
Impressum