18#define GP_FONT_NAME_MAX 64
100#define GP_FONT_STYLE(x) ((x) & GP_FONT_STYLE_MASK)
102typedef uint32_t gp_glyph_offset;
103#define GP_NOGLYPH UINT32_MAX
static unsigned int gp_font_max_advance_x(const gp_font_face *font)
Returns maximal glyph advance.
gp_font_style
Font style bitflags.
@ GP_FONT_REGULAR
Regular font.
@ GP_FONT_FALLBACK
A fallback flag.
@ GP_FONT_ITALIC
Italic font.
@ GP_FONT_STYLE_MASK
Font style mask.
@ GP_FONT_MONO
Monospace font.
gp_glyph * gp_glyph_get(const gp_font_face *font, uint32_t ch)
Looks up a glyph in a font.
gp_font_bitmap_format
Glyph bitmap data format.
@ GP_FONT_BITMAP_8BPP
8 bit per pixel.
@ GP_FONT_BITMAP_1BPP
1 bit per pixel.
gp_font_face * gp_font_face_fc_load(const char *name, uint32_t width, uint32_t height)
Uses fontconfig to lookup font file.
static const char * gp_font_family_name(const gp_font_face *font)
Returns font family name.
gp_font_face * gp_font_face_load(const char *path, uint32_t width, uint32_t height)
Load a font face from a file.
static unsigned int gp_font_avg_advance_x(const gp_font_face *font)
Returns average glyph advance.
static unsigned int gp_font_descent(const gp_font_face *font)
Returns font ascent.
void gp_font_face_free(gp_font_face *self)
Frees the font face memory.
const char * gp_font_style_name(gp_font_style style)
Returns font style name.
static unsigned int gp_font_height(const gp_font_face *font)
Returns font height.
static unsigned int gp_font_max_width(const gp_font_face *font)
Returns maximal glyph width.
gp_font_ucode_block
Unicode block ids.
@ GP_UCODE_LATIN_SUP
Latin suplement 0xa0 - 0xff.
@ GP_UCODE_HIRAGANA
Hiragan 0x3041 - 0x3096.
@ GP_UCODE_GREEK
Greek 0x384 - 0x3ce.
@ GP_UCODE_KATAKANA
Katakana 0x30a0 - 0x30aff.
@ GP_UCODE_LATIN_BASIC
ASCII block 0x20 - 0x7f.
@ GP_UCODE_LATIN_EXT_A
Latin extended A 0x100 - 0x17e.
@ GP_UCODE_CYRILIC
Cyrilic 0x340 - 0x45f.
static unsigned int gp_font_ascent(const gp_font_face *font)
Returns font ascent.
void(* font_free)(gp_font_face *self)
Callback to free a font.
uint16_t avg_glyph_advance
An average glyph advance.
uint16_t max_glyph_advance
Maximal glyph advance.
gp_glyphs glyphs[]
Glyph tables.
uint16_t ascent
Maximal height of font glyph from baseline to the top.
const gp_font_face_ops * ops
On demand loader used for non-ASCII unicode glyphs.
char family_name[64]
Font family name - eg. Sans, Serif ...
uint16_t max_glyph_width
Maximal width of font glyph.
uint8_t glyph_tables
A number of glyph tables in this font.
uint8_t style
A gp_font_style flags.
gp_font_bitmap_format glyph_bitmap_format
Bitmap format for all glyphs.
uint16_t descent
Maximal length of font glyph from baseline to the bottom.
const char * family_name
A font family name.
const gp_font_face *const fonts[]
uint32_t ucode_blocks
A bitmask of unicode blocks included in the font faces.
A data describing single Glyph.
uint8_t bitmap[]
A character bitmap.
int8_t bearing_y
An Y offset from baseline to the top of the bitmap.
uint8_t height
Bitmap heigth in pixels.
uint8_t width
Bitmap width in pixels.
int8_t bearing_x
An X offset to be applied before we start drawing.
uint8_t advance_x
An offset to be applied after drawing.
gp_glyph_offset offset
An offset to the glyph data.
uint32_t max_glyph
Last character in glyphs table.
uint32_t min_glyph
First character in glyphs table.
gp_glyph_offset * offsets
Offsets to the glyph data.
void * glyphs
Pointer to glyph bitmap buffer.