29#define BRAGI_CACHE_BUDGET (1024 * 1024)
struct bragi_face bragi_face_t
Definition bragi.h:26
struct bragi_font bragi_font_t
Definition bragi.h:25
bragi_align_t
Definition bragi.h:132
@ BRAGI_ALIGN_LEFT
Definition bragi.h:133
@ BRAGI_ALIGN_CENTER
Definition bragi.h:134
@ BRAGI_ALIGN_RIGHT
Definition bragi.h:135
void bragi_cell_size(bragi_face_t *face, int32_t *width, int32_t *height)
the cell of a monospace face, in whole pixels: the advance of "M" and the line height.
Definition bragi_cell.c:55
void bragi_draw_cell(gfx_buffer_t *buf, bragi_face_t *face, int32_t x, int32_t y, uint32_t codepoint, gfx_color_t color)
draw one character in a cell, its top left at (x, y).
Definition bragi_cell.c:162
bragi_face_t * bragi_face_new(bragi_font_t *font, float pixel_size)
the font at a size.
Definition bragi_font.c:85
void bragi_face_free(bragi_face_t *face)
Definition bragi_font.c:127
void bragi_face_set_tracking(bragi_face_t *face, float em)
letter spacing, as CSS letter-spacing: added after every character, so measuring, wrapping and drawin...
Definition bragi_font.c:107
void bragi_font_close(bragi_font_t *font)
close a font.
Definition bragi_font.c:76
int32_t bragi_line_baseline(const bragi_face_t *face, int32_t line_height)
where the baseline is in a line of text line_height pixels high, from its top: as CSS places text in ...
Definition bragi_font.c:112
bragi_font_t * bragi_font_open(const char *path)
load a TrueType file.
Definition bragi_font.c:43
int32_t bragi_descent(const bragi_face_t *face)
Definition bragi_font.c:152
void bragi_face_stats(const bragi_face_t *face, bragi_stats_t *stats)
Definition bragi_font.c:198
bool bragi_has_char(const bragi_face_t *face, uint32_t codepoint)
true if the font (not a fallback) has a glyph for the character.
Definition bragi_font.c:162
int32_t bragi_line_height(const bragi_face_t *face)
Definition bragi_font.c:157
void bragi_face_set_fallback(bragi_face_t *face, bragi_face_t *fallback)
where characters the font does not have come from (NULL: none).
Definition bragi_font.c:142
bragi_font_t * bragi_font_from_memory(const uint8_t *data, size_t size, bool take)
a font from memory.
Definition bragi_font.c:27
int32_t bragi_ascent(const bragi_face_t *face)
the vertical metrics in whole pixels: from the baseline up to the top of the highest letters (ascent)...
Definition bragi_font.c:147
int32_t bragi_caret_x(bragi_face_t *face, const char *text, int32_t length, int32_t offset)
where a caret before the byte at offset goes, in pixels from the start of the line (rounded to the ne...
Definition bragi_text.c:153
int32_t bragi_offset_at(bragi_face_t *face, const char *text, int32_t length, int32_t x)
the caret place nearest to x (pixels from the start of the line), for a click in a text field.
Definition bragi_text.c:163
int32_t bragi_measure(bragi_face_t *face, const char *text, int32_t length)
the width of a line of text in pixels (rounded up).
Definition bragi_text.c:141
int32_t bragi_measure_box(bragi_face_t *face, const char *text, int32_t width)
the height a paragraph needs at a width (all of it, nothing cut off).
Definition bragi_text.c:233
uint32_t bragi_utf8_next(const char **text, const char *end)
decode one character of UTF-8.
Definition bragi_text.c:13
int32_t bragi_wrap(bragi_face_t *face, const char *text, int32_t width, const char **next)
how many bytes of a line fit in a width, broken at a space if one is in the part that fits,...
Definition bragi_text.c:181
int32_t bragi_draw(gfx_buffer_t *buf, bragi_face_t *face, int32_t x, int32_t baseline, const char *text, int32_t length, gfx_color_t color)
draw a line of text.
Definition bragi_text.c:146
int32_t bragi_draw_box(gfx_buffer_t *buf, bragi_face_t *face, gfx_rect_t box, const char *text, bragi_align_t align, gfx_color_t color)
draw a paragraph in a box: wrapped to the box's width, aligned, and as many lines as fit in its heigh...
Definition bragi_text.c:275
libgfx: drawing into pixel buffers in memory.
uint32_t gfx_color_t
a premultiplied ARGB colour, 0xAARRGGBB.
Definition gfx.h:30
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
NULL, size_t, ptrdiff_t, offsetof.
integer types of fixed width.
int int32_t
Definition stdint.h:14
Definition bragi_internal.h:45
float size
Definition bragi_internal.h:49
bragi_font_t * font
Definition bragi_internal.h:46
int32_t line_height
Definition bragi_internal.h:53
bragi_stats_t stats
Definition bragi_internal.h:59
bragi_face_t * fallback
Definition bragi_internal.h:47
Definition bragi_internal.h:22
uint32_t hits
Definition bragi.h:179
uint32_t misses
Definition bragi.h:180
uint32_t evicted
Definition bragi.h:181
uint32_t bytes
Definition bragi.h:182