36#include "stb_truetype.h"
47typedef enum : uint16_t {
278 const stbtt_fontinfo* font,
370 const stbtt_fontinfo* font,
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
HTML / CSS reflow + paginate engine for the ra8d2 ereader.
Test-access surface for reflow internal helpers (MC/DC).
bool priv_reflow_layout_apply_image(reflow_t *engine, priv_cursor_t *cur, const reflow_token_t *tok)
Apply an <img> token: real image when a loader is bound, else a placeholder.
bool priv_reflow_layout_newline(reflow_t *engine, priv_cursor_t *cur, bool allow_justify)
Wrap to a new line, finishing a page if the bottom margin is hit.
int32_t priv_reflow_layout_glyph_advance(const stbtt_fontinfo *font, uint16_t font_px, int32_t cp)
Measure a single ASCII code point's advance width in pixels.
void priv_reflow_layout_build_link_rects(reflow_t *engine, const stbtt_fontinfo *font)
Post-layout pass: group link-tagged glyphs into tappable rects.
ra8_err_t priv_reflow_layout_apply_token(reflow_t *engine, priv_cursor_t *cur, const stbtt_fontinfo *font, const reflow_token_t *tok)
Dispatch one parsed token through the layout cursor.
bool priv_reflow_layout_push_glyph(reflow_t *engine, int32_t x, int32_t y, int32_t cp, uint16_t font_px, uint8_t style, uint32_t color, uint8_t link_id)
Push one positioned glyph into the engine glyph pool.
bool priv_reflow_layout_finish_page(reflow_t *engine, priv_cursor_t *cur)
Finalise the current page and start a new one.
void priv_reflow_layout_byte_zero(uint8_t *dst, size_t n)
Bounded zero-fill used in place of memset(0).
ra8_err_t priv_reflow_layout_init_font(const reflow_t *engine, stbtt_fontinfo *out_font)
Initialise an stbtt_fontinfo from engine->font_data.
priv_layout_consts_t
Internal sizing knobs for the layout pass.
@ k_priv_row_gap_px
Vertical gap between table rows.
@ k_priv_min_chapter_pages
Floor for non-empty input.
@ k_priv_min_word_w_px
Minimum word width before forcing a break.
@ k_priv_hr_thickness_px
Pixel thickness of an <hr> (placeholder).
@ k_priv_cell_pad_px
Left/right inset inside a table cell.
@ k_priv_image_placeholder_px
Side length of <img> placeholder.
uint16_t priv_reflow_layout_line_height(uint16_t font_px)
Compute the line height in pixels for a given font size.
ra8_err_t priv_reflow_layout_table(reflow_t *engine, priv_cursor_t *cur, const stbtt_fontinfo *font, uint32_t start, uint32_t *out_next)
Lay out a <table> token range as an equal-column grid.
Mutable state carried through the layout loop.
uint32_t page_first_image
First image-box index of the active page.
uint8_t line_has_content
1 once any glyph landed on this line.
int32_t line_top
Pixel row of the current line's top.
uint16_t active_font_px
Active font size (body or heading).
uint32_t page_first_glyph
First glyph index of the active page.
int32_t x
Pixel column for next glyph.
uint32_t line_first_glyph
First glyph index of the active line.
uint16_t line_height_px
Active line height in pixels.
int32_t y
Pixel row baseline for next glyph.
uint8_t align
Active block alignment (reflow_align_t).
uint8_t reserved8[2]
Padding.
uint16_t indent_px
Active left indent (li, blockquote).
uint8_t active_style
Active inline-style stamp.
Reflow / pagination engine state.
One parsed token in the engine's token stream.