logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

ALLEGRO_GLYPH - Allegro 5 API

Description

       A structure containing the properties of a character in a font.

              typedef struct ALLEGRO_GLYPH {
                 ALLEGRO_BITMAP *bitmap;   // the bitmap the character is on
                 int x;                    // the x position of the glyph on bitmap
                 int y;                    // the y position of the glyph on bitmap
                 int w;                    // the width of the glyph in pixels
                 int h;                    // the height of the glyph in pixels
                 int kerning;              // pixels of kerning (see below)
                 int offset_x;             // x offset to draw the glyph at
                 int offset_y;             // y offset to draw the glyph at
                 int advance;              // number of pixels to advance after this character
              } ALLEGRO_GLYPH;

       bitmap  may  be  a  sub-bitmap in the case of color fonts.  Bitmap can also be NULL in which case nothing
       should be drawn (sometimes true for whitespace characters in TTF fonts).

       kerning should be added to the x position you draw to if you want your text kerned and depends  on  which
       codepoints al_get_glyph(3alleg5) was called with.

       Glyphs are tightly packed onto the bitmap, so you need to add offset_x and offset_y to your draw position
       for the text to look right.

       advance  is  the  number of pixels to add to your x position to advance to the next character in a string
       and includes kerning.

Name

       ALLEGRO_GLYPH - Allegro 5 API

See Also

al_get_glyph(3alleg5)

Allegro reference manual                                                                  ALLEGRO_GLYPH(3alleg5)

Since

       5.2.1

              [UnstableAPI]: This API is new and subject to refinement.

Synopsis

              #include <allegro5/allegro_font.h>

              typedef struct ALLEGRO_GLYPH ALLEGRO_GLYPH;

See Also