![]() |
libdragon
|
Go to the source code of this file.
Data Structures | |
struct | range_t |
A range of codepoint (part of rdpq_font_t) More... | |
struct | sparse_range_t |
Sparse range table. More... | |
struct | glyph_t |
A glyph in the font (part of rdpq_font_t) More... | |
struct | glyph_krange_t |
For each glyph, range of kerning pairs in the kerning table. More... | |
struct | atlas_t |
A texture atlas (part of rdpq_font_t) More... | |
struct | kerning_t |
Kerning data for a pair of glyphs. More... | |
struct | style_t |
Data related to font styling. More... | |
struct | rdpq_font_t |
A font64 file containing a font. More... | |
Enumerations | |
enum | fonttype_t { FONT_TYPE_ALIASED = 0 , FONT_TYPE_MONO = 1 , FONT_TYPE_MONO_OUTLINE = 2 , FONT_TYPE_ALIASED_OUTLINE = 3 , FONT_TYPE_BITMAP = 4 } |
Type of the font. More... | |
Functions | |
int16_t | __rdpq_font_glyph (const rdpq_font_t *font, uint32_t codepoint) |
Look up a glyph in a font. | |
void | __rdpq_font_glyph_metrics (const rdpq_font_t *fnt, int16_t index, float *xadvance, int8_t *xoff, int8_t *xoff2, bool *has_kerning, uint8_t *atlas_id) |
Get glyph metrics for a font glyph. | |
float | __rdpq_font_kerning (const rdpq_font_t *font, int16_t glyph1, int16_t glyph2) |
Get kerning between two glyphs. | |
struct range_t |
A range of codepoint (part of rdpq_font_t)
struct sparse_range_t |
Sparse range table.
This is a perfect hash table used to encode glyph indices for codepoints. It is used for all sparse ranges, that is ranges where only some codepoints are defined within the min/max of the range, to avoid wasting too much memory in the glyph table for empty entries.
This uses the CHD (compress hash displace) perfect hash table algorithm, that is very fast at runtime and has very little complexity. Since we handle small tables by today's standard, this algorithm is a good fit.
struct glyph_t |
A glyph in the font (part of rdpq_font_t)
struct glyph_krange_t |
struct atlas_t |
A texture atlas (part of rdpq_font_t)
Data Fields | ||
---|---|---|
sprite_t * | sprite | Texture sprite. |
uint32_t | size | Size of the sprite in bytes. |
rspq_block_t * | up | RSPQ block that uploads the sprite. |
struct kerning_t |
struct rdpq_font_t |
A font64 file containing a font.
Data Fields | ||
---|---|---|
char | magic[3] | Magic header (FONT_MAGIC) |
uint8_t | version | Version number (1) |
uint32_t | flags | Flags. |
uint32_t | point_size | Point size of the font. |
int32_t | ascent | Ascent (number of pixels above baseline) |
int32_t | descent | Descent (number of pixels below baseline) |
int32_t | line_gap | Line gap of the font (spacing between descent and ascent) |
int32_t | space_width | Width of the space character. |
int16_t | ellipsis_width | Width of the ellipsis character. |
uint16_t | ellipsis_glyph | Index of the ellipsis glyph. |
uint16_t | ellipsis_reps | Number of ellipsis glyphs to draw. |
uint16_t | ellipsis_advance | Advance of the ellipsis character. |
uint32_t | num_ranges | Number of ranges in the font. |
uint32_t | num_glyphs | Number of glyphs in the font. |
uint32_t | num_atlases | Number of atlases in the font. |
uint32_t | num_kerning | Number of kerning pairs in the font. |
uint32_t | num_styles | Number of styles in the font. |
style_t | builtin_style | Default style for the font. |
range_t * | ranges | Array of ranges. |
sparse_range_t * | sparse_range | Sparse table of glyph indices. |
glyph_t * | glyphs | Array of glyphs. |
glyph_krange_t * | glyphs_kranges | Array of glyph kerning ranges. |
atlas_t * | atlases | Array of atlases. |
kerning_t * | kerning | Array of kerning pairs. |
style_t * | styles | Array of styles. |
enum fonttype_t |
Type of the font.
int16_t __rdpq_font_glyph | ( | const rdpq_font_t * | font, |
uint32_t | codepoint | ||
) |
Look up a glyph in a font.
font | Font to look up the glyph in |
codepoint | Unicode codepoint of the glyph |
|
inline |
Get glyph metrics for a font glyph.
fnt | Font to query. |
index | Index of the glyph in the font. |
xadvance | Pointer to store the advance width (can be NULL). |
xoff | Pointer to store the start x offset (can be NULL). |
xoff2 | Pointer to store the end x offset (can be NULL). |
has_kerning | Pointer to store whether the glyph has kerning (can be NULL). |
atlas_id | Pointer to store the atlas ID (can be NULL). |