8#ifndef LIBDRAGON_RDPQ_FONT_H
9#define LIBDRAGON_RDPQ_FONT_H
99 assertf(
false,
"Invalid builtin font");
121typedef struct rdpq_fontstyle_s {
124 void (*custom)(
void* arg);
#define assertf(expr, msg,...)
assertf() is like assert() with an attached printf().
Definition debug.h:196
Generic color structure.
Definition graphics.h:54
rdpq_font_t * __rdpq_font_load_builtin_1(void)
Load built-in font 1 (monogram)
Definition rdpq_font.c:532
rdpq_font_t * __rdpq_font_load_builtin_2(void)
Load built-in font 2 (At01)
Definition rdpq_font.c:538
rdpq_font_t * rdpq_font_load_builtin(rdpq_font_builtin_t font)
Load a builtin font provided by libdragon.
Definition rdpq_font.h:92
float xadvance
Advance after drawing the glyph.
Definition rdpq_font.h:27
int8_t x0
Top-left X coordinate of the bbox of the glyph (relative to the pen position)
Definition rdpq_font.h:28
int8_t y0
Top-left Y coordinate of the bbox of the glyph (relative to the pen position)
Definition rdpq_font.h:29
int rdpq_font_get_glyph_index(const rdpq_font_t *fnt, uint32_t codepoint)
Get the internal index of a glyoh given the codepoint.
Definition rdpq_font.c:511
int rdpq_font_render_paragraph(const rdpq_font_t *fnt, const rdpq_paragraph_char_t *chars, float x0, float y0)
Render a certain number of chars from a paragraph.
Definition rdpq_font.c:423
rdpq_font_t * rdpq_font_load(const char *fn)
Load a font from a file (.font64 format).
Definition rdpq_font.c:274
bool rdpq_font_get_glyph_ranges(const rdpq_font_t *fnt, int idx, uint32_t *start, uint32_t *end, bool *sparse)
Get information on the Unicode codepoint ranges covered by a font.
Definition rdpq_font.c:501
rdpq_font_t * rdpq_font_load_buf(void *buf, int sz)
Load a font from a buffer in memory (.font64 format).
Definition rdpq_font.c:165
void rdpq_font_free(rdpq_font_t *fnt)
Free a font.
Definition rdpq_font.c:308
rdpq_font_builtin_t
Builtin fonts, shipped with libdragon.
Definition rdpq_font.h:67
@ FONT_BUILTIN_DEBUG_VAR
Definition rdpq_font.h:76
@ FONT_BUILTIN_DEBUG_MONO
Definition rdpq_font.h:71
void rdpq_font_style(rdpq_font_t *font, uint8_t style_id, const rdpq_fontstyle_t *style)
Create a style for a font.
Definition rdpq_font.c:399
bool rdpq_font_get_glyph_metrics(const rdpq_font_t *fnt, uint32_t codepoint, rdpq_font_gmetrics_t *metrics)
Get the metrics of a glyph in a font.
Definition rdpq_font.c:516
int8_t y1
Bottom-right exclusive Y coordinate of the bbox of the glyph (relative to the pen position)
Definition rdpq_font.h:31
int8_t x1
Bottom-right exclusive X coordinate of the bbox of the glyph (relative to the pen position)
Definition rdpq_font.h:30
Metrics of a glyph in the font.
Definition rdpq_font.h:26
A font64 file containing a font.
Definition rdpq_font_internal.h:106
A single char in a layout.
Definition rdpq_paragraph.h:26
A style for a font.
Definition rdpq_font.h:121
void * custom_arg
Argument to pass to the custom function.
Definition rdpq_font.h:125
color_t color
Color of the text.
Definition rdpq_font.h:122
color_t outline_color
Color of the outline (if any)
Definition rdpq_font.h:123