1merge_fonts(3) Allegro manual merge_fonts(3)
2
3
4
6 merge_fonts - Merges two fonts into one font. Allegro game programming
7 library.
8
10 #include <allegro.h>
11
12
13 FONT *merge_fonts(FONT *f1, FONT *f2)
14
16 This function merges the character ranges from two fonts and returns a
17 new font containing all characters in the old fonts. In general, you
18 cannot merge fonts of different types (eg, TrueType fonts and bitmapped
19 fonts), but as a special case, this function can promote a monochrome
20 bitmapped font to a color font and merge those. Example:
21
22 FONT *myfont;
23 FONT *myfancy_font;
24 FONT *lower_range;
25 FONT *upper_range;
26 FONT *capitals;
27 FONT *combined_font;
28 FONT *tempfont;
29 ...
30 /* Create a font that contains the capitals from */
31 /* the fancy font but other characters from myfont */
32 lower_range = extract_font_range(myfont, -1, 'A'-1);
33 upper_range = extract_font_range(myfont, 'Z'+1, -1);
34 capitals = extract_font_range(myfancy_font, 'A', 'Z');
35
36 tempfont = merge_fonts(lower_range, capitals);
37 combined_font = merge_fonts(tempfont, upper_range);
38
39 /* Clean up temporary fonts */
40 destroy_font(lower_range);
41 destroy_font(upper_range);
42 destroy_font(capitals);
43 destroy_font(tempfont);
44
46 Returns a pointer to the new font or NULL on error. Remember that you
47 are responsible for destroying the font when you are finished with it
48 to avoid memory leaks.
49
50
52 extract_font_range(3), is_trans_font(3), is_color_font(3),
53 is_mono_font(3), exfont(3)
54
55
56
57Allegro version 4.4.3 merge_fonts(3)