1al_get_glyph_dimensions(3) al_get_glyph_dimensions(3)
2
3
4
6 al_get_glyph_dimensions - Allegro 5 API
7
9 #include <allegro5/allegro_font.h>
10
11 bool al_get_glyph_dimensions(const ALLEGRO_FONT *f,
12 int codepoint, int *bbx, int *bby, int *bbw, int *bbh)
13
15 Sometimes, the al_get_glyph_width(3) or al_get_glyph_advance(3) func‐
16 tions are not enough for exact glyph placement, so this function
17 returns some additional information, particularly if you want to draw
18 the font vertically.
19
20 The function itself returns true if the character was present in font
21 and false if the character was not present in font.
22
23 Returned variables (all in pixel):
24
25 · bbx, bby - Offset to upper left corner of bounding box.
26
27 · bbw, bbh - Dimensions of bounding box.
28
29 These values are the same as al_get_text_dimensions(3) would return for
30 a string of a single character equal to the glyph passed to this func‐
31 tion. Note that glyphs may go to the left and upwards of the X, in
32 which case x and y will have negative values.
33
34 If you want to draw a string verticallly, for Japanese or as a game
35 effect, then you should leave bby + bbh space between the glyphs in the
36 y direction for a regular placement.
37
38 If you want to draw a string horizontally in an extra compact way,
39 then you should leave bbx + bbw space between the glyphs in the x
40 direction for a compact placement.
41
42 In the figure below is an example of what bbx and bby may be like for a
43 2 glyph, and a g glyph of the same font compared to the result of
44 al_get_glyph_width().
45
46 al_get_glyph_width() al_get_glyph_width()
47 __|___ __|__
48 / \ / \
49 bbx bbw bbx bbw
50 <-->+<------>+ <-->+<----->+ X baseline
51 ^ | | ^ | |
52 bby | | | bby | | |
53 v | | | | |
54 +---+--------+ | | |
55 ^ | ***** | | | |
56 | |* ** | v | |
57 bbh | | ** | bbh +---+-------+
58 | | ** | ^ | ***** |
59 v |********| | |* *|
60 +---+--------+ | | ***** |
61 | | *|
62 | | * *|
63 v | **** |
64 +---+-------+
65
67 5.1.12
68
70 al_draw_glyph(3), al_get_glyph_width(3), al_get_glyph_advance(3).
71
72
73
74Allegro reference manual al_get_glyph_dimensions(3)