Provided by: allegro5-doc_5.2.3.0-1_all bug

NAME

       al_get_glyph_dimensions - Allegro 5 API

SYNOPSIS

              #include <allegro5/allegro_font.h>

              bool al_get_glyph_dimensions(const ALLEGRO_FONT *f,
                 int codepoint, int *bbx, int *bby, int *bbw, int *bbh)

DESCRIPTION

       Sometimes,  the al_get_glyph_width(3alleg5) or al_get_glyph_advance(3alleg5) functions are not enough for
       exact glyph placement, so this function returns some additional information, particularly if you want  to
       draw the font vertically.

       The  function itself returns true if the character was present in font and false if the character was not
       present in font.

       Returned variables (all in pixel):

       • bbx, bby - Offset to upper left corner of bounding box.

       • bbw, bbh - Dimensions of bounding box.

       These values are the same as al_get_text_dimensions(3alleg5) would  return  for  a  string  of  a  single
       character equal to the glyph passed to this function.  Note that glyphs may go to the left and upwards of
       the X, in which case x and y will have negative values.

       If you want to draw a string verticallly, for Japanese or as a game effect, then you should leave  bby  +
       bbh space between the glyphs in the y direction for a regular placement.

       If you want to draw a string horizontally in an extra compact way,
       then you should leave bbx + bbw space between the glyphs in the x direction for a compact placement.

       In  the  figure  below  is an example of what bbx and bby may be like for a 2 glyph, and a g glyph of the
       same font compared to the result of al_get_glyph_width().

                 al_get_glyph_width()     al_get_glyph_width()
                        __|___                   __|__
                       /      \                 /     \
                   bbx    bbw                 bbx   bbw
                  <-->+<------>+           <-->+<----->+   X baseline
                  ^   |        |           ^   |       |
              bby |   |        |       bby |   |       |
                  v   |        |           |   |       |
                  +---+--------+           |   |       |
                  ^   | *****  |           |   |       |
                  |   |*    ** |           v   |       |
              bbh |   |    **  |       bbh +---+-------+
                  |   |  **    |           ^   | ***** |
                  v   |********|           |   |*     *|
                  +---+--------+           |   | ***** |
                                           |   |      *|
                                           |   | *    *|
                                           v   |  **** |
                                           +---+-------+

SINCE

       5.1.12

SEE ALSO

       al_draw_glyph(3alleg5), al_get_glyph_width(3alleg5), al_get_glyph_advance(3alleg5).