Scroll to navigation

ALLEGRO_GLYPH(3alleg5) Allegro reference manual() ALLEGRO_GLYPH(3alleg5) Allegro reference manual()

NAME

ALLEGRO_GLYPH - Allegro 5 API

SYNOPSIS


#include <allegro5/allegro_font.h>
typedef struct ALLEGRO_GLYPH ALLEGRO_GLYPH;

    

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.

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.

SINCE

5.2.1

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

SEE ALSO

al_get_glyph(3alleg5)