81 const uint8_t* font_data,
281 uint32_t* out_href_off,
282 uint32_t* out_href_len);
335 uint32_t* out_index);
394 uint32_t* out_path_len,
395 uint32_t* out_frag_off,
396 uint32_t* out_frag_len);
444 const uint8_t* xhtml_buf,
446 uint32_t* out_total_pages);
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Fixed-RAM-budget glyph cache with LRU eviction (Layer 3, #147).
ra8_err_t reflow_hit_test_link(const reflow_t *engine, uint32_t page_idx, int32_t x, int32_t y, uint32_t *out_href_off, uint32_t *out_href_len)
Hit-test a point on a page against the laid-out <a> link rectangles.
ra8_err_t reflow_render_page(const reflow_t *engine, uint32_t page_idx, void *framebuffer)
Render one page into the active ra8_gfx framebuffer.
ra8_err_t reflow_run_layout(reflow_t *engine)
Run the line-break + page-break pass over engine->tokens[].
ra8_err_t reflow_layout_chapter(reflow_t *engine, const uint8_t *xhtml_buf, size_t xhtml_len, uint32_t *out_total_pages)
Parse + lay out one chapter of XHTML.
ra8_err_t reflow_parse_xhtml(reflow_t *engine, const uint8_t *xhtml_buf, size_t xhtml_len)
Parse the XHTML buffer into the engine's token stream.
ra8_err_t reflow_set_css_loader(reflow_t *engine, reflow_css_loader_fn loader, void *ctx)
Bind the external-stylesheet loader for <link rel="stylesheet">.
ra8_err_t reflow_find_anchor(const reflow_t *engine, const char *id, uint32_t id_len, uint32_t *out_page)
Find the page of a same-chapter id anchor (for #fragment jumps).
ra8_err_t reflow_bind_font(reflow_t *engine, const uint8_t *font_data, size_t font_len)
Bind an EPUB-embedded typeface as the engine's active face (#109).
ra8_err_t reflow_set_font_size(reflow_t *engine, uint16_t new_font_px)
Change the body font size and re-flow the cached chapter.
ra8_err_t reflow_href_split(const char *href, uint32_t len, reflow_href_kind_t *out_kind, uint32_t *out_path_len, uint32_t *out_frag_off, uint32_t *out_frag_len)
Split + classify an <a href> into a path part and a #fragment.
ra8_err_t reflow_init(uint16_t viewport_w, uint16_t viewport_h, const uint8_t *font_data, size_t font_len, uint16_t font_px, uint32_t body_color, uint32_t link_color, reflow_t *out_engine)
Initialise a reflow engine for a given viewport / font.
ra8_err_t reflow_set_glyph_atlas(reflow_t *engine, ra8_glyph_atlas_t *atlas, const reflow_glyph_atlas_storage_t *storage)
Bind a Layer-3 glyph cache to the engine's render path (#164).
ra8_err_t reflow_get_page_count(const reflow_t *engine, uint32_t *out_count)
Report the laid-out page count.
ra8_err_t reflow_set_image_loader(reflow_t *engine, reflow_image_loader_fn loader, void *ctx, ra8_img_arena_t *arena)
Bind an <img> byte loader + decode arena to enable image rendering.
ra8_err_t reflow_hit_test_image(const reflow_t *engine, uint32_t page_idx, int32_t x, int32_t y, uint32_t *out_index)
Hit-test a point on a page against the laid-out <img> boxes (#478).
ra8_err_t reflow_register_face(reflow_t *engine, uint8_t css_face_idx, const uint8_t *blob, size_t len)
Register one embedded @font-face typeface for per-run selection (#109).
ra8_err_t reflow_close(reflow_t *engine)
Release a previously initialized engine.
ra8_err_t reflow_render_page_at(const reflow_t *engine, uint32_t page_idx, int32_t origin_x, int32_t origin_y)
Render one page offset by (origin_x, origin_y) into the bound framebuffer.
Zero-heap raster image decode + scale + blit for reflow (#106).
Reflow-engine data model: enums, structs, typedefs, and the handle.
ra8_err_t(* reflow_css_loader_fn)(void *ctx, const char *href, uint32_t href_len, const uint8_t **out_bytes, size_t *out_len)
External-stylesheet byte loader for <link rel="stylesheet" href>.
ra8_err_t(* reflow_image_loader_fn)(void *ctx, const char *href, uint32_t href_len, const uint8_t **out_bytes, size_t *out_len)
Resolve an <img src> href to its encoded image bytes.
reflow_href_kind_t
Classification of an in-content <a href> target.
Glyph-cache state (caller-owned; treat as private).
Per-cell user descriptor: the rendered glyph dimensions.
Identifies one rendered glyph.
Caller-owned bump arena backing a single image decode.
Per-cell link metadata (one caller-owned array entry per cell).
Caller-owned backing storage for the render-path glyph cache (#164).
ra8_glyph_dims_t * dims
cell_count dimension descriptors.
ra8_glyph_key_t * keys
cell_count key-storage entries.
uint8_t * cell_mem
cell_count * cell_bytes of bitmap storage.
int32_t * buckets
bucket_count hash-bucket heads.
uint32_t cell_count
Number of cells (the glyph-cache budget).
ra8_keycache_cell_t * meta
cell_count link-metadata entries.
uint32_t cell_bytes
Bytes per cell (>= largest cached glyph).
uint32_t bucket_count
Number of hash buckets (>= 1).
Reflow / pagination engine state.