86typedef enum : uint16_t {
124typedef enum : uint8_t {
157typedef enum : uint8_t {
303 alignas(max_align_t) uint8_t
uint16_t epub_manifest_count(const epub_book_t *book)
Number of <manifest> <item> entries retained (#151).
ra8_err_t epub_set_font(epub_book_t *book, const uint8_t *font_data, size_t font_size)
Attach a TTF font blob to be used by epub_render_glyph().
const epub_manifest_item_t * epub_manifest_item(const epub_book_t *book, uint16_t index)
Borrow the manifest item at index (OPF document order, #151).
ra8_err_t epub_toc_entry_to_chapter(const epub_book_t *book, uint16_t toc_idx, uint16_t *out_chapter_idx)
Resolve a TOC entry to the spine chapter index it points into.
ra8_err_t epub_get_embedded_font_count(const epub_book_t *book, uint16_t *out_count)
Count the fonts the EPUB ships in its OPF manifest (#109).
ra8_err_t epub_close(epub_book_t *book)
Close a previously opened EPUB book.
ra8_err_t epub_get_cover_image(epub_book_t *book, uint8_t *out_buf, size_t max_len, size_t *got_len)
Copy the raw bytes of the cover image into the caller's buffer.
ra8_err_t epub_render_glyph(const epub_book_t *book, int32_t codepoint, float font_size, uint8_t *out_bitmap, size_t max_pixels, uint32_t *out_w, uint32_t *out_h)
Rasterise a single Unicode code point into an alpha-8 bitmap.
ra8_err_t epub_get_toc_kind(const epub_book_t *book, uint8_t *out_kind)
Report which navigation document the TOC was parsed from.
size_t(* epub_stream_read_fn)(void *ctx, uint64_t offset, void *buf, size_t len)
Seek+read callback backing a streamed (non-resident) EPUB open (#151).
ra8_err_t epub_open_streamed(const epub_stream_media_t *media, const char *path, epub_book_t *out_book)
Open an EPUB book from a seekable stream, with no whole-file residency (#151).
ra8_err_t epub_get_metadata(const epub_book_t *book, epub_metadata_t *out_meta)
Return Dublin Core metadata strings.
ra8_err_t epub_load_chapter(epub_book_t *book, uint16_t idx, uint8_t *out_xhtml, size_t max_len, size_t *got_len)
Extract the raw XHTML bytes of one chapter into the caller's buffer.
epub_limits_t
Static-allocation caps for the EPUB reader.
@ k_epub_id_len
Max manifest item id length (incl.
@ k_epub_max_manifest
Max <manifest> <item> entries kept (OPF order).
@ k_epub_max_fonts
Max embedded font manifest items kept.
@ k_epub_zip_archive_bytes
Storage for mz_zip_archive (miniz 3.0.2 sizeof=112; margin; static_assert in .c).
@ k_epub_media_len
Max media-type length (incl.
@ k_epub_max_toc
Max table-of-contents entries we keep.
@ k_epub_max_chapters
Max spine length we accept.
@ k_epub_max_path_len
Max href length (incl.
@ k_epub_meta_len
Max bytes per metadata field.
ra8_err_t epub_get_toc_entry(const epub_book_t *book, uint16_t idx, epub_toc_entry_t *out_entry)
Copy one table-of-contents entry into the caller's struct.
ra8_err_t epub_get_embedded_font(epub_book_t *book, uint16_t idx, uint8_t *out_buf, size_t max_len, size_t *got_len)
Extract one EPUB-shipped font's bytes into a caller buffer (#109).
epub_render_t
Pixel-format selectors for epub_render_glyph().
@ k_epub_render_alpha8
8 bits per pixel, alpha mask.
epub_toc_kind_t
Which navigation document the table of contents was parsed from.
@ k_epub_toc_ncx
Parsed from an EPUB 2 NCX document.
@ k_epub_toc_nav
Parsed from an EPUB 3 nav.xhtml.
@ k_epub_toc_none
No table of contents parsed.
ra8_err_t epub_open(const void *media, const char *path, epub_book_t *out_book)
Open an EPUB book from an opaque media handle.
ra8_err_t epub_get_chapter_count(const epub_book_t *book, uint16_t *out_count)
Report how many chapters the spine contains.
ra8_err_t epub_get_toc_count(const epub_book_t *book, uint16_t *out_count)
Report how many table-of-contents entries the book exposes.
ra8_err_t epub_get_resource(epub_book_t *book, const char *path, uint8_t *out_buf, size_t max_len, size_t *got_len)
Copy the raw bytes of an arbitrary archive resource into the caller's buffer (#140 external styleshee...
Caller-owned bounded-arena allocator for miniz.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
char author[k_epub_meta_len]
Dublin Core <dc:creator>.
char toc_path[k_epub_max_path_len]
Nav/NCX href (rel.
char chapter_paths[k_epub_max_chapters][k_epub_max_path_len]
Manifest hrefs (relative to OPF dir).
epub_miniz_workspace_t miniz_workspace
Per-book bounded allocator workspace; never shared with another book.
size_t font_size
TTF blob length.
size_t zip_size
Length of the EPUB blob.
char language[k_epub_meta_len]
Dublin Core <dc:language>.
char cover_path[k_epub_max_path_len]
Path to cover image (or empty).
uint16_t chapter_count
Spine length actually stored.
epub_xml_workspace_t xml_workspace
Per-book XML parser state; never shared with another book.
char title[k_epub_meta_len]
Dublin Core <dc:title>.
uint16_t toc_count
Number of entries stored in toc.
uint8_t toc_kind
epub_toc_kind_t: source of the TOC.
epub_manifest_item_t manifest[k_epub_max_manifest]
Items, OPF order.
uint16_t embedded_font_count
Manifest font items found (<= cap).
epub_miniz_arena_t miniz_arena
Per-book allocator descriptor bound through miniz's opaque pointer.
epub_toc_entry_t toc[k_epub_max_toc]
Flattened TOC, document order.
epub_stream_media_t stream_media
Streamed media descriptor; {} for the resident path.
uint16_t manifest_count
<manifest> <item> entries stored (<= cap).
uint8_t zip_archive_storage[k_epub_zip_archive_bytes]
Zip archive storage.
uint8_t zip_archive_active
1 = mz_zip_reader_init succeeded.
char identifier[k_epub_meta_len]
Dublin Core <dc:identifier> (unique book id).
uint8_t in_use
1 = open, 0 = closed.
char opf_dir[k_epub_max_path_len]
Directory portion of the OPF.
const uint8_t * zip_bytes
Pointer to the EPUB blob.
char embedded_font_paths[k_epub_max_fonts][k_epub_max_path_len]
Font hrefs (rel.
const uint8_t * font_data
TTF blob; NULL if unset.
One <manifest> <item> entry, retained in OPF document order.
char media_type[k_epub_media_len]
Item media-type (or "" if absent).
char href[k_epub_max_path_len]
Item href (relative to the OPF dir).
Descriptor for one caller-owned miniz allocation arena.
Exactly-sized, maximally-aligned storage for one miniz arena.
One titled entry in the table of contents.
char href[k_epub_max_path_len]
Target href (rel.
char title[k_epub_meta_len]
Navigation label text ("" if none).
uint8_t depth
Nesting level; 0 == top level.
Per-book bounded storage for strict OPF/container/TOC parsing.
xml_workspace_t reader
4096-byte open-element stack.
xml_span_t references[k_epub_max_chapters]
Spine idref spans retained between OPF passes.
xml_span_t legacy_cover_id
EPUB 2 cover manifest id.
uint16_t reference_count
Valid entries in references.
Immutable byte span expressed relative to the source.
Exactly bounded caller-owned nesting storage.
Bounded, caller-owned, no-heap XML pull reader.