void r_theme_default(r_draw* c, uint32_t background, uint32_t primary, float font_size);
Loads the built-in theme: clears all style rules and theme styleboxes, then declares and builds rules for every style. background and primary are the window and accent color, the palette is derived from them, light or dark depending on background. 0 selects the default colors and 14 for font_size. Customize the result with r_theme or r_theme_tweak.
// Use default colors. r_theme_default(&f->draw, 0, 0, 0);

uint32_t bg_color = r_rgb_u8(17, 23, 35); uint32_t fg_color = r_rgb_u8(59, 136, 251); r_theme_default(&f->draw, bg_color, fg_color, 0);

uint32_t bg_color = r_rgb_u8(224, 222, 229); uint32_t fg_color = r_rgb_u8(120, 88, 246); r_theme_default(&f->draw, bg_color, fg_color, 0);

uint32_t bg_color = r_rgb_u8(222, 219, 212); uint32_t fg_color = r_rgb_u8(46, 124, 108); r_theme_default(&f->draw, bg_color, fg_color, 0);

Concepts: default_theme
rcut works in logical pixels: rects, font sizes and theme values are the same on every display. rcut_draw multiplies them with the scale factor when rasterizing, so at 1.5 the UI is 150% large and stays sharp. Styleboxes, glyphs and icons are rasterized for the current scale and cached.
void r_draw_set_scale(r_draw* c, float scale);
Sets the DPI scale factor.
This clears the cached stylebox and fonts, so they are recomputed the next time they are rendered, and calls the backend's scale_changed.
See also: r_draw_backend, r_draw_clear_cache
Concepts: dpi_scale, draw-context
void r_draw_clear_cache(r_draw* c);
Drops all cached textures (styleboxes, glyphs, icons), they are rasterized again when next drawn. It only makes sense to call this if you want to avoid stale textures in the cache.
Concepts: dpi_scale, font, stylebox, image, draw-context
void r_image_invalidate(r_draw* c, r_image_buffer* img);
Evicts the cache entry for img. It will be uploaded again next redraw if used by a drawable.
See also: r_image_buffer
Concepts: image, draw-context
typedef struct r_draw_backend { void* userptr; uint64_t (*cache_argb) (void* userptr, int w, int h, const uint32_t* pixels, int stride, bool permanent); uint64_t (*cache_monochrome) (void* userptr, int w, int h, const uint8_t* pixels, int stride, bool permanent); uint64_t (*cache_image_buffer)(void* userptr, r_image_buffer* img); void (*submit) (void* userptr, const r_draw_quad* quads, int num_quads); bool (*is_cached) (void* userptr, uint64_t handle); void (*invalidate_cache) (void* userptr, uint64_t handle); void (*scale_changed) (void* userptr, struct r_draw* d); } r_draw_backend;
Interface to a renderer, all functions receive userptr.
The cache functions return a cache handle, an opaque uint64. This can be a pointer, an index or even a encoded texel position. rcut_draw only passes these back into the r_draw_backend functions.
cache_argb: upload a premultiplied ARGB texture and return to a handle to it's cache entry. permanent textures must be kept until invalidated, others may be evicted.cache_monochrome: like cache_argb, but the texture is 8 bit coverage data. cache_image_buffer: upload an r_image_buffer.submit: draw the quads of a frame in order.is_cached: whether a handle is still valid, evicted textures which are still in use will be queued again before the next submit call.invalidate_cache: tells the cache that the content in that handle is out of date and should be evicted.scale_changed: optional, called by r_draw_set_scale.<TODO: r_draw_backend tutorial>
typedef struct r_draw_quad { uint64_t handle; uint32_t color; r_frect src; r_frect dst; const r_draw_transform* transform; } r_draw_quad;
A textured rectangle: src of texture handle drawn to dst, tinted with color. transform maps dst to target space and clips it.
typedef struct r_draw_transform { float m[2][3]; rect clip; } r_draw_transform;
Affine 2x3 matrix applied to quad positions and the clip rect in target pixels.
typedef struct r_frect { float x, y, w, h; } r_frect;
Rectangle with float coordinates. These are only used by r_draw_quad and passed to the renderer interface that way.
See also: r_draw_quad
uint32_t r_rgb_u8(uint8_t R, uint8_t G, uint8_t B);
Packs 8 bit red, green and blue components into an opaque ARGB color.
See also: r_rgba_u8, r_rgb_f, r_hex
Concepts: colors
uint32_t r_rgba_u8(uint8_t R, uint8_t G, uint8_t B, uint8_t A);
Packs 8 bit red, green, blue and alpha components into an ARGB color.
See also: r_rgb_u8, r_rgba_f, r_hexa
Concepts: colors
uint32_t r_rgb_f(float R, float G, float B);
Packs red, green and blue components in the range 0 to 1 into an opaque ARGB color.
Concepts: colors
uint32_t r_rgba_f(float R, float G, float B, float A);
Packs red, green, blue and alpha components in the range 0 to 1 into an ARGB color.
Concepts: colors
uint32_t r_hex(uint32_t rgb);
Turns a 0xRRGGBB value into an opaque ARGB color.
Concepts: colors
uint32_t r_hexa(uint32_t rgb, float alpha);
Turns a 0xRRGGBB value and an alpha in the range 0 to 1 into an ARGB color.
Concepts: colors
Icons are small vector drawings, defined as OP codes in a tiny VM, rasterized at the size they are drawn at like glyphs. Operations all assume a 24x24 canvas, so 12.0f, 12.0f is the center.
typedef enum r_draw_icon_op { R_ICON_OP_END = 0, R_ICON_OP_WIDTH, // w : Stroke width of the following shapes (default 2), 0 fills them instead R_ICON_OP_POLYLINE, // n x0 y0 ... : Open polyline with n points, filled as a closed polygon R_ICON_OP_ARC, // cx cy r a0 a1 : Arc from a0 to a1 (clockwise), filled as a full disc R_ICON_OP_RECT, // x y w h r : Rounded rectangle R_ICON_OP_COLOR, // r g b a : Color of the following shapes (0-1, default white). Icons with a color are not tinted. } r_draw_icon_op;
bool r_draw_upload_icon(r_draw* c, int slot, r_draw_icon_def* icon);
Sets icon slot to icon, this allows you to override built in icons or add your own.
Icons use the same underlying caching system as fonts, caching each "font size" of the icon as needed. The ops array is not copied and must stay valid for when the icon needs to be cached.
// The ops are not copied, so they must outlive the call. static const float play[] = { R_WIDTH(0), R_PLINE(3, 7,5, 19,12, 7,19), R_ICON_OP_END }; static const float pause[] = { R_WIDTH(0), R_RECT(6,5, 4,14, 1), R_RECT(14,5, 4,14, 1), R_ICON_OP_END }; static const float stop[] = { R_WIDTH(0), R_RECT(6,6, 12,12, 2), R_ICON_OP_END }; static const float record[] = { R_DISC(12,12, 6), R_ICON_OP_END }; r_draw_upload_icon(&f->draw, R_ICON_USER+0, &(r_draw_icon_def){ play }); r_draw_upload_icon(&f->draw, R_ICON_USER+1, &(r_draw_icon_def){ pause }); r_draw_upload_icon(&f->draw, R_ICON_USER+2, &(r_draw_icon_def){ stop }); r_draw_upload_icon(&f->draw, R_ICON_USER+3, &(r_draw_icon_def){ record }); r_layout_iter row = r_stack(ui, r_shrink(ui->root_area, 12), R_LEFT); r_button_ex(ui, r_next(&row, 90), R_STYLE_BUTTON, R_ICON_USER+0, "Play"); r_button_ex(ui, r_next(&row, 90), R_STYLE_BUTTON, R_ICON_USER+1, "Pause"); r_button_ex(ui, r_next(&row, 90), R_STYLE_BUTTON, R_ICON_USER+2, "Stop"); r_button_ex(ui, r_next(&row, 90), R_STYLE_BUTTON, R_ICON_USER+3, "Record");
Concepts: icon
typedef struct r_draw_icon_def { const float* ops; // The OP codes, yes float* is a bit weird but all our data is float, we simply cast the OP code to int. } r_draw_icon_def;
ops points to a list of r_draw_icon_op terminated by R_ICON_OP_END, usually created with R_OP.
typedef enum r_draw_icon_op { R_ICON_OP_END = 0, R_ICON_OP_WIDTH, // w : Stroke width of the following shapes (default 2), 0 fills them instead R_ICON_OP_POLYLINE, // n x0 y0 ... : Open polyline with n points, filled as a closed polygon R_ICON_OP_ARC, // cx cy r a0 a1 : Arc from a0 to a1 (clockwise), filled as a full disc R_ICON_OP_RECT, // x y w h r : Rounded rectangle R_ICON_OP_COLOR, // r g b a : Color of the following shapes (0-1, default white). Icons with a color are not tinted. } r_draw_icon_op;
Instructions of the icon language on a 24x24 canvas. The R_LINE, R_PLINE, R_ARC, R_CIRCLE, R_DISC, R_RECT and R_WIDTH macros emit them.
static r_draw_icon_def check = { R_OP(R_WIDTH(2.5f), R_PLINE(3, 5, 12, 10, 17, 19, 7)) }; // [...] r_draw_upload_icon(&f->draw, R_ICON_USER, &check); r_icon(ui, r, 0, R_ICON_USER);
rect r_draw_icon_get_rect(r_draw* c, int slot, rect outer);
Returns the largest square centered in outer.
See also: r_draw_upload_icon, r_draw_render_icon
<TODO: Explain renderer>
typedef struct r_draw r_draw;
r_sdl_frontend.draw struct member.void r_draw_init(r_draw* d, r_context* ctx, const r_draw_backend* backend, float scale);
<TODO: Explain backend and scale>
Concepts: draw-context, dpi_scale
void r_draw_free(r_draw* d);
Frees all fonts, caches and memory owned by the renderer.
See also: r_draw_init
Concepts: draw-context
void r_draw_render(r_draw* d, uint64_t target);
<TODO: Explain rendering a target>
Concepts: draw-context, ui_list, target
void r_draw_render_area(r_draw* d, uint64_t target, rect area);
<TODO: Explain partial rendering>
Concepts: draw-context, damage
rect r_draw_take_damage(r_draw* d, uint64_t target);
<TODO: Explain damage rect usage>
Concepts: draw-context, damage
rect r_draw_target_bounds(r_draw* d, uint64_t target);
<TODO: Explain when bounds are needed>
Concepts: draw-context, target
typedef struct r_draw_software r_draw_software;
<TODO: Explain software backend usage>
void r_draw_software_init(r_draw_software* sw, int w, int h, int cache_size);
<TODO: Explain cache size>
Concepts: draw-context
void r_draw_software_free(r_draw_software* sw);
Frees the buffers owned by the software renderer.
See also: r_draw_software_init
Concepts: draw-context
r_draw_backend r_draw_software_backend(r_draw_software* sw);
<TODO: Explain backend creation>
Concepts: draw-context, draw_backend
void r_draw_software_set_target(r_draw_software* sw, uint32_t* pixels, int w, int h, int stride, int x, int y);
<TODO: Describe target pixel buffer>
Concepts: draw-context, target
<TODO: Explain draw functions>
void r_draw_render_pass_begin(r_draw* c, r_ui_list* target);
<TODO: Explain render pass usage>
Concepts: draw-function
void r_draw_render_pass_end(r_draw* c);
<TODO: Explain render pass end>
Concepts: draw-function
void r_draw_render_drawable(r_draw* c, r_drawable* d);
<TODO: Describe drawable rendering>
Concepts: draw-function, drawable
void r_draw_render_icon(r_draw* c, uint16_t icon, uint32_t color, rect bounds);
Draws an icon centered in bounds in the current render pass.
See also: r_draw_render_pass_begin, r_draw_upload_icon
Concepts: draw-function, icon
void r_draw_render_text(r_draw* c, r_draw_font* font, const char* text, uint32_t color, rect bounds); void r_draw_render_text_ex(r_draw* c, r_draw_font* font, const char* text, uint32_t color, rect bounds, r_alignment align, int scroll_x, int scroll_y, rect clip);
Draws text at the top left of bounds in the current render pass.
See also: r_draw_render_pass_begin, r_draw_measure_text
Concepts: draw-function, font
void r_draw_render_stylebox(r_draw* c, int stylebox, rect outer);
Draws the stylebox in slot stylebox stretched to outer in the current render pass.
See also: r_draw_render_pass_begin, r_draw_generate_stylebox
Concepts: draw-function, stylebox
void r_draw_render_fill(r_draw* c, uint32_t color, rect bounds);
Draws a solid rectangle in the current render pass.
See also: r_draw_render_pass_begin
Concepts: draw-function
<TODO: Explain theme>
void r_theme_label_color(r_draw* c, uint32_t color); void r_theme_label_color_auto(r_draw* c, uint32_t color);
Sets the label color, r_theme_label_color uses it exactly as given while r_theme_label_color_auto adapts it to stay readable on the element's background.
See also: r_theme_label, r_theme_surface
Concepts: theming
void r_theme(r_draw* c, int key); void r_theme_hover(r_draw* c, uint32_t color);
<TODO: Explain theme rule builder>
void r_theme_tweak(r_draw* c, int key);
<TODO: Explain tweaking existing rules>
void r_theme_build(r_draw* c); void r_theme_build_states(r_draw* c, int states); void r_theme_build_joined(r_draw* c, int states);
<TODO: Explain build variants, states>
Concepts: theming, style_rule, stylebox
void r_theme_fill(r_draw* c, uint32_t top, uint32_t bottom);
Fills the background with a vertical gradient from top to bottom.
See also: r_theme_surface, r_theme_tint
Concepts: theming
void r_theme_surface(r_draw* c, uint32_t color);
Sets the color assumed behind a translucent background, used to pick readable label colors.
See also: r_theme_fill, r_theme_label_color
Concepts: theming
void r_theme_tint(r_draw* c, uint32_t color);
Blends color over the background and border colors set so far.
See also: r_theme_fill, r_theme_border
Concepts: theming
void r_theme_border(r_draw* c, float width, uint32_t color); void r_theme_border_color(r_draw* c, uint32_t color);
Sets the border width and color, r_theme_border_color only changes the color.
See also: r_theme_underline, r_theme_bevel, r_theme_border_split
Concepts: theming
void r_theme_underline(r_draw* c, float width, uint32_t color);
Replaces the border with a bottom border of the given width and color.
See also: r_theme_border
Concepts: theming
void r_theme_bevel(r_draw* c, uint32_t top, uint32_t bottom);
Sets separate top and bottom border colors.
See also: r_theme_border, r_theme_border_split
Concepts: theming
void r_theme_border_split(r_draw* c, float width, uint32_t top_left, uint32_t bottom_right);
Sets the border width with separate top-left and bottom-right colors, for sunken or raised edges.
Concepts: theming
void r_theme_radius(r_draw* c, float radius);
Sets the radius of all corners.
See also: r_theme_corners
Concepts: theming
void r_theme_corners(r_draw* c, float top_left, float top_right, float bottom_left, float bottom_right);
Sets the radius of each corner individually.
See also: r_theme_radius
Concepts: theming
void r_theme_padding(r_draw* c, float x, float y);
Sets the horizontal and vertical content padding.
See also: r_theme_layout, r_inner
Concepts: theming
void r_theme_shadow(r_draw* c, float y, float blur, float opacity);
Sets a drop shadow with vertical offset, blur radius and opacity.
See also: r_theme_shadow2, r_theme_no_shadow, r_theme_inset
Concepts: theming
void r_theme_shadow2(r_draw* c, float y, float blur, float opacity);
Sets a second drop shadow, drawn in addition to the one from r_theme_shadow.
See also: r_theme_shadow, r_theme_glow
Concepts: theming
void r_theme_no_shadow(r_draw* c);
Removes both drop shadows.
See also: r_theme_shadow, r_theme_shadow2
Concepts: theming
void r_theme_inset(r_draw* c, float y, float blur, float opacity);
Sets an inner shadow with vertical offset, blur radius and opacity.
See also: r_theme_shadow
Concepts: theming
void r_theme_glow(r_draw* c, uint32_t color, float width);
Adds a glow of the given color and width, using the second shadow if the first one is set.
See also: r_theme_shadow, r_theme_shadow2
Concepts: theming
void r_theme_label(r_draw* c, uint32_t color, r_alignment align);
Sets the label color, adapted to stay readable, and the label alignment.
See also: r_theme_label_color, r_theme_font
void r_theme_font(r_draw* c, r_draw_font* font);
Sets the label font.
See also: r_theme_label, r_draw_get_font
void r_theme_icon(r_draw* c, uint32_t color, int size);
Sets the icon color and size.
See also: r_icon
void r_theme_layout(r_draw* c, int size, int spacing);
Sets the default size and spacing returned by r_layout_default_size and r_layout_default_spacing.
See also: r_layout_default_size, r_layout_default_spacing, r_theme_padding
void r_theme_focus(r_draw* c, enum r_theme_focus ring); void r_theme_focus_border(r_draw* c, uint32_t color);
Enables or disables the focus ring.
Concepts: theming, interactable
enum r_theme_focus { R_FOCUS_NONE, R_FOCUS_RING, R_FOCUS_BORDER };
Focus indicator styles for the r_theme_focus function.
void r_theme_text_outline(r_draw* c, float width, uint32_t color);
Draws labels with an outline of the given width and color.
See also: r_theme_text_shadow
void r_theme_text_shadow(r_draw* c, float x, float y, float blur, uint32_t color);
Draws labels with a shadow of the given offset, blur and color.
See also: r_theme_text_outline, r_theme_shadow
typedef struct r_draw_style_rule { enum r_style style; int bg_stylebox; int overlay; int padding_x, padding_y; r_draw_font* label_font; uint32_t label_color; int icon_size; int size; int spacing; uint32_t icon_color; r_alignment label_align; int focus_overlay; int hover_overlay; uint32_t text_outline_color; float text_outline; uint32_t text_shadow_color; float text_shadow_x, text_shadow_y, text_shadow_blur; } r_draw_style_rule;
<TODO: Describe style rule fields>
r_draw_style_rule* r_draw_get_style_rule(r_draw* c, enum r_style key);
Returns the style rule for exactly key, or NULL.
See also: r_draw_set_style_rule, r_draw_find_style_rule, r_draw_style_rule
Concepts: style_rule, drawable
r_draw_style_rule* r_draw_find_style_rule(r_draw* c, int style);
<TODO: Explain style fallback lookup>
Concepts: style_rule, drawable
void r_draw_set_style_rule(r_draw* c, enum r_style key, r_draw_style_rule* rule);
Copies rule as the style rule for key, replacing any existing one.
See also: r_draw_get_style_rule, r_draw_delete_style_rule
Concepts: style_rule, drawable
void r_draw_delete_style_rule(r_draw* c, enum r_style key);
Removes the style rule for key.
See also: r_draw_set_style_rule
Concepts: style_rule, drawable
<TODO: Explain styleboxes>
bool r_draw_upload_stylebox(r_draw* c, int slot, uint8_t* pixels, int w, int h, int pitch, int left, int right, int top, int bottom); bool r_draw_upload_stylebox_fill(r_draw* c, int slot, uint8_t* pixels, int w, int h, int pitch);
<TODO: Describe slicing parameters>
r_draw_upload_stylebox_fill: Upload a aspect ratio aware fill to be used with the stylebox. It will be drawn under the rest of the stylebox. (The center of the stylebox must be transparent.)
Concepts: stylebox
rect r_draw_stylebox_inner_rect(r_draw* c, int slot, rect outer);
Given the outer rect, calculates the inner rect (e.g. where text should be positioned).
See also: r_draw_stylebox_outer_rect, r_inner
rect r_draw_stylebox_outer_rect(r_draw* c, int slot, rect* inner);
Given the inner rect, calculates the outer rect (e.g. how big the entire drawable needs to be to contain the contents of inner).
See also: r_draw_stylebox_inner_rect, r_outer
typedef struct r_draw_stylebox_def { float extra_padding[4]; r_draw_gradient border_gradient[4]; float border_thickness[4]; // Note: Should be handled inset by the rasterizer so it can be alpha blended with the background. float border_blur[4]; // Blurs the inner edge of the border (outer edge remains sharp) float corner_radius[4]; struct r_draw_shadow { float offset_x, offset_y; float grow; // SDF offset. float blur; // SDF smooth threshold width. float hardness; // pow(value, hardness) uint32_t color; bool is_inset:1; // Invert shadow SDF function and do alpha-over instead of alpha-under. } shadows[4]; // If bg_preserve_aspect_ratio = true the stylebox should be (roughly) rectangular, meaning corner_radius <= border_thickness, or else you can get transparent pixels. // If bg_preserve_aspect_ratio = false the gradients should be (roughly) axis aligned or else you can get warped gradients. bool bg_preserve_aspect_ratio; r_draw_gradient bg_gradients[4]; int bg_raster_width; int bg_raster_height; float transparency; } r_draw_stylebox_def;
<TODO: Describe stylebox definition>
typedef struct r_draw_gradient { uint32_t base_color; bool use_gradient:1; bool is_elliptical:1; unsigned int num_stops:3; struct{ uint32_t color; float position; } stops[8]; float origin_x, origin_y; float end_x, end_y; // For elliptical gradients: float aspect_ratio; float focal_offset_x, focal_offset_y; } r_draw_gradient;
<TODO: Describe gradient fields>
bool r_draw_generate_stylebox(r_draw* c, int slot, r_draw_stylebox_def* definition);
<TODO: Explain generated styleboxes>
Concepts: stylebox
void r_draw_free_stylebox(r_draw* c, int slot);
Frees the stylebox slot and its cached textures.
See also: r_draw_generate_stylebox, r_draw_upload_stylebox
Concepts: stylebox
void r_stylebox_set_outline_border(r_draw_stylebox_def* box, uint32_t color, float border_thickness, float border_radius);
Sets a solid border of the given color, thickness and corner radius on all sides.
See also: r_draw_stylebox_def, r_draw_generate_stylebox
Concepts: stylebox
void r_stylebox_set_shadow(r_draw_stylebox_def* box, int slot, float offset_x, float offset_y, float blur, float opacity, bool inset);
<TODO: Describe shadow helper>
Concepts: stylebox
void r_stylebox_set_bg_color(r_draw_stylebox_def* box, uint32_t color);
Sets a solid background color.
See also: r_stylebox_set_bg_vertical_gradient, r_draw_stylebox_def
Concepts: stylebox
void r_stylebox_set_bg_vertical_gradient(r_draw_stylebox_def* box, uint32_t* stops, int num_stops);
<TODO: Describe gradient helper>
Concepts: stylebox
void r_stylebox_set_raised_borders_simple(r_draw_stylebox_def* box, float angle, uint32_t light_color, uint32_t ambient_color, float border_thickness, float border_radius, float blur);
<TODO: Describe raised border helper>
Concepts: stylebox
#define RCUT_DRAW_MAX_STYLEBOXES 512
Number of stylebox slots.
See also: RCUT_DRAW_USER_STYLEBOXES, r_draw_generate_stylebox
#define RCUT_DRAW_USER_STYLEBOXES 256 // Stylebox slots from here on are for the application, themes only use the ones below.
First stylebox slot for the application, themes only use the slots below.
See also: RCUT_DRAW_MAX_STYLEBOXES, r_draw_upload_stylebox
<TODO: Explain fonts>
#define RCUT_USE_HB_MINI #define RCUT_USE_HARFBUZZ #define RCUT_USE_STB_TRUETYPE
Selects the text backend: RCUT_USE_HARFBUZZ, RCUT_USE_HB_MINI or RCUT_USE_STB_TRUETYPE, if none is defined the backend is detected from previously included headers.
See also: r_draw_font_register
rect r_draw_measure_text(r_draw* c, r_draw_font* font, const char* text, int len);
<TODO: Describe return rect>
Widths are measured to the nearest pixel, so text may overhang its measured width by up to half a pixel (+1 device pixel of truncation).
Concepts: font
typedef struct r_draw_font r_draw_font;
<TODO: Explain font handle usage>
typedef enum r_draw_font_flags{ R_FONT_DEFAULT_WEIGHT = 0x00, R_FONT_LIGHTEST = 0x01, R_FONT_LIGHTER = 0x02, R_FONT_LIGHT = 0x03, R_FONT_REGULAR = 0x04, R_FONT_MEDIUM = 0x05, R_FONT_SEMIBOLD = 0x06, R_FONT_BOLD = 0x07, R_FONT_BOLDER = 0x08, R_FONT_BOLDEST = 0x09, R_FONT_ULTRAHEAVY = 0x0A, R_FONT_WEIGHT_MASK = 0x0F, R_FONT_ITALIC = 0x10, R_FONT_SHAPED = 0x20, // Shaped with HarfBuzz: kerning, ligatures, combining marks and complex scripts. Without it codepoints map 1:1 to glyphs. } r_draw_font_flags;
<TODO: Describe weight and style flags>
void r_draw_find_system_fonts(r_draw* c, bool include_base_fonts);
<TODO: Explain system font discovery>
Concepts: font
bool r_draw_font_register(r_draw* c, int slot, const char* font_path, bool lazy);
<TODO: Explain slots and lazy loading>
Concepts: font
void r_draw_font_set_fallbacks(r_draw* c, int base_font, int* fallbacks, int num_fallbacks, bool include_system_fallbacks);
<TODO: Explain fallback order>
Concepts: font
r_draw_font* r_draw_get_font(r_draw* c, int base_font, int size, uint32_t flags);
<TODO: Explain font instance lookup>
Concepts: font
int r_draw_font_line_height(r_draw_font* font);
Returns the line height of the font in unscaled pixels.
See also: r_draw_get_font, r_draw_measure_text
Concepts: font
int r_draw_break_text(r_draw* c, r_draw_font* font, const char* text, int len, int width, bool force, int* w);
<TODO: Explain line breaking, force>
Concepts: font