|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Reflow-engine data model: enums, structs, typedefs, and the handle. More...
#include <stddef.h>#include <stdint.h>#include "ra8_err.h"#include "ra8_glyph_atlas.h"#include "reflow_css.h"#include "reflow_image.h"Go to the source code of this file.
Data Structures | |
| struct | reflow_token_t |
| One parsed token in the engine's token stream. More... | |
| struct | reflow_glyph_t |
| One positioned glyph after layout. More... | |
| struct | reflow_page_t |
| Index range of glyphs that belong to one page. More... | |
| struct | reflow_image_box_t |
| One laid-out <img> rectangle (decoded + blitted at render time). More... | |
| struct | reflow_link_target_t |
| One distinct <a href> destination interned during a parse. More... | |
| struct | reflow_link_rect_t |
| One tappable rectangle covering a run of <a> glyphs on a page. More... | |
| struct | reflow_anchor_t |
| A laid-out element id, for same-chapter #fragment jumps. More... | |
| struct | reflow_face_t |
| One registered embedded @font-face typeface (#109). More... | |
| struct | reflow_t |
| Reflow / pagination engine state. More... | |
Typedefs | |
| typedef 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. | |
| typedef 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>. | |
Reflow-engine data model: enums, structs, typedefs, and the handle.
This sub-header holds the data model for the reflow HTML / CSS reflow
[Ring 4 / Reflow] {World: NS}
Definition in file reflow_types.h.
| typedef 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>.
Dependency-injection seam (NASA P10 Rule 9 deviation: function pointer for testability / DIP), mirroring reflow_image_loader_fn. The consumer wires this to its EPUB resource loader; the engine calls it while tokenizing a chapter, when a <link rel="stylesheet" href="X"> is seen in document order, and parses the returned CSS into the chapter's sheet at that position (so a later <style> block / inline style= correctly override it). The returned buffer is only read, never freed, by the engine and need only stay valid until the call returns.
| [in] | ctx | Opaque context passed to reflow_set_css_loader(). |
| [in] | href | Stylesheet href string (not NUL-terminated). |
| [in] | href_len | Length of href, bytes. |
| [out] | out_bytes | Receives a pointer to the CSS text bytes. |
| [out] | out_len | Receives the CSS byte count. |
Definition at line 334 of file reflow_types.h.
| typedef 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.
Dependency-injection seam (NASA P10 Rule 9 deviation: function pointer for testability / DIP). The consumer wires this to its EPUB resource loader; the engine calls it at layout time (to probe intrinsic size) and at render time (to fetch bytes for the decode). The returned buffer must remain valid until the call returns and is only read, never freed, by the engine.
| [in] | ctx | Opaque context passed to reflow_set_image_loader(). |
| [in] | href | Image src string (not NUL-terminated). |
| [in] | href_len | Length of href, bytes. |
| [out] | out_bytes | Receives a pointer to the encoded image bytes. |
| [out] | out_len | Receives the encoded byte count. |
Definition at line 304 of file reflow_types.h.
| enum reflow_align_t : uint8_t |
Block text alignment (from an inline style="text-align:...").
Carried on a block-start token (its reserved byte) and applied as a per-line pass: centre/right shift every glyph on the line; justify spreads the slack across inter-word gaps on full (wrapped) lines, leaving the last line of a paragraph left-aligned. The default is left (identical to the historical greedy layout, so unaligned content is byte-stable).
| Enumerator | |
|---|---|
| k_reflow_align_left | Left (default, ragged right). |
| k_reflow_align_right | Right-aligned. |
| k_reflow_align_center | Centred. |
| k_reflow_align_justify | Justified (last line left-aligned). |
Definition at line 168 of file reflow_types.h.
| enum reflow_color_t : uint32_t |
Sentinel marking a token / run with no CSS colour.
A text token's color field holds a 0xRRGGBB CSS colour (#111 / #140) or this sentinel, in which case the renderer falls back to the engine body colour (or link colour for an <a> run). 0xFFFFFFFF is outside the 24-bit RGB range, so it can never collide with a real colour.
| Enumerator | |
|---|---|
| k_reflow_color_inherit | No per-run CSS colour. |
Definition at line 208 of file reflow_types.h.
| enum reflow_face_pack_t : uint8_t |
How a per-run embedded-face index is packed into a glyph/token style.
The emphasis bits (bold/italic/underline) occupy bits 0-2 of the style byte; bits 4-7 are free, so the selected embedded-face index (0 = the engine's bound default face, 1..k_reflow_max_faces = a registered @font-face) rides in the high nibble (#109). Single-face content registers no faces, so the nibble is always 0 – the cached / default render path is byte-identical.
| Enumerator | |
|---|---|
| k_reflow_face_shift | Bit position of the face index in style. |
| k_reflow_face_mask | Face-index mask once shifted down. |
Definition at line 153 of file reflow_types.h.
| enum reflow_face_pad_t : uint8_t |
Padding geometry for reflow_face_t.
Names the trailing-pad byte count that rounds reflow_face_t up to an 8-byte stride (one pointer, one size_t, one uint8_t index, then k_reflow_face_pad8 bytes of padding).
| Enumerator | |
|---|---|
| k_reflow_face_pad8 | Pad bytes to reach an 8-byte struct stride. |
Definition at line 411 of file reflow_types.h.
| enum reflow_font_style_t : uint8_t |
Inline font-style flags (bitfield).
Used by both the parse pass (active style on the cursor) and the render pass (per-glyph style stamp). v1 does not yet load separate bold / italic TTFs; the flag is stored so the renderer can later pick the right face without reflow.
| Enumerator | |
|---|---|
| k_reflow_style_normal | No emphasis. |
| k_reflow_style_bold | Bold face. |
| k_reflow_style_italic | Italic face. |
| k_reflow_style_underline | Underlined run. |
Definition at line 135 of file reflow_types.h.
| enum reflow_href_kind_t : uint8_t |
Classification of an in-content <a href> target.
| Enumerator | |
|---|---|
| k_reflow_href_empty | Empty / whitespace-only href. |
| k_reflow_href_fragment | "#id" – same-chapter anchor. |
| k_reflow_href_chapter | "path" – another chapter, no frag. |
| k_reflow_href_chapter_fragment | "path#id" – chapter + anchor. |
| k_reflow_href_external | Has a URI scheme (http:, mailto:). |
Definition at line 388 of file reflow_types.h.
| enum reflow_html_tag_t : uint8_t |
Recognised HTML element kinds.
Tags outside this list are treated as transparent flow-through containers (children still emit, the tag itself contributes no styling).
Definition at line 97 of file reflow_types.h.
| enum reflow_layout_t : uint16_t |
Layout-axis named constants used by the line-break engine.
These values name the magic numbers that would otherwise show up in the layout pass: page margin, line-spacing multiplier numerator / denominator, default font size, and the heading multipliers H1..H6.
Definition at line 69 of file reflow_types.h.
| enum reflow_limits_t : uint32_t |
Static-allocation caps for the reflow engine.
The engine holds a fixed number of parsed tokens, positioned glyphs, and pages. Anything bigger is rejected with k_ra8_err_no_mem. Sized to fit the EK-RA8D2's 2 MB SRAM with comfortable headroom.
Definition at line 47 of file reflow_types.h.
| enum reflow_token_kind_t : uint8_t |
Parsed token classification.
The parser converts the markup into a flat token stream. Block-start and block-end tokens carry an reflow_html_tag_t; inline tokens carry text (a slice of the engine text pool) plus a font-style stamp.
Definition at line 185 of file reflow_types.h.