Compare commits
140
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
737b22a2df | ||
|
|
be5ce94c0f | ||
|
|
8634cb8ad3 | ||
|
|
21caebd6e4 | ||
|
|
6f05e401a1 | ||
|
|
f2e3d117dc | ||
|
|
9202522a39 | ||
|
|
301f1d1a38 | ||
|
|
1f83087aa5 | ||
|
|
68138fffdb | ||
|
|
eb98735115 | ||
|
|
b94b58756f | ||
|
|
ca6ebc56fb | ||
|
|
2ea042a68a | ||
|
|
9c12b90737 | ||
|
|
7f01eab62e | ||
|
|
3a1e9f3023 | ||
|
|
fad1a801a4 | ||
|
|
67936cb3af | ||
|
|
fd5b8078c6 | ||
|
|
bd101b2af8 | ||
|
|
19d51ec08c | ||
|
|
ea231ffd18 | ||
|
|
a2d4c6a139 | ||
|
|
b5b1f650e2 | ||
|
|
f04b8aa9a9 | ||
|
|
d9bcef7a58 | ||
|
|
a60f31cdd4 | ||
|
|
f055fdd774 | ||
|
|
bb078bae09 | ||
|
|
2d65808302 | ||
|
|
6e75e5a6be | ||
|
|
db94a86fba | ||
|
|
b12839d1d4 | ||
|
|
50e4d550fb | ||
|
|
03f73fadc7 | ||
|
|
0d64980d25 | ||
|
|
4fe80ba7a5 | ||
|
|
b229428a17 | ||
|
|
36d0e52e4b | ||
|
|
94c0ba466c | ||
|
|
da2e4eabb0 | ||
|
|
3392b3e35a | ||
|
|
52e7446757 | ||
|
|
d83605e003 | ||
|
|
ebf0413fe1 | ||
|
|
66d9e4403a | ||
|
|
174a24ba42 | ||
|
|
9897025ded | ||
|
|
f5bc554ae7 | ||
|
|
cc2079a578 | ||
|
|
75a35f0578 | ||
|
|
f872f1f549 | ||
|
|
02573dc592 | ||
|
|
dfefbfe9b5 | ||
|
|
36a3a0cc3a | ||
|
|
bbb3e06eb1 | ||
|
|
213972badc | ||
|
|
c5e861d71c | ||
|
|
34e923d722 | ||
|
|
f4e7eaa198 | ||
|
|
94d4b0c7bb | ||
|
|
6dbfc29c7e | ||
|
|
4ee406897b | ||
|
|
67973166e3 | ||
|
|
50bc9325a4 | ||
|
|
d736e52bdd | ||
|
|
91d17d9f48 | ||
|
|
d5c28fa1f1 | ||
|
|
f69650fb86 | ||
|
|
e3298c6e43 | ||
|
|
56ba9e4337 | ||
|
|
b56d3d853d | ||
|
|
e9120888fa | ||
|
|
d7797baff2 | ||
|
|
b53ac3d52c | ||
|
|
38210be820 | ||
|
|
88b10c82a3 | ||
|
|
19954aa1b5 | ||
|
|
2823a4a2cd | ||
|
|
929f290042 | ||
|
|
0f021ea5f1 | ||
|
|
99ab8b2772 | ||
|
|
7accc607af | ||
|
|
f39ba7037f | ||
|
|
2dd491b62e | ||
|
|
dc404b41c7 | ||
|
|
4ffc2a7e7e | ||
|
|
c44555007b | ||
|
|
d9aa5b4de1 | ||
|
|
a7aa4c55d8 | ||
|
|
3800179595 | ||
|
|
0b9d1a7d23 | ||
|
|
252a64fa97 | ||
|
|
75764bc6eb | ||
|
|
0ddefdc0c9 | ||
|
|
41e6e15229 | ||
|
|
082b5f295b | ||
|
|
beb7876ccf | ||
|
|
b69111bea5 | ||
|
|
86a9510957 | ||
|
|
acc1ed4358 | ||
|
|
08461c08e7 | ||
|
|
dac7fef49d | ||
|
|
a14c8e762d | ||
|
|
a525606d7f | ||
|
|
df53faab91 | ||
|
|
f2adefe729 | ||
|
|
6a98c2d865 | ||
|
|
cfd3a381ed | ||
|
|
151bf1dae4 | ||
|
|
06d28d6ffa | ||
|
|
8a11f44571 | ||
|
|
061c7688a4 | ||
|
|
510ee10153 | ||
|
|
c6d116024c | ||
|
|
85e08f9a93 | ||
|
|
0af0ad5a17 | ||
|
|
93e81daf41 | ||
|
|
a3e51f9b1e | ||
|
|
90d4c885e1 | ||
|
|
ee947b06d1 | ||
|
|
28b907321e | ||
|
|
77afea4d95 | ||
|
|
2f342508bc | ||
|
|
7bb1f7ed76 | ||
|
|
7acc31bc34 | ||
|
|
938ca3fac1 | ||
|
|
0fbe6ff469 | ||
|
|
43b20bd8be | ||
|
|
b186529120 | ||
|
|
5fa5a71ba2 | ||
|
|
aa43bd3569 | ||
|
|
8377ac9e31 | ||
|
|
71518b3336 | ||
|
|
30b14f2ecf | ||
|
|
6f7f4c592a | ||
|
|
bc57e5d64b | ||
|
|
db3bb850b2 | ||
|
|
30a209de8b |
@@ -0,0 +1,33 @@
|
||||
# CrossPoint Reader: Claude Code skills
|
||||
|
||||
Project skills for Claude Code. Claude auto-discovers them and loads one when the
|
||||
task matches its `description`; you do not invoke them by hand. They encode how
|
||||
this project wants C/C++ written: the judgment calls and self-review gates that
|
||||
keep the firmware small, stable, and reviewable.
|
||||
|
||||
These are written for capable agents, not beginners. They are principle- and
|
||||
decision-focused on purpose. They deliberately avoid line-number citations,
|
||||
which drift; they anchor on durable names (APIs, types, macros, files).
|
||||
|
||||
This is separate from `.skills/SKILL.md`, the GitHub coding-agent guide that
|
||||
mirrors CLAUDE.md. CLAUDE.md stays the always-loaded rule set; these skills are
|
||||
the applied decision procedures that load on demand and add the judgment layer
|
||||
CLAUDE.md does not carry.
|
||||
|
||||
| Skill | Loads when you are... |
|
||||
|---|---|
|
||||
| `heap-discipline` | allocating memory: new/malloc/vector/string, buffers, caches |
|
||||
| `control-flow-clarity` | writing branching logic, state flags, modes, if/else ladders |
|
||||
| `hal-and-abstractions` | touching storage, input, display, settings, i18n, rendering |
|
||||
| `scope-discipline` | adding a feature, activity, lib, setting, or dependency |
|
||||
| `refactor-for-review` | refactoring, cleaning up, or preparing a change for PR |
|
||||
|
||||
Each skill ends with a self-review checklist Claude runs against its own diff
|
||||
before handing it back. Reviewing a PR? Those checklists double as a fast rubric.
|
||||
|
||||
## Maintaining these
|
||||
|
||||
Edit the `SKILL.md` under each directory. Keep them tight. Do not restate
|
||||
CLAUDE.md; add the judgment CLAUDE.md cannot afford to carry. Trigger quality
|
||||
lives in the `description` field: it must name the situations that should pull
|
||||
the skill in, in the words a contributor's task would use.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: control-flow-clarity
|
||||
description: Branching and state-modeling clarity in C/C++. Use when writing or refactoring logic that branches on discrete values: if/else-if ladders, status flags, mode or state ints, or anything that should be an enum plus an exhaustive switch. Covers enum class over magic ints, exhaustive switch over nested if, early-return guard clauses, table dispatch, and when each is the right call.
|
||||
---
|
||||
|
||||
# Control-Flow Clarity
|
||||
|
||||
The goal: a reviewer verifies correctness by reading, not by tracing. Branching
|
||||
that mirrors the problem's shape is self-evident; branching that encodes it in
|
||||
ad-hoc ints and nesting forces the reader to reconstruct intent.
|
||||
|
||||
## Core moves
|
||||
|
||||
- **Model a closed set of states/modes as an `enum class`, not ints or bools.**
|
||||
A variable kept honest by a comment ("0 = hidden, 1 = showing, 2 = confirm")
|
||||
is a latent bug. Make it an enum and the comment becomes the type.
|
||||
- **Dispatch on an enum with an exhaustive `switch`, no `default`.** This
|
||||
codebase relies on it: omitting `default` lets the compiler flag the
|
||||
unhandled case when someone adds an enum value. A `default:` that swallows the
|
||||
unknown case throws that safety away. Add `default` only when "every other
|
||||
value does nothing" is a deliberate, documented decision.
|
||||
- **Replace nested `if/else-if` ladders that branch on one discriminant with a
|
||||
`switch`.** If each branch only maps input to a value, prefer a lookup table
|
||||
(`static constexpr` array) over both.
|
||||
- **Prefer early-return guard clauses over nested success bodies.** Handle the
|
||||
error/empty/skip cases first and return; keep the main path at the left
|
||||
margin.
|
||||
|
||||
## When NOT to switch
|
||||
|
||||
- Branches test unrelated conditions, not one discriminant: a guarded `if`
|
||||
sequence is honest; a switch would be forced.
|
||||
- Two outcomes on a genuine boolean: keep the `if`.
|
||||
- The discriminant is an open or unbounded set (arbitrary ints, strings): table
|
||||
or map, not a switch.
|
||||
|
||||
## Enum hygiene
|
||||
|
||||
- `enum class` by default for type safety. Plain `enum` only when values must
|
||||
implicitly convert (e.g. a value that doubles as a UI dropdown index), and
|
||||
then give it a trailing `_COUNT` sentinel for safe bounds/iteration, matching
|
||||
the existing settings enums.
|
||||
- Name the discriminant after what it selects, not its storage:
|
||||
`Orientation orientation`, not `uint8_t mode`.
|
||||
- No magic numeric codes for states. If you write a comment mapping numbers to
|
||||
meanings, you owe an enum.
|
||||
|
||||
## Self-review
|
||||
|
||||
- [ ] No int/bool standing in for a closed set of modes; it is an `enum class`.
|
||||
- [ ] Enum dispatch is an exhaustive `switch` with no catch-all `default` (or
|
||||
the `default` is a documented deliberate choice).
|
||||
- [ ] No nested if/else-if ladder on a single discriminant that should be a
|
||||
switch or a table.
|
||||
- [ ] Error/skip cases are early-return guards; the happy path is not buried.
|
||||
- [ ] No magic numbers where a named enum or `constexpr` would state the intent.
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
name: hal-and-abstractions
|
||||
description: Layering and abstraction discipline for the firmware. Use when touching storage, input, display, settings, i18n, or rendering, or any code that could reach into the SDK. Covers routing through the HAL (HalStorage / HalGPIO / HalDisplay) instead of raw SDK classes, MappedInputManager logical buttons instead of raw GPIO indices, UITheme/GUI for all rendering, the singleton macros, tr() for user-facing text, and where a new abstraction boundary belongs.
|
||||
---
|
||||
|
||||
# HAL and Abstractions
|
||||
|
||||
CLAUDE.md lists the HAL classes and the SdFat-concurrency reason they exist.
|
||||
This is when and how to route through them, and where to draw a new boundary.
|
||||
|
||||
## Route through the layer, always
|
||||
|
||||
- **SD card I/O:** `Storage` (HalStorage) and `HalFile`. Never `SdFat`,
|
||||
`FsFile`, `SdSpiCard`, `FsBaseFile`, or `SDCardManager` directly. The HAL
|
||||
serializes every SD access through one mutex; bypassing it races the SPI state
|
||||
machine and panics FreeRTOS (CLAUDE.md has the failure mode). This is a
|
||||
correctness boundary, not a style preference.
|
||||
- **Display:** `HalDisplay` over `EInkDisplay`. **Input:** `HalGPIO` over
|
||||
`InputManager`.
|
||||
- **Rendering:** everything through the `GUI` macro (UITheme) and the renderer's
|
||||
oriented metrics. No hardcoded fonts, colors, coordinates, or 800/480
|
||||
literals; ask the renderer for width/height and use the oriented viewable
|
||||
area.
|
||||
- **Input in activities:** `MappedInputManager::Button` logical enums
|
||||
(`Button::Confirm`, `Button::PageForward`, ...). Never raw `HalGPIO::BTN_*`
|
||||
indices outside `ButtonRemapActivity`. Logical buttons survive user remapping
|
||||
and orientation; raw indices do not.
|
||||
- **Shared state:** the singleton macros (`SETTINGS`, `APP_STATE`, `GUI`,
|
||||
`Storage`, `I18N`), not threaded pointers.
|
||||
|
||||
## User-facing text
|
||||
|
||||
Every string a user reads goes through `tr(STR_*)`. Add the key to the English
|
||||
YAML, regenerate with `scripts/gen_i18n.py`, then use the `StrId`. Log lines
|
||||
(`LOG_*`) stay hardcoded.
|
||||
|
||||
## Drawing a new boundary
|
||||
|
||||
When you need an SDK capability the HAL does not expose yet, **add the method to
|
||||
the HAL; do not reach around it.** The new method inherits the mutex, logging,
|
||||
and error contract the rest of the HAL carries. A one-off direct SDK call in an
|
||||
activity is exactly the layering violation the mutex discipline cannot tolerate.
|
||||
|
||||
Keep abstractions thin. A wrapper that only renames an SDK call without adding
|
||||
the mutex, logging, or an error contract is dead weight. Add a layer only when
|
||||
it carries one of those contracts or hides a real implementation choice.
|
||||
|
||||
## Self-review
|
||||
|
||||
- [ ] No direct SdFat / FsFile / SDCardManager / EInkDisplay / InputManager use
|
||||
outside `lib/hal`.
|
||||
- [ ] File access uses `HalFile`; no `.close()` on a local handle
|
||||
(DESTRUCTOR_CLOSES_FILE); members closed in `onExit`.
|
||||
- [ ] Input uses `MappedInputManager::Button`, not raw `BTN_*` indices.
|
||||
- [ ] Rendering goes through GUI/UITheme and oriented metrics; no 800/480 or
|
||||
hardcoded fonts/coords.
|
||||
- [ ] User-facing strings use `tr(STR_*)`; new keys added to YAML and
|
||||
regenerated.
|
||||
- [ ] Any new SDK capability is exposed as a HAL method, not called inline.
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
name: heap-discipline
|
||||
description: Memory allocation discipline for the ESP32-C3 (~380KB RAM, no PSRAM, single 48KB framebuffer). Use whenever writing or reviewing code that allocates: new / malloc / std::vector / std::string, buffers, caches, or anything held across a loop or an activity lifecycle. Covers makeUniqueNoThrow vs raw new/malloc, fragmentation avoidance, reserve-before-push_back, alloc-once-reuse, stack vs heap sizing, and the chunked grayscale buffer pattern.
|
||||
---
|
||||
|
||||
# Heap Discipline (ESP32-C3)
|
||||
|
||||
CLAUDE.md states the allocation rules. This is the procedure you run while
|
||||
writing the code and the gate you run before handing it back.
|
||||
|
||||
The constraint that makes every call matter: ~380KB RAM, no PSRAM, one 48KB
|
||||
framebuffer. **Fragmentation, not total usage, is what kills this device.**
|
||||
Free-heap can read fine while the largest free block is too small for the next
|
||||
allocation. Optimize for not leaving holes, not just for using fewer bytes.
|
||||
|
||||
## Allocation decision procedure
|
||||
|
||||
Ask in order; stop at the first yes.
|
||||
|
||||
1. **Stack?** Local, bounded, under ~256 bytes total: plain array/struct. No
|
||||
heap, no fragmentation. Keep frames lean; the task stack is small.
|
||||
2. **Compile-time constant?** `static constexpr` lives in flash, costs zero DRAM.
|
||||
3. **Allocated once and reused for an activity's lifetime?** Allocate in
|
||||
`onEnter`, hold in a member, release in `onExit`. Never per-frame, never
|
||||
per-iteration.
|
||||
4. **Dynamic and fallible?** `makeUniqueNoThrow<T>(...)` /
|
||||
`makeUniqueNoThrow<T[]>(n)` from `lib/Memory/Memory.h`. Null-check, `LOG_ERR`
|
||||
with the size, return false. It frees on every exit path.
|
||||
5. **A C/SDK API takes ownership and frees it itself?** Only then raw
|
||||
`new (std::nothrow)` / `malloc`, with a comment naming who frees it.
|
||||
|
||||
Bare `new` / `new[]` is never correct here: under `-fno-exceptions` it calls
|
||||
`abort()` on OOM instead of returning null.
|
||||
|
||||
## Fragmentation rules
|
||||
|
||||
- `std::vector`: `reserve(n)` before any `push_back` loop. Each growth is
|
||||
alloc-copy-free (three heap ops) and leaves a hole. Unknown n: estimate high.
|
||||
- No repeated `new`/`delete` or growing containers inside a loop or render path.
|
||||
Hoist the allocation out of the loop.
|
||||
- Large contiguous blocks fragment worst. Full-screen-class buffers use the
|
||||
chunked `storeBwBuffer` / `restoreBwBuffer` path in `GfxRenderer` so they
|
||||
never demand one contiguous 48KB block. Reuse that path. Do not malloc a
|
||||
second full-screen buffer.
|
||||
- `std::string` / Arduino `String`: acceptable on cold paths (file I/O, one-shot
|
||||
setup). Banned on hot/render paths. Build text with a stack `char[]` +
|
||||
`snprintf`; if a `std::string` is unavoidable, `reserve` it first.
|
||||
|
||||
## Justify every allocation
|
||||
|
||||
Per CLAUDE.md's evidence rule: when you add a heap allocation, state in one line
|
||||
why stack/static/reuse was rejected and the worst-case size. If you cannot name
|
||||
the size, you cannot budget it, and you should not allocate it.
|
||||
|
||||
## Self-review before handoff
|
||||
|
||||
- [ ] No bare `new`/`new[]`. Every fallible alloc is `makeUniqueNoThrow`, or a
|
||||
raw alloc with an explicit owner comment.
|
||||
- [ ] Every allocation is null-checked with `LOG_ERR` before the error return.
|
||||
- [ ] No allocation inside a loop or render path that could be hoisted.
|
||||
- [ ] Every `push_back` loop has a preceding `reserve`.
|
||||
- [ ] Anything allocated in `onEnter` is released in `onExit`; member `HalFile`
|
||||
closed there too.
|
||||
- [ ] No second full-screen buffer; grayscale uses store/restoreBwBuffer.
|
||||
- [ ] Each new allocation carries a one-line size + why-not-stack/static note.
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
name: refactor-for-review
|
||||
description: Producing small, single-concern, reviewable changes. Use when refactoring, cleaning up, restructuring, decomposing, or preparing a change for PR, especially in this multi-contributor AI-assisted codebase that is prone to sprawl diffs. Covers one-concern-per-commit, extracting helpers without widening scope, not bundling unrelated edits, decomposing oversized activities, comment hygiene, and a pre-handoff self-review checklist.
|
||||
---
|
||||
|
||||
# Refactor for Review
|
||||
|
||||
This is a multi-contributor, AI-assisted codebase, and the dominant failure mode
|
||||
is the sprawl diff: a one-line intent that touches thirty files. The goal is a
|
||||
change a reviewer can verify in one sitting. Cleaner structure that makes the
|
||||
next change easier is the win, not lines added.
|
||||
|
||||
## One concern per change
|
||||
|
||||
- A commit/PR does one thing. A bug fix is not also a rename is not also a
|
||||
reformat. If you spot an unrelated improvement mid-change, leave it or capture
|
||||
it separately; do not fold it in.
|
||||
- When the working tree has bundled two changes, separate them with the
|
||||
copy-affected-files-aside, reset, re-apply one concern, restore the rest
|
||||
pattern, not by committing the tangle.
|
||||
- Refactor and behavior change do not ride together. A pure refactor must not
|
||||
alter behavior; a behavior change should not drag a refactor along. If both
|
||||
are needed: two commits, refactor first.
|
||||
|
||||
## Keep the diff narrow
|
||||
|
||||
- Extract a helper to remove real duplication or to name a concept, not to chase
|
||||
abstraction. Three-plus copies, or a block that needs a name to be understood:
|
||||
extract. Two similar lines: leave them.
|
||||
- No "while I'm here" scope creep. A signature or type change that ripples to
|
||||
many call sites is its own PR: map every caller first, update them in one
|
||||
topological pass, and land it separately, not as a rider on a feature.
|
||||
- Match the surrounding code: comment density, naming, idiom. The diff should
|
||||
read like the file, not like a different author.
|
||||
|
||||
## Decompose oversized units
|
||||
|
||||
An activity or function that has outgrown one screen of responsibility (multiple
|
||||
unrelated state machines, or a file far larger than its siblings) is a
|
||||
decomposition candidate. Extract a cohesive sub-responsibility into its own
|
||||
unit, as a standalone behavior-preserving refactor, verified on its own, never
|
||||
mixed into a feature change.
|
||||
|
||||
## Comments earn their place
|
||||
|
||||
Comments explain why: an invariant, a defense, a past incident, a non-obvious
|
||||
constraint. Never what the next line already says. Delete narration, phase-marker
|
||||
comments ("now we loop over..."), and restated function names. If a comment and
|
||||
the code it sits on say the same thing, the comment is the thing to cut.
|
||||
|
||||
## Self-review before handoff
|
||||
|
||||
- [ ] The change does exactly one thing; nothing unrelated rode along.
|
||||
- [ ] Refactor and behavior change are not mixed in one commit.
|
||||
- [ ] No "while I'm here" creep; rename/signature ripples are split out.
|
||||
- [ ] Extractions remove real duplication or name a real concept, not
|
||||
speculative abstraction.
|
||||
- [ ] New comments say why, not what; no narration or phase markers.
|
||||
- [ ] A reviewer can understand the diff without running it.
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
name: scope-discipline
|
||||
description: Feature-scope discipline for a dedicated e-reader (not a Swiss Army knife). Use when adding a feature, a new activity, a new lib, a setting, or a dependency, or when a request would grow the firmware's surface. Covers the SCOPE.md test, the RAM-cost vs reading-benefit gate, preferring no-code or existing-mechanism solutions, awareness of the existing activity surface, and how to push back on out-of-scope asks.
|
||||
---
|
||||
|
||||
# Scope Discipline
|
||||
|
||||
The mission: do one thing exceptionally well, focused reading on constrained
|
||||
hardware. `SCOPE.md` is the source of truth for what is in and out. Read it
|
||||
before adding surface. This is the gate to run before writing a new feature.
|
||||
|
||||
## The gate
|
||||
|
||||
Before adding a feature, activity, lib, setting, or dependency, answer in order:
|
||||
|
||||
1. **Is it in `SCOPE.md`?** Explicitly out: interactive apps (notepad,
|
||||
calculator, games), active connectivity (RSS, news, browser), media/audio
|
||||
playback. If it is out, say so and stop.
|
||||
2. **Does it materially improve focused reading?** If the benefit is
|
||||
"nice to have" or serves a different use case, it is out. This is not a PDA.
|
||||
3. **What does it cost in RAM and in the largest-free-block budget?** A feature
|
||||
that adds steady-state RAM or a large transient allocation needs a reading
|
||||
benefit that clearly outweighs it. Quantify with `firmware_size_history.py`
|
||||
and `script_profile_mem.sh` rather than guessing.
|
||||
4. **Can it be done with no new code?** Prefer an existing activity, an existing
|
||||
setting, or a doc over a new code path. The cheapest feature is the one
|
||||
already built.
|
||||
|
||||
If a request fails the gate, push back with the specific reason and the
|
||||
`SCOPE.md` basis, and offer the in-scope alternative. Make the call and say why;
|
||||
do not just hand over a menu.
|
||||
|
||||
## Surface awareness
|
||||
|
||||
The firmware already carries dozens of activities. Each new one is permanent
|
||||
RAM, permanent maintenance, and another thing every future refactor must not
|
||||
break. Default to extending an existing activity or setting before adding a new
|
||||
screen. New top-level surface needs a real justification, not "it would be
|
||||
convenient."
|
||||
|
||||
## Settings are not free
|
||||
|
||||
A new setting is a field to persist, migrate, validate, translate, and render,
|
||||
plus combinatorial test burden. Add one only when users genuinely need the
|
||||
choice; otherwise pick a sensible fixed default.
|
||||
|
||||
## Self-review
|
||||
|
||||
- [ ] Checked against `SCOPE.md`; not on the out-of-scope list.
|
||||
- [ ] Stated the concrete reading benefit, not a generic "useful."
|
||||
- [ ] Named the RAM/size cost (measured, not guessed) and why the benefit wins.
|
||||
- [ ] Checked whether an existing activity/setting/doc already covers it.
|
||||
- [ ] New setting (if any) is justified by a real user need, not added
|
||||
"just in case."
|
||||
+1
-2
@@ -1,2 +1 @@
|
||||
github: [daveallie]
|
||||
ko_fi: daveallie
|
||||
custom: ["https://app.royalty.dev/crosspoint-reader/crosspoint-reader"]
|
||||
|
||||
@@ -53,6 +53,13 @@ jobs:
|
||||
- name: Install PlatformIO Core
|
||||
run: uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.19.zip
|
||||
|
||||
- name: Cache PlatformIO packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.platformio
|
||||
key: pio-${{ runner.os }}-${{ hashFiles('platformio.ini') }}
|
||||
restore-keys: pio-${{ runner.os }}-
|
||||
|
||||
- name: Run cppcheck
|
||||
run: pio check --fail-on-defect low --fail-on-defect medium --fail-on-defect high
|
||||
|
||||
@@ -76,6 +83,13 @@ jobs:
|
||||
- name: Install PlatformIO Core
|
||||
run: uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.19.zip
|
||||
|
||||
- name: Cache PlatformIO packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.platformio
|
||||
key: pio-${{ runner.os }}-${{ hashFiles('platformio.ini') }}
|
||||
restore-keys: pio-${{ runner.os }}-
|
||||
|
||||
- name: Build CrossPoint
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -102,6 +116,33 @@ jobs:
|
||||
path: .pio/build/default/firmware.bin
|
||||
if-no-files-found: error
|
||||
|
||||
unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install build tools
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y cmake ninja-build
|
||||
|
||||
- name: Cache googletest source
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: build/test/_deps/googletest-src
|
||||
key: ${{ runner.os }}-googletest-${{ hashFiles('test/CMakeLists.txt') }}
|
||||
|
||||
- name: Configure
|
||||
run: cmake -S test -B build/test -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build/test
|
||||
|
||||
- name: Run tests
|
||||
run: ctest --test-dir build/test --output-on-failure -j
|
||||
|
||||
# This job is used as the PR required actions check, allows for changes to other steps in the future without breaking
|
||||
# PR requirements.
|
||||
test-status:
|
||||
@@ -110,6 +151,7 @@ jobs:
|
||||
- build
|
||||
- clang-format
|
||||
- cppcheck
|
||||
- unit-tests
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@@ -25,6 +25,13 @@ jobs:
|
||||
- name: Install PlatformIO Core
|
||||
run: uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.19.zip
|
||||
|
||||
- name: Cache PlatformIO packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.platformio
|
||||
key: pio-${{ runner.os }}-${{ hashFiles('platformio.ini') }}
|
||||
restore-keys: pio-${{ runner.os }}-
|
||||
|
||||
- name: Build CrossPoint
|
||||
run: pio run -e gh_release
|
||||
|
||||
|
||||
@@ -25,6 +25,13 @@ jobs:
|
||||
- name: Install PlatformIO Core
|
||||
run: uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.19.zip
|
||||
|
||||
- name: Cache PlatformIO packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.platformio
|
||||
key: pio-${{ runner.os }}-${{ hashFiles('platformio.ini') }}
|
||||
restore-keys: pio-${{ runner.os }}-
|
||||
|
||||
- name: Extract env
|
||||
run: |
|
||||
echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||
|
||||
@@ -19,3 +19,7 @@ build
|
||||
lib/EpdFont/scripts/downloaded_fonts/
|
||||
lib/EpdFont/scripts/instanced_fonts/
|
||||
lib/EpdFont/scripts/output/
|
||||
# Claude Code: share project skills with the team, keep local agent state
|
||||
# (worktrees, scheduled-task locks, settings.local, scout CLEANUP.md) out.
|
||||
.claude/*
|
||||
!.claude/skills/
|
||||
|
||||
+70
-30
@@ -58,6 +58,7 @@ find src -name "*.cpp" -o -name "*.h" | xargs clang-format -i
|
||||
6. `constexpr` First: Compile-time constants and lookup tables must be `constexpr`, not just `static const`. This moves computation to compile time, enables dead-branch elimination, and guarantees flash placement. Use `static constexpr` for class-level constants.
|
||||
7. `std::vector` Pre-allocation: Always call `.reserve(N)` before any `push_back()` loop. Each growth event allocates a new block (2×), copies all elements, then frees the old one — three heap operations that fragment DRAM. When the final size is unknown, estimate conservatively.
|
||||
8. SPIFFS Write Throttling: Never write a settings file on every user interaction. Guard all writes with a value-change check (`if (newVal == _current) return;`). Progress saves during reading must be debounced — write on activity exit or every N page turns, not on every turn. SPIFFS sectors have a finite erase cycle limit.
|
||||
9. `new` is not nothrow on ESP32: With `-fno-exceptions`, bare `new` that fails calls `abort()` — it does NOT return `nullptr`. Always use `new (std::nothrow)` and null-check the result, or use `makeUniqueNoThrow<T>()` from `lib/Memory/Memory.h`. Never write bare `new` for any fallible allocation.
|
||||
|
||||
---
|
||||
|
||||
@@ -151,14 +152,19 @@ These flags in `platformio.ini` fundamentally affect firmware behavior:
|
||||
#include <HalStorage.h>
|
||||
|
||||
// Use Storage singleton (defined via macro)
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (Storage.openFileForRead("MODULE", "/path/to/file.bin", file)) {
|
||||
// Read from file
|
||||
// No file.close() needed — DESTRUCTOR_CLOSES_FILE=1 handles it at scope exit
|
||||
}
|
||||
```
|
||||
|
||||
**Usage**: See example above. Uses `FsFile` (SdFat), NOT Arduino `File`. Do NOT add `file.close()` for local variables (see DESTRUCTOR_CLOSES_FILE above).
|
||||
**Usage**: Use `HalFile` (the mutex-wrapping handle), NOT raw SdFat `FsFile` or Arduino `File`. Do NOT add `file.close()` for local variables (see DESTRUCTOR_CLOSES_FILE above).
|
||||
|
||||
**SdFat is not thread-safe; all SD access MUST go through HalStorage**:
|
||||
- SdFat's `SdSpiCard` tracks SPI bus state with an unsynchronized `m_spiActive` bool. Two tasks calling SdFat concurrently can confuse that state machine and end with one task calling `SPIClass::endTransaction()` against a paramLock the *other* task is holding. That trips FreeRTOS's `xTaskPriorityDisinherit` assert (`tasks.c:5156, pxTCB == pxCurrentTCBs[0]`) and panics the system. See SdFat issue #518.
|
||||
- `HalStorage` serializes everything via `storageMutex`. Downstream code uses `HalFile` (declared in `<HalStorage.h>`); every method call (read, write, seek, close) takes the mutex. `HalFile`'s destructor also takes the mutex before letting the underlying SdFat `FsFile` close.
|
||||
- **Never** call into `SdFat` / `SdSpiCard` / `FsBaseFile` / `SDCardManager` / raw `FsFile` directly — that bypasses the mutex.
|
||||
|
||||
---
|
||||
|
||||
@@ -266,43 +272,78 @@ When a template is necessary, limit instantiations: use explicit template instan
|
||||
|
||||
**Rules**: NO exceptions, NO abort(), ALWAYS log before error return
|
||||
|
||||
### Acceptable malloc/free Patterns
|
||||
### Heap Buffer Allocation
|
||||
|
||||
**Source**: [src/activities/home/HomeActivity.cpp:166](../src/activities/home/HomeActivity.cpp), [lib/GfxRenderer/GfxRenderer.cpp:439-440](../lib/GfxRenderer/GfxRenderer.cpp)
|
||||
**Prefer `makeUniqueNoThrow` over `malloc`.** Both are nothrow (return `nullptr` on OOM rather than calling `abort()`), but `malloc` requires a manual `free` on every return path — a common source of leaks. `makeUniqueNoThrow<uint8_t[]>(size)` from `lib/Memory/Memory.h` frees automatically when it goes out of scope.
|
||||
|
||||
Despite "prefer stack allocation," malloc is acceptable for:
|
||||
1. **Large temporary buffers** (> 256 bytes, won't fit on stack)
|
||||
2. **One-time allocations** during activity initialization
|
||||
3. **Bitmap rendering buffers** (variable size, used briefly)
|
||||
|
||||
**Pattern**:
|
||||
**Preferred pattern**:
|
||||
```cpp
|
||||
// Allocate
|
||||
auto* buffer = static_cast<uint8_t*>(malloc(bufferSize));
|
||||
#include <Memory.h>
|
||||
|
||||
auto buffer = makeUniqueNoThrow<uint8_t[]>(bufferSize);
|
||||
if (!buffer) {
|
||||
LOG_ERR("MODULE", "malloc failed: %d bytes", bufferSize);
|
||||
return false; // Handle allocation failure
|
||||
LOG_ERR("MODULE", "OOM: %d bytes", bufferSize);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Use buffer
|
||||
processData(buffer, bufferSize);
|
||||
processData(buffer.get(), bufferSize);
|
||||
// freed automatically — no manual free needed, no leak on early return
|
||||
```
|
||||
|
||||
// Free immediately after use
|
||||
free(buffer);
|
||||
buffer = nullptr;
|
||||
**`malloc` or `new (std::nothrow)` are still acceptable** when the buffer must be passed to a C API that takes ownership and frees it itself (e.g., certain SDK callbacks). In that case follow the manual pattern:
|
||||
```cpp
|
||||
auto* buffer = static_cast<uint8_t*>(malloc(bufferSize)); // or new (std::nothrow) uint8_t[bufferSize]
|
||||
if (!buffer) {
|
||||
LOG_ERR("MODULE", "OOM: %d bytes", bufferSize);
|
||||
return false;
|
||||
}
|
||||
sdkApiThatTakesOwnership(buffer, bufferSize); // SDK calls free() / delete[]
|
||||
```
|
||||
|
||||
**Rules**:
|
||||
- **ALWAYS check for nullptr** after malloc
|
||||
- **Free immediately** after use (don't hold across multiple operations)
|
||||
- **Set to nullptr** after free (avoid use-after-free)
|
||||
- **Document size**: Comment why stack allocation was rejected
|
||||
- **Prefer `makeUniqueNoThrow`** — automatic cleanup eliminates leak risk on error paths
|
||||
- **ALWAYS check for nullptr** after any allocation and `LOG_ERR` before returning false
|
||||
- **Raw allocation only** when a C API takes ownership; document why in a comment
|
||||
|
||||
**Examples in codebase**:
|
||||
- Memory utilities: [Memory.h](../lib/Memory/Memory.h) (`makeUniqueNoThrow`)
|
||||
- Cover image buffers: [HomeActivity.cpp:166](../src/activities/home/HomeActivity.cpp)
|
||||
- Text chunk buffers: [TxtReaderActivity.cpp:259](../src/activities/reader/TxtReaderActivity.cpp)
|
||||
- Bitmap rendering: [GfxRenderer.cpp:439-440](../lib/GfxRenderer/GfxRenderer.cpp)
|
||||
- OTA update buffer: [OtaUpdater.cpp:40](../src/network/OtaUpdater.cpp)
|
||||
|
||||
### Heap Allocation with `new`: Always Use `makeUniqueNoThrow`
|
||||
|
||||
**CRITICAL**: With `-fno-exceptions`, bare `new` on OOM calls `abort()` — it does NOT return `nullptr`. Always use `makeUniqueNoThrow` from `lib/Memory/Memory.h`, which wraps `new (std::nothrow)` and returns a `std::unique_ptr` that is null on OOM and automatically frees on scope exit.
|
||||
|
||||
**Preferred pattern**:
|
||||
```cpp
|
||||
#include <Memory.h>
|
||||
|
||||
auto obj = makeUniqueNoThrow<MyClass>(args);
|
||||
if (!obj) { LOG_ERR("MOD", "OOM: MyClass"); return false; }
|
||||
|
||||
auto buf = makeUniqueNoThrow<uint8_t[]>(size);
|
||||
if (!buf) { LOG_ERR("MOD", "OOM: %d bytes", size); return false; }
|
||||
|
||||
// Pass to C APIs via .get(); unique_ptr frees automatically on return
|
||||
someApi(buf.get(), size);
|
||||
```
|
||||
|
||||
**`new (std::nothrow)` directly is acceptable** when the object must be passed to a C API that takes ownership and calls `delete` itself:
|
||||
```cpp
|
||||
auto* obj = new (std::nothrow) MyClass(args);
|
||||
if (!obj) { LOG_ERR("MOD", "OOM: MyClass"); return false; }
|
||||
sdkApiThatTakesOwnership(obj); // SDK calls delete
|
||||
```
|
||||
|
||||
**Rules**:
|
||||
- **Prefer `makeUniqueNoThrow`** — automatic cleanup eliminates leak risk on error paths
|
||||
- **NEVER use bare `new`** — always `makeUniqueNoThrow` or `new (std::nothrow)`
|
||||
- **ALWAYS `LOG_ERR` before returning false** on OOM
|
||||
- **Use `.get()`** to pass the raw pointer to C-style APIs; ownership stays with the `unique_ptr`
|
||||
- **`new (std::nothrow)` directly only** when a C API takes ownership; document why in a comment
|
||||
|
||||
**Examples in codebase**:
|
||||
- Memory utilities: [Memory.h](../lib/Memory/Memory.h) (`makeUniqueNoThrow`)
|
||||
|
||||
---
|
||||
|
||||
@@ -416,7 +457,6 @@ void onExit() { /* free: vTaskDelete, free buffer, close member FsFiles */ Act
|
||||
**All fonts are loaded as global static objects** at firmware startup:
|
||||
- Noto Serif: 12, 14, 16, 18pt (4 styles each: regular, bold, italic, bold-italic)
|
||||
- Noto Sans: 12, 14, 16, 18pt (4 styles each)
|
||||
- OpenDyslexic: 8, 10, 12, 14pt (4 styles each)
|
||||
- Ubuntu UI fonts: 10, 12pt (2 styles)
|
||||
|
||||
**Total**: ~80+ global `EpdFont` and `EpdFontFamily` objects
|
||||
@@ -856,8 +896,8 @@ rm -rf /path/to/sd/.crosspoint/epub_<hash>/sections/
|
||||
**Source**: `lib/Epub/Epub/Section.cpp`, `lib/Epub/Epub/BookMetadataCache.cpp`
|
||||
|
||||
**Current Versions** (as of docs/file-formats.md):
|
||||
- `book.bin`: **Version 5** (metadata structure)
|
||||
- `section.bin`: **Version 12** (layout structure)
|
||||
- `book.bin`: **Version 7** (metadata structure)
|
||||
- `section.bin`: **Version 25** (layout structure)
|
||||
|
||||
**Version Increment Rules**:
|
||||
1. **ALWAYS increment version** BEFORE changing binary structure
|
||||
@@ -867,7 +907,7 @@ rm -rf /path/to/sd/.crosspoint/epub_<hash>/sections/
|
||||
**Example** (incrementing section format version):
|
||||
```cpp
|
||||
// lib/Epub/Epub/Section.cpp
|
||||
static constexpr uint8_t SECTION_FILE_VERSION = 13; // Was 12, now 13
|
||||
static constexpr uint8_t SECTION_FILE_VERSION = 26; // Was 25, now 26
|
||||
|
||||
// Add new field to structure
|
||||
struct PageLine {
|
||||
@@ -878,4 +918,4 @@ struct PageLine {
|
||||
|
||||
---
|
||||
|
||||
Philosophy: We are building a dedicated e-reader, not a Swiss Army knife. If a feature adds RAM pressure without significantly improving the reading experience, it is Out of Scope.
|
||||
Philosophy: We are building a dedicated e-reader, not a Swiss Army knife. If a feature adds RAM pressure without significantly improving the reading experience, it is Out of Scope.
|
||||
|
||||
@@ -1,122 +1,181 @@
|
||||
# CrossPoint Reader
|
||||
|
||||
Firmware for the **Xteink X4** e-paper display reader (unaffiliated with Xteink).
|
||||
Built using **PlatformIO** and targeting the **ESP32-C3** microcontroller.
|
||||
[](https://app.royalty.dev/crosspoint-reader/crosspoint-reader)
|
||||
|
||||
CrossPoint Reader is a purpose-built firmware designed to be a drop-in, fully open-source replacement for the official
|
||||
Xteink firmware. It aims to match or improve upon the standard EPUB reading experience.
|
||||
CrossPoint is open-source e-reader firmware - community-built, fully hackable, free forever. It's maintained by a growing community of developers and readers who believe your device should do what you want - not what a manufacturer decided for you.
|
||||
|
||||

|
||||
**Now running on:** ESP32C3-based Xteink [X4](https://www.xteink.com/products/xteink-x4) and [X3](https://www.xteink.com/products/xteink-x3).
|
||||
|
||||
## Motivation
|
||||

|
||||
|
||||
E-paper devices are fantastic for reading, but most commercially available readers are closed systems with limited
|
||||
customisation. The **Xteink X4** is an affordable, e-paper device, however the official firmware remains closed.
|
||||
CrossPoint exists partly as a fun side-project and partly to open up the ecosystem and truly unlock the device's
|
||||
potential.
|
||||
## What can CrossPoint do?
|
||||
|
||||
CrossPoint Reader aims to:
|
||||
* Provide a **fully open-source alternative** to the official firmware.
|
||||
* Offer a **document reader** capable of handling EPUB content on constrained hardware.
|
||||
* Support **customisable font, layout, and display** options.
|
||||
* Run purely on the **Xteink X4 hardware**.
|
||||
- **Reader engine**: EPUB 2/3 rendering with embedded-style option, image handling, hyphenation, kerning, chapter navigation, footnotes, bookmarks, go-to-percent, auto page turn, orientation control, focus reading, KOReader progress sync and more.
|
||||
|
||||
This project is **not affiliated with Xteink**; it's built as a community project.
|
||||
- **Various formats**: native handling for `.epub`, `.xtc/.xtch`, `.txt`, and `.bmp`.
|
||||
|
||||
## Features & Usage
|
||||
- **Screenshots.**
|
||||
|
||||
- [x] EPUB parsing and rendering (EPUB 2 and EPUB 3)
|
||||
- [x] Image support within EPUB
|
||||
- [x] Saved reading position
|
||||
- [x] File explorer with file picker
|
||||
- [x] Basic EPUB picker from root directory
|
||||
- [x] Support nested folders
|
||||
- [ ] EPUB picker with cover art
|
||||
- [x] Custom sleep screen
|
||||
- [x] Cover sleep screen
|
||||
- [x] Wifi book upload
|
||||
- [x] Wifi OTA updates
|
||||
- [x] KOReader Sync integration for cross-device reading progress
|
||||
- [x] Configurable font, layout, and display options
|
||||
- [ ] User provided fonts
|
||||
- [ ] Full UTF support
|
||||
- [x] Screen rotation
|
||||
- **Custom fonts**: install your favorite fonts on the SD card.
|
||||
|
||||
Multi-language support: Read EPUBs in various languages, including English, Spanish, French, German, Italian, Portuguese, Russian, Ukrainian, Polish, Swedish, Norwegian, [and more](./USER_GUIDE.md#supported-languages).
|
||||
- **Tilt page turn (X3 only)**.
|
||||
|
||||
See [the user guide](./USER_GUIDE.md) for instructions on operating CrossPoint, including the
|
||||
[KOReader Sync quick setup](./USER_GUIDE.md#367-koreader-sync-quick-setup).
|
||||
- **Library workflow**: folder browser, hidden-file toggle, long-press delete, recent books, SD-cache management.
|
||||
|
||||
For more details about the scope of the project, see the [SCOPE.md](SCOPE.md) document.
|
||||
- **Wireless workflows**:
|
||||
|
||||
- File transfer web UI
|
||||
- EPUB Optimizer
|
||||
- Web settings UI/API (edit many device settings from browser)
|
||||
- WebSocket fast uploads
|
||||
- WebDAV handler
|
||||
- AP mode (hotspot) and STA mode (join existing Wi-Fi), both with QR helpers
|
||||
- Calibre wireless connect flow
|
||||
- OPDS browser with saved servers (up to 8), search, pagination, and direct download
|
||||
- OTA update checks and installs from GitHub releases
|
||||
|
||||
## Installing
|
||||
- **Customization**: multiple themes (Classic, Lyra, Lyra Extended, RoundedRaff), sleep screen modes, front/side button remapping, status bar controls, power-button behavior, refresh cadence, and more.
|
||||
|
||||
### Web (latest firmware)
|
||||
- **Localization**: 24 UI languages and counting. RTL support.
|
||||
|
||||
1. Connect your Xteink X4 to your computer via USB-C and wake/unlock the device
|
||||
2. Go to https://xteink.dve.al/ and click "Flash CrossPoint firmware"
|
||||
### Coming soon:
|
||||
|
||||
To revert back to the official firmware, you can flash the latest official firmware from https://xteink.dve.al/, or swap
|
||||
back to the other partition using the "Swap boot partition" button here https://xteink.dve.al/debug.
|
||||
- Dictionary lookup — inline word lookup without leaving the reader.
|
||||
|
||||
### Web (specific firmware version)
|
||||
- More themes.
|
||||
|
||||
1. Connect your Xteink X4 to your computer via USB-C
|
||||
2. Download the `firmware.bin` file from the release of your choice via the [releases page](https://github.com/crosspoint-reader/crosspoint-reader/releases)
|
||||
3. Go to https://xteink.dve.al/ and flash the firmware file using the "OTA fast flash controls" section
|
||||
- Much more! stay tuned.
|
||||
|
||||
To revert back to the official firmware, you can flash the latest official firmware from https://xteink.dve.al/, or swap
|
||||
back to the other partition using the "Swap boot partition" button here https://xteink.dve.al/debug.
|
||||
---
|
||||
|
||||
### Command line (specific firmware version)
|
||||
## USB-locked devices (Xteink Unlocker)
|
||||
|
||||
Some Xteink units purchased from third-party stores (e.g. AliExpress) ship with USB flashing locked from the factory.
|
||||
If your device is locked, you will need to use the **Xteink Unlocker** tool available at
|
||||
https://crosspointreader.com/#unlock-tool before you can flash CrossPoint.
|
||||
|
||||
**You do not need this tool if you bought your device directly from xteink.com.** Those units are not locked.
|
||||
|
||||
**Not sure if your device is locked?** Power it on, connect the USB-C cable, and try flashing via the web flasher first (see
|
||||
[Install firmware](#install-firmware) below). If the browser's serial device picker does not show your device, try a different
|
||||
USB port or browser before assuming the device is locked. Only reach for the unlocker if the device still doesn't appear.
|
||||
|
||||
> ### ⚠️ WARNING: READ THIS BEFORE USING THE UNLOCKER ⚠️
|
||||
>
|
||||
> **The only officially supported firmwares in the unlock tool are CrossPoint and CrossInk.**
|
||||
>
|
||||
> Flashing any other firmware on a USB-locked device may **permanently brick the device** or leave it **permanently
|
||||
> stuck on that firmware with no recovery path**. Once USB flashing is re-locked, your only way back is via OTA, and if
|
||||
> the firmware you flashed doesn't support OTA, **there is no way out**.
|
||||
>
|
||||
> **The Papyrix fork has removed OTA update support from its code.** If you flash Papyrix onto a
|
||||
> USB-locked unit, you will have **zero update or recovery path** and will be stuck on it forever. **Do not flash
|
||||
> Papyrix (or any other unsupported firmware) on a locked device.**
|
||||
|
||||
## Install firmware
|
||||
|
||||
### Web installer (recommended)
|
||||
|
||||
1. Connect your device to your computer via USB-C and wake/unlock the device
|
||||
2. Go to https://crosspointreader.com/#flash-tools, select device (X3 or X4), and choose an official CrossPoint release.
|
||||
|
||||
### Web installer (specific version)
|
||||
|
||||
1. Connect your device to your computer via USB-C and wake/unlock the device
|
||||
2. Download a `firmware.bin` from [Releases](https://github.com/crosspoint-reader/crosspoint-reader/releases), local build, or continuous integration artifact.
|
||||
3. Go to https://crosspointreader.com/#flash-tools, select device (X3 or X4), click "Custom .bin" and upload a `firmware.bin`.
|
||||
|
||||
### Revert to Official Firmware
|
||||
|
||||
To revert to the official firmware, you can also flash the latest official firmware using https://crosspointreader.com/#flash-tools.
|
||||
|
||||
### Command line
|
||||
|
||||
1. Install [`esptool`](https://github.com/espressif/esptool):
|
||||
|
||||
1. Install [`esptool`](https://github.com/espressif/esptool) :
|
||||
```bash
|
||||
pip install esptool
|
||||
```
|
||||
2. Download the `firmware.bin` file from the release of your choice via the [releases page](https://github.com/crosspoint-reader/crosspoint-reader/releases)
|
||||
3. Connect your Xteink X4 to your computer via USB-C.
|
||||
4. Note the device location. On Linux, run `dmesg` after connecting. On MacOS, run :
|
||||
|
||||
2. Download `firmware.bin` from the [releases page](https://github.com/crosspoint-reader/crosspoint-reader/releases).
|
||||
3. Connect your device via USB-C.
|
||||
4. Find the device port. On Linux, run `dmesg` after connecting. On macOS:
|
||||
|
||||
```bash
|
||||
log stream --predicate 'subsystem == "com.apple.iokit"' --info
|
||||
```
|
||||
5. Flash the firmware :
|
||||
|
||||
5. Flash:
|
||||
|
||||
```bash
|
||||
esptool.py --chip esp32c3 --port /dev/ttyACM0 --baud 921600 write_flash 0x10000 /path/to/firmware.bin
|
||||
```
|
||||
Change `/dev/ttyACM0` to the device for your system.
|
||||
|
||||
Adjust `/dev/ttyACM0` to match your system.
|
||||
|
||||
### Manual
|
||||
|
||||
See [Development](#development) below.
|
||||
See [Development quick start](#development-quick-start) below.
|
||||
|
||||
## Development
|
||||
---
|
||||
|
||||
## Custom SD-card fonts
|
||||
|
||||
Convert your own TTF/OTF files into `.cpfont` files that load from the SD card. No firmware reflash is needed.
|
||||
|
||||
1. Go to https://crosspointreader.com/fonts and open the "SD-card font builder" form.
|
||||
2. Upload up to four styles (regular, bold, italic, bold-italic), set the family name, point sizes, and Unicode range.
|
||||
3. Download the generated `.cpfont` files.
|
||||
4. Copy them to your SD card under `/fonts/YourFont/` (or `/.fonts/YourFont/` to hide the folder).
|
||||
5. Select the font on the device from the font settings.
|
||||
|
||||
Conversion runs the firmware repo's `lib/EpdFont/scripts/fontconvert_sdcard.py` script unmodified, so output matches a local host build.
|
||||
|
||||
---
|
||||
|
||||
## Documentation
|
||||
|
||||
- [User Guide](./USER_GUIDE.md)
|
||||
- [Web server usage](./docs/webserver.md)
|
||||
- [Web server endpoints](./docs/webserver-endpoints.md)
|
||||
- [Project scope](./SCOPE.md)
|
||||
- [Contributing docs](./docs/contributing/README.md)
|
||||
|
||||
---
|
||||
|
||||
## Development quick start
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* **PlatformIO Core** (`pio`) or **VS Code + PlatformIO IDE**
|
||||
* Python 3.8+
|
||||
* USB-C cable for flashing the ESP32-C3
|
||||
* Xteink X4
|
||||
- [pioarduino](https://github.com/pioarduino/pioarduino) or VS Code + pioarduino plugin
|
||||
- Python 3.8+
|
||||
- `clang-format` 21
|
||||
- USB-C cable supporting data transfer
|
||||
|
||||
### Checking out the code
|
||||
### Setup
|
||||
|
||||
CrossPoint uses PlatformIO for building and flashing the firmware. To get started, clone the repository:
|
||||
|
||||
```
|
||||
```bash
|
||||
git clone --recursive https://github.com/crosspoint-reader/crosspoint-reader
|
||||
cd crosspoint-reader
|
||||
|
||||
# Or, if you've already cloned without --recursive:
|
||||
# if cloned without --recursive:
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
### Flashing your device
|
||||
### Build / flash / monitor
|
||||
|
||||
Connect your Xteink X4 to your computer via USB-C and run the following command.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
pio run --target upload
|
||||
```
|
||||
|
||||
### Contributor pre-PR checks
|
||||
|
||||
```bash
|
||||
./bin/clang-format-fix
|
||||
pio check -e default
|
||||
pio run -e default
|
||||
```
|
||||
|
||||
### Debugging
|
||||
|
||||
After flashing the new features, it’s recommended to capture detailed logs from the serial port.
|
||||
@@ -126,7 +185,9 @@ First, make sure all required Python packages are installed:
|
||||
```python
|
||||
python3 -m pip install pyserial colorama matplotlib
|
||||
```
|
||||
after that run the script:
|
||||
|
||||
After that run the script:
|
||||
|
||||
```sh
|
||||
# For Linux
|
||||
# This was tested on Debian and should work on most Linux systems.
|
||||
@@ -135,63 +196,77 @@ python3 scripts/debugging_monitor.py
|
||||
# For macOS
|
||||
python3 scripts/debugging_monitor.py /dev/cu.usbmodem2101
|
||||
```
|
||||
|
||||
Minor adjustments may be required for Windows.
|
||||
|
||||
## Internals
|
||||
|
||||
CrossPoint Reader is pretty aggressive about caching data down to the SD card to minimise RAM usage. The ESP32-C3 only
|
||||
has ~380KB of usable RAM, so we have to be careful. A lot of the decisions made in the design of the firmware were based
|
||||
on this constraint.
|
||||
|
||||
### Data caching
|
||||
|
||||
The first time chapters of a book are loaded, they are cached to the SD card. Subsequent loads are served from the
|
||||
cache. This cache directory exists at `.crosspoint` on the SD card. The structure is as follows:
|
||||
|
||||
|
||||
```
|
||||
.crosspoint/
|
||||
├── epub_12471232/ # Each EPUB is cached to a subdirectory named `epub_<hash>`
|
||||
│ ├── progress.bin # Stores reading progress (chapter, page, etc.)
|
||||
│ ├── cover.bmp # Book cover image (once generated)
|
||||
│ ├── book.bin # Book metadata (title, author, spine, table of contents, etc.)
|
||||
│ └── sections/ # All chapter data is stored in the sections subdirectory
|
||||
│ ├── 0.bin # Chapter data (screen count, all text layout info, etc.)
|
||||
│ ├── 1.bin # files are named by their index in the spine
|
||||
│ └── ...
|
||||
│
|
||||
└── epub_189013891/
|
||||
```
|
||||
|
||||
Deleting the `.crosspoint` directory will clear the entire cache.
|
||||
|
||||
Due the way it's currently implemented, the cache is not automatically cleared when a book is deleted and moving a book
|
||||
file will use a new cache directory, resetting the reading progress.
|
||||
|
||||
For more details on the internal file structures, see the [file formats document](./docs/file-formats.md).
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are very welcome!
|
||||
|
||||
If you are new to the codebase, start with the [contributing docs](./docs/contributing/README.md).
|
||||
|
||||
If you're looking for a way to help out, take a look at the [ideas discussion board](https://github.com/crosspoint-reader/crosspoint-reader/discussions/categories/ideas).
|
||||
If there's something there you'd like to work on, leave a comment so that we can avoid duplicated effort.
|
||||
|
||||
Everyone here is a volunteer, so please be respectful and patient. For more details on our governance and community
|
||||
principles, please see [GOVERNANCE.md](GOVERNANCE.md).
|
||||
|
||||
### To submit a contribution:
|
||||
|
||||
1. Fork the repo
|
||||
2. Create a branch (`feature/dithering-improvement`)
|
||||
3. Make changes
|
||||
4. Submit a PR
|
||||
|
||||
---
|
||||
|
||||
CrossPoint Reader is **not affiliated with Xteink or any manufacturer of the X4 hardware**.
|
||||
## Internals
|
||||
|
||||
Huge shoutout to [**diy-esp32-epub-reader** by atomic14](https://github.com/atomic14/diy-esp32-epub-reader), which was a project I took a lot of inspiration from as I
|
||||
was making CrossPoint.
|
||||
CrossPoint Reader is pretty aggressive about caching data down to the SD card to minimise RAM usage. The ESP32-C3 only has ~380KB of usable RAM, so we have to be careful. A lot of the decisions made in the design of the firmware were based on this constraint.
|
||||
|
||||
### Data caching
|
||||
|
||||
The first time chapters of a book are loaded, they are cached to the SD card. Subsequent loads are served from the
|
||||
cache. This cache directory exists at `.crosspoint` on the SD card. The structure is as follows:
|
||||
|
||||
```text
|
||||
.crosspoint/
|
||||
├── epub_<hash>/ # one directory per book, named by content hash
|
||||
│ ├── progress.bin # reading position (chapter, page, etc.)
|
||||
│ ├── cover.bmp # generated cover image
|
||||
│ ├── book.bin # metadata: title, author, spine, TOC
|
||||
│ ├── css_rules.cache # parsed CSS rule cache
|
||||
│ ├── img_* # rendered image cache files
|
||||
│ └── sections/ # per-chapter layout cache
|
||||
│ ├── 0.bin
|
||||
│ ├── 1.bin
|
||||
│ └── ...
|
||||
├── settings.json # device settings
|
||||
├── state.json # resume/runtime state
|
||||
└── recent.json # recent books list
|
||||
```
|
||||
|
||||
Removing `/.crosspoint` clears all cached metadata and forces a full regeneration on next open. Book deletes, overwrites, and moves done through the firmware or web UI clear or re-key matching caches; manual SD-card edits may leave stale cache directories behind.
|
||||
|
||||
For more details on the internal file structures, see the [file formats document](./docs/file-formats.md).
|
||||
|
||||
---
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome. If you're new to the codebase, start with the [contributing docs](./docs/contributing/README.md). For things to work on, check the [ideas discussion board](https://github.com/crosspoint-reader/crosspoint-reader/discussions/categories/ideas) — leave a comment before starting so we don't duplicate effort.
|
||||
|
||||
Everyone here is a volunteer, so please be respectful and patient. For governance and community expectations, see [GOVERNANCE.md](./GOVERNANCE.md).
|
||||
|
||||
---
|
||||
|
||||
## Community forks
|
||||
|
||||
One of the best things about open source is that anyone can take the code in a different direction. If you need something outside CrossPoint's [scope](./SCOPE.md), check out the community forks:
|
||||
|
||||
- [CrossInk](https://github.com/uxjulia/CrossInk) — Typography and reading tracking: Bionic Reading (bolds word stems to create fixation points), guide dots between words, improved paragraph indents, and replaces the default fonts with ChareInk/Lexend/Bitter.
|
||||
|
||||
- [papyrix-reader](https://github.com/bigbag/papyrix-reader) — Adds FB2 and MD format support. Actively maintained with Arabic script support. Custom themes via SD card.
|
||||
|
||||
- [crosspet](https://github.com/trilwu/crosspet) — A Vietnamese fork that adds a Tamagotchi-style virtual chicken that grows based on your reading milestones (pages read, streaks, care). Also: Flashcards, Weather, Pomodoro timer, and mini-games.
|
||||
|
||||
- [crosspoint-reader-cjk](https://github.com/aBER0724/crosspoint-reader-cjk) — Purpose-built for Chinese, Japanese, and Korean reading.
|
||||
|
||||
- [inx](https://github.com/obijuankenobiii/inx) — Completely reimagines the user interface with tabbed navigation.
|
||||
|
||||
- ~~[PlusPoint](https://github.com/ngxson/pluspoint-reader) — custom JS apps support.~~ (Unmaintained)
|
||||
|
||||
- [crosspoint-reader-papers3](https://github.com/juicecultus/crosspoint-reader-papers3) — Crosspoint port for M5Stack Paper S3.
|
||||
|
||||
- [t5s3-reader](https://github.com/ShallowGreen123/t5s3-reader) — Crosspoint port for LilyGo T5 ePaper S3 / T5S3 4.7-inch e-paper device.
|
||||
|
||||
**Note:** Many of these features will make their way into CrossPoint over time. We maintain a slower pace to ensure rock-solid stability and squash bugs before they reach your device.
|
||||
|
||||
Want to build your own device? Be sure to check out the [de-link](https://github.com/iandchasse/de-link) project.
|
||||
|
||||
---
|
||||
|
||||
CrossPoint Reader is **not affiliated with Xteink or any device manufacturer**.
|
||||
|
||||
Huge shoutout to [diy-esp32-epub-reader](https://github.com/atomic14/diy-esp32-epub-reader), which inspired this project.
|
||||
|
||||
+248
-57
@@ -21,24 +21,30 @@ Welcome to the **CrossPoint** firmware. This guide outlines the hardware control
|
||||
- [3.6.3 Controls](#363-controls)
|
||||
- [3.6.4 System](#364-system)
|
||||
- [3.6.5 OPDS Servers (Multiple Libraries)](#365-opds-servers-multiple-libraries)
|
||||
- [3.6.6 Web Settings (WiFi + OPDS)](#366-web-settings-wifi--opds)
|
||||
- [3.6.6 Web Settings (Wi-Fi + OPDS)](#366-web-settings-wi-fi--opds)
|
||||
- [3.6.7 KOReader Sync Quick Setup](#367-koreader-sync-quick-setup)
|
||||
- [3.7 Sleep Screen](#37-sleep-screen)
|
||||
- [3.8 Custom Fonts (SD Card)](#38-custom-fonts-sd-card)
|
||||
- [4. Reading Mode](#4-reading-mode)
|
||||
- [Page Turning](#page-turning)
|
||||
- [Chapter Navigation](#chapter-navigation)
|
||||
- [System Navigation](#system-navigation)
|
||||
- [Supported Languages](#supported-languages)
|
||||
- [5. Chapter Selection Screen](#5-chapter-selection-screen)
|
||||
- [6. Current Limitations \& Roadmap](#6-current-limitations--roadmap)
|
||||
- [7. Troubleshooting Issues \& Escaping Bootloop](#7-troubleshooting-issues--escaping-bootloop)
|
||||
|
||||
- [Page Turning](#page-turning)
|
||||
- [Chapter Navigation](#chapter-navigation)
|
||||
- [Auto Page Turn](#auto-page-turn)
|
||||
- [Tilt Page Turn (X3 only)](#tilt-page-turn-x3-only)
|
||||
- [Footnote Navigation](#footnote-navigation)
|
||||
- [System Navigation](#system-navigation)
|
||||
- [Supported Languages](#supported-languages)
|
||||
- [5. Reader Menu](#5-reader-menu)
|
||||
- [5.1 Chapter Selection](#51-chapter-selection)
|
||||
- [5.2 Bookmarks](#52-bookmarks)
|
||||
- [6. Current Limitations & Roadmap](#6-current-limitations--roadmap)
|
||||
- [7. Troubleshooting Issues & Escaping Bootloop](#7-troubleshooting-issues--escaping-bootloop)
|
||||
|
||||
## 1. Hardware Overview
|
||||
|
||||
The device utilises the standard buttons on the Xteink X4 (in the same layout as the manufacturer firmware, by default):
|
||||
|
||||
### Button Layout
|
||||
|
||||
| Location | Buttons |
|
||||
| --------------- | ---------------------------------------------------- |
|
||||
| **Bottom Edge** | **Back**, **Confirm**, **Left**, **Right** |
|
||||
@@ -47,6 +53,7 @@ The device utilises the standard buttons on the Xteink X4 (in the same layout as
|
||||
Button layout can be customized in the **[Controls Settings](#363-controls)**.
|
||||
|
||||
### Taking a Screenshot
|
||||
|
||||
When the Power Button and Volume Down button are pressed at the same time, it will take a screenshot and save it in the folder `screenshots/`.
|
||||
|
||||
Alternatively, while reading a book, press the **Confirm** button to open the reader menu and select **Take screenshot**.
|
||||
@@ -83,11 +90,12 @@ See [Reading Mode](#4-reading-mode) below for more information.
|
||||
|
||||
### 3.3 Browse Files Screen
|
||||
|
||||
The Browse Files screen acts as a file and folder browser.
|
||||
The Browse Files screen acts as a file and folder browser. The full path to the current directory is shown at the top of the screen. File extensions are displayed alongside each filename, and directories are shown with brackets (e.g. `[folder-name]`). Hidden directories (those beginning with `.`) are also visible.
|
||||
|
||||
* **Navigate List:** Use **Left** (or **Volume Up**), or **Right** (or **Volume Down**) to move the selection cursor up and down through folders and books. You can also long-press these buttons to scroll a full page up or down.
|
||||
* **Open Selection:** Press **Confirm** to open a folder or read a selected book.
|
||||
* **Delete Files:** Hold and release **Confirm** to delete the selected file. You will be given an option to either confirm or cancel deletion. Folder deletion is not supported.
|
||||
* **Open Selection:** Press **Confirm** to open a folder or start reading a selected book. Selecting a `.bmp` file will open the image viewer.
|
||||
* **Delete Files or Folders:** Hold and release **Confirm** to delete the selected file or folder. You will be given an option to either confirm or cancel. Multiple files can be selected for deletion in a single operation.
|
||||
* **Rename or Move:** Files can be renamed or moved to a different folder from within the browse screen.
|
||||
|
||||
### 3.4 Recent Books Screen
|
||||
|
||||
@@ -95,23 +103,37 @@ The Recent Books screen lists the most recently opened books in a chronological
|
||||
|
||||
### 3.5 File Transfer Screen
|
||||
|
||||
The File Transfer screen allows you to upload new e-books to the device. When you enter the screen, you'll be prompted with a WiFi selection dialog and then your X4 will start hosting a web server.
|
||||
The File Transfer screen allows you to upload and manage files on the device. When you enter the screen, choose **Join a Network**, **Calibre Wireless**, or **Create Hotspot**. The reader then starts the web server for the selected mode.
|
||||
|
||||
See the [webserver docs](./docs/webserver.md) for more information on how to connect to the web server and upload files.
|
||||
See the [web server docs](./docs/webserver.md) for more information on how to connect to the web server and upload files.
|
||||
|
||||
The web interface also supports **WebDAV**, allowing you to mount the device as a network drive and manage files directly from your computer's file manager.
|
||||
|
||||
Download links for files already on the device are available in the web interface, so you can retrieve books or screenshots over Wi-Fi without connecting a cable.
|
||||
|
||||
A **Wi-Fi signal strength indicator** (dBm) is displayed on-screen during joined-network web server sessions.
|
||||
|
||||
> [!TIP]
|
||||
> Advanced users can also manage files programmatically or via the command line using `curl`. See the [webserver docs](./docs/webserver.md) for details.
|
||||
> Advanced users can also manage files programmatically or via the command line using `curl`. See the [web server docs](./docs/webserver.md) for details.
|
||||
> [!TIP]
|
||||
> If your EPUBs have compatibility issues, you can run the built-in **EPUB Optimizer** directly from the device to clean up and reprocess books for better rendering.
|
||||
|
||||
### 3.5.1 Calibre Wireless Transfers
|
||||
|
||||
CrossPoint supports sending books from Calibre using the CrossPoint Reader device plugin.
|
||||
|
||||
1. Install the plugin in Calibre:
|
||||
|
||||
- Head to https://github.com/crosspoint-reader/calibre-plugins/releases to download the latest version of the crosspoint_reader plugin.
|
||||
|
||||
- Download the zip file.
|
||||
|
||||
- Open Calibre → Preferences → Plugins → Load plugin from file → Select the zip file.
|
||||
2. On the device: File Transfer → Connect to Calibre → Join a network.
|
||||
3. Make sure your computer is on the same WiFi network.
|
||||
|
||||
2. On the device: File Transfer -> Calibre Wireless, then join a network.
|
||||
|
||||
3. Make sure your computer is on the same Wi-Fi network.
|
||||
|
||||
4. In Calibre, click "Send to device" to transfer books.
|
||||
|
||||
### 3.6 Settings
|
||||
@@ -121,96 +143,148 @@ The Settings screen allows you to configure the device's behavior. There are a f
|
||||
#### 3.6.1 Display
|
||||
|
||||
- **Sleep Screen**: Which sleep screen to display when the device sleeps:
|
||||
|
||||
- "Dark" (default) - The default dark Crosspoint logo sleep screen
|
||||
- "Light" - The same default sleep screen, on a white background
|
||||
- "Custom" - Custom images from the SD card; see [Sleep Screen](#37-sleep-screen) below for more information
|
||||
- "Cover" - The book cover image (Note: this is experimental and may not work as expected)
|
||||
- "None" - A blank screen
|
||||
- "Cover + Custom" - The book cover image, falls back to "Custom" behavior
|
||||
- "Cover + Custom" - The book cover image while actively reading, falls back to "Custom" behavior otherwise
|
||||
|
||||
- **Sleep Screen Cover Mode**: How to display the book cover when "Cover" sleep screen is selected:
|
||||
|
||||
- "Fit" (default) - Scale the image down to fit centered on the screen, padding with white borders as necessary
|
||||
- "Crop" - Scale the image down and crop as necessary to try to fill the screen (Note: this is experimental and may not work as expected)
|
||||
|
||||
- **Sleep Screen Cover Filter**: What filter will be applied to the book cover when "Cover" sleep screen is selected:
|
||||
|
||||
- "None" (default) - The cover image will be converted to a grayscale image and displayed as it is
|
||||
- "Contrast" - The image will be displayed as a black & white image without grayscale conversion
|
||||
- "Inverted" - The image will be inverted as in white & black and will be displayed without grayscale conversion
|
||||
|
||||
- **Status Bar**: Configure the status bar displayed while reading:
|
||||
|
||||
- "None" - No status bar
|
||||
- "No Progress" - Show status bar without reading progress
|
||||
- "Full w/ Percentage" - Show status bar with book progress (as percentage)
|
||||
- "Full w/ Book Bar" - Show status bar with book progress (as bar)
|
||||
- "Book Bar Only" - Show book progress (as bar)
|
||||
- "Full w/ Chapter Bar" - Show status bar with chapter progress (as bar)
|
||||
|
||||
- **Hide Battery %**: Configure where to suppress the battery percentage display in the status bar; the battery icon will still be shown:
|
||||
|
||||
- "Never" (default) - Always show battery percentage
|
||||
- "In Reader" - Show battery percentage everywhere except in reading mode
|
||||
- "Always" - Always hide battery percentage
|
||||
|
||||
- **Refresh Frequency**: Set how often the screen does a full refresh while reading to reduce ghosting; options are every 1, 5, 10, 15, or 30 pages.
|
||||
|
||||
- **UI Theme**: Set which UI theme to use:
|
||||
|
||||
- "Classic" - The original Crosspoint theme
|
||||
- "Lyra" - The new theme for Crosspoint featuring rounded elements and menu icons
|
||||
- "Lyra Extended" - Lyra, but displays 3 books instead of 1 on the **[Home Screen](#31-home-screen)**
|
||||
- "RoundedRaff" - A rounded theme with additional visual styling
|
||||
|
||||
- **Sunlight Fading Fix**: Configure whether to enable a software-fix for the issue where white X4 models may fade when used in direct sunlight:
|
||||
|
||||
- "OFF" (default) - Disable the fix
|
||||
- "ON" - Enable the fix
|
||||
|
||||
> [!NOTE]
|
||||
> A battery charging indicator is shown on the battery icon whenever the device is actively charging.
|
||||
|
||||
#### 3.6.2 Reader
|
||||
|
||||
- **Reader Font Family**: Choose the font used for reading:
|
||||
|
||||
- "Noto Serif" (default) - Google's serif font
|
||||
- "Noto Sans" - Google's sans-serif font
|
||||
- "Open Dyslexic" - Font designed for readers with dyslexia
|
||||
|
||||
- **Reader Font Size**: Adjust the text size for reading; options are "Small", "Medium" (default), "Large", or "X Large".
|
||||
|
||||
- **Reader Line Spacing**: Adjust the spacing between lines; options are "Tight", "Normal" (default), or "Wide".
|
||||
|
||||
- **Reader Screen Margin**: Controls the screen margins in Reading Mode between 5 and 40 pixels in 5-pixel increments.
|
||||
|
||||
- **Reader Paragraph Alignment**: Set the alignment of paragraphs; options are "Justified" (default), "Left", "Center", or "Right".
|
||||
|
||||
- **Embedded Style**: Whether to use the EPUB file's embedded HTML and CSS stylisation and formatting; options are "ON" or "OFF".
|
||||
|
||||
- **Hyphenation**: Whether to hyphenate text in Reading Mode; options are "ON" or "OFF".
|
||||
|
||||
- **Reading Orientation**: Set the screen orientation for reading EPUB files:
|
||||
|
||||
- "Portrait" (default) - Standard portrait orientation
|
||||
- "Landscape CW" - Landscape, rotated clockwise
|
||||
- "Inverted" - Portrait, upside down
|
||||
- "Landscape CCW" - Landscape, rotated counter-clockwise
|
||||
|
||||
- **Extra Paragraph Spacing**: Set how to handle paragraph breaks:
|
||||
|
||||
- "ON" - Vertical space will be added between paragraphs in Reading Mode
|
||||
- "OFF" - Paragraphs will not have vertical space added, but will have first-line indentation
|
||||
|
||||
- **Text Anti-Aliasing**: Whether to show smooth grey edges (anti-aliasing) on text in reading mode. Note this slows down page turns slightly.
|
||||
|
||||
- **Images**: Whether to display embedded images (JPG/PNG) found in EPUB files; options are "ON" (default) or "OFF".
|
||||
|
||||
- **Focus Reading**: Bolds the first part of each word to create visual fixation points, similar to Bionic Reading. This can help improve reading speed and focus; options are "ON" or "OFF" (default).
|
||||
|
||||
#### 3.6.3 Controls
|
||||
|
||||
- **Remap Front Buttons**: A menu for customising the function of each bottom edge button.
|
||||
- **Side Button Layout (reader)**: Swap the order of the up and down volume buttons from "Prev/Next" (default) to "Next/Prev". This change is only in effect when reading.
|
||||
|
||||
- **Side Button Layout (reader)**: Swap the order of the up and down volume buttons from "Prev/Next" (default) to "Next/Prev". You can also disable them entirely. This change is only in effect when reading.
|
||||
|
||||
- **Long-press Chapter Skip**: Set whether long-pressing page turn buttons skips to the next/previous chapter:
|
||||
|
||||
- "Chapter Skip" (default) - Long-pressing skips to next/previous chapter
|
||||
- "Page Scroll" - Long-pressing scrolls a page up/down
|
||||
|
||||
- **Short Power Button Click**: Controls the effect of a short click of the power button:
|
||||
|
||||
- "Ignore" (default) - Require a long press to turn off the device
|
||||
- "Sleep" - A short press puts the device into sleep mode
|
||||
- "Page Turn" - A short press in reading mode turns to the next page; a long press turns the device off
|
||||
- "Footnotes" - A short press in reading mode opens the footnotes submenu; if only one footnote is present on the page, the referenced page is opened directly. The short press on the power button can be used to select the footnote in the submenu, and to go back to the original page after finish reading the footnote (like the back button).
|
||||
- "Refresh" - A short press triggers a manual full-screen refresh, useful for clearing ghosting
|
||||
- **Quick-return from footnotes**: Toggles on and off the quick return functionality from the footnotes. When the functionality it's active, a short press of the power button will act as the back button from the footnotes page.
|
||||
|
||||
#### 3.6.4 System
|
||||
|
||||
- **Time to Sleep**: Set the duration of inactivity before the device automatically goes to sleep; options are 1, 5, 10 (default), 15 or 30 minutes.
|
||||
- **Time to Sleep**: Set the duration of inactivity before the device automatically goes to sleep; options are 1, 3, 5, 10 (default), 15 or 30 minutes.
|
||||
|
||||
- **Wi-Fi Networks**: Connect to Wi-Fi networks for file transfers and firmware updates.
|
||||
|
||||
- **WiFi Networks**: Connect to WiFi networks for file transfers and firmware updates.
|
||||
- **KOReader Sync**: Options for setting up KOReader for syncing book progress.
|
||||
|
||||
- **OPDS Servers**: Manage one or more OPDS [(Open Publication Distribution System)](https://en.wikipedia.org/wiki/Open_Publication_Distribution_System) libraries for browsing and downloading books. See [OPDS Servers (Multiple Libraries)](#365-opds-servers-multiple-libraries) below.
|
||||
|
||||
- **Clear Reading Cache**: Clear the internal SD card cache.
|
||||
- **Check for updates**: Check for Crosspoint firmware updates over WiFi.
|
||||
- **Language**: Set the system language (see **[Supported Languages](#supported-languages)** for more information).
|
||||
|
||||
- **Check for updates**: Check for Crosspoint firmware updates over Wi-Fi. Firmware can also be updated without a USB connection by placing a `firmware.bin` file on the SD card.
|
||||
|
||||
- **Language**: Set the UI language. CrossPoint supports 24 languages: English, Spanish, French, German, Czech, Brazilian Portuguese, Russian, Swedish, Romanian, Catalan, Ukrainian, Belarusian, Italian, Polish, Finnish, Danish, Dutch, Turkish, Kazakh, Hungarian, Lithuanian, Slovenian, Valencian, and Hebrew.
|
||||
|
||||
- **Manage Fonts**: Browse, download, and manage custom font families installed from the SD card. See [Custom Fonts (SD Card)](#38-custom-fonts-sd-card) for more information.
|
||||
|
||||
#### 3.6.5 OPDS Servers (Multiple Libraries)
|
||||
|
||||
CrossPoint supports saving multiple OPDS servers and switching between them when browsing catalogs.
|
||||
|
||||
1. Open **Settings -> System -> OPDS Servers**.
|
||||
|
||||
2. Select **Add Server** to create a new entry, or select an existing server to edit it.
|
||||
|
||||
3. Configure these fields:
|
||||
- **Server Name**: Optional display name (for example, "Home Calibre" or "Public Catalog").
|
||||
- **OPDS Server URL**: Full catalog root URL (for Calibre Content Server, usually ends with `/opds`).
|
||||
- **Username / Password**: Optional credentials for authenticated servers.
|
||||
|
||||
- **Server Name**: Optional display name (for example, "Home Calibre" or "Public Catalog").
|
||||
|
||||
- **OPDS Server URL**: Full catalog root URL (for Calibre Content Server, usually ends with `/opds`).
|
||||
|
||||
- **Username / Password**: Optional credentials for authenticated servers.
|
||||
|
||||
4. Use **Delete Server** inside a server entry to remove it.
|
||||
|
||||
Behavior notes:
|
||||
@@ -224,22 +298,22 @@ You can also manage OPDS servers from the web interface while in File Transfer m
|
||||
2. Open `http://<device-ip>/settings`.
|
||||
3. Use the **OPDS Servers** card to add, edit, or delete entries.
|
||||
|
||||
For web-based WiFi network management, see [Web Settings (WiFi + OPDS)](#366-web-settings-wifi--opds).
|
||||
For web-based Wi-Fi network management, see [Web Settings (Wi-Fi + OPDS)](#366-web-settings-wi-fi--opds).
|
||||
|
||||
#### 3.6.6 Web Settings (WiFi + OPDS)
|
||||
#### 3.6.6 Web Settings (Wi-Fi + OPDS)
|
||||
|
||||
While in **File Transfer** mode, the web settings page includes management cards for both **WiFi Networks** and **OPDS Servers**.
|
||||
While in **File Transfer** mode, the web settings page includes management cards for both **Wi-Fi Networks** and **OPDS Servers**.
|
||||
|
||||
1. On device: open **File Transfer** and connect to WiFi.
|
||||
1. In a browser, open `http://<device-ip>/settings` or `http://crosspoint.local`.
|
||||
1. In **WiFi Networks**, add, edit, or delete saved network entries (SSID + optional password).
|
||||
1. In **OPDS Servers**, add, edit, or delete OPDS catalogs.
|
||||
1. On device: open **File Transfer** and connect through **Join a Network** or **Create Hotspot**.
|
||||
2. In a browser, open `http://<device-ip>/settings` or `http://crosspoint.local`.
|
||||
3. In **Wi-Fi Networks**, add, edit, or delete saved network entries (SSID + optional password).
|
||||
4. In **OPDS Servers**, add, edit, or delete OPDS catalogs.
|
||||
|
||||
Behavior notes:
|
||||
|
||||
- Passwords are never shown back in the web UI after saving.
|
||||
- Leaving Password blank while editing keeps the existing saved password unchanged.
|
||||
- The web UI can save hidden-network SSIDs, but connecting to hidden networks still depends on device-side WiFi connection flow.
|
||||
- The web UI can save hidden-network SSIDs, but connecting to hidden networks still depends on the device-side Wi-Fi connection flow.
|
||||
|
||||
#### 3.6.7 KOReader Sync Quick Setup
|
||||
|
||||
@@ -266,13 +340,19 @@ Already have KOReader Sync credentials? Skip registration; basic sync only requi
|
||||
When this returns `HTTP 402` with `{"code":2002,"message":"Username is already registered."}`, pick a different username or use that existing account.
|
||||
|
||||
2. On each CrossPoint device:
|
||||
|
||||
- Go to **Settings -> System -> KOReader Sync**.
|
||||
|
||||
- Set **Username** and **Password** (enter the plain password; CrossPoint computes MD5 internally, and use the same values on all devices).
|
||||
|
||||
- Set **Sync Server URL** to `https://sync.koreader.rocks`, or leave it empty (both use the same default KOReader sync server).
|
||||
|
||||
- Run **Authenticate**.
|
||||
|
||||
3. While reading, press **Confirm** to open the reader menu, then select **Sync Progress**.
|
||||
|
||||
- Choose **Apply Remote** to jump to remote progress.
|
||||
|
||||
- Choose **Upload Local** to push current progress.
|
||||
|
||||
##### Option B: Self-Hosted Server (Docker Compose)
|
||||
@@ -315,7 +395,7 @@ curl -H "Accept: application/vnd.koreader.v1+json" "http://<server-ip>:17200/hea
|
||||
```
|
||||
|
||||
3. Register a user once.
|
||||
CrossPoint authenticates against KOReader Sync (`koreader/kosync`) using an MD5 key, so register using the MD5 of your password:
|
||||
CrossPoint authenticates against KOReader Sync (`koreader/kosync`) using an MD5 key, so register using the MD5 of your password:
|
||||
|
||||
> [!WARNING]
|
||||
> Sending a reusable MD5-derived password over plain HTTP is insecure.
|
||||
@@ -337,29 +417,35 @@ curl -i "http://<server-ip>:17200/users/create" \
|
||||
If this returns `HTTP 402` with `{"code":2002,"message":"Username is already registered."}`, the account already exists.
|
||||
|
||||
4. On each CrossPoint device:
|
||||
|
||||
- Go to **Settings -> System -> KOReader Sync**.
|
||||
|
||||
- Set **Username** and **Password** (enter the plain password; CrossPoint computes MD5 internally, and use the same values on all devices).
|
||||
|
||||
- Set **Sync Server URL** to `http://<server-ip>:17200`.
|
||||
|
||||
- Run **Authenticate**.
|
||||
|
||||
If you use the HTTPS listener, use `https://<server-ip>:7200` (`curl -k` only for self-signed certificate testing).
|
||||
|
||||
5. While reading, press **Confirm** to open the reader menu, then select **Sync Progress**.
|
||||
|
||||
- Choose **Apply Remote** to jump to remote progress.
|
||||
|
||||
- Choose **Upload Local** to push current progress.
|
||||
|
||||
### 3.7 Sleep Screen
|
||||
|
||||
The **Sleep Screen** setting controls what is displayed when the device goes to sleep:
|
||||
|
||||
| Mode | Behavior |
|
||||
|------|----------|
|
||||
| **Dark** (default) | The CrossPoint logo on a dark background. |
|
||||
| **Light** | The CrossPoint logo on a white background. |
|
||||
| **Custom** | A custom image from the SD card (see below). Falls back to **Dark** if no custom image is found. |
|
||||
| **Cover** | The cover of the currently open book. Falls back to **Dark** if no book is open. |
|
||||
| **Cover + Custom** | The cover of the currently open book. Falls back to **Custom** behavior if no book is open. |
|
||||
| **None** | A blank screen. |
|
||||
| Mode | Behavior |
|
||||
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **Dark** (default) | The CrossPoint logo on a dark background. |
|
||||
| **Light** | The CrossPoint logo on a white background. |
|
||||
| **Custom** | A custom image from the SD card (see below). Falls back to **Dark** if no custom image is found. |
|
||||
| **Cover** | The cover of the currently open book. Falls back to **Dark** if no book is open. |
|
||||
| **Cover + Custom** | The cover of the currently open book, shown only while actively reading. Falls back to **Custom** behavior when not reading. |
|
||||
| **None** | A blank screen. |
|
||||
|
||||
#### Cover settings
|
||||
|
||||
@@ -377,10 +463,30 @@ To use custom sleep images, set the sleep screen mode to **Custom** or **Cover +
|
||||
|
||||
> [!TIP]
|
||||
> For best results:
|
||||
>
|
||||
> - Use uncompressed BMP files with 24-bit color depth
|
||||
> - X4: Use a resolution of 480x800 pixels to match the device's screen resolution.
|
||||
> - X3: Use a resolution of 528x792 pixels to match the device's screen resolution.
|
||||
|
||||
> [!TIP]
|
||||
> You can set an image as the sleep screen cover directly from the BMP image viewer in the **[Browse Files](#33-browse-files-screen)** screen.
|
||||
|
||||
---
|
||||
|
||||
### 3.8 Custom Fonts (SD Card)
|
||||
|
||||
CrossPoint supports loading additional fonts from the SD card, extending beyond the two built-in families (Noto Serif, Noto Sans). Custom fonts can include extended Unicode coverage, enabling CJK (Chinese, Japanese, Korean) and other scripts.
|
||||
|
||||
There are three ways to install fonts:
|
||||
|
||||
1. **Download from device (recommended):** Go to **Settings -> System -> Manage Fonts**, browse the available font families, and select one to download over Wi-Fi.
|
||||
2. **Upload via web interface:** While in **File Transfer** mode, open the web UI in a browser and navigate to the **Fonts** tab to upload `.cpfont` files.
|
||||
3. **Manual SD card copy:** Download font files from the [crosspoint-fonts repository](https://github.com/crosspoint-reader/crosspoint-fonts) and copy them to `/.fonts/` (preferred) or `/fonts/` on your SD card.
|
||||
|
||||
Once installed, custom fonts appear in **Settings → Reader → Font Family** alongside the built-in fonts.
|
||||
|
||||
See [docs/sd-card-fonts.md](./docs/sd-card-fonts.md) for full installation details and SD card folder structure.
|
||||
|
||||
---
|
||||
|
||||
## 4. Reading Mode
|
||||
@@ -388,6 +494,7 @@ To use custom sleep images, set the sleep screen mode to **Custom** or **Cover +
|
||||
Once you have opened a book, the button layout changes to facilitate reading.
|
||||
|
||||
### Page Turning
|
||||
|
||||
| Action | Buttons |
|
||||
| ----------------- | ------------------------------------ |
|
||||
| **Previous Page** | Press **Left** _or_ **Volume Up** |
|
||||
@@ -398,55 +505,139 @@ The role of the volume (side) buttons can be swapped in the **[Controls Settings
|
||||
If the **Short Power Button Click** setting is set to "Page Turn", you can also turn to the next page by briefly pressing the Power button.
|
||||
|
||||
### Chapter Navigation
|
||||
|
||||
* **Next Chapter:** Press and **hold** the **Right** (or **Volume Down**) button briefly, then release.
|
||||
* **Previous Chapter:** Press and **hold** the **Left** (or **Volume Up**) button briefly, then release.
|
||||
|
||||
This feature can be disabled in the **[Controls Settings](#363-controls)** to help avoid changing chapters by mistake.
|
||||
|
||||
### Auto Page Turn
|
||||
|
||||
Auto Page Turn automatically advances pages at a set interval, useful for hands-free reading. This feature can be enabled and configured from the **[Reader Menu](#5-reader-menu)** while reading an EPUB.
|
||||
|
||||
### Tilt Page Turn (X3 only)
|
||||
|
||||
On the **Xteink X3**, the gyroscope can be used to turn pages by tilting the device. This feature is available in the Controls settings.
|
||||
|
||||
### Footnote Navigation
|
||||
|
||||
When reading an EPUB that contains footnotes, you can navigate to the footnote text by selecting the footnote reference in the book. From the footnote, you can return to your original reading position.
|
||||
|
||||
### System Navigation
|
||||
|
||||
* **Return to Home:** Press the **Back** button to close the book and return to the **[Home](#31-home-screen)** screen.
|
||||
* **Return to Browse Files:** Press and hold the **Back** button to close the book and return to the **[Browse Files](#33-browse-files-screen)** screen.
|
||||
* **Chapter Menu:** Press **Confirm** to open the **[Table of Contents/Chapter Selection](#5-chapter-selection-screen)** screen.
|
||||
* **Reader Menu:** Press **Confirm** to open the **[Reader Menu](#5-reader-menu)**, which includes chapter navigation, reading options, and more.
|
||||
|
||||
### Supported Languages
|
||||
|
||||
CrossPoint renders text using the following Unicode character blocks, enabling support for a wide range of languages:
|
||||
|
||||
* **Latin Script (Basic, Supplement, Extended-A):** Covers English, German, French, Spanish, Portuguese, Italian, Dutch, Swedish, Norwegian, Danish, Finnish, Polish, Czech, Hungarian, Romanian, Slovak, Slovenian, Turkish, and others.
|
||||
* **Cyrillic Script (Standard and Extended):** Covers Russian, Ukrainian, Belarusian, Bulgarian, Serbian, Macedonian, Kazakh, Kyrgyz, Mongolian, and others.
|
||||
* **Latin Script (Basic, Supplement, Extended-A/B):** Covers English, German, French, Spanish, Portuguese, Italian, Dutch, Swedish, Norwegian, Danish, Finnish, Polish, Czech, Hungarian, Romanian, Slovak, Slovenian, Turkish, Catalan, and others.
|
||||
* **Cyrillic Script (Standard and Extended):** Covers Russian, Ukrainian, Belarusian, Bulgarian, Serbian, Macedonian, Kazakh, Kyrgyz, Mongolian, and others.
|
||||
* **Vietnamese:** Supported via extended Latin glyph coverage in the built-in reader fonts.
|
||||
|
||||
What is not supported: Chinese, Japanese, Korean, Vietnamese, Hebrew, Arabic, Greek and Farsi.
|
||||
What is not supported with built-in reader fonts: Chinese, Japanese, Korean, Arabic, Greek, Hebrew, and Farsi. However, **CJK, Hebrew, Greek, and other extended scripts can be enabled by installing custom SD card fonts** — see [Custom Fonts (SD Card)](#38-custom-fonts-sd-card).
|
||||
|
||||
---
|
||||
|
||||
## 5. Chapter Selection Screen
|
||||
## 5. Reader Menu
|
||||
|
||||
Accessible by pressing **Confirm** while inside a book.
|
||||
Press **Confirm** while reading to open the Reader Menu. From here you can access reading utilities and navigation options without leaving the book.
|
||||
|
||||
1. Use **Left** (or **Volume Up**), or **Right** (or **Volume Down**) to highlight the desired chapter.
|
||||
2. Press **Confirm** to jump to that chapter.
|
||||
3. *Alternatively, press **Back** to cancel and return to your current page.*
|
||||
Available options include:
|
||||
|
||||
- **Select Chapter** – Open the table of contents to jump to a specific chapter (see [Chapter Selection](#51-chapter-selection) below).
|
||||
- **Footnotes** – Navigate to the footnotes for the current section *(only shown in books that contain footnotes)*.
|
||||
- **Reading Orientation** – Cycle through screen orientations without leaving the reader.
|
||||
- **Auto Turn (Pages Per Minute)** – Cycle through automatic page turn speed options for hands-free reading.
|
||||
- **Go to %** – Jump to a specific position in the book by percentage.
|
||||
- **Take screenshot** – Save a screenshot of the current page to the `screenshots/` folder.
|
||||
- **Show page as QR** – Display a QR code encoding the current reading position.
|
||||
- **Go Home** – Close the book and return to the Home screen.
|
||||
- **Sync Progress** – Push or pull reading progress with a KOReader sync server (see [KOReader Sync Quick Setup](#367-koreader-sync-quick-setup)).
|
||||
- **Delete Book Cache** – Clear the cached layout data for the current book, forcing a re-index on next open.
|
||||
|
||||
Press **Back** at any time to close the menu and return to your current page.
|
||||
|
||||
### 5.1 Chapter Selection
|
||||
|
||||
Accessible by selecting **Chapters** from the Reader Menu.
|
||||
|
||||
1. Use **Left** (or **Volume Up**), or **Right** (or **Volume Down**) to highlight the desired chapter.
|
||||
2. Press **Confirm** to jump to that chapter.
|
||||
3. *Alternatively, press **Back** to cancel and return to your current page.*
|
||||
|
||||
---
|
||||
|
||||
### 5.2 Bookmarks
|
||||
|
||||
Bookmarks can be created to quickly save and restore your place in a book.
|
||||
|
||||
To create a bookmark, hold **Confirm** for 1 second while inside a book. A popup will appear letting you know a bookmark was created. The popup message will automatically disappear in a couple of seconds.
|
||||
|
||||
To open bookmarks, press **Confirm** while inside a book. Then navigate to the **Bookmarks** menu. Bookmarks can be opened by navigating to them and pressing **Confirm**, which will redirect you to that place in the book. You can delete bookmarks by holding **Confirm** for 1 second, and then pressing **Confirm** again to confirm deletion, or **Back** to cancel.
|
||||
|
||||
Bookmarks are stored in the `.crosspoint/bookmarks` folder in the JSON format.
|
||||
|
||||
## 6. Current Limitations & Roadmap
|
||||
|
||||
Please note that this firmware is currently in active development. The following features are **not yet supported** but are planned for future updates:
|
||||
|
||||
* **Images:** Embedded images in e-books will not render.
|
||||
* **Cover Images:** Large cover images embedded into EPUB require several seconds (~10s for ~2000 pixel tall image) to convert for sleep screen and home screen thumbnail. Consider optimizing the EPUB with e.g. https://github.com/bigbag/epub-to-xtc-converter to speed this up.
|
||||
* **Unsupported Image Formats:** Most JPG and PNG images in EPUBs render correctly. GIFs and progressive JPEGs are not supported and will fall back to an `[Image]` placeholder.
|
||||
*
|
||||
* **Dictionary Lookup:** Inline word lookup is not yet implemented.
|
||||
|
||||
---
|
||||
|
||||
## 7. Troubleshooting Issues & Escaping Bootloop
|
||||
|
||||
If an issue or crash is encountered while using Crosspoint, feel free to raise an issue ticket and attach the serial monitor logs. The logs can be obtained by connecting the device to a computer and starting a serial monitor. Either [Serial Monitor](https://www.serialmonitor.org/) or the following command can be used:
|
||||
If an issue or crash is encountered while using Crosspoint, feel free to raise an issue ticket and attach the logs.
|
||||
|
||||
**Crash reports on SD card:** After a crash, CrossPoint automatically saves a crash report to the SD card (no USB connection needed). Check the root of the SD card for a crash log file and include it with any bug report.
|
||||
|
||||
**Serial monitor logs:** For more detailed debugging, connect the device to a computer and run the custom debugging monitor script (requires Python 3 with `pyserial`, `colorama`, and `matplotlib`; install via `pip3 install pyserial colorama matplotlib`):
|
||||
|
||||
```
|
||||
pio device monitor
|
||||
python3 scripts/debugging_monitor.py
|
||||
```
|
||||
|
||||
The script auto-detects the serial port. You can also specify one explicitly:
|
||||
|
||||
```
|
||||
python3 scripts/debugging_monitor.py /dev/ttyACM0 # Linux
|
||||
python3 scripts/debugging_monitor.py /dev/tty.usbmodem1 # macOS
|
||||
python3 scripts/debugging_monitor.py COM7 # Windows
|
||||
```
|
||||
|
||||
**Features:**
|
||||
|
||||
- Color-coded log output by category (errors, memory, display, EPUB parsing, etc.)
|
||||
- Live memory usage graph (free RAM, total RAM, max contiguous allocation) updated every second
|
||||
- Interactive command prompt — type a command and press Enter to send it to the device
|
||||
- Screenshot capture — saves the current display to `screenshot.bmp` when triggered by the device
|
||||
|
||||
**Options:**
|
||||
|
||||
| Option | Description |
|
||||
| -------------------- | --------------------------------------------------------- |
|
||||
| `--baud RATE` | Baud rate (default: 115200) |
|
||||
| `--filter KEYWORD` | Show only lines containing the keyword (case-insensitive) |
|
||||
| `--suppress KEYWORD` | Hide lines containing the keyword (case-insensitive) |
|
||||
|
||||
**Examples:**
|
||||
|
||||
```
|
||||
# Show only memory-related log lines
|
||||
python3 scripts/debugging_monitor.py --filter MEM
|
||||
|
||||
# Hide noisy SD card log lines
|
||||
python3 scripts/debugging_monitor.py --suppress "[SD]"
|
||||
```
|
||||
|
||||
Press **Ctrl-C** or close the graph window to exit.
|
||||
|
||||
If the device is stuck in a bootloop, press and release the Reset button. Then, press and hold on to the configured Back button and the Power Button to boot to the Home Screen.
|
||||
|
||||
There can be issues with broken cache or config. In this case, delete the `.crosspoint` directory on your SD card (or consider deleting only `settings.bin`, `state.bin`, or `epub_*` cache directories in the `.crosspoint/` folder).
|
||||
There can be issues with broken cache or config. In this case, delete the `.crosspoint` directory on your SD card (or consider deleting only `settings.json`, `state.json`, or `epub_*` cache directories in the `.crosspoint/` folder).
|
||||
|
||||
@@ -8,17 +8,18 @@ At a high level, it is firmware that uses an activity-driven application archite
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Hardware: ESP32-C3 + SD + E-ink + Buttons] --> B[open-x4-sdk HAL]
|
||||
B --> C[src/main.cpp runtime loop]
|
||||
C --> D[Activities layer]
|
||||
C --> E[State and settings]
|
||||
D --> F[Reader flows]
|
||||
D --> G[Home/Library/Settings flows]
|
||||
D --> H[Network/Web server flows]
|
||||
F --> I[lib/Epub parsing + layout + hyphenation]
|
||||
I --> J[SD cache in .crosspoint]
|
||||
D --> K[GfxRenderer]
|
||||
K --> L[E-ink display buffer]
|
||||
A[Hardware: ESP32-C3 + SD + E-ink + Buttons] --> B[open-x4-sdk]
|
||||
B --> C[lib/hal wrappers]
|
||||
C --> D[src/main.cpp runtime loop]
|
||||
D --> E[Activities layer]
|
||||
D --> F[State and settings]
|
||||
E --> G[Reader flows]
|
||||
E --> H[Home/Library/Settings flows]
|
||||
E --> I[Network/Web server flows]
|
||||
G --> J[lib/Epub parsing + layout + hyphenation]
|
||||
J --> K[SD cache in .crosspoint]
|
||||
E --> L[GfxRenderer]
|
||||
L --> M[E-ink display buffer]
|
||||
```
|
||||
|
||||
## Runtime lifecycle
|
||||
@@ -58,7 +59,7 @@ Top-level activity groups:
|
||||
- `src/activities/home/`: home and library navigation
|
||||
- `src/activities/reader/`: EPUB/XTC/TXT reading flows
|
||||
- `src/activities/settings/`: settings menus and configuration
|
||||
- `src/activities/network/`: WiFi selection, AP/STA mode, file transfer server
|
||||
- `src/activities/network/`: Wi-Fi selection, AP/STA mode, file transfer server
|
||||
- `src/activities/boot_sleep/`: boot and sleep transitions
|
||||
|
||||
## Reader and content pipeline
|
||||
@@ -73,10 +74,11 @@ flowchart LR
|
||||
C -->|EPUB| D[lib/Epub/Epub]
|
||||
C -->|XTC| E[lib/Xtc reader]
|
||||
C -->|TXT| F[lib/Txt reader]
|
||||
D --> G[Parse OPF/TOC/CSS]
|
||||
G --> H[Layout pages/sections]
|
||||
H --> I[Write section and metadata caches]
|
||||
I --> J[Render current page via GfxRenderer]
|
||||
D --> G[Parse OPF/TOC and collect CSS refs]
|
||||
G --> H[Build/load book.bin and css_rules.cache]
|
||||
H --> I[Layout pages/sections]
|
||||
I --> J[Write section cache]
|
||||
J --> K[Render current page via GfxRenderer]
|
||||
```
|
||||
|
||||
Why caching matters:
|
||||
@@ -98,7 +100,7 @@ flowchart TD
|
||||
D --> E[Locate container and OPF]
|
||||
E --> F[Build or load BookMetadataCache]
|
||||
F --> G[Load TOC and spine]
|
||||
G --> H[Load or parse CSS rules]
|
||||
G --> H[Load CSS cache or parse manifest/base-dir CSS]
|
||||
|
||||
H --> I[EpubReaderActivity]
|
||||
I --> J{Section cache exists for current settings?}
|
||||
@@ -121,7 +123,12 @@ flowchart TD
|
||||
|
||||
Notes:
|
||||
|
||||
- "section cache exists" depends on cache-busting parameters such as font and layout-related settings
|
||||
- CSS files are collected from the OPF manifest and, when needed, discovered by
|
||||
streaming ZIP paths under the OPF content base directory; the firmware avoids
|
||||
preloading the full ZIP central directory for large books.
|
||||
- "section cache exists" depends on cache-busting parameters such as font,
|
||||
viewport size, paragraph alignment, hyphenation, embedded CSS, image rendering,
|
||||
and Focus Reading settings
|
||||
- rendering favors reusing precomputed layout data to keep page turns responsive on constrained hardware
|
||||
- progress/session state is persisted so the reader can reopen at the last position after reboot/sleep
|
||||
|
||||
@@ -138,14 +145,18 @@ Typical persisted areas on SD:
|
||||
/.crosspoint/
|
||||
epub_<hash>/
|
||||
book.bin
|
||||
css_rules.cache
|
||||
progress.bin
|
||||
cover.bmp
|
||||
sections/*.bin
|
||||
settings.bin
|
||||
state.bin
|
||||
img_* cache files
|
||||
settings.json
|
||||
state.json
|
||||
```
|
||||
|
||||
For binary cache formats, see `docs/file-formats.md`.
|
||||
`sections/*.bin` contains rendered pages plus anchor, paragraph, and list-item
|
||||
lookup tables used for TOC/footnote jumps and KOReader sync refinement. For
|
||||
binary cache formats, see `docs/file-formats.md`.
|
||||
|
||||
## Networking architecture
|
||||
|
||||
@@ -153,14 +164,18 @@ Network file transfer is controlled by `src/activities/network/CrossPointWebServ
|
||||
|
||||
Modes:
|
||||
|
||||
- STA: join existing WiFi network
|
||||
- STA: join existing Wi-Fi network
|
||||
- AP: create hotspot
|
||||
- Calibre Wireless: STA flow specialized for Calibre plugin uploads
|
||||
|
||||
Server behavior:
|
||||
|
||||
- HTTP server on port 80
|
||||
- WebSocket upload server on port 81
|
||||
- WebDAV handler on the HTTP server
|
||||
- UDP discovery listener for upload clients
|
||||
- file operations backed by SD storage
|
||||
- browser APIs for file management, settings, fonts, OPDS servers, and saved Wi-Fi networks
|
||||
- activity requests faster loop responsiveness while server is running
|
||||
|
||||
Endpoint reference: `docs/webserver-endpoints.md`.
|
||||
@@ -170,6 +185,7 @@ Endpoint reference: `docs/webserver-endpoints.md`.
|
||||
Some sources are generated and should not be edited manually.
|
||||
|
||||
- `scripts/build_html.py` generates `src/network/html/*.generated.h` from HTML files
|
||||
- `scripts/gen_i18n.py` generates `lib/I18n/I18nKeys.h`, `I18nStrings.h`, and `I18nStrings.cpp`
|
||||
- `scripts/generate_hyphenation_trie.py` generates hyphenation headers under `lib/Epub/Epub/hyphenation/generated/`
|
||||
|
||||
When editing related source assets, regenerate via normal build steps/scripts.
|
||||
@@ -179,6 +195,7 @@ When editing related source assets, regenerate via normal build steps/scripts.
|
||||
- `src/`: app orchestration, settings/state, and activity implementations
|
||||
- `src/network/`: web server and OTA/update networking
|
||||
- `src/components/`: theming and shared UI components
|
||||
- `lib/hal/`: hardware abstraction wrappers around open-x4-sdk
|
||||
- `lib/Epub/`: EPUB parser, layout, CSS handling, and hyphenation
|
||||
- `lib/`: supporting libraries (fonts, text, filesystem helpers, etc.)
|
||||
- `open-x4-sdk/`: hardware SDK submodule (display, input, storage, battery)
|
||||
|
||||
+177
-90
@@ -1,22 +1,26 @@
|
||||
# File Formats
|
||||
|
||||
These formats describe the SD-card cache files under `/.crosspoint/epub_<hash>/`.
|
||||
All POD fields are written in the ESP32 little-endian representation used by
|
||||
`Serialization.h`; strings are length-prefixed UTF-8.
|
||||
|
||||
## `book.bin`
|
||||
|
||||
### Version 3
|
||||
### Version 7
|
||||
|
||||
ImHex Pattern:
|
||||
`book.bin` stores EPUB metadata plus lookup tables for spine and TOC entries.
|
||||
The current firmware writes this version from `BookMetadataCache`.
|
||||
|
||||
ImHex pattern:
|
||||
|
||||
```c++
|
||||
import std.mem;
|
||||
import std.string;
|
||||
import std.core;
|
||||
|
||||
// === Configuration ===
|
||||
#define EXPECTED_VERSION 3
|
||||
#define EXPECTED_VERSION 7
|
||||
#define MAX_STRING_LENGTH 65535
|
||||
|
||||
// === String Structure ===
|
||||
|
||||
struct String {
|
||||
u32 length [[hidden, comment("String byte length")]];
|
||||
if (length > MAX_STRING_LENGTH) {
|
||||
@@ -29,74 +33,56 @@ fn format_string(String s) {
|
||||
return s.data;
|
||||
};
|
||||
|
||||
// === Metadata Structure ===
|
||||
|
||||
struct Metadata {
|
||||
String title [[comment("Book title")]];
|
||||
String author [[comment("Book author")]];
|
||||
String language [[comment("Book language code")]];
|
||||
String coverItemHref [[comment("Path to cover image")]];
|
||||
String textReferenceHref [[comment("Path to guided first text reference")]];
|
||||
} [[comment("Book metadata information")]];
|
||||
|
||||
// === Spine Entry Structure ===
|
||||
};
|
||||
|
||||
struct SpineEntry {
|
||||
String href [[comment("Resource path")]];
|
||||
u32 cumulativeSize [[comment("Cumulative size in bytes"), color("FF6B6B")]];
|
||||
s16 tocIndex [[comment("Index into TOC (-1 if none)"), color("4ECDC4")]];
|
||||
} [[comment("Spine entry defining reading order")]];
|
||||
|
||||
// === TOC Entry Structure ===
|
||||
u32 cumulativeSize [[comment("Cumulative uncompressed spine size through this entry")]];
|
||||
s16 tocIndex [[comment("Index into TOC, or inherited/previous TOC index when no direct entry exists")]];
|
||||
};
|
||||
|
||||
struct TocEntry {
|
||||
String title [[comment("Chapter/section title")]];
|
||||
String href [[comment("Resource path")]];
|
||||
String anchor [[comment("Fragment identifier")]];
|
||||
u8 level [[comment("Nesting level (0-255)"), color("95E1D3")]];
|
||||
s16 spineIndex [[comment("Index into spine (-1 if none)"), color("F38181")]];
|
||||
} [[comment("Table of contents entry")]];
|
||||
|
||||
// === Book Bin Structure ===
|
||||
u8 level [[comment("Nesting level")]];
|
||||
s16 spineIndex [[comment("Index into spine (-1 if none)")]];
|
||||
};
|
||||
|
||||
struct BookBin {
|
||||
// Header
|
||||
u8 version [[comment("Format version"), color("FFD93D")]];
|
||||
|
||||
// Version validation
|
||||
u8 version;
|
||||
if (version != EXPECTED_VERSION) {
|
||||
std::error(std::format("Unsupported version: {} (expected {})", version, EXPECTED_VERSION));
|
||||
}
|
||||
|
||||
u32 lutOffset [[comment("Offset to lookup tables"), color("6BCB77")]];
|
||||
u16 spineCount [[comment("Number of spine entries"), color("4D96FF")]];
|
||||
u16 tocCount [[comment("Number of TOC entries"), color("FF6B9D")]];
|
||||
|
||||
// Metadata section
|
||||
Metadata metadata [[comment("Book metadata")]];
|
||||
|
||||
// Validate LUT offset alignment
|
||||
|
||||
u32 lutOffset [[comment("Offset to lookup tables")]];
|
||||
u16 spineCount;
|
||||
u16 tocCount;
|
||||
|
||||
Metadata metadata;
|
||||
|
||||
u32 currentOffset = $;
|
||||
if (currentOffset != lutOffset) {
|
||||
std::warning(std::format("LUT offset mismatch: expected 0x{:X}, got 0x{:X}", lutOffset, currentOffset));
|
||||
}
|
||||
|
||||
// Lookup Tables
|
||||
u32 spineLut[spineCount] [[comment("Spine entry offsets"), color("4D96FF")]];
|
||||
u32 tocLut[tocCount] [[comment("TOC entry offsets"), color("FF6B9D")]];
|
||||
|
||||
// Data Entries
|
||||
SpineEntry spines[spineCount] [[comment("Spine entries (reading order)")]];
|
||||
TocEntry toc[tocCount] [[comment("Table of contents entries")]];
|
||||
};
|
||||
|
||||
// === File Parsing ===
|
||||
u32 spineLut[spineCount] [[comment("Spine entry offsets")]];
|
||||
u32 tocLut[tocCount] [[comment("TOC entry offsets")]];
|
||||
|
||||
SpineEntry spines[spineCount];
|
||||
TocEntry toc[tocCount];
|
||||
};
|
||||
|
||||
BookBin book @ 0x00;
|
||||
|
||||
// Validate we've consumed the entire file
|
||||
u32 fileSize = std::mem::size();
|
||||
u32 parsedSize = $;
|
||||
|
||||
if (parsedSize != fileSize) {
|
||||
std::warning(std::format("Unparsed data detected: {} bytes remaining at offset 0x{:X}", fileSize - parsedSize, parsedSize));
|
||||
}
|
||||
@@ -104,20 +90,33 @@ if (parsedSize != fileSize) {
|
||||
|
||||
## `section.bin`
|
||||
|
||||
### Version 8
|
||||
### Version 25
|
||||
|
||||
ImHex Pattern:
|
||||
Each file in `sections/*.bin` stores one laid-out spine section. The header is
|
||||
also the cache-busting key: if any layout-affecting setting differs from the
|
||||
current reader settings, the section is discarded and rebuilt.
|
||||
|
||||
Version 25 includes:
|
||||
|
||||
- cache-busting fields for paragraph alignment, hyphenation, embedded CSS,
|
||||
image rendering mode, and Focus Reading
|
||||
- page offset LUT
|
||||
- anchor-to-page map for fragment and footnote navigation
|
||||
- paragraph and list-item LUTs used by KOReader sync page refinement
|
||||
- optional per-word Focus Reading split metadata
|
||||
- per-page footnote entries
|
||||
|
||||
ImHex pattern:
|
||||
|
||||
```c++
|
||||
import std.mem;
|
||||
import std.string;
|
||||
import std.core;
|
||||
|
||||
// === Configuration ===
|
||||
#define EXPECTED_VERSION 8
|
||||
#define EXPECTED_VERSION 25
|
||||
#define MAX_STRING_LENGTH 65535
|
||||
|
||||
// === String Structure ===
|
||||
#define FOOTNOTE_NUMBER_LEN 32
|
||||
#define FOOTNOTE_HREF_LEN 96
|
||||
|
||||
struct String {
|
||||
u32 length [[hidden, comment("String byte length")]];
|
||||
@@ -131,90 +130,178 @@ fn format_string(String s) {
|
||||
return s.data;
|
||||
};
|
||||
|
||||
// === Page Structure ===
|
||||
|
||||
enum StorageType : u8 {
|
||||
PageLine = 1
|
||||
enum PageElementTag : u8 {
|
||||
TAG_PageLine = 1,
|
||||
TAG_PageImage = 2,
|
||||
TAG_PageHorizontalRule = 3
|
||||
};
|
||||
|
||||
enum WordStyle : u8 {
|
||||
REGULAR = 0,
|
||||
BOLD = 1,
|
||||
ITALIC = 2,
|
||||
BOLD_ITALIC = 3
|
||||
BOLD_ITALIC = 3,
|
||||
UNDERLINE = 4,
|
||||
STRIKETHROUGH = 8,
|
||||
SUP = 16,
|
||||
SUB = 32
|
||||
};
|
||||
|
||||
enum BlockStyle : u8 {
|
||||
enum TextAlign : u8 {
|
||||
JUSTIFIED = 0,
|
||||
LEFT_ALIGN = 1,
|
||||
CENTER_ALIGN = 2,
|
||||
RIGHT_ALIGN = 3,
|
||||
NONE = 4
|
||||
};
|
||||
|
||||
struct BlockStyle {
|
||||
TextAlign alignment;
|
||||
bool textAlignDefined;
|
||||
s16 marginTop;
|
||||
s16 marginBottom;
|
||||
s16 marginLeft;
|
||||
s16 marginRight;
|
||||
s16 paddingTop;
|
||||
s16 paddingBottom;
|
||||
s16 paddingLeft;
|
||||
s16 paddingRight;
|
||||
s16 textIndent;
|
||||
bool textIndentDefined;
|
||||
bool isRtl;
|
||||
bool directionDefined;
|
||||
};
|
||||
|
||||
struct TextBlock {
|
||||
u16 wordCount;
|
||||
String words[wordCount];
|
||||
s16 wordXPos[wordCount];
|
||||
WordStyle wordStyle[wordCount];
|
||||
|
||||
u8 hasFocus;
|
||||
if (hasFocus != 0) {
|
||||
u8 wordFocusBoundary[wordCount] [[comment("UTF-8 byte boundary between bold prefix and suffix")]];
|
||||
u16 wordFocusSuffixX[wordCount] [[comment("Suffix x offset from word start")]];
|
||||
}
|
||||
|
||||
BlockStyle blockStyle;
|
||||
};
|
||||
|
||||
struct ImageBlock {
|
||||
String imagePath;
|
||||
s16 width;
|
||||
s16 height;
|
||||
};
|
||||
|
||||
struct PageLine {
|
||||
s16 xPos;
|
||||
s16 yPos;
|
||||
u16 wordCount;
|
||||
String words[wordCount];
|
||||
u16 wordXPos[wordCount];
|
||||
WordStyle wordStyle[wordCount];
|
||||
BlockStyle blockStyle;
|
||||
s16 xPos;
|
||||
s16 yPos;
|
||||
TextBlock block;
|
||||
};
|
||||
|
||||
struct PageImage {
|
||||
s16 xPos;
|
||||
s16 yPos;
|
||||
ImageBlock image;
|
||||
};
|
||||
|
||||
struct PageHorizontalRule {
|
||||
s16 xPos;
|
||||
s16 yPos;
|
||||
u16 width;
|
||||
u8 thickness;
|
||||
};
|
||||
|
||||
struct PageElement {
|
||||
u8 pageElementType;
|
||||
if (pageElementType == 1) {
|
||||
PageElementTag pageElementType;
|
||||
if (pageElementType == TAG_PageLine) {
|
||||
PageLine pageLine [[inline]];
|
||||
} else if (pageElementType == TAG_PageImage) {
|
||||
PageImage pageImage [[inline]];
|
||||
} else if (pageElementType == TAG_PageHorizontalRule) {
|
||||
PageHorizontalRule horizontalRule [[inline]];
|
||||
} else {
|
||||
std::error(std::format("Unknown page element type: {}", pageElementType));
|
||||
}
|
||||
};
|
||||
|
||||
struct FootnoteEntry {
|
||||
char number[FOOTNOTE_NUMBER_LEN];
|
||||
char href[FOOTNOTE_HREF_LEN];
|
||||
};
|
||||
|
||||
struct Page {
|
||||
u16 elementCount;
|
||||
PageElement elements[elementCount] [[inline]];
|
||||
|
||||
u16 footnoteCount;
|
||||
FootnoteEntry footnotes[footnoteCount];
|
||||
};
|
||||
|
||||
// === Section Bin Structure ===
|
||||
struct AnchorEntry {
|
||||
String anchor;
|
||||
u16 page;
|
||||
};
|
||||
|
||||
struct AnchorMap {
|
||||
u16 count;
|
||||
AnchorEntry entries[count];
|
||||
};
|
||||
|
||||
struct ParagraphLut {
|
||||
u16 count;
|
||||
u16 paragraphIndex[count];
|
||||
};
|
||||
|
||||
struct SectionBin {
|
||||
// Header
|
||||
u8 version [[comment("Format version"), color("FFD93D")]];
|
||||
|
||||
// Version validation
|
||||
u8 version;
|
||||
if (version != EXPECTED_VERSION) {
|
||||
std::error(std::format("Unsupported version: {} (expected {})", version, EXPECTED_VERSION));
|
||||
}
|
||||
|
||||
// Cache busting parameters
|
||||
|
||||
s32 fontId;
|
||||
float lineCompression;
|
||||
bool extraParagraphSpacing;
|
||||
u8 paragraphAlignment;
|
||||
u16 viewportWidth;
|
||||
u16 vieportHeight;
|
||||
u16 viewportHeight;
|
||||
bool hyphenationEnabled;
|
||||
bool embeddedStyle;
|
||||
u8 imageRendering;
|
||||
bool focusReadingEnabled;
|
||||
|
||||
u16 pageCount;
|
||||
u32 lutOffset;
|
||||
|
||||
Page page[pageCount];
|
||||
|
||||
// Validate LUT offset alignment
|
||||
u32 pageLutOffset;
|
||||
u32 anchorMapOffset;
|
||||
u32 paragraphLutOffset;
|
||||
u32 listItemLutOffset;
|
||||
|
||||
Page pages[pageCount];
|
||||
|
||||
u32 currentOffset = $;
|
||||
if (currentOffset != lutOffset) {
|
||||
std::warning(std::format("LUT offset mismatch: expected 0x{:X}, got 0x{:X}", lutOffset, currentOffset));
|
||||
if (currentOffset != pageLutOffset) {
|
||||
std::warning(std::format("Page LUT offset mismatch: expected 0x{:X}, got 0x{:X}", pageLutOffset, currentOffset));
|
||||
}
|
||||
|
||||
u32 pageLut[pageCount] [[comment("Page data offsets")]];
|
||||
|
||||
if (anchorMapOffset != 0) {
|
||||
AnchorMap anchorMap @ anchorMapOffset;
|
||||
}
|
||||
|
||||
if (paragraphLutOffset != 0) {
|
||||
ParagraphLut paragraphLut @ paragraphLutOffset;
|
||||
}
|
||||
|
||||
if (listItemLutOffset != 0 && paragraphLutOffset != 0) {
|
||||
u16 listItemIndex[paragraphLut.count] @ listItemLutOffset;
|
||||
}
|
||||
|
||||
// Lookup Tables
|
||||
u32 lut[pageCount];
|
||||
};
|
||||
|
||||
// === File Parsing ===
|
||||
SectionBin section @ 0x00;
|
||||
|
||||
SectionBin book @ 0x00;
|
||||
|
||||
// Validate we've consumed the entire file
|
||||
u32 fileSize = std::mem::size();
|
||||
u32 parsedSize = $;
|
||||
|
||||
if (parsedSize != fileSize) {
|
||||
std::warning(std::format("Unparsed data detected: {} bytes remaining at offset 0x{:X}", fileSize - parsedSize, parsedSize));
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ Focus Reading is a reading aid that bolds the first portion of each word, guidin
|
||||
1. Open **Settings > Reader**
|
||||
2. Toggle **Focus Reading** on
|
||||
|
||||
Toggling the setting will trigger a re-index of your current book, the same as when changing font settings. Once indexing is complete, page turns proceed as normal. No changes are made to your EPUB files.
|
||||
Toggling the setting invalidates affected EPUB section caches for the current layout, the same as changing font settings. Sections are rebuilt on demand, then page turns proceed as normal. No changes are made to your EPUB files.
|
||||
|
||||
## Examples
|
||||
|
||||
|
||||
+42
-23
@@ -5,17 +5,29 @@ This guide explains the multi-language support system in CrossPoint Reader.
|
||||
## Supported Languages
|
||||
|
||||
- English
|
||||
- French
|
||||
- German
|
||||
- Portuguese
|
||||
- Spanish
|
||||
- Swedish
|
||||
- Czech
|
||||
- Russian
|
||||
- Ukrainian
|
||||
- Polish
|
||||
- Danish
|
||||
- Turkish
|
||||
- Español
|
||||
- Français
|
||||
- Deutsch
|
||||
- Čeština
|
||||
- Português (Brasil)
|
||||
- Русский
|
||||
- Svenska
|
||||
- Română
|
||||
- Català
|
||||
- Українська
|
||||
- Беларуская
|
||||
- Italiano
|
||||
- Polski
|
||||
- Suomi
|
||||
- Dansk
|
||||
- Nederlands
|
||||
- Türkçe
|
||||
- Қазақша
|
||||
- Magyar
|
||||
- Lietuvių
|
||||
- Slovenščina
|
||||
- Valencià
|
||||
- עברית
|
||||
|
||||
---
|
||||
|
||||
@@ -108,7 +120,9 @@ This automatically:
|
||||
#### 3. Use in code
|
||||
|
||||
```cpp
|
||||
#include <CrossPointSettings.h>
|
||||
#include <I18n.h>
|
||||
#include <Logging.h>
|
||||
|
||||
// Using the tr() macro (recommended)
|
||||
renderer.drawText(font, x, y, tr(STR_MY_NEW_STRING));
|
||||
@@ -175,7 +189,7 @@ The YAML files use UTF-8 encoding. Special characters are automatically converte
|
||||
// tr(id) - Get translated string without StrId:: prefix
|
||||
const char* text = tr(STR_SETTINGS_TITLE);
|
||||
renderer.drawText(font, x, y, tr(STR_BROWSE_FILES));
|
||||
Serial.printf("Status: %s\n", tr(STR_CONNECTED));
|
||||
LOG_INF("I18N", "Status: %s", tr(STR_CONNECTED));
|
||||
|
||||
// I18N - Shorthand for I18n::getInstance()
|
||||
I18N.setLanguage(Language::ES);
|
||||
@@ -191,34 +205,39 @@ const char* text = tr(STR_SETTINGS_TITLE); // Macro (recommended)
|
||||
const char* text = I18N.get(StrId::STR_SETTINGS_TITLE); // Direct call
|
||||
const char* text = I18N[StrId::STR_SETTINGS_TITLE]; // Operator overload
|
||||
|
||||
// Set language
|
||||
// Set runtime language
|
||||
I18N.setLanguage(Language::ES);
|
||||
|
||||
// Get current language
|
||||
Language lang = I18N.getLanguage();
|
||||
|
||||
// Save language setting to file
|
||||
I18N.saveSettings();
|
||||
|
||||
// Load language setting from file
|
||||
I18N.loadSettings();
|
||||
|
||||
// Get character set for font subsetting (static method)
|
||||
const char* chars = I18n::getCharacterSet(Language::FR);
|
||||
|
||||
// Persist a user language choice
|
||||
SETTINGS.language = static_cast<uint8_t>(Language::ES);
|
||||
SETTINGS.saveToFile();
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## File Storage
|
||||
|
||||
Language settings are stored in:
|
||||
The selected language is stored with the rest of the device settings in:
|
||||
```text
|
||||
/.crosspoint/settings.json
|
||||
```
|
||||
|
||||
The JSON field is `language`, stored as a stable language code string such as
|
||||
`"EN"`, `"DE"`, or `"HE"` rather than a raw enum value.
|
||||
|
||||
Older firmware versions used:
|
||||
```text
|
||||
/.crosspoint/language.bin
|
||||
```
|
||||
|
||||
This file contains:
|
||||
- Version byte
|
||||
- Current language selection (1 byte)
|
||||
On load, current firmware migrates that legacy file into `settings.json` and
|
||||
renames it to `language.bin.bak`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
+30
-8
@@ -9,15 +9,15 @@ There are three ways to install fonts:
|
||||
|
||||
### Option 1: Download from device (recommended)
|
||||
|
||||
1. Connect your CrossPoint reader to WiFi
|
||||
1. Connect your CrossPoint reader to Wi-Fi
|
||||
2. Go to **Settings > System > Manage Fonts**
|
||||
3. Browse available font families and tap to download
|
||||
4. Downloaded fonts appear immediately in **Settings > Reader > Font Family**
|
||||
|
||||
### Option 2: Upload via web browser
|
||||
|
||||
1. Connect your CrossPoint reader to WiFi
|
||||
2. Open the web interface in your browser (shown on the WiFi screen)
|
||||
1. Start **File Transfer** and connect through **Join Network** or **Create Hotspot**
|
||||
2. Open the web interface URL shown on the reader
|
||||
3. Navigate to the **Fonts** tab
|
||||
4. Upload `.cpfont` files using the upload form
|
||||
|
||||
@@ -91,14 +91,36 @@ To convert your own TrueType/OpenType fonts:
|
||||
|
||||
| Preset | Coverage |
|
||||
|--------|----------|
|
||||
| `ascii` | U+0020-U+007E (Basic Latin) |
|
||||
| `latin-ext` | European languages (Latin + Extended-A/B) |
|
||||
| `ascii` | U+0020–U+007E (Basic Latin) |
|
||||
| `latin1` | U+0080–U+00FF (Latin-1 Supplement) |
|
||||
| `latin-ext` | European languages (Latin + Extended-A/B + punctuation + ligatures) |
|
||||
| `greek` | Greek + Extended Greek |
|
||||
| `cyrillic` | Cyrillic + Supplement |
|
||||
| `hebrew` | Hebrew + Alphabetic Presentation Forms |
|
||||
| `georgian` | Georgian + Georgian Supplement |
|
||||
| `armenian` | Armenian |
|
||||
| `ethiopic` | Ethiopic + Extended |
|
||||
| `vietnamese` | Vietnamese subset (ơ/ư and combining marks) |
|
||||
| `punctuation` | General punctuation (U+2000–U+206F) |
|
||||
| `cjk` | CJK Unified Ideographs + Hiragana + Katakana + Fullwidth |
|
||||
| `hangul` | Korean Hangul syllables |
|
||||
| `builtin` | Matches built-in Bookerly coverage exactly |
|
||||
| `hangul` | Korean Hangul syllables + Jamo + Compatibility Jamo |
|
||||
| `cherokee` | Cherokee (historic + supplement block) |
|
||||
| `tifinagh` | Tifinagh |
|
||||
| `symbols` | Math, currency, arrows, box-drawing, misc symbols, dingbats |
|
||||
| `reading` | Literary fiction coverage: Latin, Greek, Cyrillic, math/symbol blocks, supplemental punctuation, and CJK quote marks |
|
||||
| `builtin` | Matches the firmware's built-in font conversion intervals |
|
||||
|
||||
Combine presets with commas: `--intervals latin-ext,greek,cyrillic`
|
||||
|
||||
Install custom fonts via WiFi upload or manual SD card copy.
|
||||
You can also specify arbitrary Unicode ranges directly:
|
||||
`--intervals latin-ext,(0x2100-0x214F)`
|
||||
|
||||
To list all presets with codepoint counts:
|
||||
|
||||
python3 lib/EpdFont/scripts/fontconvert_sdcard.py --list-presets
|
||||
|
||||
### Additional options
|
||||
|
||||
`--force-autohint` — force FreeType's auto-hinter instead of the font's native hinting (useful when a font's built-in hints produce poor results at small sizes).
|
||||
|
||||
Install custom fonts via the web interface or manual SD card copy.
|
||||
|
||||
+6
-2
@@ -1,7 +1,9 @@
|
||||
# Translators
|
||||
|
||||
Below is a list of users and languages CrossPoint may support in the future.
|
||||
Note because a language is below does not mean there is official support for the language at this time.
|
||||
Below is a list of translator credits for languages with known contributors.
|
||||
Official UI language support is determined by the YAML files in
|
||||
`lib/I18n/translations/`; see [i18n.md](./i18n.md) for the current supported
|
||||
language list.
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -37,6 +39,7 @@ If you'd like to add your name to this list, please open a PR adding yourself an
|
||||
- [Skrzakk](https://github.com/Skrzakk)
|
||||
- [pablohc](https://github.com/pablohc)
|
||||
- [DaniPhii](https://github.com/DaniPhii)
|
||||
- [lpla](https://github.com/lpla)
|
||||
|
||||
## Swedish
|
||||
- [dawiik](https://github.com/dawiik)
|
||||
@@ -47,6 +50,7 @@ If you'd like to add your name to this list, please open a PR adding yourself an
|
||||
|
||||
## Catalan
|
||||
- [angeldenom](https://github.com/angeldenom)
|
||||
- [lpla](https://github.com/lpla)
|
||||
|
||||
## Finnish
|
||||
- [plahteenlahti](https://github.com/plahteenlahti)
|
||||
|
||||
+13
-10
@@ -1,6 +1,6 @@
|
||||
# Troubleshooting
|
||||
|
||||
This document show most common issues and possible solutions while using the device features.
|
||||
This document shows common issues and possible solutions while using the device features.
|
||||
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
- [Cannot See the Device on the Network](#cannot-see-the-device-on-the-network)
|
||||
@@ -14,25 +14,27 @@ This document show most common issues and possible solutions while using the dev
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Verify both devices are on the **same WiFi network**
|
||||
- Check your computer/phone WiFi settings
|
||||
- Confirm the CrossPoint Reader shows "Connected" status
|
||||
1. Verify both devices are on the correct network
|
||||
- Check your computer/phone Wi-Fi settings
|
||||
- In **Join Network** mode, your computer/phone and CrossPoint Reader must be on the same Wi-Fi network
|
||||
- In **Create Hotspot** mode, your computer/phone must be connected to the `CrossPoint-Reader` hotspot
|
||||
2. Double-check the IP address
|
||||
- Make sure you typed it correctly
|
||||
- Include `http://` at the beginning
|
||||
- Try the displayed IP address if `http://crosspoint.local/` does not resolve
|
||||
3. Try disabling VPN if you're using one
|
||||
4. Some networks have "client isolation" enabled - check with your network administrator
|
||||
4. Some networks have "client isolation" enabled - use Create Hotspot mode or check with your network administrator
|
||||
|
||||
### Connection Drops or Times Out
|
||||
|
||||
**Problem:** WiFi connection is unstable
|
||||
**Problem:** Wi-Fi connection is unstable
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Move closer to the WiFi router
|
||||
1. Move closer to the Wi-Fi router, or use Create Hotspot mode for a direct connection
|
||||
2. Check signal strength on the device (should be at least `||` or better)
|
||||
3. Avoid interference from other devices
|
||||
4. Try a different WiFi network if available
|
||||
4. Try a different Wi-Fi network if available
|
||||
|
||||
### Upload Fails
|
||||
|
||||
@@ -40,10 +42,11 @@ This document show most common issues and possible solutions while using the dev
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. Ensure the file is a valid `.epub` file
|
||||
2. Check that the SD card has enough free space
|
||||
1. Check that the SD card has enough free space
|
||||
2. Check that the filename is valid for the SD card filesystem
|
||||
3. Try uploading a smaller file first to test
|
||||
4. Refresh the browser page and try again
|
||||
5. If WebSocket upload fails repeatedly, refresh the page and retry with the HTTP fallback path
|
||||
|
||||
### Saved Password Not Working
|
||||
|
||||
|
||||
+400
-231
@@ -1,72 +1,36 @@
|
||||
# Webserver Endpoints
|
||||
|
||||
This document describes all HTTP and WebSocket endpoints available on the CrossPoint Reader webserver.
|
||||
This document describes the HTTP, WebSocket, WebDAV, and discovery endpoints
|
||||
available while CrossPoint Reader is in File Transfer or Calibre Wireless mode.
|
||||
|
||||
- [Webserver Endpoints](#webserver-endpoints)
|
||||
- [Overview](#overview)
|
||||
- [HTTP Endpoints](#http-endpoints)
|
||||
- [GET `/` - Home Page](#get----home-page)
|
||||
- [GET `/files` - File Browser Page](#get-files---file-browser-page)
|
||||
- [GET `/api/status` - Device Status](#get-apistatus---device-status)
|
||||
- [GET `/api/files` - List Files](#get-apifiles---list-files)
|
||||
- [POST `/upload` - Upload File](#post-upload---upload-file)
|
||||
- [POST `/mkdir` - Create Folder](#post-mkdir---create-folder)
|
||||
- [POST `/delete` - Delete File or Folder](#post-delete---delete-file-or-folder)
|
||||
- [WebSocket Endpoint](#websocket-endpoint)
|
||||
- [Port 81 - Fast Binary Upload](#port-81---fast-binary-upload)
|
||||
- [Network Modes](#network-modes)
|
||||
- [Station Mode (STA)](#station-mode-sta)
|
||||
- [Access Point Mode (AP)](#access-point-mode-ap)
|
||||
- [Notes](#notes)
|
||||
- HTTP server: port 80
|
||||
- WebSocket upload server: port 81
|
||||
- UDP discovery listener: port 8134
|
||||
- WebDAV: port 80, handled by the same HTTP server
|
||||
|
||||
Examples use `crosspoint.local`. If mDNS does not resolve on your network, use
|
||||
the IP address shown on the device screen.
|
||||
|
||||
## Overview
|
||||
## HTTP Pages
|
||||
|
||||
The CrossPoint Reader exposes a webserver for file management and device monitoring:
|
||||
| Method | Path | Purpose |
|
||||
|--------|------|---------|
|
||||
| `GET` | `/` | Home/status page |
|
||||
| `GET` | `/files` | File manager page |
|
||||
| `GET` | `/settings` | Web settings page |
|
||||
| `GET` | `/fonts` | SD-card font manager page |
|
||||
| `GET` | `/js/jszip.min.js` | JavaScript asset used by the file manager |
|
||||
|
||||
- **HTTP Server**: Port 80
|
||||
- **WebSocket Server**: Port 81 (for fast binary uploads)
|
||||
## Device Status
|
||||
|
||||
---
|
||||
### `GET /api/status`
|
||||
|
||||
## HTTP Endpoints
|
||||
|
||||
### GET `/` - Home Page
|
||||
|
||||
Serves the home page HTML interface.
|
||||
|
||||
**Request:**
|
||||
```bash
|
||||
curl http://crosspoint.local/
|
||||
```
|
||||
|
||||
**Response:** HTML page (200 OK)
|
||||
|
||||
---
|
||||
|
||||
### GET `/files` - File Browser Page
|
||||
|
||||
Serves the file browser HTML interface.
|
||||
|
||||
**Request:**
|
||||
```bash
|
||||
curl http://crosspoint.local/files
|
||||
```
|
||||
|
||||
**Response:** HTML page (200 OK)
|
||||
|
||||
---
|
||||
|
||||
### GET `/api/status` - Device Status
|
||||
|
||||
Returns JSON with device status information.
|
||||
|
||||
**Request:**
|
||||
```bash
|
||||
curl http://crosspoint.local/api/status
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "1.0.0",
|
||||
@@ -74,258 +38,463 @@ curl http://crosspoint.local/api/status
|
||||
"mode": "STA",
|
||||
"rssi": -45,
|
||||
"freeHeap": 123456,
|
||||
"uptime": 3600
|
||||
"uptime": 3600,
|
||||
"device": "X4"
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Description |
|
||||
| ---------- | ------ | --------------------------------------------------------- |
|
||||
| `version` | string | CrossPoint firmware version |
|
||||
| `ip` | string | Device IP address |
|
||||
| `mode` | string | `"STA"` (connected to WiFi) or `"AP"` (access point mode) |
|
||||
| `rssi` | number | WiFi signal strength in dBm (0 in AP mode) |
|
||||
| `freeHeap` | number | Free heap memory in bytes |
|
||||
| `uptime` | number | Seconds since device boot |
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `version` | string | Firmware version |
|
||||
| `ip` | string | Device IP address |
|
||||
| `mode` | string | `"STA"` for joined Wi-Fi or `"AP"` for hotspot mode |
|
||||
| `rssi` | number | Wi-Fi RSSI in dBm; `0` in AP mode |
|
||||
| `freeHeap` | number | Free heap in bytes |
|
||||
| `uptime` | number | Seconds since boot |
|
||||
| `device` | string | `"X3"` or `"X4"` hardware detection |
|
||||
|
||||
---
|
||||
## File Management
|
||||
|
||||
### GET `/api/files` - List Files
|
||||
### `GET /api/files`
|
||||
|
||||
Returns a JSON array of files and folders in the specified directory.
|
||||
Lists files and folders under a directory.
|
||||
|
||||
**Request:**
|
||||
```bash
|
||||
# List root directory
|
||||
curl http://crosspoint.local/api/files
|
||||
|
||||
# List specific directory
|
||||
curl "http://crosspoint.local/api/files?path=/Books"
|
||||
```
|
||||
|
||||
**Query Parameters:**
|
||||
Query parameters:
|
||||
|
||||
| Parameter | Required | Default | Description |
|
||||
| --------- | -------- | ------- | ---------------------- |
|
||||
| `path` | No | `/` | Directory path to list |
|
||||
| Parameter | Required | Default | Description |
|
||||
|-----------|----------|---------|-------------|
|
||||
| `path` | No | `/` | Directory to list |
|
||||
|
||||
Response:
|
||||
|
||||
**Response (200 OK):**
|
||||
```json
|
||||
[
|
||||
{"name": "MyBook.epub", "size": 1234567, "isDirectory": false, "isEpub": true},
|
||||
{"name": "Notes", "size": 0, "isDirectory": true, "isEpub": false},
|
||||
{"name": "document.pdf", "size": 54321, "isDirectory": false, "isEpub": false}
|
||||
{"name":"MyBook.epub","size":1234567,"isDirectory":false,"isEpub":true},
|
||||
{"name":"Notes","size":0,"isDirectory":true,"isEpub":false}
|
||||
]
|
||||
```
|
||||
|
||||
| Field | Type | Description |
|
||||
| ------------- | ------- | ---------------------------------------- |
|
||||
| `name` | string | File or folder name |
|
||||
| `size` | number | Size in bytes (0 for directories) |
|
||||
| `isDirectory` | boolean | `true` if the item is a folder |
|
||||
| `isEpub` | boolean | `true` if the file has `.epub` extension |
|
||||
Hidden dotfiles are omitted unless the device setting `showHiddenFiles` is
|
||||
enabled. `System Volume Information` and `XTCache` are always hidden/protected.
|
||||
|
||||
**Notes:**
|
||||
- Hidden files (starting with `.`) are automatically filtered out
|
||||
- System folders (`System Volume Information`, `XTCache`) are hidden
|
||||
### `GET /download`
|
||||
|
||||
---
|
||||
Downloads a file from the SD card.
|
||||
|
||||
### POST `/upload` - Upload File
|
||||
|
||||
Uploads a file to the SD card via multipart form data.
|
||||
|
||||
**Request:**
|
||||
```bash
|
||||
# Upload to root directory
|
||||
curl -X POST -F "file=@mybook.epub" http://crosspoint.local/upload
|
||||
curl -OJ "http://crosspoint.local/download?path=/Books/MyBook.epub"
|
||||
```
|
||||
|
||||
# Upload to specific directory
|
||||
Query parameters:
|
||||
|
||||
| Parameter | Required | Description |
|
||||
|-----------|----------|-------------|
|
||||
| `path` | Yes | File path to download |
|
||||
|
||||
Protected dotfiles, `System Volume Information`, and `XTCache` cannot be
|
||||
downloaded. EPUB files are served as `application/epub+zip`; other files use
|
||||
`application/octet-stream`.
|
||||
|
||||
### `POST /upload`
|
||||
|
||||
Uploads a file with HTTP multipart form data.
|
||||
|
||||
```bash
|
||||
curl -X POST -F "file=@mybook.epub" "http://crosspoint.local/upload?path=/Books"
|
||||
```
|
||||
|
||||
**Query Parameters:**
|
||||
Query parameters:
|
||||
|
||||
| Parameter | Required | Default | Description |
|
||||
| --------- | -------- | ------- | ------------------------------- |
|
||||
| `path` | No | `/` | Target directory for the upload |
|
||||
| Parameter | Required | Default | Description |
|
||||
|-----------|----------|---------|-------------|
|
||||
| `path` | No | `/` | Destination directory |
|
||||
|
||||
**Response (200 OK):**
|
||||
```
|
||||
Successful response:
|
||||
|
||||
```text
|
||||
File uploaded successfully: mybook.epub
|
||||
```
|
||||
|
||||
**Error Responses:**
|
||||
Notes:
|
||||
|
||||
| Status | Body | Cause |
|
||||
| ------ | ----------------------------------------------- | --------------------------- |
|
||||
| 400 | `Failed to create file on SD card` | Cannot create file |
|
||||
| 400 | `Failed to write to SD card - disk may be full` | Write error during upload |
|
||||
| 400 | `Failed to write final data to SD card` | Error flushing final buffer |
|
||||
| 400 | `Upload aborted` | Client aborted the upload |
|
||||
| 400 | `Unknown error during upload` | Unspecified error |
|
||||
- Existing files with the same name are overwritten.
|
||||
- EPUB cache data for the uploaded path is cleared after a successful upload.
|
||||
- HTTP upload uses a 4 KB write buffer before flushing to the SD card.
|
||||
|
||||
**Notes:**
|
||||
- Existing files with the same name will be overwritten
|
||||
- Uses a 4KB buffer for efficient SD card writes
|
||||
### `POST /mkdir`
|
||||
|
||||
---
|
||||
Creates a folder.
|
||||
|
||||
### POST `/mkdir` - Create Folder
|
||||
|
||||
Creates a new folder on the SD card.
|
||||
|
||||
**Request:**
|
||||
```bash
|
||||
curl -X POST -d "name=NewFolder&path=/" http://crosspoint.local/mkdir
|
||||
```
|
||||
|
||||
**Form Parameters:**
|
||||
Form parameters:
|
||||
|
||||
| Parameter | Required | Default | Description |
|
||||
| --------- | -------- | ------- | ---------------------------- |
|
||||
| `name` | Yes | - | Name of the folder to create |
|
||||
| `path` | No | `/` | Parent directory path |
|
||||
| Parameter | Required | Default | Description |
|
||||
|-----------|----------|---------|-------------|
|
||||
| `name` | Yes | - | New folder name |
|
||||
| `path` | No | `/` | Parent folder |
|
||||
|
||||
**Response (200 OK):**
|
||||
```
|
||||
Folder created: NewFolder
|
||||
```
|
||||
### `POST /rename`
|
||||
|
||||
**Error Responses:**
|
||||
Renames a file.
|
||||
|
||||
| Status | Body | Cause |
|
||||
| ------ | ----------------------------- | ----------------------------- |
|
||||
| 400 | `Missing folder name` | `name` parameter not provided |
|
||||
| 400 | `Folder name cannot be empty` | Empty folder name |
|
||||
| 400 | `Folder already exists` | Folder with same name exists |
|
||||
| 500 | `Failed to create folder` | SD card error |
|
||||
|
||||
---
|
||||
|
||||
### POST `/delete` - Delete File or Folder
|
||||
|
||||
Deletes a file or folder from the SD card.
|
||||
|
||||
**Request:**
|
||||
```bash
|
||||
# Delete a file
|
||||
curl -X POST -d "path=/Books/mybook.epub&type=file" http://crosspoint.local/delete
|
||||
|
||||
# Delete an empty folder
|
||||
curl -X POST -d "path=/OldFolder&type=folder" http://crosspoint.local/delete
|
||||
curl -X POST -d "path=/Books/old.epub&name=new.epub" http://crosspoint.local/rename
|
||||
```
|
||||
|
||||
**Form Parameters:**
|
||||
Form parameters:
|
||||
|
||||
| Parameter | Required | Default | Description |
|
||||
| --------- | -------- | ------- | -------------------------------- |
|
||||
| `path` | Yes | - | Path to the item to delete |
|
||||
| `type` | No | `file` | Type of item: `file` or `folder` |
|
||||
| Parameter | Required | Description |
|
||||
|-----------|----------|-------------|
|
||||
| `path` | Yes | Existing file path |
|
||||
| `name` | Yes | New file name, not a path |
|
||||
|
||||
**Response (200 OK):**
|
||||
```
|
||||
Deleted successfully
|
||||
Only files can be renamed through this endpoint. The old EPUB cache path is
|
||||
cleared before the rename.
|
||||
|
||||
### `POST /move`
|
||||
|
||||
Moves a file into an existing folder.
|
||||
|
||||
```bash
|
||||
curl -X POST -d "path=/Books/mybook.epub&dest=/Read" http://crosspoint.local/move
|
||||
```
|
||||
|
||||
**Error Responses:**
|
||||
Form parameters:
|
||||
|
||||
| Status | Body | Cause |
|
||||
| ------ | --------------------------------------------- | ----------------------------- |
|
||||
| 400 | `Missing path` | `path` parameter not provided |
|
||||
| 400 | `Cannot delete root directory` | Attempted to delete `/` |
|
||||
| 400 | `Folder is not empty. Delete contents first.` | Non-empty folder |
|
||||
| 403 | `Cannot delete system files` | Hidden file (starts with `.`) |
|
||||
| 403 | `Cannot delete protected items` | Protected system folder |
|
||||
| 404 | `Item not found` | Path does not exist |
|
||||
| 500 | `Failed to delete item` | SD card error |
|
||||
| Parameter | Required | Description |
|
||||
|-----------|----------|-------------|
|
||||
| `path` | Yes | Existing file path |
|
||||
| `dest` | Yes | Existing destination folder |
|
||||
|
||||
**Protected Items:**
|
||||
- Files/folders starting with `.`
|
||||
- `System Volume Information`
|
||||
- `XTCache`
|
||||
Only files can be moved through this endpoint. The old EPUB cache path is
|
||||
cleared before the move.
|
||||
|
||||
---
|
||||
### `POST /delete`
|
||||
|
||||
## WebSocket Endpoint
|
||||
Deletes one or more files or empty folders.
|
||||
|
||||
### Port 81 - Fast Binary Upload
|
||||
|
||||
A WebSocket endpoint for high-speed binary file uploads. More efficient than HTTP multipart for large files.
|
||||
|
||||
**Connection:**
|
||||
```bash
|
||||
curl -X POST -d "path=/Books/mybook.epub" http://crosspoint.local/delete
|
||||
curl -X POST -d 'paths=["/Books/old.epub","/OldFolder"]' http://crosspoint.local/delete
|
||||
```
|
||||
|
||||
Form parameters:
|
||||
|
||||
| Parameter | Required | Description |
|
||||
|-----------|----------|-------------|
|
||||
| `path` | Yes, unless `paths` is provided | Single path to delete |
|
||||
| `paths` | Yes, unless `path` is provided | JSON array of paths to delete |
|
||||
|
||||
Protected items cannot be deleted. Non-empty folders are rejected. EPUB cache
|
||||
data for deleted files is cleared.
|
||||
|
||||
## Settings API
|
||||
|
||||
### `GET /api/settings`
|
||||
|
||||
Returns a streamed JSON array of editable settings. Each item contains common
|
||||
fields plus type-specific fields.
|
||||
|
||||
```bash
|
||||
curl http://crosspoint.local/api/settings
|
||||
```
|
||||
|
||||
Example item:
|
||||
|
||||
```json
|
||||
{
|
||||
"key": "fontSize",
|
||||
"name": "Font Size",
|
||||
"category": "Reader",
|
||||
"type": "enum",
|
||||
"value": 1,
|
||||
"options": ["Small", "Medium", "Large"]
|
||||
}
|
||||
```
|
||||
|
||||
Types:
|
||||
|
||||
| Type | Extra fields |
|
||||
|------|--------------|
|
||||
| `toggle` | `value` (`0` or `1`) |
|
||||
| `enum` | `value`, `options` |
|
||||
| `value` | `value`, `min`, `max`, `step` |
|
||||
| `string` | `value` |
|
||||
|
||||
The font-family setting includes SD-card font families when they are installed.
|
||||
|
||||
### `POST /api/settings`
|
||||
|
||||
Applies a partial settings update from a JSON object.
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"fontSize":2,"showHiddenFiles":1}' \
|
||||
http://crosspoint.local/api/settings
|
||||
```
|
||||
|
||||
Successful response:
|
||||
|
||||
```text
|
||||
Applied 2 setting(s)
|
||||
```
|
||||
|
||||
## Font Management API
|
||||
|
||||
### `GET /api/fonts`
|
||||
|
||||
Lists installed SD-card font families.
|
||||
|
||||
```bash
|
||||
curl http://crosspoint.local/api/fonts
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"maxFamilies": 128,
|
||||
"families": [
|
||||
{
|
||||
"name": "Literata",
|
||||
"sizes": [12, 14, 16, 18],
|
||||
"files": [
|
||||
{"name": "Literata_12.cpfont", "size": 123456}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `POST /api/fonts/upload`
|
||||
|
||||
Uploads one `.cpfont` file into a family folder.
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
-F "family=Literata" \
|
||||
-F "file=@Literata_12.cpfont" \
|
||||
http://crosspoint.local/api/fonts/upload
|
||||
```
|
||||
|
||||
The handler validates the family name, `.cpfont` filename, and `CPFONT` magic
|
||||
bytes before accepting the file.
|
||||
|
||||
Successful response:
|
||||
|
||||
```json
|
||||
{"ok":true}
|
||||
```
|
||||
|
||||
### `POST /api/fonts/delete`
|
||||
|
||||
Deletes an installed font family.
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"family":"Literata"}' \
|
||||
http://crosspoint.local/api/fonts/delete
|
||||
```
|
||||
|
||||
Successful response:
|
||||
|
||||
```json
|
||||
{"ok":true}
|
||||
```
|
||||
|
||||
## OPDS Server API
|
||||
|
||||
### `GET /api/opds`
|
||||
|
||||
Lists saved OPDS servers. Passwords are never returned.
|
||||
|
||||
```bash
|
||||
curl http://crosspoint.local/api/opds
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"index": 0,
|
||||
"name": "My Catalog",
|
||||
"url": "http://calibre.local:8080/opds",
|
||||
"username": "reader",
|
||||
"hasPassword": true
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### `POST /api/opds`
|
||||
|
||||
Adds or updates an OPDS server. Include `index` to update an existing entry.
|
||||
If `password` is omitted during an update, the existing password is preserved.
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"name":"My Catalog","url":"http://calibre.local:8080/opds","username":"reader","password":"secret"}' \
|
||||
http://crosspoint.local/api/opds
|
||||
```
|
||||
|
||||
### `POST /api/opds/delete`
|
||||
|
||||
Deletes an OPDS server by index.
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"index":0}' \
|
||||
http://crosspoint.local/api/opds/delete
|
||||
```
|
||||
|
||||
## Wi-Fi Credential API
|
||||
|
||||
### `GET /api/wifi`
|
||||
|
||||
Lists saved Wi-Fi networks. Passwords are never returned.
|
||||
|
||||
```bash
|
||||
curl http://crosspoint.local/api/wifi
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"index": 0,
|
||||
"ssid": "HomeWiFi",
|
||||
"hasPassword": true,
|
||||
"isLastConnected": true
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### `POST /api/wifi`
|
||||
|
||||
Adds or updates a saved Wi-Fi network. Include `index` to update an existing
|
||||
entry. If `password` is omitted during an update, the existing password is
|
||||
preserved.
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"ssid":"HomeWiFi","password":"secret"}' \
|
||||
http://crosspoint.local/api/wifi
|
||||
```
|
||||
|
||||
### `POST /api/wifi/delete`
|
||||
|
||||
Deletes a saved Wi-Fi network by index.
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"index":0}' \
|
||||
http://crosspoint.local/api/wifi/delete
|
||||
```
|
||||
|
||||
## WebSocket Upload
|
||||
|
||||
### Port 81
|
||||
|
||||
The WebSocket path is used for fast binary uploads from the file manager and
|
||||
Calibre plugin workflows.
|
||||
|
||||
Connection:
|
||||
|
||||
```text
|
||||
ws://crosspoint.local:81/
|
||||
```
|
||||
|
||||
**Protocol:**
|
||||
Protocol:
|
||||
|
||||
1. **Client** sends TEXT message: `START:<filename>:<size>:<path>`
|
||||
2. **Server** responds with TEXT: `READY`
|
||||
3. **Client** sends BINARY messages with file data chunks
|
||||
4. **Server** sends TEXT progress updates: `PROGRESS:<received>:<total>`
|
||||
5. **Server** sends TEXT when complete: `DONE` or `ERROR:<message>`
|
||||
1. Client sends text: `START:<filename>:<size>:<path>`
|
||||
2. Server replies `READY`
|
||||
3. Client sends binary chunks
|
||||
4. Server sends `PROGRESS:<received>:<total>` every 64 KB or at completion
|
||||
5. Server sends `DONE` when complete or `ERROR:<message>` on failure
|
||||
|
||||
**Example Session:**
|
||||
Example session:
|
||||
|
||||
```
|
||||
Client -> "START:mybook.epub:1234567:/Books"
|
||||
Server -> "READY"
|
||||
Client -> [binary chunk 1]
|
||||
Client -> [binary chunk 2]
|
||||
Server -> "PROGRESS:65536:1234567"
|
||||
Client -> [binary chunk 3]
|
||||
```text
|
||||
Client -> START:mybook.epub:1234567:/Books
|
||||
Server -> READY
|
||||
Client -> [binary chunk]
|
||||
Server -> PROGRESS:65536:1234567
|
||||
...
|
||||
Server -> "PROGRESS:1234567:1234567"
|
||||
Server -> "DONE"
|
||||
Server -> DONE
|
||||
```
|
||||
|
||||
**Error Messages:**
|
||||
Error messages include:
|
||||
|
||||
| Message | Cause |
|
||||
| --------------------------------- | ---------------------------------- |
|
||||
| `ERROR:Failed to create file` | Cannot create file on SD card |
|
||||
| `ERROR:Invalid START format` | Malformed START message |
|
||||
| `ERROR:No upload in progress` | Binary data received without START |
|
||||
| `ERROR:Write failed - disk full?` | SD card write error |
|
||||
| Message | Cause |
|
||||
|---------|-------|
|
||||
| `ERROR:Upload already in progress` | A second upload was started before the first completed |
|
||||
| `ERROR:Invalid START format` | Malformed START message or invalid size token |
|
||||
| `ERROR:Failed to create file` | Destination file could not be opened |
|
||||
| `ERROR:No upload in progress` | Binary data arrived without a matching START |
|
||||
| `ERROR:Upload overflow` | Client sent more bytes than declared |
|
||||
| `ERROR:Write failed - disk full?` | SD write failed |
|
||||
|
||||
**Example with `websocat`:**
|
||||
```bash
|
||||
# Interactive session
|
||||
websocat ws://crosspoint.local:81
|
||||
Incomplete WebSocket uploads are deleted on disconnect or error.
|
||||
|
||||
# Then type:
|
||||
START:mybook.epub:1234567:/Books
|
||||
# Wait for READY, then send binary data
|
||||
## WebDAV
|
||||
|
||||
The same HTTP server registers a WebDAV-compatible handler for file manager clients.
|
||||
|
||||
Supported methods:
|
||||
|
||||
```text
|
||||
OPTIONS, GET, HEAD, PUT, DELETE, PROPFIND, MKCOL, MOVE, COPY, LOCK, UNLOCK
|
||||
```
|
||||
|
||||
**Notes:**
|
||||
- Progress updates are sent every 64KB or at completion
|
||||
- Disconnection during upload will delete the incomplete file
|
||||
- Existing files with the same name will be overwritten
|
||||
Notes:
|
||||
|
||||
---
|
||||
- `PUT` writes to a temporary `.davtmp` file first, then renames it into place.
|
||||
- Protected paths are rejected.
|
||||
- `LOCK` and `UNLOCK` are accepted for client compatibility only. The server
|
||||
does not implement full WebDAV Class 2 locking semantics such as persistent
|
||||
locks or lock discovery.
|
||||
|
||||
## UDP Discovery
|
||||
|
||||
The server listens on UDP port `8134`. When it receives the text payload
|
||||
`hello`, it replies to the sender with:
|
||||
|
||||
```text
|
||||
crosspoint (on <hostname>);81
|
||||
```
|
||||
|
||||
The final field is the WebSocket upload port.
|
||||
|
||||
## Network Modes
|
||||
|
||||
The device can operate in two network modes:
|
||||
|
||||
### Station Mode (STA)
|
||||
- Device connects to an existing WiFi network
|
||||
- IP address assigned by router/DHCP
|
||||
- `mode` field in `/api/status` returns `"STA"`
|
||||
- `rssi` field shows signal strength
|
||||
|
||||
- Device joins an existing 2.4 GHz Wi-Fi network.
|
||||
- `crosspoint.local` is advertised with mDNS when available.
|
||||
- `/api/status` returns `"mode": "STA"` and RSSI in dBm.
|
||||
|
||||
### Access Point Mode (AP)
|
||||
- Device creates its own WiFi hotspot
|
||||
- Default IP is typically `192.168.4.1`
|
||||
- `mode` field in `/api/status` returns `"AP"`
|
||||
- `rssi` field returns `0`
|
||||
|
||||
---
|
||||
- Device creates an open hotspot named `CrossPoint-Reader`.
|
||||
- The device shows a Wi-Fi QR code and URL QR code.
|
||||
- The fallback IP is typically `192.168.4.1`.
|
||||
- `/api/status` returns `"mode": "AP"` and `"rssi": 0`.
|
||||
|
||||
## Notes
|
||||
### Calibre Wireless
|
||||
|
||||
- These examples use `crosspoint.local`. If your network does not support mDNS or the address does not resolve, replace it with the specific **IP Address** displayed on your device screen (e.g., `http://192.168.1.102/`).
|
||||
- All paths on the SD card start with `/`
|
||||
- Trailing slashes are automatically stripped (except for root `/`)
|
||||
- The webserver uses chunked transfer encoding for file listings
|
||||
Calibre Wireless starts the same web server in STA mode and displays setup
|
||||
instructions plus WebSocket upload progress on the device screen.
|
||||
|
||||
+98
-185
@@ -1,235 +1,148 @@
|
||||
# Web Server Guide
|
||||
|
||||
This guide explains how to connect your CrossPoint Reader to WiFi and use the built-in web server to upload files from your computer or phone.
|
||||
This guide explains how to use CrossPoint Reader's built-in web server for file
|
||||
transfer, device settings, Wi-Fi/OPDS management, and SD-card font management.
|
||||
|
||||
## Overview
|
||||
|
||||
CrossPoint Reader includes a built-in web server that allows you to:
|
||||
The web server is available while the device is in **File Transfer** or
|
||||
**Calibre Wireless** mode. It can:
|
||||
|
||||
- Upload files wirelessly from any device on the same WiFi network
|
||||
- Browse and manage files on your device's SD card
|
||||
- Create folders to organize your library
|
||||
- Delete files and folders
|
||||
- Upload, download, rename, move, and delete files on the SD card
|
||||
- Create folders
|
||||
- Edit many device settings from a browser
|
||||
- Manage saved Wi-Fi networks and OPDS servers
|
||||
- Upload and delete `.cpfont` SD-card font families
|
||||
- Accept WebDAV clients and Calibre wireless uploads
|
||||
|
||||
## Prerequisites
|
||||
The server does not require authentication. Use it only on trusted private
|
||||
networks or in hotspot mode when you control who is connected.
|
||||
|
||||
- Your CrossPoint Reader device
|
||||
- A WiFi network
|
||||
- A computer, phone, or tablet connected to the **same WiFi network**
|
||||
## Starting File Transfer
|
||||
|
||||
---
|
||||
1. From the Home screen, select **File Transfer**.
|
||||
2. Choose one of the available modes:
|
||||
|
||||
## Step 1: Accessing the WiFi Screen
|
||||
| Mode | Use when |
|
||||
|------|----------|
|
||||
| **Join Network** | You want the reader to join an existing Wi-Fi network. |
|
||||
| **Calibre Wireless** | You want to receive books from the CrossPoint Calibre plugin workflow. |
|
||||
| **Create Hotspot** | You want the reader to create its own open Wi-Fi network. |
|
||||
|
||||
1. From the main menu or file browser, navigate to the **Settings** screen
|
||||
2. Select the **WiFi** option
|
||||
3. The device will automatically start scanning for available networks
|
||||
## Join Network Mode
|
||||
|
||||
---
|
||||
1. Select **Join Network**.
|
||||
2. Pick a 2.4 GHz Wi-Fi network from the scan results.
|
||||
3. Enter the password if prompted.
|
||||
4. Save credentials if you want the reader to reconnect automatically next time.
|
||||
|
||||
## Step 2: Connecting to WiFi
|
||||
After connection, the reader shows:
|
||||
|
||||
### Viewing Available Networks
|
||||
- The connected SSID
|
||||
- A QR code for the web URL
|
||||
- The direct IP URL, for example `http://192.168.1.102/`
|
||||
- The mDNS fallback URL, usually `http://crosspoint.local/`
|
||||
|
||||
Once the scan completes, you'll see a list of available WiFi networks with the following indicators:
|
||||
Use either URL from a phone, tablet, or computer on the same network.
|
||||
|
||||
- **Signal strength bars** (`||||`, `|||`, `||`, `|`) - Shows connection quality
|
||||
- **`*` symbol** - Indicates the network is password-protected (encrypted)
|
||||
- **`+` symbol** - Indicates you have previously saved credentials for this network
|
||||
## Create Hotspot Mode
|
||||
|
||||
<img src="./images/wifi/wifi_networks.jpeg" height="500">
|
||||
1. Select **Create Hotspot**.
|
||||
2. Connect your phone or computer to the open Wi-Fi network:
|
||||
|
||||
### Selecting a Network
|
||||
```text
|
||||
CrossPoint-Reader
|
||||
```
|
||||
|
||||
1. Use the **Left/Right** (or **Volume Up/Down**) buttons to navigate through the network list
|
||||
2. Press **Confirm** to select the highlighted network
|
||||
3. Open the URL shown on the reader. `http://crosspoint.local/` is preferred
|
||||
when supported; the fallback IP is typically `http://192.168.4.1/`.
|
||||
|
||||
### Entering Password (for encrypted networks)
|
||||
The reader displays one QR code for joining the hotspot and another QR code for
|
||||
opening the web interface.
|
||||
|
||||
If the network requires a password:
|
||||
## Calibre Wireless Mode
|
||||
|
||||
1. An on-screen keyboard will appear
|
||||
2. Use the navigation buttons to select characters
|
||||
3. Press **Confirm** to enter each character
|
||||
4. When complete, select the **Done** option on the keyboard
|
||||
Calibre Wireless starts the same web server in station mode, then displays setup
|
||||
instructions and upload progress on the reader. Use this mode with the
|
||||
CrossPoint Calibre plugin or other clients that speak the documented WebSocket
|
||||
upload protocol.
|
||||
|
||||
<img src="./images/wifi/wifi_password.jpeg" height="500">
|
||||
For Calibre OPDS browsing, add `/opds` to the catalog URL when configuring an
|
||||
OPDS server.
|
||||
|
||||
**Note:** If you've previously connected to this network, the saved password will be used automatically.
|
||||
## Web Interface
|
||||
|
||||
### Connection Process
|
||||
The browser UI has four primary pages.
|
||||
|
||||
The device will display "Connecting..." while establishing the connection. This typically takes 5-10 seconds.
|
||||
### Home
|
||||
|
||||
### Saving Credentials
|
||||
|
||||
If this is a new network, you'll be prompted to save the password:
|
||||
|
||||
- Select **Yes** to save credentials for automatic connection next time (NOTE: These are stored in plaintext on the device's SD card. Do not use this for sensitive networks.)
|
||||
- Select **No** to connect without saving
|
||||
|
||||
---
|
||||
|
||||
## Step 3: Connection Success
|
||||
|
||||
Once connected, the screen will display:
|
||||
|
||||
- **Network name** (SSID)
|
||||
- **IP Address** (e.g., `192.168.1.102`)
|
||||
- **Web server URL** (e.g., `http://192.168.1.102/`)
|
||||
|
||||
<img src="./images/wifi/wifi_connected.jpeg" height="500">
|
||||
|
||||
**Important:** Make note of the IP address - you'll need this to access the web interface from your computer or phone.
|
||||
|
||||
---
|
||||
|
||||
## Step 4: Accessing the Web Interface
|
||||
|
||||
### From a Computer
|
||||
|
||||
1. Ensure your computer is connected to the **same WiFi network** as your CrossPoint Reader
|
||||
2. Open any web browser (Chrome is recommended)
|
||||
3. Type the IP address shown on your device into the browser's address bar
|
||||
- Example: `http://192.168.1.102/`
|
||||
4. Press Enter
|
||||
|
||||
### From a Phone or Tablet
|
||||
|
||||
1. Ensure your phone/tablet is connected to the **same WiFi network** as your CrossPoint Reader
|
||||
2. Open your mobile browser (Safari, Chrome, etc.)
|
||||
3. Type the IP address into the address bar
|
||||
- Example: `http://192.168.1.102/`
|
||||
4. Tap Go
|
||||
|
||||
---
|
||||
|
||||
## Step 5: Using the Web Interface
|
||||
|
||||
### Home Page
|
||||
|
||||
The home page displays:
|
||||
|
||||
- Device status and version information
|
||||
- WiFi connection status
|
||||
- Current IP address
|
||||
- Available memory
|
||||
|
||||
Navigation links:
|
||||
|
||||
- **Home** - Returns to the status page
|
||||
- **File Manager** - Access file management features
|
||||
|
||||
<img src="./images/wifi/webserver_homepage.png" width="600">
|
||||
The Home page shows firmware status, network mode, IP address, device type,
|
||||
uptime, and free heap.
|
||||
|
||||
### File Manager
|
||||
|
||||
Click **File Manager** to access file management features.
|
||||
The File Manager page can:
|
||||
|
||||
#### Browsing Files
|
||||
- Browse SD-card folders
|
||||
- Upload files, using WebSocket upload when available and HTTP upload as a fallback
|
||||
- Create folders
|
||||
- Download files
|
||||
- Rename files
|
||||
- Move files into existing folders
|
||||
- Delete one or more selected files or empty folders
|
||||
|
||||
- The file manager displays all files and folders on your SD card
|
||||
- **Folders** are highlighted in yellow and indicated with a 📁 icon
|
||||
- **EPUB Files** are highlighted in green and indicated with a 📗 icon
|
||||
- **All Other Files** are not highlighted and indicated with a 📄 icon
|
||||
- Click on a folder name to navigate into it
|
||||
- Use the breadcrumb navigation at the top to go back to parent folders
|
||||
Existing files with the same name are overwritten by uploads. When EPUB files
|
||||
are overwritten, moved, renamed, or deleted through the web server, the matching
|
||||
book cache is cleared so stale metadata is not reused.
|
||||
|
||||
<img src="./images/wifi/webserver_files.png" width="600">
|
||||
### Settings
|
||||
|
||||
#### Uploading Files
|
||||
The Settings page exposes many firmware settings in the browser. It also has
|
||||
cards for:
|
||||
|
||||
1. Click the **📤 Upload** button in the top-right corner
|
||||
2. Click **Choose File** and select a file from your device
|
||||
3. Click **Upload**
|
||||
4. A progress bar will show the upload status
|
||||
5. The page will automatically refresh when the upload is complete
|
||||
- Saved Wi-Fi networks
|
||||
- OPDS servers
|
||||
|
||||
<img src="./images/wifi/webserver_upload.png" width="600">
|
||||
Passwords are accepted when adding or editing entries, but saved passwords are
|
||||
not returned by the API.
|
||||
|
||||
#### Creating Folders
|
||||
### Fonts
|
||||
|
||||
1. Click the **📁 New Folder** button in the top-right corner
|
||||
2. Enter a folder name (must not contain characters \" * : < > ? / \\ | and must not be . or ..)
|
||||
3. Click **Create Folder**
|
||||
The Fonts page lists installed SD-card font families and lets you upload
|
||||
`.cpfont` files. Upload files from one font family at a time. The server validates
|
||||
the font family name, filename, and `.cpfont` magic bytes before accepting the
|
||||
upload.
|
||||
|
||||
This is useful for organizing your library by genre, author, series or file type.
|
||||
Installed fonts appear in **Settings > Reader > Font Family** after the font
|
||||
registry refreshes.
|
||||
|
||||
#### Deleting Files and Folders
|
||||
## Command Line Use
|
||||
|
||||
1. Click the **🗑️** (trash) icon next to any file or folder
|
||||
2. Confirm the deletion in the popup dialog
|
||||
3. Click **Delete** to permanently remove the item
|
||||
Power users can use `curl`, WebDAV clients, or WebSocket clients while the web
|
||||
server is running.
|
||||
|
||||
**Warning:** Deletion is permanent and cannot be undone!
|
||||
|
||||
**Note:** Folders must be empty before they can be deleted.
|
||||
|
||||
#### Moving Files
|
||||
|
||||
1. Click the **📂** (folder) icon next to any file
|
||||
2. Enter a folder name or select one from the dropdown
|
||||
3. Click **Move** to relocate the file
|
||||
|
||||
**Note:** Typing in a nonexistent folder name will result in the following error: "Failed to move: Destination not found"
|
||||
|
||||
#### Renaming Files
|
||||
|
||||
1. Click the **✏️** (pencil) icon next to any file
|
||||
2. Enter a file name (must not contain characters \" * : < > ? / \\ | and must not be . or ..)
|
||||
3. Click **Rename** to permanently rename the file
|
||||
|
||||
---
|
||||
|
||||
## Command Line File Management
|
||||
|
||||
For power users, you can manage files directly from your terminal using `curl` while the device is in File Upload mode. Detailed documentation can be found [here](./webserver-endpoints.md).
|
||||
Endpoint details are documented in [webserver-endpoints.md](./webserver-endpoints.md).
|
||||
|
||||
## Security Notes
|
||||
|
||||
- The web server runs on port 80 (standard HTTP)
|
||||
- **No authentication is required** - anyone on the same network can access the interface
|
||||
- The web server is only accessible while the WiFi screen shows "Connected"
|
||||
- The web server automatically stops when you exit the WiFi screen
|
||||
- For security, only use on trusted private networks
|
||||
- The HTTP server runs on port 80.
|
||||
- The WebSocket upload server runs on port 81.
|
||||
- There is no authentication.
|
||||
- Anyone on the same network can access the web interface while it is running.
|
||||
- The server stops when you exit File Transfer or Calibre Wireless mode.
|
||||
- Hotspot mode creates an open network for connectivity fallback; disconnect when done.
|
||||
|
||||
---
|
||||
## Tips
|
||||
|
||||
## Technical Details
|
||||
|
||||
- **Supported WiFi:** 2.4GHz networks (802.11 b/g/n)
|
||||
- **Web Server Port:** 80 (HTTP)
|
||||
- **Maximum Upload Size:** Limited by available SD card space
|
||||
- **Browser Compatibility:** All modern browsers (Chrome, Firefox, Safari, Edge)
|
||||
|
||||
---
|
||||
|
||||
## Tips and Best Practices
|
||||
|
||||
1. **Organize with folders** - Create folders before uploading to keep your library organized
|
||||
2. **Check signal strength** - Stronger signals (`|||` or `||||`) provide faster, more reliable uploads
|
||||
3. **Upload multiple files** - You can select and upload multiple files at once; the manager will queue them and refresh when the batch is finished
|
||||
4. **Use descriptive names** - Name your folders clearly (e.g., "SciFi", "Mystery", "Non-Fiction")
|
||||
5. **Keep credentials saved** - Save your WiFi password for quick reconnection in the future
|
||||
6. **Exit when done** - Press **Back** to exit the WiFi screen and save battery
|
||||
|
||||
---
|
||||
|
||||
## Exiting WiFi Mode
|
||||
|
||||
When you're finished uploading files:
|
||||
|
||||
1. Press the **Back** button on your CrossPoint Reader
|
||||
2. The web server will automatically stop
|
||||
3. WiFi will disconnect to conserve battery
|
||||
4. You'll return to the previous screen
|
||||
|
||||
Your uploaded files will be immediately available in the file browser!
|
||||
|
||||
---
|
||||
1. Use **Create Hotspot** when no trusted network is available.
|
||||
2. Prefer `crosspoint.local` when available, but keep the displayed IP address as a fallback.
|
||||
3. Move closer to the router if upload progress stalls in Join Network mode.
|
||||
4. Upload custom fonts through the Fonts page or copy them to `/.fonts/` or `/fonts/` on the SD card.
|
||||
5. Exit File Transfer mode when finished to conserve battery.
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [User Guide](../USER_GUIDE.md) - General device operation
|
||||
- [Troubleshooting](./troubleshooting.md) - Troubleshooting
|
||||
- [README](../README.md) - Project overview and features
|
||||
- [User Guide](../USER_GUIDE.md)
|
||||
- [Webserver Endpoints](./webserver-endpoints.md)
|
||||
- [SD Card Fonts](./sd-card-fonts.md)
|
||||
- [Troubleshooting](./troubleshooting.md)
|
||||
|
||||
@@ -3,7 +3,20 @@
|
||||
|
||||
class EpdFontFamily {
|
||||
public:
|
||||
enum Style : uint8_t { REGULAR = 0, BOLD = 1, ITALIC = 2, BOLD_ITALIC = 3, UNDERLINE = 4 };
|
||||
// Bitmask of text style flags carried per-word through layout and serialized in page cache.
|
||||
// Bits 0-1 select the font variant (BOLD/ITALIC); bits 2-5 are decoration/positioning overlays
|
||||
// applied at render time without changing the underlying font. getFont() ignores all bits
|
||||
// above bit 1 so decorations compose freely with bold/italic (e.g. BOLD | UNDERLINE | SUP).
|
||||
enum Style : uint8_t {
|
||||
REGULAR = 0,
|
||||
BOLD = 1,
|
||||
ITALIC = 2,
|
||||
BOLD_ITALIC = 3,
|
||||
UNDERLINE = 4, // drawn as a line below baseline by TextBlock::render()
|
||||
STRIKETHROUGH = 8, // drawn as a line through midline by TextBlock::render()
|
||||
SUP = 16, // superscript: glyph scaled 50%, raised ~40% of ascender
|
||||
SUB = 32, // subscript: glyph scaled 50%, lowered ~25% of ascender
|
||||
};
|
||||
|
||||
explicit EpdFontFamily(const EpdFont* regular, const EpdFont* bold = nullptr, const EpdFont* italic = nullptr,
|
||||
const EpdFont* boldItalic = nullptr)
|
||||
|
||||
+133
-75
@@ -9,16 +9,20 @@
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include "EpdFontFamily.h"
|
||||
|
||||
static_assert(sizeof(EpdGlyph) == 16, "EpdGlyph must be 16 bytes to match .cpfont file layout");
|
||||
static_assert(sizeof(EpdUnicodeInterval) == 12, "EpdUnicodeInterval must be 12 bytes to match .cpfont file layout");
|
||||
static_assert(sizeof(EpdKernClassEntry) == 3, "EpdKernClassEntry must be 3 bytes to match .cpfont file layout");
|
||||
static_assert(sizeof(EpdLigaturePair) == 8, "EpdLigaturePair must be 8 bytes to match .cpfont file layout");
|
||||
|
||||
// FNV-1a hash for content-based font ID generation
|
||||
static constexpr uint32_t FNV_OFFSET = 2166136261u;
|
||||
static constexpr uint32_t FNV_PRIME = 16777619u;
|
||||
namespace {
|
||||
|
||||
static uint32_t fnv1a(const uint8_t* data, size_t len, uint32_t hash = FNV_OFFSET) {
|
||||
// FNV-1a hash for content-based font ID generation
|
||||
constexpr uint32_t FNV_OFFSET = 2166136261u;
|
||||
constexpr uint32_t FNV_PRIME = 16777619u;
|
||||
|
||||
uint32_t fnv1a(const uint8_t* data, size_t len, uint32_t hash = FNV_OFFSET) {
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
hash ^= data[i];
|
||||
hash *= FNV_PRIME;
|
||||
@@ -27,16 +31,44 @@ static uint32_t fnv1a(const uint8_t* data, size_t len, uint32_t hash = FNV_OFFSE
|
||||
}
|
||||
|
||||
// .cpfont magic bytes
|
||||
static constexpr char CPFONT_MAGIC[8] = {'C', 'P', 'F', 'O', 'N', 'T', '\0', '\0'};
|
||||
constexpr char CPFONT_MAGIC[8] = {'C', 'P', 'F', 'O', 'N', 'T', '\0', '\0'};
|
||||
// CPFONT_VERSION is defined as a #define in SdCardFont.h so it can be
|
||||
// stringified into FONT_MANIFEST_URL.
|
||||
static constexpr uint32_t HEADER_SIZE = 32;
|
||||
static constexpr uint32_t STYLE_TOC_ENTRY_SIZE = 32;
|
||||
constexpr uint32_t HEADER_SIZE = 32;
|
||||
constexpr uint32_t STYLE_TOC_ENTRY_SIZE = 32;
|
||||
|
||||
// Helper to read little-endian values from byte buffer
|
||||
static inline uint16_t readU16(const uint8_t* p) { return p[0] | (p[1] << 8); }
|
||||
static inline int16_t readI16(const uint8_t* p) { return static_cast<int16_t>(p[0] | (p[1] << 8)); }
|
||||
static inline uint32_t readU32(const uint8_t* p) { return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); }
|
||||
inline uint16_t readU16(const uint8_t* p) { return p[0] | (p[1] << 8); }
|
||||
inline int16_t readI16(const uint8_t* p) { return static_cast<int16_t>(p[0] | (p[1] << 8)); }
|
||||
inline uint32_t readU32(const uint8_t* p) { return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); }
|
||||
|
||||
// Walks a null-terminated UTF-8 string and appends each unique codepoint to
|
||||
// codepoints[0..cpCount-1] via O(n²) dedup. Returns true if the buffer
|
||||
// reached maxCount (cap hit), false if all codepoints fit.
|
||||
bool collectUniqueCodepoints(const char* text, uint32_t* codepoints, uint32_t& cpCount, uint32_t maxCount) {
|
||||
const unsigned char* p = reinterpret_cast<const unsigned char*>(text);
|
||||
while (*p) {
|
||||
uint32_t cp = utf8NextCodepoint(&p);
|
||||
if (cp == 0) break;
|
||||
bool found = false;
|
||||
for (uint32_t i = 0; i < cpCount; i++) {
|
||||
if (codepoints[i] == cp) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (cpCount >= maxCount) return true;
|
||||
codepoints[cpCount++] = cp;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* asCStr(const std::string& s) { return s.c_str(); }
|
||||
const char* asCStr(const char* s) { return s; }
|
||||
|
||||
} // namespace
|
||||
|
||||
SdCardFont::~SdCardFont() { freeAll(); }
|
||||
|
||||
@@ -136,7 +168,7 @@ bool SdCardFont::loadStyleKernLigatureData(PerStyle& s) {
|
||||
return true;
|
||||
}
|
||||
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (!Storage.openFileForRead("SDCF", filePath_, file)) {
|
||||
LOG_ERR("SDCF", "Failed to open .cpfont for kern/lig: %s", filePath_);
|
||||
return false;
|
||||
@@ -313,7 +345,7 @@ bool SdCardFont::buildMiniKernMatrix(PerStyle& s, const uint32_t* codepoints, ui
|
||||
// Step 6: read the full matrix's rows for each used left class, keep only
|
||||
// columns for used right classes. One SD seek + one read per used left class;
|
||||
// a row is kernRightClassCount bytes (~200 for Literata).
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (!Storage.openFileForRead("SDCF", filePath_, file)) {
|
||||
LOG_ERR("SDCF", "Failed to open .cpfont for mini kern: %s", filePath_);
|
||||
freeStyleMiniKern(s);
|
||||
@@ -393,7 +425,7 @@ bool SdCardFont::load(const char* path) {
|
||||
strncpy(filePath_, path, sizeof(filePath_) - 1);
|
||||
filePath_[sizeof(filePath_) - 1] = '\0';
|
||||
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (!Storage.openFileForRead("SDCF", path, file)) {
|
||||
LOG_ERR("SDCF", "Failed to open .cpfont: %s", path);
|
||||
return false;
|
||||
@@ -587,6 +619,8 @@ int32_t SdCardFont::findGlobalGlyphIndex(const PerStyle& s, uint32_t codepoint)
|
||||
|
||||
int SdCardFont::prewarm(const char* utf8Text, uint8_t styleMask, bool metadataOnly) {
|
||||
if (!loaded_) return -1;
|
||||
styleMask = resolveStyleMask(styleMask);
|
||||
if (styleMask == 0) return 0;
|
||||
|
||||
unsigned long startMs = millis();
|
||||
|
||||
@@ -764,7 +798,7 @@ int SdCardFont::prewarmStyle(uint8_t styleIdx, const uint32_t* codepoints, uint3
|
||||
std::sort(readOrder, readOrder + validCount,
|
||||
[&](uint32_t a, uint32_t b) { return mappings[a].globalIndex < mappings[b].globalIndex; });
|
||||
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (!Storage.openFileForRead("SDCF", filePath_, file)) {
|
||||
LOG_ERR("SDCF", "Failed to reopen .cpfont for prewarm (style %u)", styleIdx);
|
||||
delete[] readOrder;
|
||||
@@ -1015,62 +1049,10 @@ uint16_t SdCardFont::getAdvance(uint32_t codepoint, uint8_t style) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SdCardFont::buildAdvanceTable(const char* utf8Text, uint8_t styleMask) {
|
||||
if (!loaded_) return -1;
|
||||
|
||||
// Note: advance table is preserved across calls. We only fetch codepoints
|
||||
// not already present, then merge them in. Use clearPersistentCache() to
|
||||
// wipe the table when the font/size/family changes.
|
||||
|
||||
unsigned long startMs = millis();
|
||||
|
||||
// Step 1: Extract unique codepoints, capped at MAX_UNIQUE_CODEPOINTS.
|
||||
// The dedup buffer is sized to the cap, not total chars — a large EPUB section
|
||||
// may contain 50K+ characters but real text has far fewer unique codepoints.
|
||||
// 4096 × 4 bytes = 16KB temporary; bounded regardless of input size.
|
||||
static constexpr uint32_t MAX_UNIQUE_CODEPOINTS = 4096;
|
||||
uint32_t* codepoints = new (std::nothrow) uint32_t[MAX_UNIQUE_CODEPOINTS];
|
||||
if (!codepoints) {
|
||||
LOG_ERR("SDCF", "buildAdvanceTable: failed to allocate codepoint buffer (%u bytes)", MAX_UNIQUE_CODEPOINTS * 4);
|
||||
return -1;
|
||||
}
|
||||
uint32_t cpCount = 0;
|
||||
bool hitCap = false;
|
||||
|
||||
// Second pass: collect unique codepoints via O(n²) dedup.
|
||||
// Bounded by uniqueCount × totalChars comparisons. For 2000 unique from 2291 total,
|
||||
// worst case ~4.6M comparisons of uint32_t — ~30ms on 160MHz RISC-V, acceptable
|
||||
// for one-time section indexing.
|
||||
const unsigned char* p = reinterpret_cast<const unsigned char*>(utf8Text);
|
||||
while (*p) {
|
||||
uint32_t cp = utf8NextCodepoint(&p);
|
||||
if (cp == 0) break;
|
||||
|
||||
bool found = false;
|
||||
for (uint32_t i = 0; i < cpCount; i++) {
|
||||
if (codepoints[i] == cp) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (cpCount >= MAX_UNIQUE_CODEPOINTS) {
|
||||
hitCap = true;
|
||||
break;
|
||||
}
|
||||
codepoints[cpCount++] = cp;
|
||||
}
|
||||
}
|
||||
if (hitCap) {
|
||||
LOG_ERR("SDCF", "buildAdvanceTable: unique codepoint cap (%u) hit, layout may be approximate",
|
||||
MAX_UNIQUE_CODEPOINTS);
|
||||
}
|
||||
|
||||
// Sort for ordered glyph index mapping and final table output
|
||||
std::sort(codepoints, codepoints + cpCount);
|
||||
|
||||
// Step 2: For each requested style, fetch any codepoints not yet cached and
|
||||
// merge them into the persistent advance table.
|
||||
// Given a sorted array of unique codepoints, resolve glyph indices per style,
|
||||
// batch-read advanceX from SD, and merge into the persistent advance table.
|
||||
// Caller owns the codepoints buffer.
|
||||
int SdCardFont::fetchAdvancesForCodepoints(uint32_t* codepoints, uint32_t cpCount, uint8_t styleMask) {
|
||||
int totalMissed = 0;
|
||||
for (uint8_t si = 0; si < MAX_STYLES; si++) {
|
||||
if (!(styleMask & (1 << si)) || !styles_[si].present) continue;
|
||||
@@ -1097,13 +1079,17 @@ int SdCardFont::buildAdvanceTable(const char* utf8Text, uint8_t styleMask) {
|
||||
|
||||
uint32_t needCount = 0;
|
||||
uint32_t missedThisStyle = 0;
|
||||
const int32_t replacementIdx = findGlobalGlyphIndex(s, REPLACEMENT_GLYPH);
|
||||
for (uint32_t i = 0; i < cpCount; i++) {
|
||||
const uint32_t cp = codepoints[i];
|
||||
if (advanceTableLookup(si, cp, nullptr)) continue; // already cached
|
||||
int32_t idx = findGlobalGlyphIndex(s, cp);
|
||||
if (idx < 0) {
|
||||
missedThisStyle++;
|
||||
continue;
|
||||
if (replacementIdx < 0) {
|
||||
missedThisStyle++;
|
||||
continue;
|
||||
}
|
||||
idx = replacementIdx;
|
||||
}
|
||||
mappings[needCount].codepoint = cp;
|
||||
mappings[needCount].glyphIndex = idx;
|
||||
@@ -1118,7 +1104,7 @@ int SdCardFont::buildAdvanceTable(const char* utf8Text, uint8_t styleMask) {
|
||||
[](const CpIdx& a, const CpIdx& b) { return a.glyphIndex < b.glyphIndex; });
|
||||
|
||||
// Open file once and read advanceX for each needed glyph.
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (!Storage.openFileForRead("SDCF", filePath_, file)) {
|
||||
LOG_ERR("SDCF", "buildAdvanceTable: failed to open .cpfont for style %u", si);
|
||||
continue;
|
||||
@@ -1165,12 +1151,55 @@ int SdCardFont::buildAdvanceTable(const char* utf8Text, uint8_t styleMask) {
|
||||
ADVANCE_CACHE_LIMIT);
|
||||
}
|
||||
|
||||
delete[] codepoints;
|
||||
return totalMissed;
|
||||
}
|
||||
|
||||
template <typename Iter>
|
||||
int SdCardFont::buildAdvanceTableRange(Iter begin, Iter end, bool includeSpace, bool includeHyphen, uint8_t styleMask) {
|
||||
if (!loaded_) return -1;
|
||||
styleMask = resolveStyleMask(styleMask);
|
||||
if (styleMask == 0) return 0;
|
||||
|
||||
unsigned long startMs = millis();
|
||||
|
||||
// +2 reserved slots for space and hyphen injected after the main scan.
|
||||
static constexpr uint32_t MAX_UNIQUE_CODEPOINTS = 4096;
|
||||
uint32_t* codepoints = new (std::nothrow) uint32_t[MAX_UNIQUE_CODEPOINTS + 2];
|
||||
if (!codepoints) {
|
||||
LOG_ERR("SDCF", "buildAdvanceTable: failed to allocate codepoint buffer (%u bytes)", MAX_UNIQUE_CODEPOINTS * 4);
|
||||
return -1;
|
||||
}
|
||||
uint32_t cpCount = 0;
|
||||
bool hitCap = false;
|
||||
|
||||
for (auto it = begin; it != end && !hitCap; ++it) {
|
||||
hitCap = collectUniqueCodepoints(asCStr(*it), codepoints, cpCount, MAX_UNIQUE_CODEPOINTS);
|
||||
}
|
||||
|
||||
if (includeSpace && std::none_of(codepoints, codepoints + cpCount, [](uint32_t c) { return c == ' '; }))
|
||||
codepoints[cpCount++] = ' ';
|
||||
if (includeHyphen && std::none_of(codepoints, codepoints + cpCount, [](uint32_t c) { return c == '-'; }))
|
||||
codepoints[cpCount++] = '-';
|
||||
|
||||
if (hitCap) {
|
||||
LOG_ERR("SDCF", "buildAdvanceTable: unique codepoint cap (%u) hit, layout may be approximate",
|
||||
MAX_UNIQUE_CODEPOINTS);
|
||||
}
|
||||
std::sort(codepoints, codepoints + cpCount);
|
||||
int totalMissed = fetchAdvancesForCodepoints(codepoints, cpCount, styleMask);
|
||||
delete[] codepoints;
|
||||
stats_.prewarmTotalMs = millis() - startMs;
|
||||
return totalMissed;
|
||||
}
|
||||
|
||||
int SdCardFont::buildAdvanceTable(const char* utf8Text, uint8_t styleMask) {
|
||||
return buildAdvanceTableRange(&utf8Text, &utf8Text + 1, false, false, styleMask);
|
||||
}
|
||||
|
||||
int SdCardFont::buildAdvanceTable(const std::vector<std::string>& words, bool includeHyphen, uint8_t styleMask) {
|
||||
return buildAdvanceTableRange(words.begin(), words.end(), words.size() > 1, includeHyphen, styleMask);
|
||||
}
|
||||
|
||||
// --- Stats ---
|
||||
|
||||
void SdCardFont::logStats(const char* label) {
|
||||
@@ -1190,6 +1219,35 @@ EpdFont* SdCardFont::getEpdFont(uint8_t style) {
|
||||
|
||||
bool SdCardFont::hasStyle(uint8_t style) const { return styles_[style & (MAX_STYLES - 1)].present; }
|
||||
|
||||
uint8_t SdCardFont::resolveStyle(uint8_t style) const {
|
||||
static const uint8_t kFallbacks[MAX_STYLES][MAX_STYLES] = {
|
||||
// REGULAR: REGULAR -> BOLD -> ITALIC -> BOLD_ITALIC
|
||||
{EpdFontFamily::REGULAR, EpdFontFamily::BOLD, EpdFontFamily::ITALIC, EpdFontFamily::BOLD_ITALIC},
|
||||
// BOLD: BOLD -> REGULAR -> BOLD_ITALIC -> ITALIC
|
||||
{EpdFontFamily::BOLD, EpdFontFamily::REGULAR, EpdFontFamily::BOLD_ITALIC, EpdFontFamily::ITALIC},
|
||||
// ITALIC: ITALIC -> REGULAR -> BOLD_ITALIC -> BOLD
|
||||
{EpdFontFamily::ITALIC, EpdFontFamily::REGULAR, EpdFontFamily::BOLD_ITALIC, EpdFontFamily::BOLD},
|
||||
// BOLD_ITALIC: BOLD_ITALIC -> BOLD -> ITALIC -> REGULAR
|
||||
{EpdFontFamily::BOLD_ITALIC, EpdFontFamily::BOLD, EpdFontFamily::ITALIC, EpdFontFamily::REGULAR},
|
||||
};
|
||||
|
||||
const uint8_t styleBits = style & (MAX_STYLES - 1);
|
||||
for (uint8_t candidate : kFallbacks[styleBits]) {
|
||||
if (styles_[candidate].present) return candidate;
|
||||
}
|
||||
return EpdFontFamily::REGULAR;
|
||||
}
|
||||
|
||||
uint8_t SdCardFont::resolveStyleMask(uint8_t styleMask) const {
|
||||
uint8_t resolvedMask = 0;
|
||||
for (uint8_t si = 0; si < MAX_STYLES; si++) {
|
||||
if (styleMask & (1 << si)) {
|
||||
resolvedMask |= static_cast<uint8_t>(1u << resolveStyle(si));
|
||||
}
|
||||
}
|
||||
return resolvedMask;
|
||||
}
|
||||
|
||||
// --- On-demand glyph loading (overflow buffer) ---
|
||||
|
||||
const EpdGlyph* SdCardFont::onGlyphMiss(void* ctx, uint32_t codepoint) {
|
||||
@@ -1219,7 +1277,7 @@ const EpdGlyph* SdCardFont::onGlyphMiss(void* ctx, uint32_t codepoint) {
|
||||
bool wasAtCapacity = (self->overflowCount_ == OVERFLOW_CAPACITY);
|
||||
|
||||
// Read glyph metadata into temporary
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (!Storage.openFileForRead("SDCF", self->filePath_, file)) {
|
||||
LOG_ERR("SDCF", "Overflow: failed to open .cpfont");
|
||||
return nullptr;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "EpdFont.h"
|
||||
#include "EpdFontData.h"
|
||||
@@ -43,10 +45,11 @@ class SdCardFont {
|
||||
int prewarm(const char* utf8Text, uint8_t styleMask = 0x0F, bool metadataOnly = false);
|
||||
|
||||
// Build a compact advance-only table for layout measurement.
|
||||
// Extracts ALL unique codepoints from utf8Text (no MAX_PAGE_GLYPHS cap),
|
||||
// Extracts ALL unique codepoints from words (no MAX_PAGE_GLYPHS cap),
|
||||
// batch-reads advanceX from SD, stores in a sorted per-style table.
|
||||
// Returns number of codepoints not found in font coverage.
|
||||
int buildAdvanceTable(const char* utf8Text, uint8_t styleMask = 0x0F);
|
||||
int buildAdvanceTable(const std::vector<std::string>& words, bool includeHyphen, uint8_t styleMask = 0x0F);
|
||||
|
||||
// Look up advanceX for a codepoint from the advance table.
|
||||
// Returns the 12.4 fixed-point advance, or 0 if not found.
|
||||
@@ -71,6 +74,13 @@ class SdCardFont {
|
||||
// Returns true if the given style is present in this font file.
|
||||
bool hasStyle(uint8_t style) const;
|
||||
|
||||
// Resolve requested style bits to the closest present style.
|
||||
uint8_t resolveStyle(uint8_t style) const;
|
||||
|
||||
// Resolve every requested style bit through fallback and return the actual
|
||||
// styles that need cache/advance preparation.
|
||||
uint8_t resolveStyleMask(uint8_t styleMask) const;
|
||||
|
||||
// Number of styles present in this font file.
|
||||
uint8_t styleCount() const { return styleCount_; }
|
||||
|
||||
@@ -229,6 +239,9 @@ class SdCardFont {
|
||||
void applyKernLigaturePointers(PerStyle& s, EpdFontData& data) const;
|
||||
void applyGlyphMissCallback(uint8_t styleIdx);
|
||||
int32_t findGlobalGlyphIndex(const PerStyle& s, uint32_t codepoint) const;
|
||||
int fetchAdvancesForCodepoints(uint32_t* codepoints, uint32_t cpCount, uint8_t styleMask);
|
||||
template <typename Iter>
|
||||
int buildAdvanceTableRange(Iter begin, Iter end, bool includeSpace, bool includeHyphen, uint8_t styleMask);
|
||||
int prewarmStyle(uint8_t styleIdx, const uint32_t* codepoints, uint32_t cpCount, bool metadataOnly);
|
||||
|
||||
// Global helpers
|
||||
|
||||
@@ -77,12 +77,12 @@ bool SdCardFontRegistry::parseFilename(const char* filename, uint8_t& size, uint
|
||||
}
|
||||
|
||||
void SdCardFontRegistry::scanDirectory(const char* dirPath, SdCardFontFamilyInfo& family) {
|
||||
FsFile dir = Storage.open(dirPath);
|
||||
HalFile dir = Storage.open(dirPath);
|
||||
if (!dir || !dir.isDirectory()) return;
|
||||
|
||||
char nameBuffer[128];
|
||||
while (true) {
|
||||
FsFile entry = dir.openNextFile();
|
||||
HalFile entry = dir.openNextFile();
|
||||
if (!entry) break;
|
||||
if (entry.isDirectory()) {
|
||||
entry.close();
|
||||
@@ -126,7 +126,7 @@ void SdCardFontRegistry::scanDirectory(const char* dirPath, SdCardFontFamilyInfo
|
||||
// Skips families whose names already exist in `out` (de-duplicates between
|
||||
// the hidden and visible roots — first scan wins).
|
||||
void SdCardFontRegistry::scanRoot(const char* rootPath, std::vector<SdCardFontFamilyInfo>& out) {
|
||||
FsFile root = Storage.open(rootPath);
|
||||
HalFile root = Storage.open(rootPath);
|
||||
if (!root) {
|
||||
LOG_DBG("SDREG", "Fonts directory not found: %s", rootPath);
|
||||
return;
|
||||
@@ -138,7 +138,7 @@ void SdCardFontRegistry::scanRoot(const char* rootPath, std::vector<SdCardFontFa
|
||||
|
||||
char nameBuffer[128];
|
||||
while (true) {
|
||||
FsFile entry = root.openNextFile();
|
||||
HalFile entry = root.openNextFile();
|
||||
if (!entry) break;
|
||||
if (entry.isDirectory()) {
|
||||
entry.getName(nameBuffer, sizeof(nameBuffer));
|
||||
|
||||
@@ -33,22 +33,6 @@
|
||||
#include <builtinFonts/notosans_18_bolditalic.h>
|
||||
#include <builtinFonts/notosans_18_italic.h>
|
||||
#include <builtinFonts/notosans_18_regular.h>
|
||||
#include <builtinFonts/opendyslexic_10_bold.h>
|
||||
#include <builtinFonts/opendyslexic_10_bolditalic.h>
|
||||
#include <builtinFonts/opendyslexic_10_italic.h>
|
||||
#include <builtinFonts/opendyslexic_10_regular.h>
|
||||
#include <builtinFonts/opendyslexic_12_bold.h>
|
||||
#include <builtinFonts/opendyslexic_12_bolditalic.h>
|
||||
#include <builtinFonts/opendyslexic_12_italic.h>
|
||||
#include <builtinFonts/opendyslexic_12_regular.h>
|
||||
#include <builtinFonts/opendyslexic_14_bold.h>
|
||||
#include <builtinFonts/opendyslexic_14_bolditalic.h>
|
||||
#include <builtinFonts/opendyslexic_14_italic.h>
|
||||
#include <builtinFonts/opendyslexic_14_regular.h>
|
||||
#include <builtinFonts/opendyslexic_8_bold.h>
|
||||
#include <builtinFonts/opendyslexic_8_bolditalic.h>
|
||||
#include <builtinFonts/opendyslexic_8_italic.h>
|
||||
#include <builtinFonts/opendyslexic_8_regular.h>
|
||||
#include <builtinFonts/ubuntu_10_bold.h>
|
||||
#include <builtinFonts/ubuntu_10_regular.h>
|
||||
#include <builtinFonts/ubuntu_12_bold.h>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,8 @@
|
||||
!NotoSerif/**
|
||||
!NotoSans/
|
||||
!NotoSans/**
|
||||
!NotoSansHebrew/
|
||||
!NotoSansHebrew/**
|
||||
!OpenDyslexic/
|
||||
!OpenDyslexic/**
|
||||
!Ubuntu/
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,93 @@
|
||||
Copyright 2022 The Noto Project Authors (https://github.com/notofonts/hebrew)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://openfontlicense.org
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1558
-1039
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -80,42 +80,6 @@ ruby -rdigest -e 'puts [
|
||||
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
|
||||
))"
|
||||
|
||||
echo "#define OPENDYSLEXIC_8_FONT_ID ($(
|
||||
ruby -rdigest -e 'puts [
|
||||
"./opendyslexic_8_regular.h",
|
||||
"./opendyslexic_8_bold.h",
|
||||
"./opendyslexic_8_bolditalic.h",
|
||||
"./opendyslexic_8_italic.h",
|
||||
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
|
||||
))"
|
||||
|
||||
echo "#define OPENDYSLEXIC_10_FONT_ID ($(
|
||||
ruby -rdigest -e 'puts [
|
||||
"./opendyslexic_10_regular.h",
|
||||
"./opendyslexic_10_bold.h",
|
||||
"./opendyslexic_10_bolditalic.h",
|
||||
"./opendyslexic_10_italic.h",
|
||||
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
|
||||
))"
|
||||
|
||||
echo "#define OPENDYSLEXIC_12_FONT_ID ($(
|
||||
ruby -rdigest -e 'puts [
|
||||
"./opendyslexic_12_regular.h",
|
||||
"./opendyslexic_12_bold.h",
|
||||
"./opendyslexic_12_bolditalic.h",
|
||||
"./opendyslexic_12_italic.h",
|
||||
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
|
||||
))"
|
||||
|
||||
echo "#define OPENDYSLEXIC_14_FONT_ID ($(
|
||||
ruby -rdigest -e 'puts [
|
||||
"./opendyslexic_14_regular.h",
|
||||
"./opendyslexic_14_bold.h",
|
||||
"./opendyslexic_14_bolditalic.h",
|
||||
"./opendyslexic_14_italic.h",
|
||||
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
|
||||
))"
|
||||
|
||||
echo "#define UI_10_FONT_ID ($(
|
||||
ruby -rdigest -e 'puts [
|
||||
"./ubuntu_10_regular.h",
|
||||
|
||||
@@ -46,6 +46,7 @@ DEFAULT_CONFIG = SCRIPT_DIR / "sd-fonts.yaml"
|
||||
DEFAULT_OUTPUT = SCRIPT_DIR / "output"
|
||||
DOWNLOAD_DIR = SCRIPT_DIR / "downloaded_fonts"
|
||||
INSTANCE_DIR = SCRIPT_DIR / "instanced_fonts"
|
||||
DEFAULT_FALLBACK_FONT = EPDFONTS_DIR / "builtinFonts/source/NotoSans/NotoSans-Regular.ttf"
|
||||
|
||||
|
||||
def download_font(url: str, dest: Path) -> Path:
|
||||
@@ -186,12 +187,14 @@ def build_family(
|
||||
# Multi-style mode
|
||||
for style_name, font_path in resolved_styles.items():
|
||||
cmd.extend([f"--{style_name}", str(font_path)])
|
||||
cmd.extend([f"--fallback-{style_name}", str(DEFAULT_FALLBACK_FONT)])
|
||||
else:
|
||||
# Single-style mode
|
||||
style_name = next(iter(resolved_styles))
|
||||
font_path = resolved_styles[style_name]
|
||||
cmd.append(str(font_path))
|
||||
cmd.extend(["--style", style_name])
|
||||
cmd.extend([f"--fallback-{style_name}", str(DEFAULT_FALLBACK_FONT)])
|
||||
|
||||
cmd.extend(["--intervals", intervals])
|
||||
cmd.extend(["--sizes", sizes])
|
||||
@@ -330,6 +333,15 @@ def main():
|
||||
print("ERROR: No families defined in config", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if not DEFAULT_FALLBACK_FONT.exists() or not DEFAULT_FALLBACK_FONT.is_file():
|
||||
print(
|
||||
"ERROR: Missing default fallback font: "
|
||||
f"{DEFAULT_FALLBACK_FONT}\n"
|
||||
"This font is required for fallback glyphs in SD font builds.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
# Filter if --only specified
|
||||
if args.only:
|
||||
only_names = set(args.only.split(","))
|
||||
|
||||
@@ -7,7 +7,6 @@ cd "$(dirname "$0")"
|
||||
READER_FONT_STYLES=("Regular" "Italic" "Bold" "BoldItalic")
|
||||
NOTOSERIF_FONT_SIZES=(12 14 16 18)
|
||||
NOTOSANS_FONT_SIZES=(12 14 16 18)
|
||||
OPENDYSLEXIC_FONT_SIZES=(8 10 12 14)
|
||||
|
||||
for size in ${NOTOSERIF_FONT_SIZES[@]}; do
|
||||
for style in ${READER_FONT_STYLES[@]}; do
|
||||
@@ -29,16 +28,6 @@ for size in ${NOTOSANS_FONT_SIZES[@]}; do
|
||||
done
|
||||
done
|
||||
|
||||
for size in ${OPENDYSLEXIC_FONT_SIZES[@]}; do
|
||||
for style in ${READER_FONT_STYLES[@]}; do
|
||||
font_name="opendyslexic_${size}_$(echo $style | tr '[:upper:]' '[:lower:]')"
|
||||
font_path="../builtinFonts/source/OpenDyslexic/OpenDyslexic-${style}.otf"
|
||||
output_path="../builtinFonts/${font_name}.h"
|
||||
python fontconvert.py $font_name $size $font_path --2bit --compress > $output_path
|
||||
echo "Generated $output_path"
|
||||
done
|
||||
done
|
||||
|
||||
UI_FONT_SIZES=(10 12)
|
||||
UI_FONT_STYLES=("Regular" "Bold")
|
||||
|
||||
@@ -46,13 +35,23 @@ for size in ${UI_FONT_SIZES[@]}; do
|
||||
for style in ${UI_FONT_STYLES[@]}; do
|
||||
font_name="ubuntu_${size}_$(echo $style | tr '[:upper:]' '[:lower:]')"
|
||||
font_path="../builtinFonts/source/Ubuntu/Ubuntu-${style}.ttf"
|
||||
hebrew_path="../builtinFonts/source/NotoSansHebrew/NotoSansHebrew-${style}.ttf"
|
||||
# Ubuntu lacks the Latin Extended Additional block (U+1EA0-U+1EF9) used for
|
||||
# Vietnamese tone marks. Append a Vietnamese-only Ubuntu cut so those glyphs
|
||||
# are filled from it while every glyph Ubuntu already has stays unchanged
|
||||
# (fontstack is ordered by descending priority).
|
||||
viet_path="../builtinFonts/source/Ubuntu/Ubuntu-Vietnamese-${style}.ttf"
|
||||
output_path="../builtinFonts/${font_name}.h"
|
||||
python fontconvert.py $font_name $size $font_path > $output_path
|
||||
python fontconvert.py $font_name $size $font_path $hebrew_path $viet_path \
|
||||
--additional-intervals 0x05D0,0x05EA > $output_path
|
||||
echo "Generated $output_path"
|
||||
done
|
||||
done
|
||||
|
||||
python fontconvert.py notosans_8_regular 8 ../builtinFonts/source/NotoSans/NotoSans-Regular.ttf > ../builtinFonts/notosans_8_regular.h
|
||||
python fontconvert.py notosans_8_regular 8 \
|
||||
../builtinFonts/source/NotoSans/NotoSans-Regular.ttf \
|
||||
../builtinFonts/source/NotoSansHebrew/NotoSansHebrew-Regular.ttf \
|
||||
--additional-intervals 0x05D0,0x05EA > ../builtinFonts/notosans_8_regular.h
|
||||
|
||||
echo ""
|
||||
echo "Running compression verification..."
|
||||
|
||||
@@ -43,6 +43,7 @@ INTERVAL_PRESETS = {
|
||||
(0x1E00, 0x1EFF), (0x2000, 0x206F), (0xFB00, 0xFB06)],
|
||||
"greek": [(0x0370, 0x03FF), (0x1F00, 0x1FFF)],
|
||||
"cyrillic": [(0x0400, 0x04FF), (0x0500, 0x052F)],
|
||||
"hebrew": [(0x0590, 0x05FF), (0xFB1D, 0xFB4F)],
|
||||
"georgian": [(0x10A0, 0x10FF), (0x2D00, 0x2D2F)],
|
||||
"armenian": [(0x0530, 0x058F)],
|
||||
"ethiopic": [(0x1200, 0x137F), (0x1380, 0x139F), (0x2D80, 0x2DDF)],
|
||||
@@ -59,12 +60,14 @@ INTERVAL_PRESETS = {
|
||||
(0x2190, 0x21FF), (0x2200, 0x22FF), (0x2500, 0x257F),
|
||||
(0x25A0, 0x25FF), (0x2600, 0x26FF), (0x2700, 0x27BF)],
|
||||
# Composite preset for English-language literary fiction including scifi/popsci.
|
||||
# Greek for physics terms, math operators, miscellaneous symbols (♪♫♬), dingbats.
|
||||
# Greek for physics terms, math operators, geometric shapes, uncommon
|
||||
# dialogue punctuation, CJK quote marks, miscellaneous symbols (♪♫♬), dingbats.
|
||||
"reading": [(0x0020, 0x024F), (0x0300, 0x036F), (0x0370, 0x03FF),
|
||||
(0x0400, 0x04FF), (0x1E00, 0x1EFF), (0x2000, 0x206F),
|
||||
(0x2070, 0x209F), (0x20A0, 0x20CF), (0x2150, 0x218F),
|
||||
(0x2190, 0x21FF), (0x2200, 0x22FF), (0x2500, 0x257F),
|
||||
(0x25A0, 0x25FF), (0x2600, 0x26FF), (0x2700, 0x27BF),
|
||||
(0x2900, 0x29FF), (0x2E00, 0x2E7F), (0x3000, 0x303F),
|
||||
(0xFB00, 0xFB06)],
|
||||
# Matches the built-in font intervals from fontconvert.py exactly
|
||||
"builtin": [(0x0000, 0x007F), (0x0080, 0x00FF), (0x0100, 0x017F),
|
||||
@@ -515,7 +518,8 @@ def extract_ligatures_fonttools(font_path, codepoints):
|
||||
return pairs
|
||||
|
||||
|
||||
def rasterize_font_style(fontfile, size, intervals, style_id=0, force_autohint=False):
|
||||
def rasterize_font_style(fontfile, size, intervals, style_id=0, force_autohint=False,
|
||||
fallback_fontfile=None):
|
||||
"""Rasterize all glyphs for one font style. Returns StyleRasterData."""
|
||||
import freetype
|
||||
|
||||
@@ -528,6 +532,10 @@ def rasterize_font_style(fontfile, size, intervals, style_id=0, force_autohint=F
|
||||
# it before set_char_size() would waste work at the default size and risk
|
||||
# Invalid_Size_Handle on some fonts.
|
||||
face.set_char_size(size << 6, size << 6, 150, 150)
|
||||
fallback_face = None
|
||||
if fallback_fontfile:
|
||||
fallback_face = freetype.Face(fallback_fontfile)
|
||||
fallback_face.set_char_size(size << 6, size << 6, 150, 150)
|
||||
|
||||
load_flags = freetype.FT_LOAD_RENDER
|
||||
if force_autohint:
|
||||
@@ -538,6 +546,11 @@ def rasterize_font_style(fontfile, size, intervals, style_id=0, force_autohint=F
|
||||
if glyph_index > 0:
|
||||
face.load_glyph(glyph_index, load_flags)
|
||||
return face
|
||||
if fallback_face:
|
||||
fallback_glyph_index = fallback_face.get_char_index(code_point)
|
||||
if fallback_glyph_index > 0:
|
||||
fallback_face.load_glyph(fallback_glyph_index, load_flags)
|
||||
return fallback_face
|
||||
return None
|
||||
|
||||
# Validate intervals: remove codepoints not present in the font.
|
||||
@@ -549,7 +562,9 @@ def rasterize_font_style(fontfile, size, intervals, style_id=0, force_autohint=F
|
||||
for i_start, i_end in intervals:
|
||||
start = i_start
|
||||
for code_point in range(i_start, i_end + 1):
|
||||
if face.get_char_index(code_point) == 0:
|
||||
has_primary = face.get_char_index(code_point) != 0
|
||||
has_fallback = fallback_face and fallback_face.get_char_index(code_point) != 0
|
||||
if not has_primary and not has_fallback:
|
||||
if start < code_point:
|
||||
validated_intervals.append((start, code_point - 1))
|
||||
start = code_point + 1
|
||||
@@ -760,10 +775,11 @@ def style_sections_total_size(sections):
|
||||
# --- File writers ---
|
||||
|
||||
def generate_cpfont_multistyle(style_fonts, size, intervals, output_path,
|
||||
force_autohint=False):
|
||||
force_autohint=False, fallback_style_fonts=None):
|
||||
"""Generate a multi-style v4 .cpfont file.
|
||||
|
||||
style_fonts: dict of {style_id: fontfile_path} e.g. {0: "Regular.ttf", 2: "Italic.ttf"}
|
||||
fallback_style_fonts: optional dict of {style_id: fallback_fontfile_path}
|
||||
"""
|
||||
MAGIC = b"CPFONT\x00\x00"
|
||||
HEADER_SIZE = 32
|
||||
@@ -773,12 +789,15 @@ def generate_cpfont_multistyle(style_fonts, size, intervals, output_path,
|
||||
|
||||
# Rasterize each style
|
||||
raster_data = {} # style_id -> StyleRasterData
|
||||
fallback_style_fonts = fallback_style_fonts or {}
|
||||
for style_id in sorted(style_fonts.keys()):
|
||||
fontfile = style_fonts[style_id]
|
||||
fallback_fontfile = fallback_style_fonts.get(style_id)
|
||||
print(f" Rasterizing style {style_id}...", file=sys.stderr)
|
||||
raster_data[style_id] = rasterize_font_style(
|
||||
fontfile, size, intervals, style_id=style_id,
|
||||
force_autohint=force_autohint)
|
||||
force_autohint=force_autohint,
|
||||
fallback_fontfile=fallback_fontfile)
|
||||
|
||||
# Pack binary sections for each style
|
||||
packed_sections = {} # style_id -> tuple of section bytearrays
|
||||
@@ -889,6 +908,14 @@ def main():
|
||||
help="Font file for italic style.")
|
||||
parser.add_argument("--bolditalic", dest="font_bolditalic",
|
||||
help="Font file for bold-italic style.")
|
||||
parser.add_argument("--fallback-regular", dest="fallback_regular",
|
||||
help="Fallback font file for regular style.")
|
||||
parser.add_argument("--fallback-bold", dest="fallback_bold",
|
||||
help="Fallback font file for bold style.")
|
||||
parser.add_argument("--fallback-italic", dest="fallback_italic",
|
||||
help="Fallback font file for italic style.")
|
||||
parser.add_argument("--fallback-bolditalic", dest="fallback_bolditalic",
|
||||
help="Fallback font file for bold-italic style.")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -910,6 +937,16 @@ def main():
|
||||
if args.font_bolditalic:
|
||||
style_fonts[3] = args.font_bolditalic
|
||||
|
||||
fallback_style_fonts = {}
|
||||
if args.fallback_regular:
|
||||
fallback_style_fonts[0] = args.fallback_regular
|
||||
if args.fallback_bold:
|
||||
fallback_style_fonts[1] = args.fallback_bold
|
||||
if args.fallback_italic:
|
||||
fallback_style_fonts[2] = args.fallback_italic
|
||||
if args.fallback_bolditalic:
|
||||
fallback_style_fonts[3] = args.fallback_bolditalic
|
||||
|
||||
is_multistyle = len(style_fonts) > 0
|
||||
fontfile = args.fontfile
|
||||
|
||||
@@ -977,7 +1014,8 @@ def main():
|
||||
print(f"Generating {output_path} (size {sz}, {len(style_fonts)} style(s), v4)...", file=sys.stderr)
|
||||
total_size += generate_cpfont_multistyle(
|
||||
style_fonts, sz, intervals, output_path,
|
||||
force_autohint=args.force_autohint)
|
||||
force_autohint=args.force_autohint,
|
||||
fallback_style_fonts=fallback_style_fonts)
|
||||
print(f"\nTotal: {len(sizes)} files, {total_size / 1024 / 1024:.2f} MB", file=sys.stderr)
|
||||
|
||||
|
||||
|
||||
@@ -113,6 +113,27 @@ families:
|
||||
italic: {url: "https://raw.githubusercontent.com/google/fonts/main/ofl/bitter/Bitter-Italic%5Bwght%5D.ttf", variable: {wght: 500}}
|
||||
bolditalic: {url: "https://raw.githubusercontent.com/google/fonts/main/ofl/bitter/Bitter-Italic%5Bwght%5D.ttf", variable: {wght: 700}}
|
||||
|
||||
- name: Domitian
|
||||
description: "A humanist serif for literary reading (Latin, Greek, Cyrillic)"
|
||||
intervals: latin-ext,greek,cyrillic
|
||||
sizes: [12, 14, 16, 18]
|
||||
styles:
|
||||
regular: {url: "https://mirrors.ctan.org/fonts/domitian/opentype/Domitian-Roman.otf"}
|
||||
bold: {url: "https://mirrors.ctan.org/fonts/domitian/opentype/Domitian-Bold.otf"}
|
||||
italic: {url: "https://mirrors.ctan.org/fonts/domitian/opentype/Domitian-Italic.otf"}
|
||||
bolditalic: {url: "https://mirrors.ctan.org/fonts/domitian/opentype/Domitian-BoldItalic.otf"}
|
||||
|
||||
- name: LibreBaskerville
|
||||
description: "A serif reimplementing the classic Baskerville (Latin)"
|
||||
intervals: latin-ext
|
||||
sizes: [12, 14, 16, 18]
|
||||
styles:
|
||||
regular: {url: "https://raw.githubusercontent.com/impallari/Libre-Baskerville/master/fonts/ttf/LibreBaskerville-Regular.ttf"}
|
||||
bold: {url: "https://raw.githubusercontent.com/impallari/Libre-Baskerville/master/fonts/ttf/LibreBaskerville-Bold.ttf"}
|
||||
italic: {url: "https://raw.githubusercontent.com/impallari/Libre-Baskerville/master/fonts/ttf/LibreBaskerville-Italic.ttf"}
|
||||
bolditalic: {url: "https://raw.githubusercontent.com/impallari/Libre-Baskerville/master/fonts/ttf/LibreBaskerville-BoldItalic.ttf"}
|
||||
|
||||
|
||||
# ── Sans-serif ─────────────────────────────────────────────────────────
|
||||
|
||||
- name: NotoSansExtended
|
||||
@@ -187,6 +208,18 @@ families:
|
||||
italic: {url: "https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/TTF/SourceCodePro-It.ttf"}
|
||||
bolditalic: {url: "https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/TTF/SourceCodePro-BoldIt.ttf"}
|
||||
|
||||
# ── Dyslexia ───────────────────────────────────────────────────────────────
|
||||
|
||||
- name: OpenDyslexic
|
||||
description: "Dyslexia-friendly font (Latin)"
|
||||
intervals: latin-ext
|
||||
sizes: [8, 10, 12, 14]
|
||||
styles:
|
||||
regular: {path: "builtinFonts/source/OpenDyslexic/OpenDyslexic-Regular.otf"}
|
||||
bold: {path: "builtinFonts/source/OpenDyslexic/OpenDyslexic-Bold.otf"}
|
||||
italic: {path: "builtinFonts/source/OpenDyslexic/OpenDyslexic-Italic.otf"}
|
||||
bolditalic: {path: "builtinFonts/source/OpenDyslexic/OpenDyslexic-BoldItalic.otf"}
|
||||
|
||||
# ── Accessibility ──────────────────────────────────────────────────────
|
||||
|
||||
- name: AtkinsonHyperlegibleNext
|
||||
|
||||
+66
-29
@@ -44,7 +44,7 @@ bool Epub::findContentOpfFile(std::string* contentOpfFile) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Epub::parseContentOpf(BookMetadataCache::BookMetadata& bookMetadata) {
|
||||
bool Epub::parseContentOpf(BookMetadataCache::BookMetadata& bookMetadata, const bool writeSpineEntries) {
|
||||
std::string contentOpfFilePath;
|
||||
if (!findContentOpfFile(&contentOpfFilePath)) {
|
||||
LOG_ERR("EBP", "Could not find content.opf in zip");
|
||||
@@ -61,7 +61,8 @@ bool Epub::parseContentOpf(BookMetadataCache::BookMetadata& bookMetadata) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ContentOpfParser opfParser(getCachePath(), getBasePath(), contentOpfSize, bookMetadataCache.get());
|
||||
ContentOpfParser opfParser(getCachePath(), getBasePath(), contentOpfSize,
|
||||
writeSpineEntries ? bookMetadataCache.get() : nullptr);
|
||||
if (!opfParser.setup()) {
|
||||
LOG_ERR("EBP", "Could not setup content.opf parser");
|
||||
return false;
|
||||
@@ -104,8 +105,9 @@ bool Epub::parseContentOpf(BookMetadataCache::BookMetadata& bookMetadata) {
|
||||
const auto endPos = coverPageHtml.find('"', pos);
|
||||
if (endPos != std::string::npos) {
|
||||
const auto ref = std::string_view{coverPageHtml}.substr(pos, endPos - pos);
|
||||
// Check if it's an image file
|
||||
if (FsHelpers::hasPngExtension(ref) || FsHelpers::hasJpgExtension(ref) || FsHelpers::hasGifExtension(ref)) {
|
||||
// Cover BMP generation supports JPG/PNG only; skip GIF so an unsupported wrapper image
|
||||
// does not block a later supported cover reference.
|
||||
if (FsHelpers::hasPngExtension(ref) || FsHelpers::hasJpgExtension(ref)) {
|
||||
imageRef = ref;
|
||||
break;
|
||||
}
|
||||
@@ -116,7 +118,7 @@ bool Epub::parseContentOpf(BookMetadataCache::BookMetadata& bookMetadata) {
|
||||
}
|
||||
|
||||
if (!imageRef.empty()) {
|
||||
bookMetadata.coverItemHref = FsHelpers::normalisePath(coverPageBase + imageRef);
|
||||
bookMetadata.coverItemHref = FsHelpers::normalisePath(FsHelpers::decodeUriEscapes(coverPageBase + imageRef));
|
||||
LOG_DBG("EBP", "Found cover image from guide: %s", bookMetadata.coverItemHref.c_str());
|
||||
}
|
||||
}
|
||||
@@ -150,7 +152,7 @@ bool Epub::parseTocNcxFile() const {
|
||||
LOG_DBG("EBP", "Parsing toc ncx file: %s", tocNcxItem.c_str());
|
||||
|
||||
const auto tmpNcxPath = getCachePath() + "/toc.ncx";
|
||||
FsFile tempNcxFile;
|
||||
HalFile tempNcxFile;
|
||||
if (!Storage.openFileForWrite("EBP", tmpNcxPath, tempNcxFile)) {
|
||||
return false;
|
||||
}
|
||||
@@ -206,7 +208,7 @@ bool Epub::parseTocNavFile() const {
|
||||
LOG_DBG("EBP", "Parsing toc nav file: %s", tocNavItem.c_str());
|
||||
|
||||
const auto tmpNavPath = getCachePath() + "/toc.nav";
|
||||
FsFile tempNavFile;
|
||||
HalFile tempNavFile;
|
||||
if (!Storage.openFileForWrite("EBP", tmpNavPath, tempNavFile)) {
|
||||
return false;
|
||||
}
|
||||
@@ -254,6 +256,30 @@ bool Epub::parseTocNavFile() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Epub::discoverCssFilesFromZip() {
|
||||
const std::string& opfDir = contentBasePath;
|
||||
ZipFile zf(filepath);
|
||||
|
||||
if (!zf.enumerateFilePaths([&](std::string_view filePath) {
|
||||
if (!opfDir.empty() && filePath.find(opfDir) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FsHelpers::hasCssExtension(filePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (std::find(cssFiles.begin(), cssFiles.end(), filePath) != cssFiles.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DBG("EBP", "Discovered CSS file via ZIP enumeration: %.*s", (int)filePath.size(), filePath.data());
|
||||
cssFiles.push_back(std::string{filePath});
|
||||
})) {
|
||||
LOG_ERR("EBP", "Failed to enumerate ZIP file paths for CSS discovery");
|
||||
}
|
||||
}
|
||||
|
||||
void Epub::parseCssFiles() const {
|
||||
// Maximum CSS file size we'll attempt to parse (uncompressed)
|
||||
// Larger files risk memory exhaustion on ESP32
|
||||
@@ -297,7 +323,7 @@ void Epub::parseCssFiles() const {
|
||||
|
||||
// Extract CSS file to temp location
|
||||
const auto tmpCssPath = getCachePath() + "/.tmp.css";
|
||||
FsFile tempCssFile;
|
||||
HalFile tempCssFile;
|
||||
if (!Storage.openFileForWrite("EBP", tmpCssPath, tempCssFile)) {
|
||||
LOG_ERR("EBP", "Could not create temp CSS file");
|
||||
continue;
|
||||
@@ -328,9 +354,9 @@ void Epub::parseCssFiles() const {
|
||||
if (!cssParser->saveToCache()) {
|
||||
LOG_ERR("EBP", "Failed to save CSS rules to cache");
|
||||
}
|
||||
cssParser->clear();
|
||||
|
||||
LOG_DBG("EBP", "Loaded %zu CSS style rules from %zu files", cssParser->ruleCount(), cssFiles.size());
|
||||
cssParser->clear();
|
||||
}
|
||||
|
||||
// load in the meta data for the epub file
|
||||
@@ -350,11 +376,20 @@ bool Epub::load(const bool buildIfMissing, const bool skipLoadingCss) {
|
||||
LOG_DBG("EBP", "CSS rules cache missing or stale, attempting to parse CSS files");
|
||||
cssParser->deleteCache();
|
||||
|
||||
if (!parseContentOpf(bookMetadataCache->coreMetadata)) {
|
||||
BookMetadataCache::BookMetadata cachedMetadata = bookMetadataCache->coreMetadata;
|
||||
if (!parseContentOpf(cachedMetadata, /*writeSpineEntries=*/false)) {
|
||||
LOG_ERR("EBP", "Could not parse content.opf from cached bookMetadata for CSS files");
|
||||
// continue anyway - book will work without CSS and we'll still load any inline style CSS
|
||||
} else {
|
||||
discoverCssFilesFromZip();
|
||||
}
|
||||
bookMetadataCache.reset();
|
||||
parseCssFiles();
|
||||
bookMetadataCache.reset(new BookMetadataCache(cachePath));
|
||||
if (!bookMetadataCache->load()) {
|
||||
LOG_ERR("EBP", "Failed to reload cache after CSS rebuild");
|
||||
return false;
|
||||
}
|
||||
// Invalidate section caches so they are rebuilt with the new CSS
|
||||
Storage.removeDir((cachePath + "/sections").c_str());
|
||||
}
|
||||
@@ -391,6 +426,7 @@ bool Epub::load(const bool buildIfMissing, const bool skipLoadingCss) {
|
||||
LOG_ERR("EBP", "Could not parse content.opf");
|
||||
return false;
|
||||
}
|
||||
discoverCssFilesFromZip();
|
||||
if (!bookMetadataCache->endContentOpfPass()) {
|
||||
LOG_ERR("EBP", "Could not end writing content.opf pass");
|
||||
return false;
|
||||
@@ -448,6 +484,13 @@ bool Epub::load(const bool buildIfMissing, const bool skipLoadingCss) {
|
||||
LOG_DBG("EBP", "Could not cleanup tmp files - ignoring");
|
||||
}
|
||||
|
||||
if (!skipLoadingCss) {
|
||||
// Parse CSS before reloading book.bin to leave more heap for CSS rule-table growth.
|
||||
bookMetadataCache.reset();
|
||||
parseCssFiles();
|
||||
Storage.removeDir((cachePath + "/sections").c_str());
|
||||
}
|
||||
|
||||
// Reload the cache from disk so it's in the correct state
|
||||
bookMetadataCache.reset(new BookMetadataCache(cachePath));
|
||||
if (!bookMetadataCache->load()) {
|
||||
@@ -455,12 +498,6 @@ bool Epub::load(const bool buildIfMissing, const bool skipLoadingCss) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!skipLoadingCss) {
|
||||
// Parse CSS files after cache reload
|
||||
parseCssFiles();
|
||||
Storage.removeDir((cachePath + "/sections").c_str());
|
||||
}
|
||||
|
||||
LOG_DBG("EBP", "Loaded ePub: %s", filepath.c_str());
|
||||
return true;
|
||||
}
|
||||
@@ -545,7 +582,7 @@ bool Epub::generateCoverBmp(bool cropped) const {
|
||||
LOG_DBG("EBP", "Generating BMP from JPG cover image (%s mode)", cropped ? "cropped" : "fit");
|
||||
const auto coverJpgTempPath = getCachePath() + "/.cover.jpg";
|
||||
|
||||
FsFile coverJpg;
|
||||
HalFile coverJpg;
|
||||
if (!Storage.openFileForWrite("EBP", coverJpgTempPath, coverJpg)) {
|
||||
return false;
|
||||
}
|
||||
@@ -557,7 +594,7 @@ bool Epub::generateCoverBmp(bool cropped) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
FsFile coverBmp;
|
||||
HalFile coverBmp;
|
||||
if (!Storage.openFileForWrite("EBP", getCoverBmpPath(cropped), coverBmp)) {
|
||||
return false;
|
||||
}
|
||||
@@ -579,7 +616,7 @@ bool Epub::generateCoverBmp(bool cropped) const {
|
||||
LOG_DBG("EBP", "Generating BMP from PNG cover image (%s mode)", cropped ? "cropped" : "fit");
|
||||
const auto coverPngTempPath = getCachePath() + "/.cover.png";
|
||||
|
||||
FsFile coverPng;
|
||||
HalFile coverPng;
|
||||
if (!Storage.openFileForWrite("EBP", coverPngTempPath, coverPng)) {
|
||||
return false;
|
||||
}
|
||||
@@ -591,7 +628,7 @@ bool Epub::generateCoverBmp(bool cropped) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
FsFile coverBmp;
|
||||
HalFile coverBmp;
|
||||
if (!Storage.openFileForWrite("EBP", getCoverBmpPath(cropped), coverBmp)) {
|
||||
return false;
|
||||
}
|
||||
@@ -634,7 +671,7 @@ bool Epub::generateThumbBmp(int height) const {
|
||||
LOG_DBG("EBP", "Generating thumb BMP from JPG cover image");
|
||||
const auto coverJpgTempPath = getCachePath() + "/.cover.jpg";
|
||||
|
||||
FsFile coverJpg;
|
||||
HalFile coverJpg;
|
||||
if (!Storage.openFileForWrite("EBP", coverJpgTempPath, coverJpg)) {
|
||||
return false;
|
||||
}
|
||||
@@ -646,7 +683,7 @@ bool Epub::generateThumbBmp(int height) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
FsFile thumbBmp;
|
||||
HalFile thumbBmp;
|
||||
if (!Storage.openFileForWrite("EBP", getThumbBmpPath(height), thumbBmp)) {
|
||||
return false;
|
||||
}
|
||||
@@ -671,7 +708,7 @@ bool Epub::generateThumbBmp(int height) const {
|
||||
LOG_DBG("EBP", "Generating thumb BMP from PNG cover image");
|
||||
const auto coverPngTempPath = getCachePath() + "/.cover.png";
|
||||
|
||||
FsFile coverPng;
|
||||
HalFile coverPng;
|
||||
if (!Storage.openFileForWrite("EBP", coverPngTempPath, coverPng)) {
|
||||
return false;
|
||||
}
|
||||
@@ -683,7 +720,7 @@ bool Epub::generateThumbBmp(int height) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
FsFile thumbBmp;
|
||||
HalFile thumbBmp;
|
||||
if (!Storage.openFileForWrite("EBP", getThumbBmpPath(height), thumbBmp)) {
|
||||
return false;
|
||||
}
|
||||
@@ -707,7 +744,7 @@ bool Epub::generateThumbBmp(int height) const {
|
||||
}
|
||||
|
||||
// Write an empty bmp file to avoid generation attempts in the future
|
||||
FsFile thumbBmp;
|
||||
HalFile thumbBmp;
|
||||
Storage.openFileForWrite("EBP", getThumbBmpPath(height), thumbBmp);
|
||||
return false;
|
||||
}
|
||||
@@ -863,10 +900,10 @@ float Epub::calculateProgress(const int currentSpineIndex, const float currentSp
|
||||
int Epub::resolveHrefToSpineIndex(const std::string& href) const {
|
||||
if (!bookMetadataCache || !bookMetadataCache->isLoaded()) return -1;
|
||||
|
||||
// Extract filename (remove #anchor)
|
||||
std::string target = href;
|
||||
size_t hashPos = target.find('#');
|
||||
if (hashPos != std::string::npos) target = target.substr(0, hashPos);
|
||||
// Split before decoding so escaped '#' characters in filenames stay part of the path.
|
||||
const size_t hashPos = href.find('#');
|
||||
const std::string rawTarget = hashPos != std::string::npos ? href.substr(0, hashPos) : href;
|
||||
const std::string target = FsHelpers::normalisePath(FsHelpers::decodeUriEscapes(rawTarget));
|
||||
|
||||
// Same-file reference (anchor-only)
|
||||
if (target.empty()) return -1;
|
||||
|
||||
+2
-1
@@ -31,9 +31,10 @@ class Epub {
|
||||
std::vector<std::string> cssFiles;
|
||||
|
||||
bool findContentOpfFile(std::string* contentOpfFile) const;
|
||||
bool parseContentOpf(BookMetadataCache::BookMetadata& bookMetadata);
|
||||
bool parseContentOpf(BookMetadataCache::BookMetadata& bookMetadata, bool writeSpineEntries = true);
|
||||
bool parseTocNcxFile() const;
|
||||
bool parseTocNavFile() const;
|
||||
void discoverCssFilesFromZip();
|
||||
void parseCssFiles() const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "FsHelpers.h"
|
||||
|
||||
namespace {
|
||||
constexpr uint8_t BOOK_CACHE_VERSION = 5;
|
||||
constexpr uint8_t BOOK_CACHE_VERSION = 7;
|
||||
constexpr char bookBinFile[] = "/book.bin";
|
||||
constexpr char tmpSpineBinFile[] = "/spine.bin.tmp";
|
||||
constexpr char tmpTocBinFile[] = "/toc.bin.tmp";
|
||||
@@ -292,7 +292,7 @@ bool BookMetadataCache::cleanupTmpFiles() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t BookMetadataCache::writeSpineEntry(FsFile& file, const SpineEntry& entry) const {
|
||||
uint32_t BookMetadataCache::writeSpineEntry(HalFile& file, const SpineEntry& entry) const {
|
||||
const uint32_t pos = file.position();
|
||||
serialization::writeString(file, entry.href);
|
||||
serialization::writePod(file, entry.cumulativeSize);
|
||||
@@ -300,7 +300,7 @@ uint32_t BookMetadataCache::writeSpineEntry(FsFile& file, const SpineEntry& entr
|
||||
return pos;
|
||||
}
|
||||
|
||||
uint32_t BookMetadataCache::writeTocEntry(FsFile& file, const TocEntry& entry) const {
|
||||
uint32_t BookMetadataCache::writeTocEntry(HalFile& file, const TocEntry& entry) const {
|
||||
const uint32_t pos = file.position();
|
||||
serialization::writeString(file, entry.title);
|
||||
serialization::writeString(file, entry.href);
|
||||
@@ -438,7 +438,7 @@ BookMetadataCache::TocEntry BookMetadataCache::getTocEntry(const int index) {
|
||||
return readTocEntry(bookFile);
|
||||
}
|
||||
|
||||
BookMetadataCache::SpineEntry BookMetadataCache::readSpineEntry(FsFile& file) const {
|
||||
BookMetadataCache::SpineEntry BookMetadataCache::readSpineEntry(HalFile& file) const {
|
||||
SpineEntry entry;
|
||||
serialization::readString(file, entry.href);
|
||||
serialization::readPod(file, entry.cumulativeSize);
|
||||
@@ -446,7 +446,7 @@ BookMetadataCache::SpineEntry BookMetadataCache::readSpineEntry(FsFile& file) co
|
||||
return entry;
|
||||
}
|
||||
|
||||
BookMetadataCache::TocEntry BookMetadataCache::readTocEntry(FsFile& file) const {
|
||||
BookMetadataCache::TocEntry BookMetadataCache::readTocEntry(HalFile& file) const {
|
||||
TocEntry entry;
|
||||
serialization::readString(file, entry.title);
|
||||
serialization::readString(file, entry.href);
|
||||
|
||||
@@ -50,10 +50,10 @@ class BookMetadataCache {
|
||||
bool loaded;
|
||||
bool buildMode;
|
||||
|
||||
FsFile bookFile;
|
||||
HalFile bookFile;
|
||||
// Temp file handles during build
|
||||
FsFile spineFile;
|
||||
FsFile tocFile;
|
||||
HalFile spineFile;
|
||||
HalFile tocFile;
|
||||
|
||||
// Index for fast href→spineIndex lookup (used only for large EPUBs)
|
||||
struct SpineHrefIndexEntry {
|
||||
@@ -76,10 +76,10 @@ class BookMetadataCache {
|
||||
return hash;
|
||||
}
|
||||
|
||||
uint32_t writeSpineEntry(FsFile& file, const SpineEntry& entry) const;
|
||||
uint32_t writeTocEntry(FsFile& file, const TocEntry& entry) const;
|
||||
SpineEntry readSpineEntry(FsFile& file) const;
|
||||
TocEntry readTocEntry(FsFile& file) const;
|
||||
uint32_t writeSpineEntry(HalFile& file, const SpineEntry& entry) const;
|
||||
uint32_t writeTocEntry(HalFile& file, const TocEntry& entry) const;
|
||||
SpineEntry readSpineEntry(HalFile& file) const;
|
||||
TocEntry readTocEntry(HalFile& file) const;
|
||||
|
||||
public:
|
||||
BookMetadata coreMetadata;
|
||||
|
||||
+56
-6
@@ -1,13 +1,16 @@
|
||||
#include "Page.h"
|
||||
|
||||
#include <GfxRenderer.h>
|
||||
#include <Logging.h>
|
||||
#include <Serialization.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
void PageLine::render(GfxRenderer& renderer, const int fontId, const int xOffset, const int yOffset) {
|
||||
block->render(renderer, fontId, xPos + xOffset, yPos + yOffset);
|
||||
}
|
||||
|
||||
bool PageLine::serialize(FsFile& file) {
|
||||
bool PageLine::serialize(HalFile& file) {
|
||||
serialization::writePod(file, xPos);
|
||||
serialization::writePod(file, yPos);
|
||||
|
||||
@@ -15,7 +18,7 @@ bool PageLine::serialize(FsFile& file) {
|
||||
return block->serialize(file);
|
||||
}
|
||||
|
||||
std::unique_ptr<PageLine> PageLine::deserialize(FsFile& file) {
|
||||
std::unique_ptr<PageLine> PageLine::deserialize(HalFile& file) {
|
||||
int16_t xPos;
|
||||
int16_t yPos;
|
||||
serialization::readPod(file, xPos);
|
||||
@@ -30,7 +33,7 @@ void PageImage::render(GfxRenderer& renderer, const int fontId, const int xOffse
|
||||
imageBlock->render(renderer, xPos + xOffset, yPos + yOffset);
|
||||
}
|
||||
|
||||
bool PageImage::serialize(FsFile& file) {
|
||||
bool PageImage::serialize(HalFile& file) {
|
||||
serialization::writePod(file, xPos);
|
||||
serialization::writePod(file, yPos);
|
||||
|
||||
@@ -38,7 +41,7 @@ bool PageImage::serialize(FsFile& file) {
|
||||
return imageBlock->serialize(file);
|
||||
}
|
||||
|
||||
std::unique_ptr<PageImage> PageImage::deserialize(FsFile& file) {
|
||||
std::unique_ptr<PageImage> PageImage::deserialize(HalFile& file) {
|
||||
int16_t xPos;
|
||||
int16_t yPos;
|
||||
serialization::readPod(file, xPos);
|
||||
@@ -48,13 +51,54 @@ std::unique_ptr<PageImage> PageImage::deserialize(FsFile& file) {
|
||||
return std::unique_ptr<PageImage>(new PageImage(std::move(ib), xPos, yPos));
|
||||
}
|
||||
|
||||
void PageHorizontalRule::render(GfxRenderer& renderer, const int fontId, const int xOffset, const int yOffset) {
|
||||
(void)fontId;
|
||||
if (width == 0 || thickness == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
renderer.drawLine(xPos + xOffset, yPos + yOffset, xPos + xOffset + width - 1, yPos + yOffset, thickness, true);
|
||||
}
|
||||
|
||||
bool PageHorizontalRule::serialize(HalFile& file) {
|
||||
serialization::writePod(file, xPos);
|
||||
serialization::writePod(file, yPos);
|
||||
serialization::writePod(file, width);
|
||||
serialization::writePod(file, thickness);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<PageHorizontalRule> PageHorizontalRule::deserialize(HalFile& file) {
|
||||
int16_t xPos = 0;
|
||||
int16_t yPos = 0;
|
||||
uint16_t width = 0;
|
||||
uint8_t thickness = 0;
|
||||
serialization::readPod(file, xPos);
|
||||
serialization::readPod(file, yPos);
|
||||
serialization::readPod(file, width);
|
||||
serialization::readPod(file, thickness);
|
||||
|
||||
if (width == 0 || thickness == 0) {
|
||||
LOG_ERR("PGE", "Deserialization failed: invalid horizontal rule metadata (width=%u thickness=%u)", width,
|
||||
thickness);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto* rule = new (std::nothrow) PageHorizontalRule(width, thickness, xPos, yPos);
|
||||
if (!rule) {
|
||||
LOG_ERR("PGE", "Deserialization failed: could not allocate PageHorizontalRule");
|
||||
return nullptr;
|
||||
}
|
||||
return std::unique_ptr<PageHorizontalRule>(rule);
|
||||
}
|
||||
|
||||
void Page::render(GfxRenderer& renderer, const int fontId, const int xOffset, const int yOffset) const {
|
||||
for (auto& element : elements) {
|
||||
element->render(renderer, fontId, xOffset, yOffset);
|
||||
}
|
||||
}
|
||||
|
||||
bool Page::serialize(FsFile& file) const {
|
||||
bool Page::serialize(HalFile& file) const {
|
||||
const uint16_t count = elements.size();
|
||||
serialization::writePod(file, count);
|
||||
|
||||
@@ -82,7 +126,7 @@ bool Page::serialize(FsFile& file) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<Page> Page::deserialize(FsFile& file) {
|
||||
std::unique_ptr<Page> Page::deserialize(HalFile& file) {
|
||||
auto page = std::unique_ptr<Page>(new Page());
|
||||
|
||||
uint16_t count;
|
||||
@@ -98,6 +142,12 @@ std::unique_ptr<Page> Page::deserialize(FsFile& file) {
|
||||
} else if (tag == TAG_PageImage) {
|
||||
auto pi = PageImage::deserialize(file);
|
||||
page->elements.push_back(std::move(pi));
|
||||
} else if (tag == TAG_PageHorizontalRule) {
|
||||
auto rule = PageHorizontalRule::deserialize(file);
|
||||
if (!rule) {
|
||||
return nullptr;
|
||||
}
|
||||
page->elements.push_back(std::move(rule));
|
||||
} else {
|
||||
LOG_ERR("PGE", "Deserialization failed: Unknown tag %u", tag);
|
||||
return nullptr;
|
||||
|
||||
+23
-8
@@ -12,7 +12,8 @@
|
||||
|
||||
enum PageElementTag : uint8_t {
|
||||
TAG_PageLine = 1,
|
||||
TAG_PageImage = 2, // New tag
|
||||
TAG_PageImage = 2,
|
||||
TAG_PageHorizontalRule = 3,
|
||||
};
|
||||
|
||||
// represents something that has been added to a page
|
||||
@@ -23,7 +24,7 @@ class PageElement {
|
||||
explicit PageElement(const int16_t xPos, const int16_t yPos) : xPos(xPos), yPos(yPos) {}
|
||||
virtual ~PageElement() = default;
|
||||
virtual void render(GfxRenderer& renderer, int fontId, int xOffset, int yOffset) = 0;
|
||||
virtual bool serialize(FsFile& file) = 0;
|
||||
virtual bool serialize(HalFile& file) = 0;
|
||||
virtual PageElementTag getTag() const = 0; // Add type identification
|
||||
};
|
||||
|
||||
@@ -36,9 +37,9 @@ class PageLine final : public PageElement {
|
||||
: PageElement(xPos, yPos), block(std::move(block)) {}
|
||||
const std::shared_ptr<TextBlock>& getBlock() const { return block; }
|
||||
void render(GfxRenderer& renderer, int fontId, int xOffset, int yOffset) override;
|
||||
bool serialize(FsFile& file) override;
|
||||
bool serialize(HalFile& file) override;
|
||||
PageElementTag getTag() const override { return TAG_PageLine; }
|
||||
static std::unique_ptr<PageLine> deserialize(FsFile& file);
|
||||
static std::unique_ptr<PageLine> deserialize(HalFile& file);
|
||||
};
|
||||
|
||||
// New PageImage class
|
||||
@@ -49,12 +50,26 @@ class PageImage final : public PageElement {
|
||||
PageImage(std::shared_ptr<ImageBlock> block, const int16_t xPos, const int16_t yPos)
|
||||
: PageElement(xPos, yPos), imageBlock(std::move(block)) {}
|
||||
void render(GfxRenderer& renderer, int fontId, int xOffset, int yOffset) override;
|
||||
bool serialize(FsFile& file) override;
|
||||
bool serialize(HalFile& file) override;
|
||||
PageElementTag getTag() const override { return TAG_PageImage; }
|
||||
static std::unique_ptr<PageImage> deserialize(FsFile& file);
|
||||
static std::unique_ptr<PageImage> deserialize(HalFile& file);
|
||||
const ImageBlock& getImageBlock() const { return *imageBlock; }
|
||||
};
|
||||
|
||||
class PageHorizontalRule final : public PageElement {
|
||||
uint16_t width;
|
||||
uint8_t thickness;
|
||||
|
||||
public:
|
||||
PageHorizontalRule(uint16_t width, uint8_t thickness, const int16_t xPos, const int16_t yPos)
|
||||
: PageElement(xPos, yPos), width(width), thickness(thickness) {}
|
||||
|
||||
void render(GfxRenderer& renderer, int fontId, int xOffset, int yOffset) override;
|
||||
bool serialize(HalFile& file) override;
|
||||
PageElementTag getTag() const override { return TAG_PageHorizontalRule; }
|
||||
static std::unique_ptr<PageHorizontalRule> deserialize(HalFile& file);
|
||||
};
|
||||
|
||||
class Page {
|
||||
public:
|
||||
// the list of block index and line numbers on this page
|
||||
@@ -73,8 +88,8 @@ class Page {
|
||||
}
|
||||
|
||||
void render(GfxRenderer& renderer, int fontId, int xOffset, int yOffset) const;
|
||||
bool serialize(FsFile& file) const;
|
||||
static std::unique_ptr<Page> deserialize(FsFile& file);
|
||||
bool serialize(HalFile& file) const;
|
||||
static std::unique_ptr<Page> deserialize(HalFile& file);
|
||||
|
||||
// Check if page contains any images (used to force full refresh)
|
||||
bool hasImages() const {
|
||||
|
||||
+282
-113
@@ -1,5 +1,6 @@
|
||||
#include "ParsedText.h"
|
||||
|
||||
#include <BidiUtils.h>
|
||||
#include <GfxRenderer.h>
|
||||
#include <Utf8.h>
|
||||
|
||||
@@ -18,6 +19,19 @@ namespace {
|
||||
// Soft hyphen byte pattern used throughout EPUBs (UTF-8 for U+00AD).
|
||||
constexpr char SOFT_HYPHEN_UTF8[] = "\xC2\xAD";
|
||||
constexpr size_t SOFT_HYPHEN_BYTES = 2;
|
||||
// Paragraph-level direction: scan the first N words to find base direction.
|
||||
constexpr size_t RTL_PARAGRAPH_PROBE_WORDS = 3;
|
||||
// Per-word: scan enough chars to see through leading neutrals (quotes, numbers)
|
||||
// before giving up. 64 is a hedge for pathological cases like long numeric tokens.
|
||||
constexpr int RTL_PER_WORD_PROBE_DEPTH = 64;
|
||||
|
||||
// Byte-level pre-check: Hebrew UTF-8 lead bytes 0xD6-0xD7, Arabic/Syriac 0xD8-0xDB.
|
||||
bool mayContainRtlBytes(const char* str) {
|
||||
for (const auto* p = reinterpret_cast<const unsigned char*>(str); *p; ++p) {
|
||||
if (*p >= 0xD6 && *p <= 0xDB) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns the first rendered codepoint of a word (skipping leading soft hyphens).
|
||||
uint32_t firstCodepoint(const std::string& word) {
|
||||
@@ -115,6 +129,8 @@ void ParsedText::addWord(std::string word, const EpdFontFamily::Style fontStyle,
|
||||
if (underline) {
|
||||
baseStyle = static_cast<EpdFontFamily::Style>(baseStyle | EpdFontFamily::UNDERLINE);
|
||||
}
|
||||
const bool wordStartsRtl = !hasRtlWord && mayContainRtlBytes(word.c_str()) &&
|
||||
BidiUtils::startsWithRtl(word.c_str(), RTL_PER_WORD_PROBE_DEPTH);
|
||||
|
||||
// Already-bold text should stay fully bold; focus splitting would make its suffix regular later.
|
||||
if (!this->focusReadingEnabled || (baseStyle & EpdFontFamily::BOLD) != 0) {
|
||||
@@ -122,6 +138,9 @@ void ParsedText::addWord(std::string word, const EpdFontFamily::Style fontStyle,
|
||||
wordStyles.push_back(baseStyle);
|
||||
wordContinues.push_back(attachToPrevious);
|
||||
wordIsFocusSuffix.push_back(false);
|
||||
if (wordStartsRtl) {
|
||||
hasRtlWord = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -237,6 +256,25 @@ void ParsedText::addWord(std::string word, const EpdFontFamily::Style fontStyle,
|
||||
size_t segmentLen = end - segmentStart;
|
||||
std::string_view segment(reinterpret_cast<const char*>(segmentStart), segmentLen);
|
||||
processSegment(segment, inWordSegment, isFirstSegment ? attachToPrevious : true);
|
||||
if (wordStartsRtl) {
|
||||
hasRtlWord = true;
|
||||
}
|
||||
}
|
||||
|
||||
int ParsedText::resolveFirstLineIndent(const bool isFirstLine, const GfxRenderer& renderer, const int fontId) const {
|
||||
if (!isFirstLine || !isNaturalAlign) {
|
||||
return 0;
|
||||
}
|
||||
if (blockStyle.textIndentDefined) {
|
||||
if (blockStyle.textIndent < 0 || !extraParagraphSpacing) {
|
||||
return blockStyle.textIndent;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (!extraParagraphSpacing) {
|
||||
return renderer.getSpaceWidth(fontId, EpdFontFamily::REGULAR) * 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
// Consumes data to minimize memory usage
|
||||
void ParsedText::layoutAndExtractLines(const GfxRenderer& renderer, const int fontId, const uint16_t viewportWidth,
|
||||
@@ -246,8 +284,22 @@ void ParsedText::layoutAndExtractLines(const GfxRenderer& renderer, const int fo
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply fixed transforms before any per-line layout work.
|
||||
applyParagraphIndent();
|
||||
// Per-paragraph RTL auto-detection: only when CSS/HTML didn't explicitly set direction.
|
||||
// Explicit dir="ltr" must be respected and not overridden by content heuristic.
|
||||
if (!blockStyle.directionDefined && hasRtlWord) {
|
||||
// Check the first few words for RTL letter codepoints (no heap allocation).
|
||||
const size_t wordsToScan = std::min(words.size(), RTL_PARAGRAPH_PROBE_WORDS);
|
||||
for (size_t i = 0; i < wordsToScan; ++i) {
|
||||
if (BidiUtils::startsWithRtl(words[i].c_str(), BidiUtils::RTL_PARAGRAPH_PROBE_DEPTH)) {
|
||||
blockStyle.isRtl = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isNaturalAlign =
|
||||
blockStyle.alignment == CssTextAlign::Justify ||
|
||||
(blockStyle.isRtl ? blockStyle.alignment == CssTextAlign::Right : blockStyle.alignment == CssTextAlign::Left);
|
||||
|
||||
// Ensure SD card font glyph metrics are loaded before measuring word widths.
|
||||
// For flash-based fonts isSdCardFont() returns false and this block is skipped
|
||||
@@ -255,20 +307,6 @@ void ParsedText::layoutAndExtractLines(const GfxRenderer& renderer, const int fo
|
||||
// (advanceX only, no bitmaps) for all unique codepoints in this paragraph so
|
||||
// that calculateWordWidths() can measure text without on-demand SD I/O.
|
||||
if (renderer.isSdCardFont(fontId)) {
|
||||
// Reserve upfront so the joined text allocates exactly once. Without this,
|
||||
// paragraphs with many words trigger a chain of vector-like reallocations
|
||||
// inside std::string during layout — visible in prewarm timings for SD fonts.
|
||||
size_t totalSize = hyphenationEnabled ? 1 : 0;
|
||||
if (!words.empty()) totalSize += words.size() - 1; // inter-word spaces
|
||||
for (const auto& w : words) totalSize += w.size();
|
||||
std::string allText;
|
||||
allText.reserve(totalSize);
|
||||
for (size_t i = 0; i < words.size(); i++) {
|
||||
if (i > 0) allText += ' ';
|
||||
allText += words[i];
|
||||
}
|
||||
if (hyphenationEnabled) allText += '-';
|
||||
|
||||
// Style mask: only ask the SD font to load advances for styles actually
|
||||
// used in this paragraph. Style index is the low two bits (regular/bold/
|
||||
// italic/bold-italic); the underline bit is irrelevant to advance metrics.
|
||||
@@ -277,7 +315,7 @@ void ParsedText::layoutAndExtractLines(const GfxRenderer& renderer, const int fo
|
||||
styleMask |= static_cast<uint8_t>(1u << (static_cast<uint8_t>(s) & 0x03));
|
||||
}
|
||||
if (styleMask == 0) styleMask = 0x01; // defensive: regular only
|
||||
renderer.ensureSdCardFontReady(fontId, allText.c_str(), styleMask);
|
||||
renderer.ensureSdCardFontReady(fontId, words, hyphenationEnabled, styleMask);
|
||||
}
|
||||
|
||||
const int pageWidth = viewportWidth;
|
||||
@@ -323,15 +361,7 @@ std::vector<size_t> ParsedText::computeLineBreaks(const GfxRenderer& renderer, c
|
||||
return {};
|
||||
}
|
||||
|
||||
// Calculate first line indent (only for left/justified text).
|
||||
// Positive text-indent (paragraph indent) is suppressed when extraParagraphSpacing is on.
|
||||
// Negative text-indent (hanging indent, e.g. margin-left:3em; text-indent:-1em) always applies —
|
||||
// it is structural (positions the bullet/marker), not decorative.
|
||||
const int firstLineIndent =
|
||||
blockStyle.textIndentDefined && (blockStyle.textIndent < 0 || !extraParagraphSpacing) &&
|
||||
(blockStyle.alignment == CssTextAlign::Justify || blockStyle.alignment == CssTextAlign::Left)
|
||||
? blockStyle.textIndent
|
||||
: 0;
|
||||
const int firstLineIndent = resolveFirstLineIndent(true, renderer, fontId);
|
||||
|
||||
// Ensure any word that would overflow even as the first entry on a line is split using fallback hyphenation.
|
||||
for (size_t i = 0; i < wordWidths.size(); ++i) {
|
||||
@@ -437,33 +467,11 @@ std::vector<size_t> ParsedText::computeLineBreaks(const GfxRenderer& renderer, c
|
||||
return lineBreakIndices;
|
||||
}
|
||||
|
||||
void ParsedText::applyParagraphIndent() {
|
||||
if (extraParagraphSpacing || words.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (blockStyle.textIndentDefined) {
|
||||
// CSS text-indent is explicitly set (even if 0) - don't use fallback EmSpace
|
||||
// The actual indent positioning is handled in extractLine()
|
||||
} else if (blockStyle.alignment == CssTextAlign::Justify || blockStyle.alignment == CssTextAlign::Left) {
|
||||
// No CSS text-indent defined - use EmSpace fallback for visual indent
|
||||
words.front().insert(0, "\xe2\x80\x83");
|
||||
}
|
||||
}
|
||||
|
||||
// Builds break indices while opportunistically splitting the word that would overflow the current line.
|
||||
std::vector<size_t> ParsedText::computeHyphenatedLineBreaks(const GfxRenderer& renderer, const int fontId,
|
||||
const int pageWidth, std::vector<uint16_t>& wordWidths,
|
||||
std::vector<bool>& continuesVec) {
|
||||
// Calculate first line indent (only for left/justified text).
|
||||
// Positive text-indent (paragraph indent) is suppressed when extraParagraphSpacing is on.
|
||||
// Negative text-indent (hanging indent, e.g. margin-left:3em; text-indent:-1em) always applies —
|
||||
// it is structural (positions the bullet/marker), not decorative.
|
||||
const int firstLineIndent =
|
||||
blockStyle.textIndentDefined && (blockStyle.textIndent < 0 || !extraParagraphSpacing) &&
|
||||
(blockStyle.alignment == CssTextAlign::Justify || blockStyle.alignment == CssTextAlign::Left)
|
||||
? blockStyle.textIndent
|
||||
: 0;
|
||||
const int firstLineIndent = resolveFirstLineIndent(true, renderer, fontId);
|
||||
|
||||
std::vector<size_t> lineBreakIndices;
|
||||
size_t currentIndex = 0;
|
||||
@@ -626,16 +634,22 @@ void ParsedText::extractLine(const size_t breakIndex, const int pageWidth, const
|
||||
const size_t lastBreakAt = breakIndex > 0 ? lineBreakIndices[breakIndex - 1] : 0;
|
||||
const size_t lineWordCount = lineBreak - lastBreakAt;
|
||||
|
||||
// Calculate first line indent (only for left/justified text).
|
||||
// Positive text-indent (paragraph indent) is suppressed when extraParagraphSpacing is on.
|
||||
// Negative text-indent (hanging indent, e.g. margin-left:3em; text-indent:-1em) always applies —
|
||||
// it is structural (positions the bullet/marker), not decorative.
|
||||
const bool isFirstLine = breakIndex == 0;
|
||||
const int firstLineIndent =
|
||||
isFirstLine && blockStyle.textIndentDefined && (blockStyle.textIndent < 0 || !extraParagraphSpacing) &&
|
||||
(blockStyle.alignment == CssTextAlign::Justify || blockStyle.alignment == CssTextAlign::Left)
|
||||
? blockStyle.textIndent
|
||||
: 0;
|
||||
const int firstLineIndent = resolveFirstLineIndent(breakIndex == 0, renderer, fontId);
|
||||
|
||||
// Build line data by moving from the original vectors using index range
|
||||
std::vector<std::string> lineWords;
|
||||
lineWords.reserve(lineWordCount);
|
||||
std::vector<EpdFontFamily::Style> lineWordStyles;
|
||||
lineWordStyles.reserve(lineWordCount);
|
||||
|
||||
for (size_t i = 0; i < lineWordCount; ++i) {
|
||||
std::string word = std::move(words[lastBreakAt + i]);
|
||||
if (containsSoftHyphen(word)) {
|
||||
stripSoftHyphensInPlace(word);
|
||||
}
|
||||
lineWords.push_back(std::move(word));
|
||||
lineWordStyles.push_back(wordStyles[lastBreakAt + i]);
|
||||
}
|
||||
|
||||
// Calculate total word width for this line, count actual word gaps,
|
||||
// and accumulate total natural gap widths (including space kerning adjustments).
|
||||
@@ -648,19 +662,17 @@ void ParsedText::extractLine(const size_t breakIndex, const int pageWidth, const
|
||||
// Count gaps: each word after the first creates a gap, unless it's a continuation
|
||||
if (wordIdx > 0 && !continuesVec[lastBreakAt + wordIdx]) {
|
||||
actualGapCount++;
|
||||
totalNaturalGaps +=
|
||||
renderer.getSpaceAdvance(fontId, lastCodepoint(words[lastBreakAt + wordIdx - 1]),
|
||||
firstCodepoint(words[lastBreakAt + wordIdx]), wordStyles[lastBreakAt + wordIdx - 1]);
|
||||
totalNaturalGaps += renderer.getSpaceAdvance(fontId, lastCodepoint(lineWords[wordIdx - 1]),
|
||||
firstCodepoint(lineWords[wordIdx]), lineWordStyles[wordIdx - 1]);
|
||||
} else if (wordIdx > 0 && continuesVec[lastBreakAt + wordIdx]) {
|
||||
// Non-breaking space tokens (" " with continues=true) are visible, stretchable spaces —
|
||||
// count them as justifiable gaps so justifyExtra is distributed to them too.
|
||||
if (words[lastBreakAt + wordIdx] == " ") {
|
||||
if (lineWords[wordIdx] == " ") {
|
||||
actualGapCount++;
|
||||
}
|
||||
// Cross-boundary kerning for continuation words (e.g. nonbreaking spaces, attached punctuation)
|
||||
totalNaturalGaps +=
|
||||
renderer.getKerning(fontId, lastCodepoint(words[lastBreakAt + wordIdx - 1]),
|
||||
firstCodepoint(words[lastBreakAt + wordIdx]), wordStyles[lastBreakAt + wordIdx - 1]);
|
||||
totalNaturalGaps += renderer.getKerning(fontId, lastCodepoint(lineWords[wordIdx - 1]),
|
||||
firstCodepoint(lineWords[wordIdx]), lineWordStyles[wordIdx - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,73 +680,229 @@ void ParsedText::extractLine(const size_t breakIndex, const int pageWidth, const
|
||||
const int effectivePageWidth = pageWidth - firstLineIndent;
|
||||
const bool isLastLine = breakIndex == lineBreakIndices.size() - 1;
|
||||
|
||||
// For RTL, implicit/default Left alignment becomes Right alignment.
|
||||
// Explicit text-align:left must remain left for CSS correctness.
|
||||
const CssTextAlign effectiveAlignment =
|
||||
(blockStyle.isRtl && !blockStyle.textAlignDefined && blockStyle.alignment == CssTextAlign::Left)
|
||||
? CssTextAlign::Right
|
||||
: blockStyle.alignment;
|
||||
|
||||
// For justified text, compute per-gap extra to distribute remaining space evenly
|
||||
const int spareSpace = effectivePageWidth - lineWordWidthSum - totalNaturalGaps;
|
||||
const int justifyExtra = (blockStyle.alignment == CssTextAlign::Justify && !isLastLine && actualGapCount >= 1)
|
||||
const int justifyExtra = (effectiveAlignment == CssTextAlign::Justify && !isLastLine && actualGapCount >= 1)
|
||||
? spareSpace / static_cast<int>(actualGapCount)
|
||||
: 0;
|
||||
|
||||
// Calculate initial x position (first line starts at indent for left/justified text;
|
||||
// may be negative for hanging indents, e.g. margin-left:3em; text-indent:-1em).
|
||||
auto xpos = static_cast<int16_t>(firstLineIndent);
|
||||
if (blockStyle.alignment == CssTextAlign::Right) {
|
||||
xpos = effectivePageWidth - lineWordWidthSum - totalNaturalGaps;
|
||||
} else if (blockStyle.alignment == CssTextAlign::Center) {
|
||||
xpos = (effectivePageWidth - lineWordWidthSum - totalNaturalGaps) / 2;
|
||||
}
|
||||
// BiDi processing: reorder words with UAX#9 in full-line context.
|
||||
visualOrderScratch.clear();
|
||||
visualOrderScratch.reserve(lineWordCount);
|
||||
// Skip expensive visual-order resolution for pure LTR paragraphs that have no RTL words.
|
||||
const bool shouldResolveVisualOrder = blockStyle.isRtl || hasRtlWord;
|
||||
const bool willReorder =
|
||||
shouldResolveVisualOrder && BidiUtils::computeVisualWordOrder(lineWords, blockStyle.isRtl, visualOrderScratch);
|
||||
|
||||
// Pre-calculate X positions for words
|
||||
// Continuation words attach to the previous word with no space before them
|
||||
std::vector<int16_t> lineXPos;
|
||||
lineXPos.reserve(lineWordCount);
|
||||
|
||||
for (size_t wordIdx = 0; wordIdx < lineWordCount; wordIdx++) {
|
||||
lineXPos.push_back(xpos);
|
||||
if (willReorder) {
|
||||
reorderedWordsScratch.clear();
|
||||
reorderedStylesScratch.clear();
|
||||
reorderedWidthsScratch.clear();
|
||||
reorderedContinuesScratch.clear();
|
||||
reorderedFocusSuffixScratch.clear();
|
||||
reorderedWordsScratch.reserve(visualOrderScratch.size());
|
||||
reorderedStylesScratch.reserve(visualOrderScratch.size());
|
||||
reorderedWidthsScratch.reserve(visualOrderScratch.size());
|
||||
reorderedContinuesScratch.reserve(visualOrderScratch.size());
|
||||
reorderedFocusSuffixScratch.reserve(visualOrderScratch.size());
|
||||
|
||||
const bool nextIsContinuation = wordIdx + 1 < lineWordCount && continuesVec[lastBreakAt + wordIdx + 1];
|
||||
if (nextIsContinuation) {
|
||||
int advance = wordWidths[lastBreakAt + wordIdx];
|
||||
// Cross-boundary kerning for continuation words (e.g. nonbreaking spaces, attached punctuation)
|
||||
advance +=
|
||||
renderer.getKerning(fontId, lastCodepoint(words[lastBreakAt + wordIdx]),
|
||||
firstCodepoint(words[lastBreakAt + wordIdx + 1]), wordStyles[lastBreakAt + wordIdx]);
|
||||
// Non-breaking space tokens are stretchable — expand them during justification like normal spaces.
|
||||
if (words[lastBreakAt + wordIdx] == " " && continuesVec[lastBreakAt + wordIdx] &&
|
||||
blockStyle.alignment == CssTextAlign::Justify && !isLastLine) {
|
||||
advance += justifyExtra;
|
||||
for (size_t i = 0; i < visualOrderScratch.size(); ++i) {
|
||||
const uint16_t src = visualOrderScratch[i];
|
||||
reorderedWordsScratch.push_back(std::move(lineWords[src]));
|
||||
reorderedStylesScratch.push_back(lineWordStyles[src]);
|
||||
reorderedWidthsScratch.push_back(wordWidths[lastBreakAt + src]);
|
||||
reorderedFocusSuffixScratch.push_back(wordIsFocusSuffix[lastBreakAt + src]);
|
||||
|
||||
// Continuation means "no break/gap between two adjacent logical tokens".
|
||||
// After visual reordering (common in RTL), an adjacent logical pair can appear
|
||||
// as either (prev -> curr) or (curr -> prev) in visual order; preserve both.
|
||||
bool continues = false;
|
||||
if (i > 0) {
|
||||
const size_t prevSrc = visualOrderScratch[i - 1];
|
||||
const size_t currSrc = src;
|
||||
const bool forwardAdjacent = currSrc == prevSrc + 1;
|
||||
const bool reverseAdjacent = prevSrc == currSrc + 1;
|
||||
|
||||
if (forwardAdjacent && continuesVec[lastBreakAt + currSrc]) {
|
||||
continues = true;
|
||||
} else if (reverseAdjacent && continuesVec[lastBreakAt + prevSrc]) {
|
||||
continues = true;
|
||||
}
|
||||
}
|
||||
reorderedContinuesScratch.push_back(continues);
|
||||
}
|
||||
|
||||
int reorderedWordWidthSum = 0;
|
||||
size_t reorderedGapCount = 0;
|
||||
int reorderedNaturalGaps = 0;
|
||||
for (size_t wordIdx = 0; wordIdx < reorderedWidthsScratch.size(); wordIdx++) {
|
||||
reorderedWordWidthSum += reorderedWidthsScratch[wordIdx];
|
||||
if (wordIdx > 0 && !reorderedContinuesScratch[wordIdx]) {
|
||||
reorderedGapCount++;
|
||||
reorderedNaturalGaps += renderer.getSpaceAdvance(fontId, lastCodepoint(reorderedWordsScratch[wordIdx - 1]),
|
||||
firstCodepoint(reorderedWordsScratch[wordIdx]),
|
||||
reorderedStylesScratch[wordIdx - 1]);
|
||||
} else if (wordIdx > 0 && reorderedContinuesScratch[wordIdx]) {
|
||||
if (reorderedWordsScratch[wordIdx] == " ") {
|
||||
reorderedGapCount++;
|
||||
}
|
||||
reorderedNaturalGaps +=
|
||||
renderer.getKerning(fontId, lastCodepoint(reorderedWordsScratch[wordIdx - 1]),
|
||||
firstCodepoint(reorderedWordsScratch[wordIdx]), reorderedStylesScratch[wordIdx - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
const int reorderedSpare = effectivePageWidth - reorderedWordWidthSum - reorderedNaturalGaps;
|
||||
const int reorderedJustifyExtra =
|
||||
(effectiveAlignment == CssTextAlign::Justify && !isLastLine && reorderedGapCount >= 1)
|
||||
? reorderedSpare / static_cast<int>(reorderedGapCount)
|
||||
: 0;
|
||||
|
||||
const int justifyContribution = (effectiveAlignment == CssTextAlign::Justify && !isLastLine)
|
||||
? reorderedJustifyExtra * static_cast<int>(reorderedGapCount)
|
||||
: 0;
|
||||
const int contentWidth = reorderedWordWidthSum + reorderedNaturalGaps + justifyContribution;
|
||||
|
||||
int xpos = 0;
|
||||
if (blockStyle.isRtl) {
|
||||
if (effectiveAlignment == CssTextAlign::Right || effectiveAlignment == CssTextAlign::Justify) {
|
||||
xpos = effectivePageWidth - contentWidth;
|
||||
} else if (effectiveAlignment == CssTextAlign::Center) {
|
||||
xpos = (effectivePageWidth - contentWidth) / 2;
|
||||
}
|
||||
xpos += advance;
|
||||
} else {
|
||||
int gap = 0;
|
||||
if (wordIdx + 1 < lineWordCount) {
|
||||
gap = renderer.getSpaceAdvance(fontId, lastCodepoint(words[lastBreakAt + wordIdx]),
|
||||
firstCodepoint(words[lastBreakAt + wordIdx + 1]),
|
||||
wordStyles[lastBreakAt + wordIdx]);
|
||||
xpos = firstLineIndent;
|
||||
if (effectiveAlignment == CssTextAlign::Right) {
|
||||
xpos = effectivePageWidth - contentWidth;
|
||||
} else if (effectiveAlignment == CssTextAlign::Center) {
|
||||
xpos = (effectivePageWidth - contentWidth) / 2;
|
||||
}
|
||||
if (blockStyle.alignment == CssTextAlign::Justify && !isLastLine) {
|
||||
gap += justifyExtra;
|
||||
}
|
||||
|
||||
for (size_t wordIdx = 0; wordIdx < reorderedWidthsScratch.size(); wordIdx++) {
|
||||
lineXPos.push_back(static_cast<int16_t>(xpos));
|
||||
xpos += reorderedWidthsScratch[wordIdx];
|
||||
|
||||
const bool nextIsContinuation =
|
||||
wordIdx + 1 < reorderedWidthsScratch.size() && reorderedContinuesScratch[wordIdx + 1];
|
||||
if (nextIsContinuation) {
|
||||
int advance =
|
||||
renderer.getKerning(fontId, lastCodepoint(reorderedWordsScratch[wordIdx]),
|
||||
firstCodepoint(reorderedWordsScratch[wordIdx + 1]), reorderedStylesScratch[wordIdx]);
|
||||
if (reorderedWordsScratch[wordIdx] == " " && reorderedContinuesScratch[wordIdx] &&
|
||||
effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
||||
advance += reorderedJustifyExtra;
|
||||
}
|
||||
xpos += advance;
|
||||
} else if (wordIdx + 1 < reorderedWidthsScratch.size()) {
|
||||
int gap = renderer.getSpaceAdvance(fontId, lastCodepoint(reorderedWordsScratch[wordIdx]),
|
||||
firstCodepoint(reorderedWordsScratch[wordIdx + 1]),
|
||||
reorderedStylesScratch[wordIdx]);
|
||||
if (effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
||||
gap += reorderedJustifyExtra;
|
||||
}
|
||||
xpos += gap;
|
||||
}
|
||||
}
|
||||
|
||||
lineWords.swap(reorderedWordsScratch);
|
||||
lineWordStyles.swap(reorderedStylesScratch);
|
||||
} else {
|
||||
// Standard LTR/RTL positioning loop when no visual reordering is needed
|
||||
if (blockStyle.isRtl) {
|
||||
// RTL: position words from right to left
|
||||
int xpos = effectivePageWidth;
|
||||
if (effectiveAlignment == CssTextAlign::Left) {
|
||||
// Explicit left alignment in RTL context
|
||||
xpos = lineWordWidthSum + totalNaturalGaps;
|
||||
} else if (effectiveAlignment == CssTextAlign::Center) {
|
||||
xpos = (effectivePageWidth + lineWordWidthSum + totalNaturalGaps) / 2;
|
||||
}
|
||||
// For Right and Justify, start from right edge (xpos = effectivePageWidth)
|
||||
|
||||
for (size_t wordIdx = 0; wordIdx < lineWordCount; wordIdx++) {
|
||||
xpos -= wordWidths[lastBreakAt + wordIdx];
|
||||
lineXPos.push_back(static_cast<int16_t>(xpos));
|
||||
|
||||
const bool nextIsContinuation = wordIdx + 1 < lineWordCount && continuesVec[lastBreakAt + wordIdx + 1];
|
||||
if (nextIsContinuation) {
|
||||
// Cross-boundary kerning for continuation words
|
||||
int advance = renderer.getKerning(fontId, lastCodepoint(lineWords[wordIdx]),
|
||||
firstCodepoint(lineWords[wordIdx + 1]), lineWordStyles[wordIdx]);
|
||||
if (lineWords[wordIdx] == " " && continuesVec[lastBreakAt + wordIdx] &&
|
||||
effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
||||
advance += justifyExtra;
|
||||
}
|
||||
xpos -= advance;
|
||||
} else {
|
||||
int gap = 0;
|
||||
if (wordIdx + 1 < lineWordCount) {
|
||||
gap = renderer.getSpaceAdvance(fontId, lastCodepoint(lineWords[wordIdx]),
|
||||
firstCodepoint(lineWords[wordIdx + 1]), lineWordStyles[wordIdx]);
|
||||
}
|
||||
if (effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
||||
gap += justifyExtra;
|
||||
}
|
||||
xpos -= gap;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// LTR: position words from left to right
|
||||
int xpos = firstLineIndent;
|
||||
if (effectiveAlignment == CssTextAlign::Right) {
|
||||
xpos = effectivePageWidth - lineWordWidthSum - totalNaturalGaps;
|
||||
} else if (effectiveAlignment == CssTextAlign::Center) {
|
||||
xpos = (effectivePageWidth - lineWordWidthSum - totalNaturalGaps) / 2;
|
||||
}
|
||||
|
||||
for (size_t wordIdx = 0; wordIdx < lineWordCount; wordIdx++) {
|
||||
lineXPos.push_back(static_cast<int16_t>(xpos));
|
||||
|
||||
const bool nextIsContinuation = wordIdx + 1 < lineWordCount && continuesVec[lastBreakAt + wordIdx + 1];
|
||||
if (nextIsContinuation) {
|
||||
int advance = wordWidths[lastBreakAt + wordIdx];
|
||||
advance += renderer.getKerning(fontId, lastCodepoint(lineWords[wordIdx]),
|
||||
firstCodepoint(lineWords[wordIdx + 1]), lineWordStyles[wordIdx]);
|
||||
if (lineWords[wordIdx] == " " && continuesVec[lastBreakAt + wordIdx] &&
|
||||
effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
||||
advance += justifyExtra;
|
||||
}
|
||||
xpos += advance;
|
||||
} else {
|
||||
int gap = 0;
|
||||
if (wordIdx + 1 < lineWordCount) {
|
||||
gap = renderer.getSpaceAdvance(fontId, lastCodepoint(lineWords[wordIdx]),
|
||||
firstCodepoint(lineWords[wordIdx + 1]), lineWordStyles[wordIdx]);
|
||||
}
|
||||
if (effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
||||
gap += justifyExtra;
|
||||
}
|
||||
xpos += wordWidths[lastBreakAt + wordIdx] + gap;
|
||||
}
|
||||
}
|
||||
xpos += wordWidths[lastBreakAt + wordIdx] + gap;
|
||||
}
|
||||
}
|
||||
|
||||
// Build line data by moving from the original vectors using index range
|
||||
std::vector<std::string> lineWords(std::make_move_iterator(words.begin() + lastBreakAt),
|
||||
std::make_move_iterator(words.begin() + lineBreak));
|
||||
std::vector<EpdFontFamily::Style> lineWordStyles(wordStyles.begin() + lastBreakAt, wordStyles.begin() + lineBreak);
|
||||
|
||||
for (auto& word : lineWords) {
|
||||
if (containsSoftHyphen(word)) {
|
||||
stripSoftHyphensInPlace(word);
|
||||
}
|
||||
}
|
||||
const auto isFocusSuffixAt = [&](const size_t idx) {
|
||||
return willReorder ? reorderedFocusSuffixScratch[idx] : wordIsFocusSuffix[lastBreakAt + idx];
|
||||
};
|
||||
|
||||
// Fast path: when no word on this line was split for focus reading, skip the merge work
|
||||
// entirely and pass empty boundary/suffixX vectors. TextBlock pays zero per-word RAM cost
|
||||
// for these annotations when the vectors are empty.
|
||||
bool lineHasFocusSplit = false;
|
||||
for (size_t i = 0; i < lineWordCount; i++) {
|
||||
if (wordIsFocusSuffix[lastBreakAt + i]) {
|
||||
if (isFocusSuffixAt(i)) {
|
||||
lineHasFocusSplit = true;
|
||||
break;
|
||||
}
|
||||
@@ -761,17 +929,18 @@ void ParsedText::extractLine(const size_t breakIndex, const int pageWidth, const
|
||||
outSuffixX.reserve(lineWordCount);
|
||||
|
||||
for (size_t i = 0; i < lineWordCount; i++) {
|
||||
if (wordIsFocusSuffix[lastBreakAt + i] && !outWords.empty()) {
|
||||
if (isFocusSuffixAt(i) && !outWords.empty()) {
|
||||
// Focus suffix: merge string into the preceding bold-prefix entry.
|
||||
outWords.back() += lineWords[i];
|
||||
} else {
|
||||
// Normal word: check for a following focus suffix to record the byte boundary.
|
||||
uint8_t boundary = 0;
|
||||
uint16_t suffixX = 0;
|
||||
if (i + 1 < lineWordCount && wordIsFocusSuffix[lastBreakAt + i + 1]) {
|
||||
if (i + 1 < lineWordCount && isFocusSuffixAt(i + 1)) {
|
||||
boundary = static_cast<uint8_t>(std::min(lineWords[i].size(), size_t{255}));
|
||||
// Suffix x offset = layout-time advance of the bold prefix, already known from xpos table.
|
||||
suffixX = static_cast<uint16_t>(lineXPos[i + 1] - lineXPos[i]);
|
||||
const int suffixDelta = static_cast<int>(lineXPos[i + 1]) - static_cast<int>(lineXPos[i]);
|
||||
suffixX = static_cast<uint16_t>(suffixDelta > 0 ? suffixDelta : 0);
|
||||
}
|
||||
outWords.push_back(std::move(lineWords[i]));
|
||||
outXPos.push_back(lineXPos[i]);
|
||||
|
||||
@@ -21,8 +21,16 @@ class ParsedText {
|
||||
bool extraParagraphSpacing;
|
||||
bool hyphenationEnabled;
|
||||
bool focusReadingEnabled;
|
||||
bool isNaturalAlign;
|
||||
bool hasRtlWord;
|
||||
std::vector<std::string> reorderedWordsScratch;
|
||||
std::vector<EpdFontFamily::Style> reorderedStylesScratch;
|
||||
std::vector<uint16_t> reorderedWidthsScratch;
|
||||
std::vector<bool> reorderedContinuesScratch;
|
||||
std::vector<bool> reorderedFocusSuffixScratch;
|
||||
std::vector<uint16_t> visualOrderScratch;
|
||||
|
||||
void applyParagraphIndent();
|
||||
int resolveFirstLineIndent(bool isFirstLine, const GfxRenderer& renderer, int fontId) const;
|
||||
std::vector<size_t> computeLineBreaks(const GfxRenderer& renderer, int fontId, int pageWidth,
|
||||
std::vector<uint16_t>& wordWidths, std::vector<bool>& continuesVec);
|
||||
std::vector<size_t> computeHyphenatedLineBreaks(const GfxRenderer& renderer, int fontId, int pageWidth,
|
||||
@@ -41,7 +49,9 @@ class ParsedText {
|
||||
: blockStyle(blockStyle),
|
||||
extraParagraphSpacing(extraParagraphSpacing),
|
||||
hyphenationEnabled(hyphenationEnabled),
|
||||
focusReadingEnabled(focusReadingEnabled) {}
|
||||
focusReadingEnabled(focusReadingEnabled),
|
||||
isNaturalAlign(false),
|
||||
hasRtlWord(false) {}
|
||||
~ParsedText() = default;
|
||||
|
||||
void addWord(std::string word, EpdFontFamily::Style fontStyle, bool underline = false, bool attachToPrevious = false);
|
||||
@@ -52,4 +62,4 @@ class ParsedText {
|
||||
void layoutAndExtractLines(const GfxRenderer& renderer, int fontId, uint16_t viewportWidth,
|
||||
const std::function<void(std::shared_ptr<TextBlock>)>& processLine,
|
||||
bool includeLastLine = true);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "parsers/ChapterHtmlSlimParser.h"
|
||||
|
||||
namespace {
|
||||
constexpr uint8_t SECTION_FILE_VERSION = 23;
|
||||
constexpr uint8_t SECTION_FILE_VERSION = 26;
|
||||
constexpr uint32_t HEADER_SIZE = sizeof(uint8_t) + sizeof(int) + sizeof(float) + sizeof(bool) + sizeof(uint8_t) +
|
||||
sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint16_t) + sizeof(bool) + sizeof(bool) +
|
||||
sizeof(uint8_t) + sizeof(bool) + sizeof(uint32_t) + sizeof(uint32_t) +
|
||||
@@ -176,7 +176,7 @@ bool Section::createSectionFile(const int fontId, const float lineCompression, c
|
||||
Storage.remove(tmpHtmlPath.c_str());
|
||||
}
|
||||
|
||||
FsFile tmpHtml;
|
||||
HalFile tmpHtml;
|
||||
if (!Storage.openFileForWrite("SCT", tmpHtmlPath, tmpHtml)) {
|
||||
continue;
|
||||
}
|
||||
@@ -221,13 +221,26 @@ bool Section::createSectionFile(const int fontId, const float lineCompression, c
|
||||
}
|
||||
}
|
||||
|
||||
// Collect TOC anchors for this spine so the parser can insert page breaks at chapter boundaries
|
||||
std::vector<std::string> tocAnchors;
|
||||
const int startTocIndex = epub->getTocIndexForSpineIndex(spineIndex);
|
||||
if (startTocIndex >= 0) {
|
||||
for (int i = startTocIndex; i < epub->getTocItemsCount(); i++) {
|
||||
auto entry = epub->getTocItem(i);
|
||||
if (entry.spineIndex != spineIndex) break;
|
||||
if (!entry.anchor.empty()) {
|
||||
tocAnchors.push_back(std::move(entry.anchor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ChapterHtmlSlimParser visitor(
|
||||
epub, tmpHtmlPath, renderer, fontId, lineCompression, extraParagraphSpacing, paragraphAlignment, viewportWidth,
|
||||
viewportHeight, hyphenationEnabled, focusReadingEnabled,
|
||||
[this, &lut](std::unique_ptr<Page> page, const uint16_t paragraphIndex, const uint16_t listItemIndex) {
|
||||
lut.push_back({this->onPageComplete(std::move(page)), paragraphIndex, listItemIndex});
|
||||
},
|
||||
embeddedStyle, contentBase, imageBasePath, imageRendering, popupFn, cssParser);
|
||||
embeddedStyle, contentBase, imageBasePath, imageRendering, std::move(tocAnchors), popupFn, cssParser);
|
||||
Hyphenator::setPreferredLanguage(epub->getLanguage());
|
||||
success = visitor.parseAndBuildPages();
|
||||
|
||||
@@ -316,8 +329,45 @@ std::unique_ptr<Page> Section::loadPageFromSectionFile() {
|
||||
return page;
|
||||
}
|
||||
|
||||
std::string Section::getTextFromSectionFile() {
|
||||
std::string fullText;
|
||||
auto p = this->loadPageFromSectionFile();
|
||||
if (p) {
|
||||
for (const auto& el : p->elements) {
|
||||
if (el->getTag() == TAG_PageLine) {
|
||||
const auto& line = static_cast<const PageLine&>(*el);
|
||||
if (line.getBlock()) {
|
||||
const auto& words = line.getBlock()->getWords();
|
||||
for (const auto& w : words) {
|
||||
if (!fullText.empty()) fullText += " ";
|
||||
fullText += w;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return fullText;
|
||||
}
|
||||
|
||||
std::optional<uint16_t> Section::getCachedPageCount() const {
|
||||
HalFile f;
|
||||
if (!Storage.openFileForRead("SCT", filePath, f)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const uint32_t fileSize = f.size();
|
||||
if (fileSize < HEADER_SIZE) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
f.seek(HEADER_SIZE - sizeof(uint32_t) * 4 - sizeof(uint16_t));
|
||||
uint16_t count;
|
||||
serialization::readPod(f, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
std::optional<uint16_t> Section::getPageForAnchor(const std::string& anchor) const {
|
||||
FsFile f;
|
||||
HalFile f;
|
||||
if (!Storage.openFileForRead("SCT", filePath, f)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -347,7 +397,7 @@ std::optional<uint16_t> Section::getPageForAnchor(const std::string& anchor) con
|
||||
}
|
||||
|
||||
std::optional<uint16_t> Section::getPageForParagraphIndex(const uint16_t pIndex) const {
|
||||
FsFile f;
|
||||
HalFile f;
|
||||
if (!Storage.openFileForRead("SCT", filePath, f)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -386,7 +436,7 @@ std::optional<uint16_t> Section::getPageForParagraphIndex(const uint16_t pIndex)
|
||||
}
|
||||
|
||||
std::optional<uint16_t> Section::getParagraphIndexForPage(const uint16_t page) const {
|
||||
FsFile f;
|
||||
HalFile f;
|
||||
if (!Storage.openFileForRead("SCT", filePath, f)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -418,7 +468,7 @@ std::optional<uint16_t> Section::getParagraphIndexForPage(const uint16_t page) c
|
||||
}
|
||||
|
||||
std::optional<uint16_t> Section::getPageForListItemIndex(const uint16_t liIndex) const {
|
||||
FsFile f;
|
||||
HalFile f;
|
||||
if (!Storage.openFileForRead("SCT", filePath, f)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class Section {
|
||||
const int spineIndex;
|
||||
GfxRenderer& renderer;
|
||||
std::string filePath;
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
|
||||
void writeSectionFileHeader(int fontId, float lineCompression, bool extraParagraphSpacing, uint8_t paragraphAlignment,
|
||||
uint16_t viewportWidth, uint16_t viewportHeight, bool hyphenationEnabled,
|
||||
@@ -40,10 +40,14 @@ class Section {
|
||||
uint8_t imageRendering, bool focusReadingEnabled,
|
||||
const std::function<void()>& popupFn = nullptr);
|
||||
std::unique_ptr<Page> loadPageFromSectionFile();
|
||||
std::string getTextFromSectionFile();
|
||||
|
||||
// Look up the page number for an anchor id from the section cache file.
|
||||
std::optional<uint16_t> getPageForAnchor(const std::string& anchor) const;
|
||||
|
||||
// Get the page count from the section cache file without fully loading it.
|
||||
std::optional<uint16_t> getCachedPageCount() const;
|
||||
|
||||
// Look up the page number for a synthetic paragraph index from XPath p[N].
|
||||
std::optional<uint16_t> getPageForParagraphIndex(uint16_t pIndex) const;
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ struct BlockStyle {
|
||||
int16_t textIndent = 0;
|
||||
bool textIndentDefined = false; // true if text-indent was explicitly set in CSS
|
||||
bool textAlignDefined = false; // true if text-align was explicitly set in CSS
|
||||
bool isRtl = false; // true if resolved direction is RTL
|
||||
bool directionDefined = false; // true if direction was explicitly set in CSS/HTML
|
||||
|
||||
// Combined insets (margin + padding)
|
||||
[[nodiscard]] int16_t leftInset() const { return marginLeft + paddingLeft; }
|
||||
@@ -84,6 +86,12 @@ struct BlockStyle {
|
||||
result.paddingBottom = static_cast<int16_t>(child.paddingBottom + paddingBottom);
|
||||
}
|
||||
|
||||
// Direction is not axis-specific. Inherit from parent when child doesn't define it.
|
||||
if (!child.directionDefined && directionDefined) {
|
||||
result.isRtl = isRtl;
|
||||
result.directionDefined = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -107,7 +115,7 @@ struct BlockStyle {
|
||||
blockStyle.paddingRight = std::min(cssStyle.paddingRight.toPixelsInt16(emSize, vw), maxHorizontalInsetPx);
|
||||
|
||||
// For textIndent: if it's a percentage we can't resolve (no viewport width),
|
||||
// leave textIndentDefined=false so the EmSpace fallback in applyParagraphIndent() is used
|
||||
// leave textIndentDefined=false so the space-width fallback in resolveFirstLineIndent() is used
|
||||
if (cssStyle.hasTextIndent() && cssStyle.textIndent.isResolvable(vw)) {
|
||||
blockStyle.textIndent = cssStyle.textIndent.toPixelsInt16(emSize, vw);
|
||||
blockStyle.textIndentDefined = true;
|
||||
@@ -119,6 +127,11 @@ struct BlockStyle {
|
||||
} else {
|
||||
blockStyle.alignment = paragraphAlignment;
|
||||
}
|
||||
// RTL direction from CSS/HTML
|
||||
if (cssStyle.hasDirection()) {
|
||||
blockStyle.isRtl = (cssStyle.direction == CssTextDirection::Rtl);
|
||||
blockStyle.directionDefined = true;
|
||||
}
|
||||
return blockStyle;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include "ImageBlock.h"
|
||||
|
||||
#include <FontCacheManager.h>
|
||||
#include <GfxRenderer.h>
|
||||
#include <Logging.h>
|
||||
#include <Serialization.h>
|
||||
|
||||
#include "../converters/DirectPixelWriter.h"
|
||||
#include "../converters/ImageDecoderFactory.h"
|
||||
#include "Epub/converters/DirectPixelWriter.h"
|
||||
#include "Epub/converters/ImageDecoderFactory.h"
|
||||
|
||||
// Cache file format:
|
||||
// - uint16_t width
|
||||
@@ -30,7 +31,7 @@ std::string getCachePath(const std::string& imagePath) {
|
||||
|
||||
bool renderFromCache(GfxRenderer& renderer, const std::string& cachePath, int x, int y, int expectedWidth,
|
||||
int expectedHeight) {
|
||||
FsFile cacheFile;
|
||||
HalFile cacheFile;
|
||||
if (!Storage.openFileForRead("IMG", cachePath, cacheFile)) {
|
||||
return false;
|
||||
}
|
||||
@@ -55,10 +56,22 @@ bool renderFromCache(GfxRenderer& renderer, const std::string& cachePath, int x,
|
||||
|
||||
LOG_DBG("IMG", "Loading from cache: %s (%dx%d)", cachePath.c_str(), cachedWidth, cachedHeight);
|
||||
|
||||
// Read and render row by row to minimize memory usage
|
||||
// Read several rows per SD access. A full-page image is re-rendered on every
|
||||
// grayscale strip pass (~14x per page), and a one-row-per-read loop here means
|
||||
// cachedHeight (~728) tiny reads through the storage mutex + SdFat each time —
|
||||
// the dominant cost of displaying an image page. Batching rows into a ~4KB
|
||||
// buffer cuts that to ~20 reads per pass without holding the whole image.
|
||||
const int bytesPerRow = (cachedWidth + 3) / 4; // 2 bits per pixel, 4 pixels per byte
|
||||
uint8_t* rowBuffer = (uint8_t*)malloc(bytesPerRow);
|
||||
if (!rowBuffer) {
|
||||
int rowsPerRead = 4096 / bytesPerRow;
|
||||
if (rowsPerRead < 1) rowsPerRead = 1;
|
||||
if (rowsPerRead > cachedHeight) rowsPerRead = cachedHeight;
|
||||
uint8_t* readBuffer = (uint8_t*)malloc((size_t)rowsPerRead * bytesPerRow);
|
||||
if (!readBuffer) {
|
||||
// Fall back to a single-row buffer under memory pressure.
|
||||
rowsPerRead = 1;
|
||||
readBuffer = (uint8_t*)malloc(bytesPerRow);
|
||||
}
|
||||
if (!readBuffer) {
|
||||
LOG_ERR("IMG", "Failed to allocate row buffer");
|
||||
return false;
|
||||
}
|
||||
@@ -66,16 +79,31 @@ bool renderFromCache(GfxRenderer& renderer, const std::string& cachePath, int x,
|
||||
DirectPixelWriter pw;
|
||||
pw.init(renderer);
|
||||
|
||||
int rowsInBuffer = 0;
|
||||
int bufferRow = 0;
|
||||
for (int row = 0; row < cachedHeight; row++) {
|
||||
if (cacheFile.read(rowBuffer, bytesPerRow) != bytesPerRow) {
|
||||
LOG_ERR("IMG", "Cache read error at row %d", row);
|
||||
free(rowBuffer);
|
||||
return false;
|
||||
if (bufferRow >= rowsInBuffer) {
|
||||
const int toRead = (cachedHeight - row < rowsPerRead) ? (cachedHeight - row) : rowsPerRead;
|
||||
const size_t bytes = (size_t)toRead * bytesPerRow;
|
||||
if (cacheFile.read(readBuffer, bytes) != static_cast<int>(bytes)) {
|
||||
LOG_ERR("IMG", "Cache read error at row %d", row);
|
||||
free(readBuffer);
|
||||
return false;
|
||||
}
|
||||
rowsInBuffer = toRead;
|
||||
bufferRow = 0;
|
||||
}
|
||||
|
||||
const uint8_t* rowBuffer = readBuffer + (size_t)bufferRow * bytesPerRow;
|
||||
bufferRow++;
|
||||
|
||||
const int destY = y + row;
|
||||
pw.beginRow(destY);
|
||||
for (int col = 0; col < cachedWidth; col++) {
|
||||
// On a grayscale strip pass only a narrow column window of the image is in
|
||||
// the active band; skip the rest instead of unpacking+clipping every pixel.
|
||||
int colStart, colEnd;
|
||||
pw.bandColRange(x, cachedWidth, colStart, colEnd);
|
||||
for (int col = colStart; col < colEnd; col++) {
|
||||
const int byteIdx = col >> 2; // col / 4
|
||||
const int bitShift = 6 - (col & 3) * 2; // MSB first within byte
|
||||
uint8_t pixelValue = (rowBuffer[byteIdx] >> bitShift) & 0x03;
|
||||
@@ -84,7 +112,7 @@ bool renderFromCache(GfxRenderer& renderer, const std::string& cachePath, int x,
|
||||
}
|
||||
}
|
||||
|
||||
free(rowBuffer);
|
||||
free(readBuffer);
|
||||
LOG_DBG("IMG", "Cache render complete");
|
||||
return true;
|
||||
}
|
||||
@@ -92,6 +120,14 @@ bool renderFromCache(GfxRenderer& renderer, const std::string& cachePath, int x,
|
||||
} // namespace
|
||||
|
||||
void ImageBlock::render(GfxRenderer& renderer, const int x, const int y) {
|
||||
// The font-prewarm scan pass only accumulates glyphs; an image contributes
|
||||
// none, and its DirectPixelWriter output bypasses the renderer's scan-mode
|
||||
// suppression, so it would otherwise do a full (discarded) cache render every
|
||||
// page view. Skip it here. The image still draws in the real BW/grayscale
|
||||
// passes; on first view this just moves the one-time decode to the BW pass.
|
||||
FontCacheManager* fcm = renderer.getFontCacheManager();
|
||||
if (fcm && fcm->isScanning()) return;
|
||||
|
||||
LOG_DBG("IMG", "Rendering image at %d,%d: %s (%dx%d)", x, y, imagePath.c_str(), width, height);
|
||||
|
||||
const int screenWidth = renderer.getScreenWidth();
|
||||
@@ -104,6 +140,16 @@ void ImageBlock::render(GfxRenderer& renderer, const int x, const int y) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Tiled grayscale (#2190): skip the whole image when it doesn't touch the
|
||||
// active band. The per-pixel writer already clips off-band pixels, but without
|
||||
// this each of the ~7 bands per plane re-ran the full cache load / pixel walk
|
||||
// and discarded the result — the dominant cost of AA on image pages. The check
|
||||
// is orientation-aware and returns true when no strip is active, so the BW
|
||||
// pass and non-tiled controllers render the image exactly as before.
|
||||
if (!renderer.glyphIntersectsStrip(x, y, x + width - 1, y + height - 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to render from cache first
|
||||
std::string cachePath = getCachePath(imagePath);
|
||||
if (renderFromCache(renderer, cachePath, x, y, width, height)) {
|
||||
@@ -112,7 +158,7 @@ void ImageBlock::render(GfxRenderer& renderer, const int x, const int y) {
|
||||
|
||||
// No cache - need to decode the image
|
||||
// Check if image file exists
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (!Storage.openFileForRead("IMG", imagePath, file)) {
|
||||
LOG_ERR("IMG", "Image file not found: %s", imagePath.c_str());
|
||||
return;
|
||||
@@ -155,14 +201,14 @@ void ImageBlock::render(GfxRenderer& renderer, const int x, const int y) {
|
||||
LOG_DBG("IMG", "Decode successful");
|
||||
}
|
||||
|
||||
bool ImageBlock::serialize(FsFile& file) {
|
||||
bool ImageBlock::serialize(HalFile& file) {
|
||||
serialization::writeString(file, imagePath);
|
||||
serialization::writePod(file, width);
|
||||
serialization::writePod(file, height);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<ImageBlock> ImageBlock::deserialize(FsFile& file) {
|
||||
std::unique_ptr<ImageBlock> ImageBlock::deserialize(HalFile& file) {
|
||||
std::string path;
|
||||
serialization::readString(file, path);
|
||||
int16_t w, h;
|
||||
|
||||
@@ -21,8 +21,8 @@ class ImageBlock final : public Block {
|
||||
bool isEmpty() override { return false; }
|
||||
|
||||
void render(GfxRenderer& renderer, const int x, const int y);
|
||||
bool serialize(FsFile& file);
|
||||
static std::unique_ptr<ImageBlock> deserialize(FsFile& file);
|
||||
bool serialize(HalFile& file);
|
||||
static std::unique_ptr<ImageBlock> deserialize(HalFile& file);
|
||||
|
||||
private:
|
||||
std::string imagePath;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "TextBlock.h"
|
||||
|
||||
#include <BidiUtils.h>
|
||||
#include <GfxRenderer.h>
|
||||
#include <Logging.h>
|
||||
#include <Serialization.h>
|
||||
@@ -18,11 +19,26 @@ void TextBlock::render(const GfxRenderer& renderer, const int fontId, const int
|
||||
return;
|
||||
}
|
||||
|
||||
const bool scanning = renderer.isFontCacheScanning();
|
||||
const int ascender = renderer.getFontAscenderSize(fontId);
|
||||
for (size_t i = 0; i < words.size(); i++) {
|
||||
const int wordX = wordXpos[i] + x;
|
||||
const EpdFontFamily::Style currentStyle = wordStyles[i];
|
||||
const auto baseDir = static_cast<BidiUtils::BidiBaseDir>(
|
||||
BidiUtils::detectParagraphLevel(words[i].c_str(), blockStyle.isRtl ? 1 : 0));
|
||||
const uint8_t boundary = hasFocus ? wordFocusBoundary[i] : 0;
|
||||
|
||||
// SUP/SUB shift the baseline passed to drawText; the glyph is also scaled 50% inside
|
||||
// drawText, so these offsets are chosen relative to the full-size ascender:
|
||||
// SUP: raise by 40% of ascender — sits clearly above the cap-height
|
||||
// SUB: lower by 25% of ascender — descends below baseline without clashing with ascenders below
|
||||
int wordY = y;
|
||||
if ((currentStyle & EpdFontFamily::SUP) != 0) {
|
||||
wordY -= ascender * 2 / 5;
|
||||
} else if ((currentStyle & EpdFontFamily::SUB) != 0) {
|
||||
wordY += ascender / 4;
|
||||
}
|
||||
|
||||
if (boundary > 0) {
|
||||
// Focus split: draw bold prefix, then the regular suffix at a pre-computed x offset.
|
||||
// The bold prefix is bounded to 9 codepoints by the clamp on targetBoldChars in
|
||||
@@ -36,38 +52,28 @@ void TextBlock::render(const GfxRenderer& renderer, const int fontId, const int
|
||||
const size_t boldLen = std::min<size_t>({static_cast<size_t>(boundary), words[i].size(), sizeof(boldBuf) - 1});
|
||||
memcpy(boldBuf, words[i].c_str(), boldLen);
|
||||
boldBuf[boldLen] = '\0';
|
||||
renderer.drawText(fontId, wordX, y, boldBuf, true, boldStyle);
|
||||
renderer.drawText(fontId, wordX, wordY, boldBuf, true, boldStyle, baseDir);
|
||||
const int suffixX = wordX + wordFocusSuffixX[i];
|
||||
renderer.drawText(fontId, suffixX, y, words[i].c_str() + boldLen, true, currentStyle);
|
||||
renderer.drawText(fontId, suffixX, wordY, words[i].c_str() + boldLen, true, currentStyle, baseDir);
|
||||
} else {
|
||||
renderer.drawText(fontId, wordX, y, words[i].c_str(), true, currentStyle);
|
||||
renderer.drawText(fontId, wordX, wordY, words[i].c_str(), true, currentStyle, baseDir);
|
||||
}
|
||||
|
||||
if ((currentStyle & EpdFontFamily::UNDERLINE) != 0) {
|
||||
if (!scanning && (currentStyle & EpdFontFamily::UNDERLINE) != 0) {
|
||||
const std::string& w = words[i];
|
||||
const int fullWordWidth = renderer.getTextWidth(fontId, w.c_str(), currentStyle);
|
||||
// y is the top of the text line; add ascender to reach baseline, then offset 2px below
|
||||
const int underlineY = y + renderer.getFontAscenderSize(fontId) + 2;
|
||||
int underlineWidth = renderer.getTextWidth(fontId, w.c_str(), currentStyle, baseDir);
|
||||
const int underlineY = wordY + ascender + 2;
|
||||
|
||||
int startX = wordX;
|
||||
int underlineWidth = fullWordWidth;
|
||||
|
||||
// if word starts with em-space ("\xe2\x80\x83"), account for the additional indent before drawing the line
|
||||
if (w.size() >= 3 && static_cast<uint8_t>(w[0]) == 0xE2 && static_cast<uint8_t>(w[1]) == 0x80 &&
|
||||
static_cast<uint8_t>(w[2]) == 0x83) {
|
||||
const char* visiblePtr = w.c_str() + 3;
|
||||
const int prefixWidth = renderer.getTextAdvanceX(fontId, "\xe2\x80\x83", currentStyle);
|
||||
const int visibleWidth = renderer.getTextWidth(fontId, visiblePtr, currentStyle);
|
||||
startX = wordX + prefixWidth;
|
||||
underlineWidth = visibleWidth;
|
||||
if ((currentStyle & (EpdFontFamily::SUP | EpdFontFamily::SUB)) != 0) {
|
||||
underlineWidth = (underlineWidth + 1) / 2;
|
||||
}
|
||||
|
||||
renderer.drawLine(startX, underlineY, startX + underlineWidth, underlineY, true);
|
||||
renderer.drawLine(wordX, underlineY, wordX + underlineWidth, underlineY, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TextBlock::serialize(FsFile& file) const {
|
||||
bool TextBlock::serialize(HalFile& file) const {
|
||||
// Focus annotations are optional; vectors are either empty (no splits in this block)
|
||||
// or sized in lockstep with words[].
|
||||
const bool hasFocus = !wordFocusBoundary.empty();
|
||||
@@ -106,11 +112,13 @@ bool TextBlock::serialize(FsFile& file) const {
|
||||
serialization::writePod(file, blockStyle.paddingRight);
|
||||
serialization::writePod(file, blockStyle.textIndent);
|
||||
serialization::writePod(file, blockStyle.textIndentDefined);
|
||||
serialization::writePod(file, blockStyle.isRtl);
|
||||
serialization::writePod(file, blockStyle.directionDefined);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<TextBlock> TextBlock::deserialize(FsFile& file) {
|
||||
std::unique_ptr<TextBlock> TextBlock::deserialize(HalFile& file) {
|
||||
uint16_t wc;
|
||||
std::vector<std::string> words;
|
||||
std::vector<int16_t> wordXpos;
|
||||
@@ -159,6 +167,8 @@ std::unique_ptr<TextBlock> TextBlock::deserialize(FsFile& file) {
|
||||
serialization::readPod(file, blockStyle.paddingRight);
|
||||
serialization::readPod(file, blockStyle.textIndent);
|
||||
serialization::readPod(file, blockStyle.textIndentDefined);
|
||||
serialization::readPod(file, blockStyle.isRtl);
|
||||
serialization::readPod(file, blockStyle.directionDefined);
|
||||
|
||||
return std::unique_ptr<TextBlock>(new TextBlock(std::move(words), std::move(wordXpos), std::move(wordStyles),
|
||||
std::move(wordFocusBoundary), std::move(wordFocusSuffixX),
|
||||
|
||||
@@ -47,6 +47,6 @@ class TextBlock final : public Block {
|
||||
// given a renderer works out where to break the words into lines
|
||||
void render(const GfxRenderer& renderer, int fontId, int x, int y) const;
|
||||
BlockType getType() override { return TEXT_BLOCK; }
|
||||
bool serialize(FsFile& file) const;
|
||||
static std::unique_ptr<TextBlock> deserialize(FsFile& file);
|
||||
bool serialize(HalFile& file) const;
|
||||
static std::unique_ptr<TextBlock> deserialize(HalFile& file);
|
||||
};
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <HalDisplay.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// Direct framebuffer writer that eliminates per-pixel overhead from the image
|
||||
// rendering hot path. Pre-computes orientation transform as linear coefficients
|
||||
// and caches render-mode state so the inner loop is: one multiply, one add,
|
||||
@@ -16,6 +18,12 @@ struct DirectPixelWriter {
|
||||
uint8_t* fb;
|
||||
GfxRenderer::RenderMode mode;
|
||||
uint16_t displayWidthBytes; // Runtime framebuffer stride (X4: 100, X3: 99)
|
||||
// Active write target: for tiled grayscale, fb is the band scratch, originY is
|
||||
// the band's top physical row, and clipRows is the band height. Off-band
|
||||
// pixels are dropped. With no strip active these collapse to the full frame
|
||||
// (originY 0, clipRows panelHeight) so the clip doubles as a bounds guard.
|
||||
int originY;
|
||||
int clipRows;
|
||||
|
||||
// Orientation is collapsed into a linear transform:
|
||||
// phyX = phyXBase + x * phyXStepX + y * phyXStepY
|
||||
@@ -28,7 +36,9 @@ struct DirectPixelWriter {
|
||||
int rowPhyXBase, rowPhyYBase;
|
||||
|
||||
void init(GfxRenderer& renderer) {
|
||||
fb = renderer.getFrameBuffer();
|
||||
fb = renderer.getWriteTarget();
|
||||
originY = renderer.getWriteOriginY();
|
||||
clipRows = renderer.getWriteRows();
|
||||
mode = renderer.getRenderMode();
|
||||
displayWidthBytes = renderer.getDisplayWidthBytes();
|
||||
|
||||
@@ -91,6 +101,46 @@ struct DirectPixelWriter {
|
||||
rowPhyYBase = phyYBase + logicalY * phyYStepY;
|
||||
}
|
||||
|
||||
// For the current row (set via beginRow), narrow [colStart, colEnd) to the
|
||||
// columns whose pixels fall inside the active strip band. writePixel() would
|
||||
// clip the rest anyway, but on a strip pass that is most of a full-page image
|
||||
// (only ~one strip-height worth of columns survive in portrait); skipping them
|
||||
// here avoids the per-pixel unpack+transform entirely. For full-frame passes
|
||||
// (clipRows == panel height) the range is unchanged. xBase is the logical X of
|
||||
// column 0; the band test mirrors writePixel(): 0 <= phyY - originY < clipRows.
|
||||
inline void bandColRange(int xBase, int width, int& colStart, int& colEnd) const {
|
||||
// init() only ever sets phyYStepX to 0, +1, or -1; the +1/-1 solve below
|
||||
// relies on that.
|
||||
assert(phyYStepX == 0 || phyYStepX == 1 || phyYStepX == -1);
|
||||
colStart = 0;
|
||||
colEnd = width;
|
||||
if (phyYStepX == 0) {
|
||||
// phyY is constant across the row: the whole row is in-band or out.
|
||||
const int sy = rowPhyYBase - originY;
|
||||
if (static_cast<unsigned>(sy) >= static_cast<unsigned>(clipRows)) colEnd = 0;
|
||||
return;
|
||||
}
|
||||
// phyY = rowPhyYBase + logicalX * phyYStepX (phyYStepX is +1 or -1).
|
||||
// Solve originY <= phyY <= originY + clipRows - 1 for logicalX.
|
||||
const int loY = originY;
|
||||
const int hiY = originY + clipRows - 1;
|
||||
int xLo, xHi;
|
||||
if (phyYStepX > 0) {
|
||||
xLo = loY - rowPhyYBase;
|
||||
xHi = hiY - rowPhyYBase;
|
||||
} else {
|
||||
xLo = rowPhyYBase - hiY;
|
||||
xHi = rowPhyYBase - loY;
|
||||
}
|
||||
const int cs = xLo - xBase;
|
||||
const int ce = xHi - xBase + 1; // exclusive
|
||||
if (cs > colStart) colStart = cs;
|
||||
if (ce < colEnd) colEnd = ce;
|
||||
if (colStart < 0) colStart = 0;
|
||||
if (colEnd > width) colEnd = width;
|
||||
if (colStart > colEnd) colStart = colEnd;
|
||||
}
|
||||
|
||||
// Write a single 2-bit dithered pixel value to the framebuffer.
|
||||
// Must be called after beginRow() for the current row.
|
||||
// No bounds checking — caller guarantees coordinates are valid.
|
||||
@@ -120,7 +170,12 @@ struct DirectPixelWriter {
|
||||
const int phyX = rowPhyXBase + logicalX * phyXStepX;
|
||||
const int phyY = rowPhyYBase + logicalX * phyYStepX;
|
||||
|
||||
const uint16_t byteIndex = phyY * displayWidthBytes + (phyX >> 3);
|
||||
// Band-local row. The unsigned compare drops both off-band pixels (strip
|
||||
// mode) and any out-of-frame row (full-frame mode) in one branch.
|
||||
const int sy = phyY - originY;
|
||||
if (static_cast<unsigned>(sy) >= static_cast<unsigned>(clipRows)) return;
|
||||
|
||||
const uint16_t byteIndex = static_cast<uint16_t>(sy * displayWidthBytes + (phyX >> 3));
|
||||
const uint8_t bitMask = 1 << (7 - (phyX & 7));
|
||||
|
||||
if (state) {
|
||||
@@ -134,27 +189,42 @@ struct DirectPixelWriter {
|
||||
// Direct cache writer that eliminates per-pixel overhead from PixelCache::setPixel().
|
||||
// Pre-computes row pointer so the inner loop is just byte index + bit manipulation.
|
||||
//
|
||||
// Caller guarantees coordinates are within cache bounds.
|
||||
// The cache buffer is a small streaming band (e.g. 16 rows), not the full image,
|
||||
// so a band-relative row/column that lands outside it would corrupt adjacent
|
||||
// heap. This writer therefore bounds-checks every access: beginRow() invalidates
|
||||
// the row when it falls outside the band, and writePixel() drops out-of-range
|
||||
// columns. This path only runs during the single decode that populates the
|
||||
// cache, never on the screen render hot path, so the checks are cheap.
|
||||
struct DirectCacheWriter {
|
||||
uint8_t* buffer;
|
||||
int bytesPerRow;
|
||||
int bandRows;
|
||||
int originX;
|
||||
uint8_t* rowPtr; // Pre-computed for current row
|
||||
uint8_t* rowPtr; // Pre-computed for current row; nullptr if row is out of band
|
||||
|
||||
void init(uint8_t* cacheBuffer, int cacheBytesPerRow, int cacheOriginX) {
|
||||
void init(uint8_t* cacheBuffer, int cacheBytesPerRow, int cacheBandRows, int cacheOriginX) {
|
||||
buffer = cacheBuffer;
|
||||
bytesPerRow = cacheBytesPerRow;
|
||||
bandRows = cacheBandRows;
|
||||
originX = cacheOriginX;
|
||||
rowPtr = nullptr;
|
||||
}
|
||||
|
||||
// Call once per row before the column loop.
|
||||
inline void beginRow(int screenY, int cacheOriginY) { rowPtr = buffer + (screenY - cacheOriginY) * bytesPerRow; }
|
||||
// Call once per row before the column loop. Drops rows outside the band.
|
||||
inline void beginRow(int screenY, int cacheOriginY) {
|
||||
const int localRow = screenY - cacheOriginY;
|
||||
rowPtr = (static_cast<unsigned>(localRow) < static_cast<unsigned>(bandRows))
|
||||
? buffer + (size_t)localRow * bytesPerRow
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
// Write a 2-bit pixel value. No bounds checking.
|
||||
// Write a 2-bit pixel value. Drops the write if the row is out of band or the
|
||||
// column is out of range.
|
||||
inline void writePixel(int screenX, uint8_t value) const {
|
||||
if (!rowPtr) return;
|
||||
const int localX = screenX - originX;
|
||||
const int byteIdx = localX >> 2; // localX / 4
|
||||
const int byteIdx = localX >> 2; // localX / 4
|
||||
if (static_cast<unsigned>(byteIdx) >= static_cast<unsigned>(bytesPerRow)) return;
|
||||
const int bitShift = 6 - (localX & 3) * 2; // MSB first: pixel 0 at bits 6-7
|
||||
rowPtr[byteIdx] = (rowPtr[byteIdx] & ~(0x03 << bitShift)) | ((value & 0x03) << bitShift);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
#include <HalStorage.h>
|
||||
#include <JPEGDEC.h>
|
||||
#include <Logging.h>
|
||||
#include <Memory.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
|
||||
#include "DirectPixelWriter.h"
|
||||
@@ -17,7 +19,7 @@ namespace {
|
||||
|
||||
// Context struct passed through JPEGDEC callbacks to avoid global mutable state.
|
||||
// The draw callback receives this via pDraw->pUser (set by setUserPointer()).
|
||||
// The file I/O callbacks receive the FsFile* via pFile->fHandle (set by jpegOpen()).
|
||||
// The file I/O callbacks receive the HalFile* via pFile->fHandle (set by jpegOpen()).
|
||||
struct JpegContext {
|
||||
GfxRenderer* renderer{nullptr};
|
||||
const RenderConfig* config{nullptr};
|
||||
@@ -46,10 +48,10 @@ struct JpegContext {
|
||||
bool caching{false};
|
||||
};
|
||||
|
||||
// File I/O callbacks use pFile->fHandle to access the FsFile*,
|
||||
// File I/O callbacks use pFile->fHandle to access the HalFile*,
|
||||
// avoiding the need for global file state.
|
||||
void* jpegOpen(const char* filename, int32_t* size) {
|
||||
FsFile* f = new FsFile();
|
||||
HalFile* f = new HalFile();
|
||||
if (!Storage.openFileForRead("JPG", std::string(filename), *f)) {
|
||||
delete f;
|
||||
return nullptr;
|
||||
@@ -59,7 +61,7 @@ void* jpegOpen(const char* filename, int32_t* size) {
|
||||
}
|
||||
|
||||
void jpegClose(void* handle) {
|
||||
FsFile* f = reinterpret_cast<FsFile*>(handle);
|
||||
HalFile* f = reinterpret_cast<HalFile*>(handle);
|
||||
if (f) {
|
||||
f->close();
|
||||
delete f;
|
||||
@@ -71,7 +73,7 @@ void jpegClose(void* handle) {
|
||||
// MUST maintain iPos to match the actual file position, otherwise progressive
|
||||
// JPEGs with large headers fail during parsing.
|
||||
int32_t jpegRead(JPEGFILE* pFile, uint8_t* pBuf, int32_t len) {
|
||||
FsFile* f = reinterpret_cast<FsFile*>(pFile->fHandle);
|
||||
HalFile* f = reinterpret_cast<HalFile*>(pFile->fHandle);
|
||||
if (!f) return 0;
|
||||
int32_t bytesRead = f->read(pBuf, len);
|
||||
if (bytesRead < 0) return 0;
|
||||
@@ -80,7 +82,7 @@ int32_t jpegRead(JPEGFILE* pFile, uint8_t* pBuf, int32_t len) {
|
||||
}
|
||||
|
||||
int32_t jpegSeek(JPEGFILE* pFile, int32_t pos) {
|
||||
FsFile* f = reinterpret_cast<FsFile*>(pFile->fHandle);
|
||||
HalFile* f = reinterpret_cast<HalFile*>(pFile->fHandle);
|
||||
if (!f) return -1;
|
||||
if (!f->seek(pos)) return -1;
|
||||
pFile->iPos = pos;
|
||||
@@ -130,7 +132,7 @@ int jpegDrawCallback(JPEGDRAW* pDraw) {
|
||||
if (stride <= 0 || blockH <= 0 || validW <= 0) return 1;
|
||||
|
||||
const bool useDithering = ctx->config->useDithering;
|
||||
const bool caching = ctx->caching;
|
||||
bool caching = ctx->caching;
|
||||
const int32_t fineScaleFPX = ctx->fineScaleFPX;
|
||||
const int32_t invScaleFPX = ctx->invScaleFPX;
|
||||
const int32_t fineScaleFPY = ctx->fineScaleFPY;
|
||||
@@ -167,9 +169,21 @@ int jpegDrawCallback(JPEGDRAW* pDraw) {
|
||||
DirectPixelWriter pw;
|
||||
pw.init(renderer);
|
||||
|
||||
// The cache streams to disk one MCU-row band at a time. Flushing rows below
|
||||
// this block (raster order guarantees they are final) repositions the band;
|
||||
// cacheOriginY then maps screen rows to the band-local buffer rows. If a flush
|
||||
// write fails, stop caching for the rest of this decode (and let finalize drop
|
||||
// the partial file) rather than writing past the band buffer.
|
||||
DirectCacheWriter cw;
|
||||
int cacheOriginY = 0;
|
||||
if (caching) {
|
||||
cw.init(ctx->cache.buffer, ctx->cache.bytesPerRow, ctx->cache.originX);
|
||||
if (!ctx->cache.advanceTo(dstYStart)) {
|
||||
caching = false;
|
||||
ctx->caching = false;
|
||||
} else {
|
||||
cw.init(ctx->cache.buffer, ctx->cache.bytesPerRow, ctx->cache.bandRows, ctx->cache.originX);
|
||||
cacheOriginY = ctx->config->y + ctx->cache.bandStart;
|
||||
}
|
||||
}
|
||||
|
||||
// === 1:1 fast path: no scaling math ===
|
||||
@@ -177,7 +191,7 @@ int jpegDrawCallback(JPEGDRAW* pDraw) {
|
||||
for (int dstY = dstYStart; dstY < dstYEnd; dstY++) {
|
||||
const int outY = cfgY + dstY;
|
||||
pw.beginRow(outY);
|
||||
if (caching) cw.beginRow(outY, ctx->config->y);
|
||||
if (caching) cw.beginRow(outY, cacheOriginY);
|
||||
const uint8_t* row = &pixels[(dstY - blockY) * stride];
|
||||
for (int dstX = dstXStart; dstX < dstXEnd; dstX++) {
|
||||
const int outX = cfgX + dstX;
|
||||
@@ -211,7 +225,7 @@ int jpegDrawCallback(JPEGDRAW* pDraw) {
|
||||
for (int dstY = dstYStart; dstY < dstYEnd; dstY++) {
|
||||
const int outY = cfgY + dstY;
|
||||
pw.beginRow(outY);
|
||||
if (caching) cw.beginRow(outY, ctx->config->y);
|
||||
if (caching) cw.beginRow(outY, cacheOriginY);
|
||||
const int32_t srcFyFP = dstY * invScaleFPY;
|
||||
const int32_t fy = srcFyFP & FP_MASK;
|
||||
const int32_t fyInv = FP_ONE - fy;
|
||||
@@ -308,7 +322,7 @@ int jpegDrawCallback(JPEGDRAW* pDraw) {
|
||||
for (int dstY = dstYStart; dstY < dstYEnd; dstY++) {
|
||||
const int outY = cfgY + dstY;
|
||||
pw.beginRow(outY);
|
||||
if (caching) cw.beginRow(outY, ctx->config->y);
|
||||
if (caching) cw.beginRow(outY, cacheOriginY);
|
||||
const int32_t srcFyFP = dstY * invScaleFPY;
|
||||
int ly = (srcFyFP >> FP_SHIFT) - blockY;
|
||||
if (ly < 0) ly = 0;
|
||||
@@ -347,16 +361,16 @@ bool JpegToFramebufferConverter::getDimensionsStatic(const std::string& imagePat
|
||||
return false;
|
||||
}
|
||||
|
||||
JPEGDEC* jpeg = new (std::nothrow) JPEGDEC();
|
||||
std::unique_ptr<JPEGDEC> jpeg(new (std::nothrow) JPEGDEC());
|
||||
if (!jpeg) {
|
||||
LOG_ERR("JPG", "Failed to allocate JPEG decoder for dimensions");
|
||||
return false;
|
||||
}
|
||||
|
||||
int rc = jpeg->open(imagePath.c_str(), jpegOpen, jpegClose, jpegRead, jpegSeek, nullptr);
|
||||
const ScopedCleanup cleanup{[&jpeg]() { jpeg->close(); }};
|
||||
if (rc != 1) {
|
||||
LOG_ERR("JPG", "Failed to open JPEG for dimensions (err=%d): %s", jpeg->getLastError(), imagePath.c_str());
|
||||
delete jpeg;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -364,8 +378,6 @@ bool JpegToFramebufferConverter::getDimensionsStatic(const std::string& imagePat
|
||||
out.height = jpeg->getHeight();
|
||||
LOG_DBG("JPG", "Image dimensions: %dx%d", out.width, out.height);
|
||||
|
||||
jpeg->close();
|
||||
delete jpeg;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -379,7 +391,7 @@ bool JpegToFramebufferConverter::decodeToFramebuffer(const std::string& imagePat
|
||||
return false;
|
||||
}
|
||||
|
||||
JPEGDEC* jpeg = new (std::nothrow) JPEGDEC();
|
||||
std::unique_ptr<JPEGDEC> jpeg(new (std::nothrow) JPEGDEC());
|
||||
if (!jpeg) {
|
||||
LOG_ERR("JPG", "Failed to allocate JPEG decoder");
|
||||
return false;
|
||||
@@ -392,9 +404,9 @@ bool JpegToFramebufferConverter::decodeToFramebuffer(const std::string& imagePat
|
||||
ctx.screenHeight = renderer.getScreenHeight();
|
||||
|
||||
int rc = jpeg->open(imagePath.c_str(), jpegOpen, jpegClose, jpegRead, jpegSeek, jpegDrawCallback);
|
||||
const ScopedCleanup cleanup{[&jpeg]() { jpeg->close(); }};
|
||||
if (rc != 1) {
|
||||
LOG_ERR("JPG", "Failed to open JPEG (err=%d): %s", jpeg->getLastError(), imagePath.c_str());
|
||||
delete jpeg;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -403,14 +415,10 @@ bool JpegToFramebufferConverter::decodeToFramebuffer(const std::string& imagePat
|
||||
|
||||
if (srcWidth <= 0 || srcHeight <= 0) {
|
||||
LOG_ERR("JPG", "Invalid JPEG dimensions: %dx%d", srcWidth, srcHeight);
|
||||
jpeg->close();
|
||||
delete jpeg;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!validateImageDimensions(srcWidth, srcHeight, "JPEG")) {
|
||||
jpeg->close();
|
||||
delete jpeg;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -453,8 +461,6 @@ bool JpegToFramebufferConverter::decodeToFramebuffer(const std::string& imagePat
|
||||
if (destWidth <= 0 || destHeight <= 0) {
|
||||
LOG_ERR("JPG", "Degenerate output dimensions %dx%d for %s, skipping render", destWidth, destHeight,
|
||||
imagePath.c_str());
|
||||
jpeg->close();
|
||||
delete jpeg;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -475,11 +481,14 @@ bool JpegToFramebufferConverter::decodeToFramebuffer(const std::string& imagePat
|
||||
jpeg->setPixelType(EIGHT_BIT_GRAYSCALE);
|
||||
jpeg->setUserPointer(&ctx);
|
||||
|
||||
// Allocate cache buffer using final output dimensions
|
||||
// Start streaming the pixel cache to disk. The band only needs to hold the
|
||||
// tallest single decode block: a JPEGDEC MCU cell is at most 16 scaled-source
|
||||
// rows tall, which our fine scale maps to this many output rows.
|
||||
ctx.caching = !config.cachePath.empty();
|
||||
if (ctx.caching) {
|
||||
if (!ctx.cache.allocate(destWidth, destHeight, config.x, config.y)) {
|
||||
LOG_ERR("JPG", "Failed to allocate cache buffer, continuing without caching");
|
||||
const int maxBlockDstRows = (int)(((int64_t)16 * ctx.fineScaleFPY) >> FP_SHIFT) + 2;
|
||||
if (!ctx.cache.begin(config.cachePath, destWidth, destHeight, config.x, config.y, maxBlockDstRows)) {
|
||||
LOG_ERR("JPG", "Failed to start cache stream, continuing without caching");
|
||||
ctx.caching = false;
|
||||
}
|
||||
}
|
||||
@@ -490,18 +499,16 @@ bool JpegToFramebufferConverter::decodeToFramebuffer(const std::string& imagePat
|
||||
|
||||
if (rc != 1) {
|
||||
LOG_ERR("JPG", "Decode failed (rc=%d, lastError=%d)", rc, jpeg->getLastError());
|
||||
jpeg->close();
|
||||
delete jpeg;
|
||||
if (ctx.caching) ctx.cache.abort();
|
||||
return false;
|
||||
}
|
||||
|
||||
jpeg->close();
|
||||
delete jpeg;
|
||||
LOG_DBG("JPG", "JPEG decoding complete - render time: %lu ms", decodeTime);
|
||||
|
||||
// Write cache file if caching was enabled
|
||||
// Finalize the streamed cache file. Note: a flush failure mid-decode clears
|
||||
// ctx.caching (the partial file is dropped), so re-read the flag here.
|
||||
if (ctx.caching) {
|
||||
ctx.cache.writeToFile(config.cachePath);
|
||||
ctx.cache.finalize();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -4,76 +4,181 @@
|
||||
#include <Logging.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
// Cache buffer for storing 2-bit pixels (4 levels) during decode.
|
||||
// Packs 4 pixels per byte, MSB first.
|
||||
// Streaming cache writer for 2-bit pixels (4 levels). Packs 4 pixels per byte,
|
||||
// MSB first.
|
||||
//
|
||||
// The .pxc file is written incrementally in small row bands rather than holding
|
||||
// the whole decoded image in one heap buffer. A full-page image (e.g. 482x728)
|
||||
// needs ~88KB packed, which will not fit alongside the ~20KB JPEG decoder on a
|
||||
// fragmented 380KB heap (free heap is routinely ~55KB on an image page). When
|
||||
// the cache cannot be written, every render pass re-decodes the JPEG from
|
||||
// scratch; an anti-aliased image page renders ~14 times (BW + AA restore + two
|
||||
// grayscale planes x ~6 strips), so a 2s decode becomes a ~30s freeze / watchdog
|
||||
// reset. Streaming keeps the working set to a single MCU-row band, so caching
|
||||
// succeeds and the image is decoded exactly once.
|
||||
//
|
||||
// Correctness relies on JPEGDEC delivering blocks in raster MCU order (outer
|
||||
// loop over y, inner over x: see jpeg.inl DecodeJPEG). Consecutive MCU rows map
|
||||
// to contiguous, non-overlapping destination row ranges, so once a block whose
|
||||
// top row is Y arrives, every output row < Y is final and is flushed to disk.
|
||||
struct PixelCache {
|
||||
uint8_t* buffer;
|
||||
uint8_t* buffer; // band buffer: (bandRows + 1) rows; last row kept zeroed
|
||||
uint8_t* zeroRow; // points at the spare zeroed row, for gap/clip fill
|
||||
int width;
|
||||
int height;
|
||||
int bytesPerRow;
|
||||
int originX; // config.x - to convert screen coords to cache coords
|
||||
int originY; // config.y
|
||||
int originX; // config.x - to convert screen coords to cache coords
|
||||
int originY; // config.y
|
||||
int bandRows; // rows held in the band buffer
|
||||
int bandStart; // image-local row index of band buffer row 0
|
||||
int flushedRows; // image-local rows already written to file
|
||||
HalFile file;
|
||||
std::string cachePathStr;
|
||||
bool ok;
|
||||
|
||||
PixelCache() : buffer(nullptr), width(0), height(0), bytesPerRow(0), originX(0), originY(0) {}
|
||||
PixelCache()
|
||||
: buffer(nullptr),
|
||||
zeroRow(nullptr),
|
||||
width(0),
|
||||
height(0),
|
||||
bytesPerRow(0),
|
||||
originX(0),
|
||||
originY(0),
|
||||
bandRows(0),
|
||||
bandStart(0),
|
||||
flushedRows(0),
|
||||
ok(false) {}
|
||||
PixelCache(const PixelCache&) = delete;
|
||||
PixelCache& operator=(const PixelCache&) = delete;
|
||||
|
||||
static constexpr size_t MAX_CACHE_BYTES = 256 * 1024; // 256KB limit for embedded targets
|
||||
static constexpr int MIN_BAND_ROWS = 16;
|
||||
static constexpr size_t MAX_BAND_BYTES = 24 * 1024; // band working-set ceiling
|
||||
|
||||
bool allocate(int w, int h, int ox, int oy) {
|
||||
// Open the cache file, write the header, and allocate a band buffer big enough
|
||||
// to hold the tallest single decode block (maxBlockDstRows output rows).
|
||||
bool begin(const std::string& cachePath, int w, int h, int ox, int oy, int maxBlockDstRows) {
|
||||
width = w;
|
||||
height = h;
|
||||
originX = ox;
|
||||
originY = oy;
|
||||
bytesPerRow = (w + 3) / 4; // 2 bits per pixel, 4 pixels per byte
|
||||
size_t bufferSize = (size_t)bytesPerRow * h;
|
||||
if (bufferSize > MAX_CACHE_BYTES) {
|
||||
LOG_ERR("IMG", "Cache buffer too large: %d bytes for %dx%d (limit %d)", bufferSize, w, h, MAX_CACHE_BYTES);
|
||||
bandStart = 0;
|
||||
flushedRows = 0;
|
||||
ok = false;
|
||||
|
||||
int wantRows = maxBlockDstRows + 2;
|
||||
if (wantRows < MIN_BAND_ROWS) wantRows = MIN_BAND_ROWS;
|
||||
if (wantRows > h) wantRows = h;
|
||||
|
||||
size_t maxRowsByMem = MAX_BAND_BYTES / (size_t)bytesPerRow;
|
||||
if (maxRowsByMem < 1) maxRowsByMem = 1;
|
||||
if ((size_t)wantRows > maxRowsByMem) wantRows = (int)maxRowsByMem;
|
||||
|
||||
// A single decode block must fit inside the band, otherwise streaming would
|
||||
// drop rows. This only fails for pathological upscales that could not be
|
||||
// cached at all; fall back to the no-cache path.
|
||||
if (wantRows < maxBlockDstRows) {
|
||||
LOG_ERR("IMG", "Cache band too small (%d < %d rows) for %dx%d", wantRows, maxBlockDstRows, w, h);
|
||||
return false;
|
||||
}
|
||||
buffer = (uint8_t*)malloc(bufferSize);
|
||||
if (buffer) {
|
||||
memset(buffer, 0, bufferSize);
|
||||
LOG_DBG("IMG", "Allocated cache buffer: %d bytes for %dx%d", bufferSize, w, h);
|
||||
bandRows = wantRows;
|
||||
|
||||
const size_t bufSize = (size_t)(bandRows + 1) * bytesPerRow; // +1 spare zero row
|
||||
buffer = (uint8_t*)malloc(bufSize);
|
||||
if (!buffer) {
|
||||
LOG_ERR("IMG", "OOM cache band: %u bytes", (unsigned)bufSize);
|
||||
return false;
|
||||
}
|
||||
return buffer != nullptr;
|
||||
}
|
||||
memset(buffer, 0, bufSize);
|
||||
zeroRow = buffer + (size_t)bandRows * bytesPerRow;
|
||||
|
||||
void setPixel(int screenX, int screenY, uint8_t value) {
|
||||
if (!buffer) return;
|
||||
int localX = screenX - originX;
|
||||
int localY = screenY - originY;
|
||||
if (localX < 0 || localX >= width || localY < 0 || localY >= height) return;
|
||||
|
||||
int byteIdx = localY * bytesPerRow + localX / 4;
|
||||
int bitShift = 6 - (localX % 4) * 2; // MSB first: pixel 0 at bits 6-7
|
||||
buffer[byteIdx] = (buffer[byteIdx] & ~(0x03 << bitShift)) | ((value & 0x03) << bitShift);
|
||||
}
|
||||
|
||||
bool writeToFile(const std::string& cachePath) {
|
||||
if (!buffer) return false;
|
||||
|
||||
FsFile cacheFile;
|
||||
if (!Storage.openFileForWrite("IMG", cachePath, cacheFile)) {
|
||||
if (!Storage.openFileForWrite("IMG", cachePath, file)) {
|
||||
LOG_ERR("IMG", "Failed to open cache file for writing: %s", cachePath.c_str());
|
||||
free(buffer);
|
||||
buffer = nullptr;
|
||||
return false;
|
||||
}
|
||||
cachePathStr = cachePath;
|
||||
|
||||
uint16_t w16 = (uint16_t)w;
|
||||
uint16_t h16 = (uint16_t)h;
|
||||
if (file.write(&w16, 2) != 2 || file.write(&h16, 2) != 2) {
|
||||
LOG_ERR("IMG", "Failed to write cache header: %s", cachePath.c_str());
|
||||
abort();
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t w = width;
|
||||
uint16_t h = height;
|
||||
cacheFile.write(&w, 2);
|
||||
cacheFile.write(&h, 2);
|
||||
cacheFile.write(buffer, bytesPerRow * height);
|
||||
cacheFile.close();
|
||||
|
||||
LOG_DBG("IMG", "Cache written: %s (%dx%d, %d bytes)", cachePath.c_str(), width, height, 4 + bytesPerRow * height);
|
||||
LOG_DBG("IMG", "Cache stream started: %s (%dx%d, band %d rows)", cachePath.c_str(), w, h, bandRows);
|
||||
ok = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Flush every output row below newTopRow (they are final in raster order) and
|
||||
// reposition the band to start at newTopRow. Returns false if a write failed,
|
||||
// in which case the caller must stop caching for the rest of the decode.
|
||||
bool advanceTo(int newTopRow) {
|
||||
if (!ok) return false;
|
||||
if (newTopRow <= bandStart) return true;
|
||||
if (newTopRow > height) newTopRow = height;
|
||||
|
||||
for (int r = bandStart; r < newTopRow; ++r) {
|
||||
const int idx = r - bandStart;
|
||||
const uint8_t* rowPtr = (idx < bandRows) ? (buffer + (size_t)idx * bytesPerRow) : zeroRow;
|
||||
if (file.write(rowPtr, (size_t)bytesPerRow) != (size_t)bytesPerRow) {
|
||||
LOG_ERR("IMG", "Cache write error at row %d", r);
|
||||
ok = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
flushedRows = newTopRow;
|
||||
bandStart = newTopRow;
|
||||
memset(buffer, 0, (size_t)bandRows * bytesPerRow); // fresh band (gaps stay black)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Flush the final band and zero-fill any rows never covered (image clipped by
|
||||
// the screen), then close the file.
|
||||
bool finalize() {
|
||||
if (!ok) {
|
||||
abort();
|
||||
return false;
|
||||
}
|
||||
for (int r = flushedRows; r < height; ++r) {
|
||||
const int idx = r - bandStart;
|
||||
const uint8_t* rowPtr = (idx >= 0 && idx < bandRows) ? (buffer + (size_t)idx * bytesPerRow) : zeroRow;
|
||||
if (file.write(rowPtr, (size_t)bytesPerRow) != (size_t)bytesPerRow) {
|
||||
LOG_ERR("IMG", "Cache write error at row %d", r);
|
||||
abort();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
LOG_DBG("IMG", "Cache written: %s (%dx%d, %d bytes)", cachePathStr.c_str(), width, height,
|
||||
4 + bytesPerRow * height);
|
||||
ok = false; // file handed off; nothing left to clean up
|
||||
return true;
|
||||
}
|
||||
|
||||
// Drop a partial/failed cache so a later decode re-creates it cleanly.
|
||||
void abort() {
|
||||
if (file.isOpen()) file.close();
|
||||
if (!cachePathStr.empty()) {
|
||||
Storage.remove(cachePathStr.c_str());
|
||||
}
|
||||
ok = false;
|
||||
}
|
||||
|
||||
~PixelCache() {
|
||||
if (file.isOpen()) {
|
||||
// The file is still open, so neither finalize() nor abort() ran, or a
|
||||
// mid-stream write failed (advanceTo() cleared ok but left the file open).
|
||||
// Drop the partial cache so we leave no corrupt file behind.
|
||||
abort();
|
||||
}
|
||||
if (buffer) {
|
||||
free(buffer);
|
||||
buffer = nullptr;
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
#include <GfxRenderer.h>
|
||||
#include <HalStorage.h>
|
||||
#include <Logging.h>
|
||||
#include <Memory.h>
|
||||
#include <PNGdec.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
|
||||
#include "DirectPixelWriter.h"
|
||||
@@ -17,7 +19,7 @@ namespace {
|
||||
|
||||
// Context struct passed through PNGdec callbacks to avoid global mutable state.
|
||||
// The draw callback receives this via pDraw->pUser (set by png.decode()).
|
||||
// The file I/O callbacks receive the FsFile* via pFile->fHandle (set by pngOpen()).
|
||||
// The file I/O callbacks receive the HalFile* via pFile->fHandle (set by pngOpen()).
|
||||
struct PngContext {
|
||||
GfxRenderer* renderer{nullptr};
|
||||
const RenderConfig* config{nullptr};
|
||||
@@ -38,10 +40,10 @@ struct PngContext {
|
||||
uint8_t* grayLineBuffer{nullptr};
|
||||
};
|
||||
|
||||
// File I/O callbacks use pFile->fHandle to access the FsFile*,
|
||||
// File I/O callbacks use pFile->fHandle to access the HalFile*,
|
||||
// avoiding the need for global file state.
|
||||
void* pngOpenWithHandle(const char* filename, int32_t* size) {
|
||||
FsFile* f = new FsFile();
|
||||
HalFile* f = new HalFile();
|
||||
if (!Storage.openFileForRead("PNG", std::string(filename), *f)) {
|
||||
delete f;
|
||||
return nullptr;
|
||||
@@ -51,7 +53,7 @@ void* pngOpenWithHandle(const char* filename, int32_t* size) {
|
||||
}
|
||||
|
||||
void pngCloseWithHandle(void* handle) {
|
||||
FsFile* f = reinterpret_cast<FsFile*>(handle);
|
||||
HalFile* f = reinterpret_cast<HalFile*>(handle);
|
||||
if (f) {
|
||||
f->close();
|
||||
delete f;
|
||||
@@ -59,13 +61,13 @@ void pngCloseWithHandle(void* handle) {
|
||||
}
|
||||
|
||||
int32_t pngReadWithHandle(PNGFILE* pFile, uint8_t* pBuf, int32_t len) {
|
||||
FsFile* f = reinterpret_cast<FsFile*>(pFile->fHandle);
|
||||
HalFile* f = reinterpret_cast<HalFile*>(pFile->fHandle);
|
||||
if (!f) return 0;
|
||||
return f->read(pBuf, len);
|
||||
}
|
||||
|
||||
int32_t pngSeekWithHandle(PNGFILE* pFile, int32_t pos) {
|
||||
FsFile* f = reinterpret_cast<FsFile*>(pFile->fHandle);
|
||||
HalFile* f = reinterpret_cast<HalFile*>(pFile->fHandle);
|
||||
if (!f) return -1;
|
||||
return f->seek(pos);
|
||||
}
|
||||
@@ -199,10 +201,19 @@ int pngDrawCallback(PNGDRAW* pDraw) {
|
||||
pw.init(*ctx->renderer);
|
||||
pw.beginRow(outY);
|
||||
|
||||
// The cache streams to disk one row at a time. Flushing rows below this one
|
||||
// (PNGdec delivers scanlines top to bottom) repositions the single-row band.
|
||||
// A flush failure stops caching for the rest of the decode so we never write
|
||||
// past the band buffer; finalize() then drops the partial file.
|
||||
DirectCacheWriter cw;
|
||||
if (caching) {
|
||||
cw.init(ctx->cache.buffer, ctx->cache.bytesPerRow, ctx->cache.originX);
|
||||
cw.beginRow(outY, ctx->config->y);
|
||||
if (!ctx->cache.advanceTo(dstY)) {
|
||||
caching = false;
|
||||
ctx->caching = false;
|
||||
} else {
|
||||
cw.init(ctx->cache.buffer, ctx->cache.bytesPerRow, ctx->cache.bandRows, ctx->cache.originX);
|
||||
cw.beginRow(outY, ctx->config->y + ctx->cache.bandStart);
|
||||
}
|
||||
}
|
||||
|
||||
int srcX = 0;
|
||||
@@ -244,7 +255,7 @@ bool PngToFramebufferConverter::getDimensionsStatic(const std::string& imagePath
|
||||
return false;
|
||||
}
|
||||
|
||||
PNG* png = new (std::nothrow) PNG();
|
||||
std::unique_ptr<PNG> png(new (std::nothrow) PNG());
|
||||
if (!png) {
|
||||
LOG_ERR("PNG", "Failed to allocate PNG decoder for dimensions");
|
||||
return false;
|
||||
@@ -252,18 +263,16 @@ bool PngToFramebufferConverter::getDimensionsStatic(const std::string& imagePath
|
||||
|
||||
int rc = png->open(imagePath.c_str(), pngOpenWithHandle, pngCloseWithHandle, pngReadWithHandle, pngSeekWithHandle,
|
||||
nullptr);
|
||||
const ScopedCleanup cleanup{[&png]() { png->close(); }};
|
||||
|
||||
if (rc != 0) {
|
||||
LOG_ERR("PNG", "Failed to open PNG for dimensions: %d", rc);
|
||||
delete png;
|
||||
return false;
|
||||
}
|
||||
|
||||
out.width = png->getWidth();
|
||||
out.height = png->getHeight();
|
||||
|
||||
png->close();
|
||||
delete png;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -278,7 +287,7 @@ bool PngToFramebufferConverter::decodeToFramebuffer(const std::string& imagePath
|
||||
}
|
||||
|
||||
// Heap-allocate PNG decoder (~42 KB) - freed at end of function
|
||||
PNG* png = new (std::nothrow) PNG();
|
||||
std::unique_ptr<PNG> png(new (std::nothrow) PNG());
|
||||
if (!png) {
|
||||
LOG_ERR("PNG", "Failed to allocate PNG decoder");
|
||||
return false;
|
||||
@@ -292,15 +301,13 @@ bool PngToFramebufferConverter::decodeToFramebuffer(const std::string& imagePath
|
||||
|
||||
int rc = png->open(imagePath.c_str(), pngOpenWithHandle, pngCloseWithHandle, pngReadWithHandle, pngSeekWithHandle,
|
||||
pngDrawCallback);
|
||||
const ScopedCleanup cleanup{[&png]() { png->close(); }};
|
||||
if (rc != PNG_SUCCESS) {
|
||||
LOG_ERR("PNG", "Failed to open PNG: %d", rc);
|
||||
delete png;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!validateImageDimensions(png->getWidth(), png->getHeight(), "PNG")) {
|
||||
png->close();
|
||||
delete png;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -335,8 +342,6 @@ bool PngToFramebufferConverter::decodeToFramebuffer(const std::string& imagePath
|
||||
"PNG row buffer too small: need %d bytes for width=%d type=%d, configured PNG_MAX_BUFFERED_PIXELS=%d",
|
||||
requiredInternal, ctx.srcWidth, pixelType, PNG_MAX_BUFFERED_PIXELS);
|
||||
LOG_ERR("PNG", "Aborting decode to avoid PNGdec internal buffer overflow");
|
||||
png->close();
|
||||
delete png;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -349,24 +354,19 @@ bool PngToFramebufferConverter::decodeToFramebuffer(const std::string& imagePath
|
||||
ctx.grayLineBuffer = static_cast<uint8_t*>(malloc(grayBufSize));
|
||||
if (!ctx.grayLineBuffer) {
|
||||
LOG_ERR("PNG", "Failed to allocate gray line buffer");
|
||||
png->close();
|
||||
delete png;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Allocate cache buffer using SCALED dimensions.
|
||||
// PNG decode is fast enough (~135ms for 400x600) that caching provides minimal benefit
|
||||
// for larger images, while the cache buffer competes with the 44KB PNG decoder for heap.
|
||||
// Skip caching when the buffer would exceed the framebuffer size (48KB).
|
||||
static constexpr size_t PNG_MAX_CACHE_BYTES = 48000;
|
||||
// Stream the pixel cache to disk. PNGdec delivers source scanlines top to
|
||||
// bottom and we emit at most one (downscaled) output row per callback, so the
|
||||
// band only needs a single row. Streaming keeps the working set tiny, so
|
||||
// unlike the old full-image buffer it neither competes with the ~44KB decoder
|
||||
// nor forces larger images to skip caching - which previously meant a full
|
||||
// re-decode on every one of an image page's ~14 render passes.
|
||||
ctx.caching = !config.cachePath.empty();
|
||||
if (ctx.caching) {
|
||||
size_t cacheSize = (size_t)((ctx.dstWidth + 3) / 4) * ctx.dstHeight;
|
||||
if (cacheSize > PNG_MAX_CACHE_BYTES) {
|
||||
LOG_DBG("PNG", "Skipping cache: %zu bytes exceeds PNG limit (%zu)", cacheSize, PNG_MAX_CACHE_BYTES);
|
||||
ctx.caching = false;
|
||||
} else if (!ctx.cache.allocate(ctx.dstWidth, ctx.dstHeight, config.x, config.y)) {
|
||||
LOG_ERR("PNG", "Failed to allocate cache buffer, continuing without caching");
|
||||
if (!ctx.cache.begin(config.cachePath, ctx.dstWidth, ctx.dstHeight, config.x, config.y, 1)) {
|
||||
LOG_ERR("PNG", "Failed to start cache stream, continuing without caching");
|
||||
ctx.caching = false;
|
||||
}
|
||||
}
|
||||
@@ -380,18 +380,15 @@ bool PngToFramebufferConverter::decodeToFramebuffer(const std::string& imagePath
|
||||
|
||||
if (rc != PNG_SUCCESS) {
|
||||
LOG_ERR("PNG", "Decode failed: %d", rc);
|
||||
png->close();
|
||||
delete png;
|
||||
if (ctx.caching) ctx.cache.abort();
|
||||
return false;
|
||||
}
|
||||
|
||||
png->close();
|
||||
delete png;
|
||||
LOG_DBG("PNG", "PNG decoding complete - render time: %lu ms", decodeTime);
|
||||
|
||||
// Write cache file if caching was enabled and buffer was allocated
|
||||
// Finalize the streamed cache (caching may have been cleared on a flush error).
|
||||
if (ctx.caching) {
|
||||
ctx.cache.writeToFile(config.cachePath);
|
||||
ctx.cache.finalize();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+325
-290
@@ -6,6 +6,8 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cctype>
|
||||
#include <charconv>
|
||||
#include <cstring>
|
||||
#include <string_view>
|
||||
|
||||
namespace {
|
||||
@@ -29,9 +31,7 @@ struct StackBuffer {
|
||||
|
||||
// Get string view of current content (zero-copy)
|
||||
std::string_view view() const { return std::string_view(data, len); }
|
||||
|
||||
// Convert to string for passing to functions (single allocation)
|
||||
std::string str() const { return std::string(data, len); }
|
||||
operator std::string_view() const noexcept { return view(); }
|
||||
};
|
||||
|
||||
// Buffer size for reading CSS files
|
||||
@@ -50,7 +50,87 @@ constexpr size_t MIN_FREE_HEAP_FOR_CSS = 48 * 1024;
|
||||
constexpr size_t MAX_SELECTOR_LENGTH = 256;
|
||||
|
||||
// Check if character is CSS whitespace
|
||||
bool isCssWhitespace(const char c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f'; }
|
||||
constexpr bool isCssWhitespace(const char c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f'; }
|
||||
|
||||
constexpr std::string_view trimCssWhitespace(std::string_view s) {
|
||||
while (!s.empty() && isCssWhitespace(s.front())) s.remove_prefix(1);
|
||||
while (!s.empty() && isCssWhitespace(s.back())) s.remove_suffix(1);
|
||||
return s;
|
||||
}
|
||||
|
||||
constexpr char asciiToLower(const char c) { return (c >= 'A' && c <= 'Z') ? static_cast<char>(c + 32) : c; }
|
||||
|
||||
// Case-insensitive equality on ASCII. lowercaseKeyword MUST already be
|
||||
// lowercase; CSS keywords are ASCII by spec so byte-wise tolower is safe.
|
||||
constexpr bool iequalsAscii(std::string_view value, std::string_view lowercaseKeyword) {
|
||||
return std::equal(value.begin(), value.end(), lowercaseKeyword.begin(), lowercaseKeyword.end(),
|
||||
[](char a, char b) { return asciiToLower(a) == b; });
|
||||
}
|
||||
|
||||
// Case-insensitive ASCII substring search. Only needed by text-decoration,
|
||||
// which accepts multi-value strings like "underline solid red".
|
||||
constexpr bool icontainsAscii(std::string_view value, std::string_view lowercaseKeyword) {
|
||||
return std::search(value.begin(), value.end(), lowercaseKeyword.begin(), lowercaseKeyword.end(),
|
||||
[](char a, char b) { return asciiToLower(a) == b; }) != value.end();
|
||||
}
|
||||
|
||||
// Walk s and invoke fn(token) for each non-empty run between delimiters.
|
||||
// Tokens are boundary-trimmed and yielded as string_views into s; no
|
||||
// allocation. Runs of consecutive delimiters coalesce — no empty tokens are
|
||||
// emitted. `isDelimiter` is invoked once per character.
|
||||
template <typename Pred, typename F>
|
||||
void forEachDelimitedToken(std::string_view s, Pred isDelimiter, F&& fn) {
|
||||
size_t start = 0;
|
||||
for (size_t i = 0; i <= s.size(); ++i) {
|
||||
if (i == s.size() || isDelimiter(s[i])) {
|
||||
const std::string_view trimmed = trimCssWhitespace(s.substr(start, i - start));
|
||||
if (!trimmed.empty()) {
|
||||
fn(trimmed);
|
||||
}
|
||||
start = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FNV-1a per Fowler/Noll/Vo, sized to match size_t on the target. The firmware
|
||||
// runs on a 32-bit core where size_t is 32 bits, so naively using the 64-bit
|
||||
// constants would silently truncate FNV_PRIME to a non-prime and wreck hash
|
||||
// distribution. The selection below picks the canonical 32- or 64-bit
|
||||
// constants at compile time so the same source works in a 64-bit host
|
||||
// simulator. `fnv1aMix` is the per-byte mix step; callers apply any
|
||||
// byte-level transform (e.g. asciiToLower) first.
|
||||
static_assert(sizeof(size_t) == 4 || sizeof(size_t) == 8, "FNV constants are only defined for 32- or 64-bit size_t");
|
||||
constexpr size_t FNV_OFFSET_BASIS =
|
||||
sizeof(size_t) == 8 ? static_cast<size_t>(14695981039346656037ULL) : static_cast<size_t>(2166136261U);
|
||||
constexpr size_t FNV_PRIME =
|
||||
sizeof(size_t) == 8 ? static_cast<size_t>(1099511628211ULL) : static_cast<size_t>(16777619U);
|
||||
|
||||
constexpr size_t fnv1aMix(size_t hash, unsigned char byte) { return (hash ^ byte) * FNV_PRIME; }
|
||||
|
||||
// Parse the entirety of s as a number into `out`. Accepts an optional leading
|
||||
// '+' (which std::from_chars rejects by spec) so callers can pass CSS-style
|
||||
// signed numbers without manual trimming. Returns false on empty input, a
|
||||
// non-numeric suffix, or any from_chars error.
|
||||
template <typename T>
|
||||
bool tryParseNumber(std::string_view s, T& out) {
|
||||
const char* begin = s.data();
|
||||
const char* end = s.data() + s.size();
|
||||
if (begin < end && *begin == '+') ++begin;
|
||||
const auto r = std::from_chars(begin, end, out);
|
||||
return r.ec == std::errc{} && r.ptr == end;
|
||||
}
|
||||
|
||||
// Collect up to 4 whitespace-separated tokens for a CSS edge-value shorthand
|
||||
// (margin, padding, and the border-* family). Returns the number of tokens
|
||||
// written; extras are silently dropped. Callers apply the 1/2/3/4-value
|
||||
// fallback rule using the returned count.
|
||||
size_t collectEdgeValueTokens(std::string_view s, std::string_view (&out)[4]) {
|
||||
size_t count = 0;
|
||||
forEachDelimitedToken(s, isCssWhitespace, [&](std::string_view tok) {
|
||||
if (count < 4) out[count++] = tok;
|
||||
});
|
||||
return count;
|
||||
}
|
||||
|
||||
std::string_view stripTrailingImportant(std::string_view value) {
|
||||
constexpr std::string_view IMPORTANT = "!important";
|
||||
@@ -64,7 +144,7 @@ std::string_view stripTrailingImportant(std::string_view value) {
|
||||
}
|
||||
|
||||
const size_t suffixPos = value.size() - IMPORTANT.size();
|
||||
if (value.substr(suffixPos) != IMPORTANT) {
|
||||
if (!iequalsAscii(value.substr(suffixPos), IMPORTANT)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -77,178 +157,143 @@ std::string_view stripTrailingImportant(std::string_view value) {
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// String utilities implementation
|
||||
// Transparent case-insensitive hash/equal. Bodies live here (rather than
|
||||
// inline in the header) so they can share the anonymous-namespace asciiToLower
|
||||
// with the other ASCII helpers in this translation unit.
|
||||
|
||||
std::string CssParser::normalized(const std::string& s) {
|
||||
std::string result;
|
||||
result.reserve(s.size());
|
||||
|
||||
bool inSpace = true; // Start true to skip leading space
|
||||
for (const char c : s) {
|
||||
if (isCssWhitespace(c)) {
|
||||
if (!inSpace) {
|
||||
result.push_back(' ');
|
||||
inSpace = true;
|
||||
}
|
||||
} else {
|
||||
result.push_back(static_cast<char>(std::tolower(static_cast<unsigned char>(c))));
|
||||
inSpace = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove trailing space
|
||||
while (!result.empty() && (result.back() == ' ' || result.back() == '\n')) {
|
||||
result.pop_back();
|
||||
}
|
||||
return result;
|
||||
size_t CssParser::SvHash::operator()(std::string_view sv) const noexcept {
|
||||
size_t h = FNV_OFFSET_BASIS;
|
||||
for (char c : sv) h = fnv1aMix(h, asciiToLower(c));
|
||||
return h;
|
||||
}
|
||||
|
||||
void CssParser::normalizedInto(const std::string& s, std::string& out) {
|
||||
out.clear();
|
||||
out.reserve(s.size());
|
||||
size_t CssParser::SvHash::operator()(const std::string& s) const noexcept { return operator()(std::string_view(s)); }
|
||||
|
||||
bool inSpace = true; // Start true to skip leading space
|
||||
for (const char c : s) {
|
||||
if (isCssWhitespace(c)) {
|
||||
if (!inSpace) {
|
||||
out.push_back(' ');
|
||||
inSpace = true;
|
||||
}
|
||||
} else {
|
||||
out.push_back(static_cast<char>(std::tolower(static_cast<unsigned char>(c))));
|
||||
inSpace = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!out.empty() && out.back() == ' ') {
|
||||
out.pop_back();
|
||||
size_t CssParser::SvHash::operator()(CompositeKey k) const noexcept {
|
||||
// Hash the case-folded concatenation of every piece without materializing
|
||||
// it — the running hash continues across pieces as if they were one buffer.
|
||||
size_t h = FNV_OFFSET_BASIS;
|
||||
for (std::string_view piece : k.pieces) {
|
||||
for (char c : piece) h = fnv1aMix(h, asciiToLower(c));
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
std::vector<std::string> CssParser::splitOnChar(const std::string& s, const char delimiter) {
|
||||
std::vector<std::string> parts;
|
||||
size_t start = 0;
|
||||
|
||||
for (size_t i = 0; i <= s.size(); ++i) {
|
||||
if (i == s.size() || s[i] == delimiter) {
|
||||
std::string part = s.substr(start, i - start);
|
||||
std::string trimmed = normalized(part);
|
||||
if (!trimmed.empty()) {
|
||||
parts.push_back(trimmed);
|
||||
}
|
||||
start = i + 1;
|
||||
}
|
||||
bool CssParser::SvEqual::operator()(std::string_view a, std::string_view b) const noexcept {
|
||||
if (a.size() != b.size()) return false;
|
||||
for (size_t i = 0; i < a.size(); ++i) {
|
||||
if (asciiToLower(a[i]) != asciiToLower(b[i])) return false;
|
||||
}
|
||||
return parts;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> CssParser::splitWhitespace(const std::string& s) {
|
||||
std::vector<std::string> parts;
|
||||
size_t start = 0;
|
||||
bool inWord = false;
|
||||
bool CssParser::SvEqual::operator()(const std::string& a, std::string_view b) const noexcept {
|
||||
return operator()(std::string_view(a), b);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i <= s.size(); ++i) {
|
||||
const bool isSpace = i == s.size() || isCssWhitespace(s[i]);
|
||||
if (isSpace && inWord) {
|
||||
parts.push_back(s.substr(start, i - start));
|
||||
inWord = false;
|
||||
} else if (!isSpace && !inWord) {
|
||||
start = i;
|
||||
inWord = true;
|
||||
bool CssParser::SvEqual::operator()(std::string_view a, const std::string& b) const noexcept {
|
||||
return operator()(a, std::string_view(b));
|
||||
}
|
||||
|
||||
bool CssParser::SvEqual::operator()(const std::string& a, const std::string& b) const noexcept {
|
||||
return operator()(std::string_view(a), std::string_view(b));
|
||||
}
|
||||
|
||||
bool CssParser::SvEqual::operator()(CompositeKey k, std::string_view sv) const noexcept {
|
||||
size_t total = 0;
|
||||
for (std::string_view piece : k.pieces) total += piece.size();
|
||||
if (total != sv.size()) return false;
|
||||
size_t i = 0;
|
||||
for (std::string_view piece : k.pieces) {
|
||||
for (char c : piece) {
|
||||
if (asciiToLower(c) != asciiToLower(sv[i++])) return false;
|
||||
}
|
||||
}
|
||||
return parts;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CssParser::SvEqual::operator()(std::string_view sv, CompositeKey k) const noexcept { return operator()(k, sv); }
|
||||
|
||||
// Property value interpreters
|
||||
|
||||
CssTextAlign CssParser::interpretAlignment(const std::string& val) {
|
||||
const std::string v = normalized(val);
|
||||
CssTextAlign CssParser::interpretAlignment(std::string_view val) {
|
||||
val = trimCssWhitespace(val);
|
||||
|
||||
if (v == "left" || v == "start") return CssTextAlign::Left;
|
||||
if (v == "right" || v == "end") return CssTextAlign::Right;
|
||||
if (v == "center") return CssTextAlign::Center;
|
||||
if (v == "justify") return CssTextAlign::Justify;
|
||||
if (iequalsAscii(val, "left") || iequalsAscii(val, "start")) return CssTextAlign::Left;
|
||||
if (iequalsAscii(val, "right") || iequalsAscii(val, "end")) return CssTextAlign::Right;
|
||||
if (iequalsAscii(val, "center")) return CssTextAlign::Center;
|
||||
if (iequalsAscii(val, "justify")) return CssTextAlign::Justify;
|
||||
|
||||
return CssTextAlign::Left;
|
||||
}
|
||||
|
||||
CssFontStyle CssParser::interpretFontStyle(const std::string& val) {
|
||||
const std::string v = normalized(val);
|
||||
CssFontStyle CssParser::interpretFontStyle(std::string_view val) {
|
||||
val = trimCssWhitespace(val);
|
||||
|
||||
if (v == "italic" || v == "oblique") return CssFontStyle::Italic;
|
||||
if (iequalsAscii(val, "italic") || iequalsAscii(val, "oblique")) return CssFontStyle::Italic;
|
||||
return CssFontStyle::Normal;
|
||||
}
|
||||
|
||||
CssFontWeight CssParser::interpretFontWeight(const std::string& val) {
|
||||
const std::string v = normalized(val);
|
||||
CssFontWeight CssParser::interpretFontWeight(std::string_view val) {
|
||||
val = trimCssWhitespace(val);
|
||||
|
||||
// Named values
|
||||
if (v == "bold" || v == "bolder") return CssFontWeight::Bold;
|
||||
if (v == "normal" || v == "lighter") return CssFontWeight::Normal;
|
||||
if (iequalsAscii(val, "bold") || iequalsAscii(val, "bolder")) return CssFontWeight::Bold;
|
||||
if (iequalsAscii(val, "normal") || iequalsAscii(val, "lighter")) return CssFontWeight::Normal;
|
||||
|
||||
// Numeric values: 100-900
|
||||
// CSS spec: 400 = normal, 700 = bold
|
||||
// We use: 0-400 = normal, 700+ = bold, 500-600 = normal (conservative)
|
||||
char* endPtr = nullptr;
|
||||
const long numericWeight = std::strtol(v.c_str(), &endPtr, 10);
|
||||
|
||||
// If we parsed a number and consumed the whole string
|
||||
if (endPtr != v.c_str() && *endPtr == '\0') {
|
||||
long numericWeight = 0;
|
||||
if (tryParseNumber(val, numericWeight)) {
|
||||
return numericWeight >= 700 ? CssFontWeight::Bold : CssFontWeight::Normal;
|
||||
}
|
||||
|
||||
return CssFontWeight::Normal;
|
||||
}
|
||||
|
||||
CssTextDecoration CssParser::interpretDecoration(const std::string& val) {
|
||||
const std::string v = normalized(val);
|
||||
|
||||
CssTextDecoration CssParser::interpretDecoration(std::string_view val) {
|
||||
// text-decoration can have multiple space-separated values
|
||||
if (v.find("underline") != std::string::npos) {
|
||||
if (icontainsAscii(val, "underline")) {
|
||||
return CssTextDecoration::Underline;
|
||||
}
|
||||
return CssTextDecoration::None;
|
||||
}
|
||||
|
||||
CssLength CssParser::interpretLength(const std::string& val) {
|
||||
CssLength CssParser::interpretLength(std::string_view val) {
|
||||
CssLength result;
|
||||
tryInterpretLength(val, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CssParser::tryInterpretLength(const std::string& val, CssLength& out) {
|
||||
const std::string v = normalized(val);
|
||||
if (v.empty()) {
|
||||
bool CssParser::tryInterpretLength(std::string_view val, CssLength& out) {
|
||||
val = trimCssWhitespace(val);
|
||||
if (val.empty()) {
|
||||
out = CssLength{};
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t unitStart = v.size();
|
||||
for (size_t i = 0; i < v.size(); ++i) {
|
||||
const char c = v[i];
|
||||
size_t unitStart = val.size();
|
||||
for (size_t i = 0; i < val.size(); ++i) {
|
||||
const char c = val[i];
|
||||
if (!std::isdigit(c) && c != '.' && c != '-' && c != '+') {
|
||||
unitStart = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string numPart = v.substr(0, unitStart);
|
||||
const std::string unitPart = v.substr(unitStart);
|
||||
|
||||
char* endPtr = nullptr;
|
||||
const float numericValue = std::strtof(numPart.c_str(), &endPtr);
|
||||
if (endPtr == numPart.c_str()) {
|
||||
float numericValue;
|
||||
if (!tryParseNumber(val.substr(0, unitStart), numericValue)) {
|
||||
out = CssLength{};
|
||||
return false; // No number parsed (e.g. auto, inherit, initial)
|
||||
}
|
||||
|
||||
const std::string_view unitPart = val.substr(unitStart);
|
||||
auto unit = CssUnit::Pixels;
|
||||
if (unitPart == "em") {
|
||||
if (iequalsAscii(unitPart, "em")) {
|
||||
unit = CssUnit::Em;
|
||||
} else if (unitPart == "rem") {
|
||||
} else if (iequalsAscii(unitPart, "rem")) {
|
||||
unit = CssUnit::Rem;
|
||||
} else if (unitPart == "pt") {
|
||||
} else if (iequalsAscii(unitPart, "pt")) {
|
||||
unit = CssUnit::Points;
|
||||
} else if (unitPart == "%") {
|
||||
unit = CssUnit::Percent;
|
||||
@@ -260,107 +305,119 @@ bool CssParser::tryInterpretLength(const std::string& val, CssLength& out) {
|
||||
|
||||
// Declaration parsing
|
||||
|
||||
void CssParser::parseDeclarationIntoStyle(const std::string& decl, CssStyle& style, std::string& propNameBuf,
|
||||
std::string& propValueBuf) {
|
||||
void CssParser::parseDeclarationIntoStyle(std::string_view decl, CssStyle& style) {
|
||||
const size_t colonPos = decl.find(':');
|
||||
if (colonPos == std::string::npos || colonPos == 0) return;
|
||||
if (colonPos == std::string_view::npos || colonPos == 0) return;
|
||||
|
||||
normalizedInto(decl.substr(0, colonPos), propNameBuf);
|
||||
normalizedInto(decl.substr(colonPos + 1), propValueBuf);
|
||||
const std::string_view name = trimCssWhitespace(decl.substr(0, colonPos));
|
||||
const std::string_view value = trimCssWhitespace(decl.substr(colonPos + 1));
|
||||
|
||||
if (propNameBuf.empty() || propValueBuf.empty()) return;
|
||||
if (name.empty() || value.empty()) return;
|
||||
|
||||
if (propNameBuf == "text-align") {
|
||||
style.textAlign = interpretAlignment(propValueBuf);
|
||||
if (iequalsAscii(name, "text-align")) {
|
||||
style.textAlign = interpretAlignment(value);
|
||||
style.defined.textAlign = 1;
|
||||
} else if (propNameBuf == "font-style") {
|
||||
style.fontStyle = interpretFontStyle(propValueBuf);
|
||||
} else if (iequalsAscii(name, "font-style")) {
|
||||
style.fontStyle = interpretFontStyle(value);
|
||||
style.defined.fontStyle = 1;
|
||||
} else if (propNameBuf == "font-weight") {
|
||||
style.fontWeight = interpretFontWeight(propValueBuf);
|
||||
} else if (iequalsAscii(name, "font-weight")) {
|
||||
style.fontWeight = interpretFontWeight(value);
|
||||
style.defined.fontWeight = 1;
|
||||
} else if (propNameBuf == "text-decoration" || propNameBuf == "text-decoration-line") {
|
||||
style.textDecoration = interpretDecoration(propValueBuf);
|
||||
} else if (iequalsAscii(name, "text-decoration") || iequalsAscii(name, "text-decoration-line")) {
|
||||
style.textDecoration = interpretDecoration(value);
|
||||
style.defined.textDecoration = 1;
|
||||
} else if (propNameBuf == "text-indent") {
|
||||
style.textIndent = interpretLength(propValueBuf);
|
||||
} else if (iequalsAscii(name, "text-indent")) {
|
||||
style.textIndent = interpretLength(value);
|
||||
style.defined.textIndent = 1;
|
||||
} else if (propNameBuf == "margin-top") {
|
||||
style.marginTop = interpretLength(propValueBuf);
|
||||
} else if (iequalsAscii(name, "margin-top")) {
|
||||
style.marginTop = interpretLength(value);
|
||||
style.defined.marginTop = 1;
|
||||
} else if (propNameBuf == "margin-bottom") {
|
||||
style.marginBottom = interpretLength(propValueBuf);
|
||||
} else if (iequalsAscii(name, "margin-bottom")) {
|
||||
style.marginBottom = interpretLength(value);
|
||||
style.defined.marginBottom = 1;
|
||||
} else if (propNameBuf == "margin-left") {
|
||||
style.marginLeft = interpretLength(propValueBuf);
|
||||
} else if (iequalsAscii(name, "margin-left")) {
|
||||
style.marginLeft = interpretLength(value);
|
||||
style.defined.marginLeft = 1;
|
||||
} else if (propNameBuf == "margin-right") {
|
||||
style.marginRight = interpretLength(propValueBuf);
|
||||
} else if (iequalsAscii(name, "margin-right")) {
|
||||
style.marginRight = interpretLength(value);
|
||||
style.defined.marginRight = 1;
|
||||
} else if (propNameBuf == "margin") {
|
||||
const auto values = splitWhitespace(propValueBuf);
|
||||
if (!values.empty()) {
|
||||
style.marginTop = interpretLength(values[0]);
|
||||
style.marginRight = values.size() >= 2 ? interpretLength(values[1]) : style.marginTop;
|
||||
style.marginBottom = values.size() >= 3 ? interpretLength(values[2]) : style.marginTop;
|
||||
style.marginLeft = values.size() >= 4 ? interpretLength(values[3]) : style.marginRight;
|
||||
} else if (iequalsAscii(name, "margin")) {
|
||||
std::string_view margins[4];
|
||||
const size_t count = collectEdgeValueTokens(value, margins);
|
||||
if (count > 0) {
|
||||
style.marginTop = interpretLength(margins[0]);
|
||||
style.marginRight = count >= 2 ? interpretLength(margins[1]) : style.marginTop;
|
||||
style.marginBottom = count >= 3 ? interpretLength(margins[2]) : style.marginTop;
|
||||
style.marginLeft = count >= 4 ? interpretLength(margins[3]) : style.marginRight;
|
||||
style.defined.marginTop = style.defined.marginRight = style.defined.marginBottom = style.defined.marginLeft = 1;
|
||||
}
|
||||
} else if (propNameBuf == "padding-top") {
|
||||
style.paddingTop = interpretLength(propValueBuf);
|
||||
} else if (iequalsAscii(name, "padding-top")) {
|
||||
style.paddingTop = interpretLength(value);
|
||||
style.defined.paddingTop = 1;
|
||||
} else if (propNameBuf == "padding-bottom") {
|
||||
style.paddingBottom = interpretLength(propValueBuf);
|
||||
} else if (iequalsAscii(name, "padding-bottom")) {
|
||||
style.paddingBottom = interpretLength(value);
|
||||
style.defined.paddingBottom = 1;
|
||||
} else if (propNameBuf == "padding-left") {
|
||||
style.paddingLeft = interpretLength(propValueBuf);
|
||||
} else if (iequalsAscii(name, "padding-left")) {
|
||||
style.paddingLeft = interpretLength(value);
|
||||
style.defined.paddingLeft = 1;
|
||||
} else if (propNameBuf == "padding-right") {
|
||||
style.paddingRight = interpretLength(propValueBuf);
|
||||
} else if (iequalsAscii(name, "padding-right")) {
|
||||
style.paddingRight = interpretLength(value);
|
||||
style.defined.paddingRight = 1;
|
||||
} else if (propNameBuf == "padding") {
|
||||
const auto values = splitWhitespace(propValueBuf);
|
||||
if (!values.empty()) {
|
||||
style.paddingTop = interpretLength(values[0]);
|
||||
style.paddingRight = values.size() >= 2 ? interpretLength(values[1]) : style.paddingTop;
|
||||
style.paddingBottom = values.size() >= 3 ? interpretLength(values[2]) : style.paddingTop;
|
||||
style.paddingLeft = values.size() >= 4 ? interpretLength(values[3]) : style.paddingRight;
|
||||
} else if (iequalsAscii(name, "padding")) {
|
||||
std::string_view paddings[4];
|
||||
const size_t count = collectEdgeValueTokens(value, paddings);
|
||||
if (count > 0) {
|
||||
style.paddingTop = interpretLength(paddings[0]);
|
||||
style.paddingRight = count >= 2 ? interpretLength(paddings[1]) : style.paddingTop;
|
||||
style.paddingBottom = count >= 3 ? interpretLength(paddings[2]) : style.paddingTop;
|
||||
style.paddingLeft = count >= 4 ? interpretLength(paddings[3]) : style.paddingRight;
|
||||
style.defined.paddingTop = style.defined.paddingRight = style.defined.paddingBottom = style.defined.paddingLeft =
|
||||
1;
|
||||
}
|
||||
} else if (propNameBuf == "height") {
|
||||
} else if (iequalsAscii(name, "height")) {
|
||||
CssLength len;
|
||||
if (tryInterpretLength(propValueBuf, len)) {
|
||||
if (tryInterpretLength(value, len)) {
|
||||
style.imageHeight = len;
|
||||
style.defined.imageHeight = 1;
|
||||
}
|
||||
} else if (propNameBuf == "width") {
|
||||
} else if (iequalsAscii(name, "width")) {
|
||||
CssLength len;
|
||||
if (tryInterpretLength(propValueBuf, len)) {
|
||||
if (tryInterpretLength(value, len)) {
|
||||
style.imageWidth = len;
|
||||
style.defined.imageWidth = 1;
|
||||
}
|
||||
} else if (propNameBuf == "display") {
|
||||
const std::string_view displayValue = stripTrailingImportant(propValueBuf);
|
||||
style.display = (displayValue == "none") ? CssDisplay::None : CssDisplay::Block;
|
||||
} else if (iequalsAscii(name, "display")) {
|
||||
const std::string_view displayValue = stripTrailingImportant(value);
|
||||
style.display = iequalsAscii(displayValue, "none") ? CssDisplay::None : CssDisplay::Block;
|
||||
style.defined.display = 1;
|
||||
} else if (iequalsAscii(name, "direction")) {
|
||||
const std::string_view directionValue = stripTrailingImportant(value);
|
||||
if (iequalsAscii(directionValue, "rtl")) {
|
||||
style.direction = CssTextDirection::Rtl;
|
||||
style.defined.direction = 1;
|
||||
} else if (iequalsAscii(directionValue, "ltr")) {
|
||||
style.direction = CssTextDirection::Ltr;
|
||||
style.defined.direction = 1;
|
||||
}
|
||||
} else if (iequalsAscii(name, "vertical-align")) {
|
||||
if (iequalsAscii(value, "super")) {
|
||||
style.verticalAlign = CssVerticalAlign::Super;
|
||||
style.defined.verticalAlign = 1;
|
||||
} else if (iequalsAscii(value, "sub")) {
|
||||
style.verticalAlign = CssVerticalAlign::Sub;
|
||||
style.defined.verticalAlign = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CssStyle CssParser::parseDeclarations(const std::string& declBlock) {
|
||||
CssStyle CssParser::parseDeclarations(std::string_view declBlock) {
|
||||
CssStyle style;
|
||||
std::string propNameBuf;
|
||||
std::string propValueBuf;
|
||||
|
||||
size_t start = 0;
|
||||
for (size_t i = 0; i <= declBlock.size(); ++i) {
|
||||
if (i == declBlock.size() || declBlock[i] == ';') {
|
||||
if (i > start) {
|
||||
const size_t len = i - start;
|
||||
std::string decl = declBlock.substr(start, len);
|
||||
if (!decl.empty()) {
|
||||
parseDeclarationIntoStyle(decl, style, propNameBuf, propValueBuf);
|
||||
}
|
||||
parseDeclarationIntoStyle(declBlock.substr(start, i - start), style);
|
||||
}
|
||||
start = i + 1;
|
||||
}
|
||||
@@ -371,96 +428,64 @@ CssStyle CssParser::parseDeclarations(const std::string& declBlock) {
|
||||
|
||||
// Rule processing
|
||||
|
||||
void CssParser::processRuleBlockWithStyle(const std::string& selectorGroup, const CssStyle& style) {
|
||||
void CssParser::processRuleBlockWithStyle(std::string_view selectorGroup, const CssStyle& style) {
|
||||
// Check if we've reached the rule limit before processing
|
||||
if (rulesBySelector_.size() >= MAX_RULES) {
|
||||
LOG_DBG("CSS", "Reached max rules limit (%zu), stopping CSS parsing", MAX_RULES);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle comma-separated selectors
|
||||
const auto selectors = splitOnChar(selectorGroup, ',');
|
||||
// Walk comma-separated selectors in place — no vector allocation. Selectors
|
||||
// with unsupported syntax (combinators, attributes, pseudo, etc.) are skipped
|
||||
// silently; the only heap allocation per kept selector is the std::string
|
||||
// map key, which is unavoidable since the map owns its keys.
|
||||
bool limitReached = false;
|
||||
forEachDelimitedToken(
|
||||
selectorGroup, [](char c) { return c == ','; },
|
||||
[&](std::string_view sel) {
|
||||
if (limitReached) return;
|
||||
|
||||
for (const auto& sel : selectors) {
|
||||
// Validate selector length before processing
|
||||
if (sel.size() > MAX_SELECTOR_LENGTH) {
|
||||
LOG_DBG("CSS", "Selector too long (%zu > %zu), skipping", sel.size(), MAX_SELECTOR_LENGTH);
|
||||
continue;
|
||||
}
|
||||
if (sel.size() > MAX_SELECTOR_LENGTH) {
|
||||
LOG_DBG("CSS", "Selector too long (%zu > %zu), skipping", sel.size(), MAX_SELECTOR_LENGTH);
|
||||
return;
|
||||
}
|
||||
|
||||
// Normalize the selector
|
||||
std::string key = normalized(sel);
|
||||
if (key.empty()) continue;
|
||||
// TODO: Support richer CSS selector syntax in the future. For now we only
|
||||
// handle `tag`, `.class`, or `tag.class`. Reject anything containing a
|
||||
// character that introduces unsupported syntax:
|
||||
// '+' adjacent sibling combinator
|
||||
// '>' child combinator
|
||||
// '[' attribute selector
|
||||
// ':' pseudo class/element
|
||||
// '#' ID selector
|
||||
// '~' general sibling combinator
|
||||
// '*' wildcard
|
||||
// ' ' descendant combinator
|
||||
// Single-pass scan via find_first_of instead of eight sequential find() calls.
|
||||
constexpr std::string_view kUnsupportedSelectorChars = "+>[:#~* ";
|
||||
if (sel.find_first_of(kUnsupportedSelectorChars) != std::string_view::npos) return;
|
||||
|
||||
// TODO: Consider adding support for sibling css selectors in the future
|
||||
// Ensure no + in selector as we don't support adjacent CSS selectors for now
|
||||
if (key.find('+') != std::string_view::npos) {
|
||||
continue;
|
||||
}
|
||||
// Skip if this would exceed the rule limit
|
||||
if (rulesBySelector_.size() >= MAX_RULES) {
|
||||
LOG_DBG("CSS", "Reached max rules limit, stopping selector processing");
|
||||
limitReached = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Consider adding support for direct nested css selectors in the future
|
||||
// Ensure no > in selector as we don't support nested CSS selectors for now
|
||||
if (key.find('>') != std::string_view::npos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Consider adding support for attribute css selectors in the future
|
||||
// Ensure no [ in selector as we don't support attribute CSS selectors for now
|
||||
if (key.find('[') != std::string_view::npos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Consider adding support for pseudo selectors in the future
|
||||
// Ensure no : in selector as we don't support pseudo CSS selectors for now
|
||||
if (key.find(':') != std::string_view::npos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Consider adding support for ID css selectors in the future
|
||||
// Ensure no # in selector as we don't support ID CSS selectors for now
|
||||
if (key.find('#') != std::string_view::npos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Consider adding support for general sibling combinator selectors in the future
|
||||
// Ensure no ~ in selector as we don't support general sibling combinator CSS selectors for now
|
||||
if (key.find('~') != std::string_view::npos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Consider adding support for wildcard css selectors in the future
|
||||
// Ensure no * in selector as we don't support wildcard CSS selectors for now
|
||||
if (key.find('*') != std::string_view::npos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Add support for more complex selectors in the future
|
||||
// At the moment, we only ever check for `tag`, `tag.class1` or `.class1`
|
||||
// If the selector has whitespace in it, then it's either a CSS selector for a descendant element (e.g. `tag1 tag2`)
|
||||
// or some other slightly more advanced CSS selector which we don't support yet
|
||||
if (key.find(' ') != std::string_view::npos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip if this would exceed the rule limit
|
||||
if (rulesBySelector_.size() >= MAX_RULES) {
|
||||
LOG_DBG("CSS", "Reached max rules limit, stopping selector processing");
|
||||
return;
|
||||
}
|
||||
|
||||
// Store or merge with existing
|
||||
auto it = rulesBySelector_.find(key);
|
||||
if (it != rulesBySelector_.end()) {
|
||||
it->second.applyOver(style);
|
||||
} else {
|
||||
rulesBySelector_[key] = style;
|
||||
}
|
||||
}
|
||||
// Store or merge with existing. Hash/equal are case-insensitive, so two
|
||||
// selectors that differ only in ASCII case collide on insert and merge.
|
||||
auto it = rulesBySelector_.find(sel);
|
||||
if (it != rulesBySelector_.end()) {
|
||||
it->second.applyOver(style);
|
||||
} else {
|
||||
rulesBySelector_.emplace(std::string(sel), style);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Main parsing entry point
|
||||
|
||||
bool CssParser::loadFromStream(FsFile& source) {
|
||||
bool CssParser::loadFromStream(HalFile& source) {
|
||||
if (!source) {
|
||||
LOG_ERR("CSS", "Cannot read from invalid file");
|
||||
return false;
|
||||
@@ -471,9 +496,6 @@ bool CssParser::loadFromStream(FsFile& source) {
|
||||
// Use stack-allocated buffers for parsing to avoid heap reallocations
|
||||
StackBuffer selector;
|
||||
StackBuffer declBuffer;
|
||||
// Keep these as std::string since they're passed by reference to parseDeclarationIntoStyle
|
||||
std::string propNameBuf;
|
||||
std::string propValueBuf;
|
||||
|
||||
bool inComment = false;
|
||||
bool maybeSlash = false;
|
||||
@@ -530,10 +552,10 @@ bool CssParser::loadFromStream(FsFile& source) {
|
||||
--bodyDepth;
|
||||
if (bodyDepth == 0) {
|
||||
if (!skippingRule && !declBuffer.empty()) {
|
||||
parseDeclarationIntoStyle(declBuffer.str(), currentStyle, propNameBuf, propValueBuf);
|
||||
parseDeclarationIntoStyle(declBuffer, currentStyle);
|
||||
}
|
||||
if (!skippingRule) {
|
||||
processRuleBlockWithStyle(selector.str(), currentStyle);
|
||||
processRuleBlockWithStyle(selector, currentStyle);
|
||||
}
|
||||
selector.clear();
|
||||
declBuffer.clear();
|
||||
@@ -548,7 +570,7 @@ bool CssParser::loadFromStream(FsFile& source) {
|
||||
if (!skippingRule) {
|
||||
if (c == ';') {
|
||||
if (!declBuffer.empty()) {
|
||||
parseDeclarationIntoStyle(declBuffer.str(), currentStyle, propNameBuf, propValueBuf);
|
||||
parseDeclarationIntoStyle(declBuffer, currentStyle);
|
||||
declBuffer.clear();
|
||||
}
|
||||
} else {
|
||||
@@ -608,7 +630,7 @@ bool CssParser::loadFromStream(FsFile& source) {
|
||||
|
||||
// Style resolution
|
||||
|
||||
CssStyle CssParser::resolveStyle(const std::string& tagName, const std::string& classAttr) const {
|
||||
CssStyle CssParser::resolveStyle(std::string_view tagName, std::string_view classAttr) const {
|
||||
static bool lowHeapWarningLogged = false;
|
||||
if (ESP.getFreeHeap() < MIN_FREE_HEAP_FOR_CSS) {
|
||||
if (!lowHeapWarningLogged) {
|
||||
@@ -618,47 +640,40 @@ CssStyle CssParser::resolveStyle(const std::string& tagName, const std::string&
|
||||
}
|
||||
return CssStyle{};
|
||||
}
|
||||
CssStyle result;
|
||||
const std::string tag = normalized(tagName);
|
||||
|
||||
// 1. Apply element-level style (lowest priority)
|
||||
const auto tagIt = rulesBySelector_.find(tag);
|
||||
if (tagIt != rulesBySelector_.end()) {
|
||||
result.applyOver(tagIt->second);
|
||||
CssStyle result;
|
||||
|
||||
// 1. Apply element-level style (lowest priority). The map's hash/equal are
|
||||
// case-insensitive, so the raw tagName view can be used as the lookup key.
|
||||
if (auto it = rulesBySelector_.find(tagName); it != rulesBySelector_.end()) {
|
||||
result.applyOver(it->second);
|
||||
}
|
||||
|
||||
if (classAttr.empty()) return result;
|
||||
|
||||
// TODO: Support combinations of classes (e.g. style on .class1.class2)
|
||||
// 2. Apply class styles (medium priority)
|
||||
if (!classAttr.empty()) {
|
||||
const auto classes = splitWhitespace(classAttr);
|
||||
|
||||
for (const auto& cls : classes) {
|
||||
std::string classKey = "." + normalized(cls);
|
||||
|
||||
auto classIt = rulesBySelector_.find(classKey);
|
||||
if (classIt != rulesBySelector_.end()) {
|
||||
result.applyOver(classIt->second);
|
||||
}
|
||||
// 2. Apply class styles (medium priority). The transparent hash/equal accept
|
||||
// a CompositeKey, so we never materialize the concatenation.
|
||||
forEachDelimitedToken(classAttr, isCssWhitespace, [&](std::string_view cls) {
|
||||
if (auto it = rulesBySelector_.find(CompositeKey{".", cls}); it != rulesBySelector_.end()) {
|
||||
result.applyOver(it->second);
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: Support combinations of classes (e.g. style on p.class1.class2)
|
||||
// 3. Apply element.class styles (higher priority)
|
||||
for (const auto& cls : classes) {
|
||||
std::string combinedKey = tag + "." + normalized(cls);
|
||||
|
||||
auto combinedIt = rulesBySelector_.find(combinedKey);
|
||||
if (combinedIt != rulesBySelector_.end()) {
|
||||
result.applyOver(combinedIt->second);
|
||||
}
|
||||
// TODO: Support combinations of classes (e.g. style on p.class1.class2)
|
||||
// 3. Apply element.class styles (higher priority).
|
||||
forEachDelimitedToken(classAttr, isCssWhitespace, [&](std::string_view cls) {
|
||||
if (auto it = rulesBySelector_.find(CompositeKey{tagName, ".", cls}); it != rulesBySelector_.end()) {
|
||||
result.applyOver(it->second);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Inline style parsing (static - doesn't need rule database)
|
||||
|
||||
CssStyle CssParser::parseInlineStyle(const std::string& styleValue) { return parseDeclarations(styleValue); }
|
||||
CssStyle CssParser::parseInlineStyle(std::string_view styleValue) { return parseDeclarations(styleValue); }
|
||||
|
||||
// Cache serialization
|
||||
|
||||
@@ -676,7 +691,7 @@ bool CssParser::saveToCache() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (!Storage.openFileForWrite("CSS", cachePath + rulesCache, file)) {
|
||||
return false;
|
||||
}
|
||||
@@ -701,6 +716,7 @@ bool CssParser::saveToCache() const {
|
||||
file.write(static_cast<uint8_t>(style.fontStyle));
|
||||
file.write(static_cast<uint8_t>(style.fontWeight));
|
||||
file.write(static_cast<uint8_t>(style.textDecoration));
|
||||
file.write(static_cast<uint8_t>(style.direction));
|
||||
|
||||
// Write CssLength fields (value + unit)
|
||||
auto writeLength = [&file](const CssLength& len) {
|
||||
@@ -720,9 +736,10 @@ bool CssParser::saveToCache() const {
|
||||
writeLength(style.imageHeight);
|
||||
writeLength(style.imageWidth);
|
||||
file.write(static_cast<uint8_t>(style.display));
|
||||
file.write(static_cast<uint8_t>(style.verticalAlign));
|
||||
|
||||
// Write defined flags as uint16_t
|
||||
uint16_t definedBits = 0;
|
||||
// Write defined flags as uint32_t
|
||||
uint32_t definedBits = 0;
|
||||
if (style.defined.textAlign) definedBits |= 1 << 0;
|
||||
if (style.defined.fontStyle) definedBits |= 1 << 1;
|
||||
if (style.defined.fontWeight) definedBits |= 1 << 2;
|
||||
@@ -739,6 +756,8 @@ bool CssParser::saveToCache() const {
|
||||
if (style.defined.imageHeight) definedBits |= 1 << 13;
|
||||
if (style.defined.imageWidth) definedBits |= 1 << 14;
|
||||
if (style.defined.display) definedBits |= 1 << 15;
|
||||
if (style.defined.direction) definedBits |= 1 << 16;
|
||||
if (style.defined.verticalAlign) definedBits |= 1 << 17;
|
||||
file.write(reinterpret_cast<const uint8_t*>(&definedBits), sizeof(definedBits));
|
||||
}
|
||||
|
||||
@@ -751,7 +770,7 @@ bool CssParser::loadFromCache() {
|
||||
return false;
|
||||
}
|
||||
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (!Storage.openFileForRead("CSS", cachePath + rulesCache, file)) {
|
||||
return false;
|
||||
}
|
||||
@@ -789,7 +808,7 @@ bool CssParser::loadFromCache() {
|
||||
constexpr size_t CSS_LENGTH_FIELD_COUNT = 11;
|
||||
constexpr size_t CSS_LENGTH_BYTES = sizeof(float) + sizeof(uint8_t);
|
||||
constexpr size_t CSS_FIXED_STYLE_BYTES =
|
||||
4 * sizeof(uint8_t) + (CSS_LENGTH_FIELD_COUNT * CSS_LENGTH_BYTES) + sizeof(uint8_t) + sizeof(uint16_t);
|
||||
5 * sizeof(uint8_t) + (CSS_LENGTH_FIELD_COUNT * CSS_LENGTH_BYTES) + sizeof(uint8_t) + sizeof(uint32_t);
|
||||
|
||||
// Read each rule
|
||||
for (uint16_t i = 0; i < ruleCount; ++i) {
|
||||
@@ -851,6 +870,12 @@ bool CssParser::loadFromCache() {
|
||||
}
|
||||
style.textDecoration = static_cast<CssTextDecoration>(enumVal);
|
||||
|
||||
if (file.read(&enumVal, 1) != 1) {
|
||||
rulesBySelector_.clear();
|
||||
return false;
|
||||
}
|
||||
style.direction = static_cast<CssTextDirection>(enumVal);
|
||||
|
||||
// Read CssLength fields
|
||||
auto readLength = [&file](CssLength& len) -> bool {
|
||||
if (file.read(&len.value, sizeof(len.value)) != sizeof(len.value)) {
|
||||
@@ -880,8 +905,16 @@ bool CssParser::loadFromCache() {
|
||||
}
|
||||
style.display = static_cast<CssDisplay>(displayVal);
|
||||
|
||||
// Read verticalAlign value
|
||||
uint8_t verticalAlignVal;
|
||||
if (file.read(&verticalAlignVal, 1) != 1) {
|
||||
rulesBySelector_.clear();
|
||||
return false;
|
||||
}
|
||||
style.verticalAlign = static_cast<CssVerticalAlign>(verticalAlignVal);
|
||||
|
||||
// Read defined flags
|
||||
uint16_t definedBits = 0;
|
||||
uint32_t definedBits = 0;
|
||||
if (file.read(&definedBits, sizeof(definedBits)) != sizeof(definedBits)) {
|
||||
rulesBySelector_.clear();
|
||||
return false;
|
||||
@@ -902,6 +935,8 @@ bool CssParser::loadFromCache() {
|
||||
style.defined.imageHeight = (definedBits & 1 << 13) != 0;
|
||||
style.defined.imageWidth = (definedBits & 1 << 14) != 0;
|
||||
style.defined.display = (definedBits & 1 << 15) != 0;
|
||||
style.defined.direction = (definedBits & 1 << 16) != 0;
|
||||
style.defined.verticalAlign = (definedBits & 1 << 17) != 0;
|
||||
|
||||
rulesBySelector_[selector] = style;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
#include <HalStorage.h>
|
||||
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -31,7 +33,7 @@
|
||||
class CssParser {
|
||||
public:
|
||||
// Bump when CSS cache format or rules change; section caches are invalidated when this changes
|
||||
static constexpr uint8_t CSS_CACHE_VERSION = 4;
|
||||
static constexpr uint8_t CSS_CACHE_VERSION = 6;
|
||||
|
||||
explicit CssParser(std::string cachePath) : cachePath(std::move(cachePath)) {}
|
||||
~CssParser() = default;
|
||||
@@ -46,7 +48,7 @@ class CssParser {
|
||||
* @param source Open file handle to read from
|
||||
* @return true if parsing completed (even if no rules found)
|
||||
*/
|
||||
bool loadFromStream(FsFile& source);
|
||||
bool loadFromStream(HalFile& source);
|
||||
|
||||
/**
|
||||
* Look up the style for an HTML element, considering tag name and class attributes.
|
||||
@@ -56,14 +58,14 @@ class CssParser {
|
||||
* @param classAttr The class attribute value (may contain multiple space-separated classes)
|
||||
* @return Combined style with all applicable rules merged
|
||||
*/
|
||||
[[nodiscard]] CssStyle resolveStyle(const std::string& tagName, const std::string& classAttr) const;
|
||||
[[nodiscard]] CssStyle resolveStyle(std::string_view tagName, std::string_view classAttr) const;
|
||||
|
||||
/**
|
||||
* Parse an inline style attribute string.
|
||||
* @param styleValue The value of a style="" attribute
|
||||
* @return Parsed style properties
|
||||
*/
|
||||
[[nodiscard]] static CssStyle parseInlineStyle(const std::string& styleValue);
|
||||
[[nodiscard]] static CssStyle parseInlineStyle(std::string_view styleValue);
|
||||
|
||||
/**
|
||||
* Check if any rules have been loaded
|
||||
@@ -104,29 +106,53 @@ class CssParser {
|
||||
bool loadFromCache();
|
||||
|
||||
private:
|
||||
// Storage: maps normalized selector -> style properties
|
||||
std::unordered_map<std::string, CssStyle> rulesBySelector_;
|
||||
// Lookup key for a multi-piece selector. The pieces are hashed and compared
|
||||
// as if concatenated, so callers can look up composite keys without
|
||||
// materializing the concatenation in a scratch buffer. Constructed from a
|
||||
// braced list of any arity, e.g. `CompositeKey{tagName, ".", cls}` or
|
||||
// `CompositeKey{".", cls}`. The initializer_list's backing array lives for
|
||||
// the full expression, which covers the lifetime of the find() call.
|
||||
struct CompositeKey {
|
||||
std::initializer_list<std::string_view> pieces;
|
||||
CompositeKey(std::initializer_list<std::string_view> p) noexcept : pieces(p) {}
|
||||
};
|
||||
|
||||
// ASCII-case-insensitive transparent hash/equal. Stored selectors and lookup
|
||||
// keys are compared without regard to case, so callers may insert and look up
|
||||
// using whatever case the CSS source or HTML element name happens to use.
|
||||
// Bodies live in CssParser.cpp so they can share the file-local asciiToLower.
|
||||
struct SvHash {
|
||||
using is_transparent = void;
|
||||
size_t operator()(std::string_view sv) const noexcept;
|
||||
size_t operator()(const std::string& s) const noexcept;
|
||||
size_t operator()(CompositeKey k) const noexcept;
|
||||
};
|
||||
struct SvEqual {
|
||||
using is_transparent = void;
|
||||
bool operator()(std::string_view a, std::string_view b) const noexcept;
|
||||
bool operator()(const std::string& a, std::string_view b) const noexcept;
|
||||
bool operator()(std::string_view a, const std::string& b) const noexcept;
|
||||
bool operator()(const std::string& a, const std::string& b) const noexcept;
|
||||
bool operator()(CompositeKey a, std::string_view b) const noexcept;
|
||||
bool operator()(std::string_view a, CompositeKey b) const noexcept;
|
||||
};
|
||||
|
||||
// Storage: maps selector -> style properties. Hash/equal are case-insensitive.
|
||||
std::unordered_map<std::string, CssStyle, SvHash, SvEqual> rulesBySelector_;
|
||||
|
||||
std::string cachePath;
|
||||
|
||||
// Internal parsing helpers
|
||||
void processRuleBlockWithStyle(const std::string& selectorGroup, const CssStyle& style);
|
||||
static CssStyle parseDeclarations(const std::string& declBlock);
|
||||
static void parseDeclarationIntoStyle(const std::string& decl, CssStyle& style, std::string& propNameBuf,
|
||||
std::string& propValueBuf);
|
||||
void processRuleBlockWithStyle(std::string_view selectorGroup, const CssStyle& style);
|
||||
static CssStyle parseDeclarations(std::string_view declBlock);
|
||||
static void parseDeclarationIntoStyle(std::string_view decl, CssStyle& style);
|
||||
|
||||
// Individual property value parsers
|
||||
static CssTextAlign interpretAlignment(const std::string& val);
|
||||
static CssFontStyle interpretFontStyle(const std::string& val);
|
||||
static CssFontWeight interpretFontWeight(const std::string& val);
|
||||
static CssTextDecoration interpretDecoration(const std::string& val);
|
||||
static CssLength interpretLength(const std::string& val);
|
||||
static CssTextAlign interpretAlignment(std::string_view val);
|
||||
static CssFontStyle interpretFontStyle(std::string_view val);
|
||||
static CssFontWeight interpretFontWeight(std::string_view val);
|
||||
static CssTextDecoration interpretDecoration(std::string_view val);
|
||||
static CssLength interpretLength(std::string_view val);
|
||||
/** Returns true only when a numeric length was parsed (e.g. 2em, 50%). False for auto/inherit/initial. */
|
||||
static bool tryInterpretLength(const std::string& val, CssLength& out);
|
||||
|
||||
// String utilities
|
||||
static std::string normalized(const std::string& s);
|
||||
static void normalizedInto(const std::string& s, std::string& out);
|
||||
static std::vector<std::string> splitOnChar(const std::string& s, char delimiter);
|
||||
static std::vector<std::string> splitWhitespace(const std::string& s);
|
||||
static bool tryInterpretLength(std::string_view val, CssLength& out);
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// Matches order of PARAGRAPH_ALIGNMENT in CrossPointSettings
|
||||
enum class CssTextAlign : uint8_t { Justify = 0, Left = 1, Center = 2, Right = 3, None = 4 };
|
||||
enum class CssUnit : uint8_t { Pixels = 0, Em = 1, Rem = 2, Points = 3, Percent = 4 };
|
||||
enum class CssTextDirection : uint8_t { Ltr = 0, Rtl = 1 };
|
||||
|
||||
// Represents a CSS length value with its unit, allowing deferred resolution to pixels
|
||||
struct CssLength {
|
||||
@@ -57,6 +58,9 @@ enum class CssTextDecoration : uint8_t { None = 0, Underline = 1 };
|
||||
// Display options - only None and Block are relevant for e-ink rendering
|
||||
enum class CssDisplay : uint8_t { Block = 0, None = 1 };
|
||||
|
||||
// Vertical alignment options for inline elements (e.g. superscript/subscript)
|
||||
enum class CssVerticalAlign : uint8_t { Baseline = 0, Super = 1, Sub = 2 };
|
||||
|
||||
// Bitmask for tracking which properties have been explicitly set
|
||||
struct CssPropertyFlags {
|
||||
uint16_t textAlign : 1;
|
||||
@@ -75,6 +79,8 @@ struct CssPropertyFlags {
|
||||
uint16_t imageHeight : 1;
|
||||
uint16_t imageWidth : 1;
|
||||
uint16_t display : 1;
|
||||
uint16_t direction : 1;
|
||||
uint16_t verticalAlign : 1;
|
||||
|
||||
CssPropertyFlags()
|
||||
: textAlign(0),
|
||||
@@ -92,22 +98,28 @@ struct CssPropertyFlags {
|
||||
paddingRight(0),
|
||||
imageHeight(0),
|
||||
imageWidth(0),
|
||||
display(0) {}
|
||||
display(0),
|
||||
direction(0),
|
||||
verticalAlign(0) {}
|
||||
|
||||
[[nodiscard]] bool anySet() const {
|
||||
return textAlign || fontStyle || fontWeight || textDecoration || textIndent || marginTop || marginBottom ||
|
||||
marginLeft || marginRight || paddingTop || paddingBottom || paddingLeft || paddingRight || imageHeight ||
|
||||
imageWidth || display;
|
||||
imageWidth || display || direction || verticalAlign;
|
||||
}
|
||||
|
||||
void clearAll() {
|
||||
textAlign = fontStyle = fontWeight = textDecoration = textIndent = 0;
|
||||
marginTop = marginBottom = marginLeft = marginRight = 0;
|
||||
paddingTop = paddingBottom = paddingLeft = paddingRight = 0;
|
||||
imageHeight = imageWidth = display = 0;
|
||||
imageHeight = imageWidth = display = direction = verticalAlign = 0;
|
||||
}
|
||||
};
|
||||
|
||||
// Cache serializes defined flags as uint32_t with bit indices 0..17.
|
||||
static_assert(sizeof(CssPropertyFlags) <= sizeof(uint32_t),
|
||||
"CssPropertyFlags exceeds 32 bits; update cache read/write in CssParser.cpp");
|
||||
|
||||
// Represents a collection of CSS style properties
|
||||
// Only stores properties relevant to e-ink text rendering
|
||||
// Length values are stored as CssLength (value + unit) for deferred resolution
|
||||
@@ -116,6 +128,7 @@ struct CssStyle {
|
||||
CssFontStyle fontStyle = CssFontStyle::Normal;
|
||||
CssFontWeight fontWeight = CssFontWeight::Normal;
|
||||
CssTextDecoration textDecoration = CssTextDecoration::None;
|
||||
CssTextDirection direction = CssTextDirection::Ltr;
|
||||
|
||||
CssLength textIndent; // First-line indent (deferred resolution)
|
||||
CssLength marginTop; // Vertical spacing before block
|
||||
@@ -128,7 +141,8 @@ struct CssStyle {
|
||||
CssLength paddingRight; // Padding right
|
||||
CssLength imageHeight; // Height for img (e.g. 2em) – width derived from aspect ratio when only height set
|
||||
CssLength imageWidth; // Width for img when both or only width set
|
||||
CssDisplay display = CssDisplay::Block; // display property (Block or None)
|
||||
CssDisplay display = CssDisplay::Block; // display property (Block or None)
|
||||
CssVerticalAlign verticalAlign = CssVerticalAlign::Baseline; // vertical-align (super/sub positioning)
|
||||
|
||||
CssPropertyFlags defined; // Tracks which properties were explicitly set
|
||||
|
||||
@@ -199,6 +213,14 @@ struct CssStyle {
|
||||
display = base.display;
|
||||
defined.display = 1;
|
||||
}
|
||||
if (base.hasDirection()) {
|
||||
direction = base.direction;
|
||||
defined.direction = 1;
|
||||
}
|
||||
if (base.hasVerticalAlign()) {
|
||||
verticalAlign = base.verticalAlign;
|
||||
defined.verticalAlign = 1;
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] bool hasTextAlign() const { return defined.textAlign; }
|
||||
@@ -217,17 +239,21 @@ struct CssStyle {
|
||||
[[nodiscard]] bool hasImageHeight() const { return defined.imageHeight; }
|
||||
[[nodiscard]] bool hasImageWidth() const { return defined.imageWidth; }
|
||||
[[nodiscard]] bool hasDisplay() const { return defined.display; }
|
||||
[[nodiscard]] bool hasDirection() const { return defined.direction; }
|
||||
[[nodiscard]] bool hasVerticalAlign() const { return defined.verticalAlign; }
|
||||
|
||||
void reset() {
|
||||
textAlign = CssTextAlign::Left;
|
||||
fontStyle = CssFontStyle::Normal;
|
||||
fontWeight = CssFontWeight::Normal;
|
||||
textDecoration = CssTextDecoration::None;
|
||||
direction = CssTextDirection::Ltr;
|
||||
textIndent = CssLength{};
|
||||
marginTop = marginBottom = marginLeft = marginRight = CssLength{};
|
||||
paddingTop = paddingBottom = paddingLeft = paddingRight = CssLength{};
|
||||
imageHeight = imageWidth = CssLength{};
|
||||
display = CssDisplay::Block;
|
||||
verticalAlign = CssVerticalAlign::Baseline;
|
||||
defined.clearAll();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,9 +13,19 @@ uint32_t toLowerLatinImpl(const uint32_t cp) {
|
||||
return cp + 0x20;
|
||||
}
|
||||
|
||||
// Latin Extended-A (U+0100..U+017E): uppercase letters are paired with
|
||||
// lowercase at cp+1. Two sub-ranges have different alignment:
|
||||
// U+0100..U+0137: uppercase on EVEN codepoints
|
||||
// U+0139..U+0148: uppercase on ODD codepoints
|
||||
// U+014A..U+0177: uppercase on EVEN codepoints
|
||||
// U+0179..U+017E: uppercase on ODD codepoints
|
||||
// Covers Polish (Ą/ą, Ć/ć, Ę/ę, Ł/ł, Ń/ń, Ś/ś, Ź/ź, Ż/ż), Czech, Hungarian, Turkish, etc.
|
||||
if ((cp >= 0x0100 && cp <= 0x0137 && (cp % 2 == 0)) || (cp >= 0x0139 && cp <= 0x0148 && (cp % 2 == 1)) ||
|
||||
(cp >= 0x014A && cp <= 0x0177 && (cp % 2 == 0)) || (cp >= 0x0179 && cp <= 0x017E && (cp % 2 == 1))) {
|
||||
return cp + 1;
|
||||
}
|
||||
|
||||
switch (cp) {
|
||||
case 0x0152: // Œ
|
||||
return 0x0153; // œ
|
||||
case 0x0178: // Ÿ
|
||||
return 0x00FF; // ÿ
|
||||
case 0x1E9E: // ẞ
|
||||
@@ -54,6 +64,11 @@ bool isLatinLetter(const uint32_t cp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Latin Extended-A (U+0100..U+017F): Polish, Czech, Hungarian, Turkish, etc.
|
||||
if (cp >= 0x0100 && cp <= 0x017F) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (cp) {
|
||||
case 0x0152: // Œ
|
||||
case 0x0153: // œ
|
||||
@@ -273,6 +288,30 @@ std::vector<CodepointInfo> collectCodepoints(const std::string& word) {
|
||||
case 0x0079:
|
||||
composed = 0x00FD;
|
||||
break; // y -> ý
|
||||
case 0x0043:
|
||||
composed = 0x0106;
|
||||
break; // C -> Ć
|
||||
case 0x0063:
|
||||
composed = 0x0107;
|
||||
break; // c -> ć
|
||||
case 0x004E:
|
||||
composed = 0x0143;
|
||||
break; // N -> Ń
|
||||
case 0x006E:
|
||||
composed = 0x0144;
|
||||
break; // n -> ń
|
||||
case 0x0053:
|
||||
composed = 0x015A;
|
||||
break; // S -> Ś
|
||||
case 0x0073:
|
||||
composed = 0x015B;
|
||||
break; // s -> ś
|
||||
case 0x005A:
|
||||
composed = 0x0179;
|
||||
break; // Z -> Ź
|
||||
case 0x007A:
|
||||
composed = 0x017A;
|
||||
break; // z -> ź
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -373,6 +412,18 @@ std::vector<CodepointInfo> collectCodepoints(const std::string& word) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x0307: // dot above (Polish Ż)
|
||||
switch (prev) {
|
||||
case 0x005A:
|
||||
composed = 0x017B;
|
||||
break; // Z -> Ż
|
||||
case 0x007A:
|
||||
composed = 0x017C;
|
||||
break; // z -> ż
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x0327: // cedilla
|
||||
switch (prev) {
|
||||
case 0x0043:
|
||||
@@ -385,6 +436,24 @@ std::vector<CodepointInfo> collectCodepoints(const std::string& word) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x0328: // ogonek (Polish Ą, Ę)
|
||||
switch (prev) {
|
||||
case 0x0041:
|
||||
composed = 0x0104;
|
||||
break; // A -> Ą
|
||||
case 0x0061:
|
||||
composed = 0x0105;
|
||||
break; // a -> ą
|
||||
case 0x0045:
|
||||
composed = 0x0118;
|
||||
break; // E -> Ę
|
||||
case 0x0065:
|
||||
composed = 0x0119;
|
||||
break; // e -> ę
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,9 @@ struct Iso639Mapping {
|
||||
const char* iso639_2;
|
||||
const char* iso639_1;
|
||||
};
|
||||
static constexpr Iso639Mapping kIso639Mappings[] = {
|
||||
{"eng", "en"}, {"fra", "fr"}, {"fre", "fr"}, {"deu", "de"}, {"ger", "de"},
|
||||
{"rus", "ru"}, {"spa", "es"}, {"ita", "it"}, {"ukr", "uk"},
|
||||
};
|
||||
static constexpr Iso639Mapping kIso639Mappings[] = {{"eng", "en"}, {"fra", "fr"}, {"fre", "fr"}, {"deu", "de"},
|
||||
{"ger", "de"}, {"rus", "ru"}, {"spa", "es"}, {"ita", "it"},
|
||||
{"ukr", "uk"}, {"swe", "sv"}};
|
||||
|
||||
// Maps a BCP-47 or ISO 639-2 language tag to a language-specific hyphenator.
|
||||
const LanguageHyphenator* hyphenatorForLanguage(const std::string& langTag) {
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
#include "generated/hyph-es.trie.h"
|
||||
#include "generated/hyph-fr.trie.h"
|
||||
#include "generated/hyph-it.trie.h"
|
||||
#include "generated/hyph-pl.trie.h"
|
||||
#include "generated/hyph-ru.trie.h"
|
||||
#include "generated/hyph-sv.trie.h"
|
||||
#include "generated/hyph-uk.trie.h"
|
||||
|
||||
namespace {
|
||||
@@ -21,9 +23,11 @@ LanguageHyphenator germanHyphenator(de_patterns, isLatinLetter, toLowerLatin);
|
||||
LanguageHyphenator russianHyphenator(ru_patterns, isCyrillicLetter, toLowerCyrillic);
|
||||
LanguageHyphenator spanishHyphenator(es_patterns, isLatinLetter, toLowerLatin);
|
||||
LanguageHyphenator italianHyphenator(it_patterns, isLatinLetter, toLowerLatin);
|
||||
LanguageHyphenator swedishHyphenator(sv_patterns, isLatinLetter, toLowerLatin);
|
||||
LanguageHyphenator ukrainianHyphenator(uk_patterns, isCyrillicLetter, toLowerCyrillic);
|
||||
LanguageHyphenator polishHyphenator(pl_patterns, isLatinLetter, toLowerLatin);
|
||||
|
||||
using EntryArray = std::array<LanguageEntry, 7>;
|
||||
using EntryArray = std::array<LanguageEntry, 9>;
|
||||
|
||||
const EntryArray& entries() {
|
||||
static const EntryArray kEntries = {{{"english", "en", &englishHyphenator},
|
||||
@@ -32,6 +36,8 @@ const EntryArray& entries() {
|
||||
{"russian", "ru", &russianHyphenator},
|
||||
{"spanish", "es", &spanishHyphenator},
|
||||
{"italian", "it", &italianHyphenator},
|
||||
{"polish", "pl", &polishHyphenator},
|
||||
{"swedish", "sv", &swedishHyphenator},
|
||||
{"ukrainian", "uk", &ukrainianHyphenator}}};
|
||||
return kEntries;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "../SerializedHyphenationTrie.h"
|
||||
#include "Epub/hyphenation/SerializedHyphenationTrie.h"
|
||||
|
||||
// Auto-generated by generate_hyphenation_trie.py. Do not edit manually.
|
||||
alignas(4) constexpr uint8_t de_trie_data[] = {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "../SerializedHyphenationTrie.h"
|
||||
#include "Epub/hyphenation/SerializedHyphenationTrie.h"
|
||||
|
||||
// Auto-generated by generate_hyphenation_trie.py. Do not edit manually.
|
||||
alignas(4) constexpr uint8_t en_trie_data[] = {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "../SerializedHyphenationTrie.h"
|
||||
#include "Epub/hyphenation/SerializedHyphenationTrie.h"
|
||||
|
||||
// Auto-generated by generate_hyphenation_trie.py. Do not edit manually.
|
||||
alignas(4) constexpr uint8_t es_trie_data[] = {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "../SerializedHyphenationTrie.h"
|
||||
#include "Epub/hyphenation/SerializedHyphenationTrie.h"
|
||||
|
||||
// Auto-generated by generate_hyphenation_trie.py. Do not edit manually.
|
||||
alignas(4) constexpr uint8_t fr_trie_data[] = {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "../SerializedHyphenationTrie.h"
|
||||
#include "Epub/hyphenation/SerializedHyphenationTrie.h"
|
||||
|
||||
// Auto-generated by generate_hyphenation_trie.py. Do not edit manually.
|
||||
alignas(4) constexpr uint8_t it_trie_data[] = {
|
||||
|
||||
@@ -0,0 +1,987 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "Epub/hyphenation/SerializedHyphenationTrie.h"
|
||||
|
||||
// Auto-generated by generate_hyphenation_trie.py. Do not edit manually.
|
||||
alignas(4) constexpr uint8_t pl_trie_data[] = {
|
||||
0x3A, 0x26, 0x30, 0x48, 0x17, 0x3E, 0x0F, 0x52, 0x67, 0x0C, 0x44, 0x16, 0x0C, 0x0D, 0x16, 0x0D,
|
||||
0x22, 0x23, 0x21, 0x35, 0x16, 0x35, 0x0C, 0x21, 0x0C, 0x5C, 0x0D, 0x1C, 0x20, 0x0D, 0x21, 0x0E,
|
||||
0x34, 0x34, 0x0B, 0x3F, 0x16, 0x3F, 0x0C, 0x49, 0x0C,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0C, 0x0D, 0x22, 0x0D, 0x0E, 0x0C, 0x0D, 0x22, 0x0F,
|
||||
0x16, 0x22, 0x17, 0x0C, 0x2B, 0x34, 0x0F, 0x35, 0x20, 0x2C, 0x0B, 0x2C, 0x0C, 0x35, 0x0E, 0x0D,
|
||||
0x35, 0x0E, 0x16, 0x35, 0x0C, 0x0C, 0x0D, 0x36, 0x0F, 0x36, 0x0F, 0x16, 0x36, 0x0F, 0x0E, 0x48,
|
||||
0x0D, 0x49, 0x0E, 0x3F, 0x2B, 0x0C, 0x21, 0x0E, 0x0D, 0x16, 0x21, 0x0E, 0x0D, 0x0C, 0x22, 0x0F,
|
||||
0x0E, 0x0D, 0x36, 0x0F, 0x0C, 0x41, 0x0C, 0x48, 0x0B, 0x66, 0x0D, 0x2A, 0x16, 0x17, 0x20, 0x11,
|
||||
0x4A, 0x0F, 0x18, 0x0D, 0x0C, 0x18, 0x17, 0x22, 0x0D, 0x20, 0x48, 0x21, 0x3E, 0x17, 0x21, 0x0C,
|
||||
0x0D, 0x68, 0x34, 0x2B, 0x2B, 0x0E, 0x22, 0x0D, 0x0C, 0x0B, 0x0C, 0x52, 0x17, 0x36, 0x21, 0x15,
|
||||
0x01, 0x16, 0x02, 0x15, 0x02, 0x0B, 0x02, 0x1F, 0x03, 0x0C, 0x03, 0x0C, 0x16, 0x03, 0x0C, 0x0C,
|
||||
0x04, 0x17, 0x04, 0x0D, 0x08, 0x16, 0x0D, 0x16, 0x16, 0x0D, 0x16, 0x0D, 0x3E, 0x0B, 0x20, 0x0B,
|
||||
0x20, 0x0C, 0x0D, 0x20, 0x17, 0x29, 0x16, 0x11, 0x16, 0x0F, 0x20, 0x0B, 0x0C, 0x2A, 0x0B, 0x16,
|
||||
0x15, 0x18, 0x0E, 0x0D, 0x20, 0x0F, 0x16, 0x11, 0x3F, 0x18, 0x16, 0x0D, 0x16, 0x16, 0x0D, 0x17,
|
||||
0x0C, 0x20, 0x15, 0x17, 0x0C, 0x0D, 0x16, 0x0C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 0xFD, 0x45,
|
||||
0x82, 0x84, 0x9B, 0xBA, 0xBC, 0xFF, 0x02, 0xFF, 0x02, 0xFF, 0x71, 0xFF, 0xBE, 0xFF, 0x02, 0xA0,
|
||||
0x00, 0xF3, 0x21, 0x74, 0xFD, 0x21, 0x73, 0xFD, 0xA0, 0x01, 0x51, 0x21, 0x74, 0xFD, 0xA1, 0x01,
|
||||
0x41, 0x70, 0xFD, 0xA0, 0x01, 0x41, 0xA1, 0x01, 0x41, 0x75, 0xF2, 0xA2, 0x01, 0x41, 0x70, 0x72,
|
||||
0xED, 0xED, 0xA6, 0x01, 0x22, 0x61, 0x65, 0x69, 0x6F, 0x75, 0x79, 0xEC, 0xF1, 0xF4, 0xF9, 0xF1,
|
||||
0xF1, 0xA0, 0x00, 0x91, 0xA5, 0x01, 0x61, 0x61, 0x65, 0x69, 0x6F, 0x75, 0xFD, 0xFD, 0xFD, 0xFD,
|
||||
0xFD, 0x21, 0x6F, 0xF3, 0x21, 0x72, 0xFD, 0x25, 0x61, 0x65, 0x69, 0x6F, 0x75, 0xEA, 0xEA, 0xEA,
|
||||
0xEA, 0xEA, 0x21, 0x79, 0xF5, 0x21, 0x74, 0xFD, 0xA0, 0x01, 0x72, 0x21, 0x82, 0xFD, 0xA1, 0x01,
|
||||
0x92, 0x7A, 0xFA, 0xA0, 0x01, 0x92, 0x29, 0xC5, 0x62, 0x6B, 0x6D, 0x61, 0x65, 0x69, 0x6F, 0x75,
|
||||
0xF5, 0xF8, 0xFD, 0xFD, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0x21, 0x79, 0xED, 0x21, 0x63, 0xFD, 0xA0,
|
||||
0x01, 0xB2, 0x21, 0x68, 0xD6, 0xA0, 0x01, 0xD2, 0x21, 0x73, 0xFD, 0x21, 0x6E, 0xFD, 0x21, 0x61,
|
||||
0xFD, 0x21, 0x72, 0xFD, 0x47, 0x63, 0x61, 0x65, 0x69, 0x6F, 0x74, 0x75, 0xFF, 0xEE, 0xFF, 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xBF, 0xBF, 0xA0, 0x02, 0x72,
|
||||
0x21, 0x9B, 0xFD, 0xA0, 0x02, 0x92, 0x22, 0xC5, 0x6B, 0xFA, 0xFD, 0x21, 0x6F, 0xFB, 0x21, 0x82,
|
||||
0xFD, 0x21, 0xC5, 0xFD, 0x41, 0x7A, 0xFD, 0x35, 0xA1, 0x00, 0x51, 0x72, 0xFC, 0xA0, 0x02, 0xB2,
|
||||
0x21, 0x77, 0xFD, 0x21, 0x6F, 0xFD, 0x21, 0x6B, 0xFD, 0xA0, 0x02, 0xD2, 0x21, 0x72, 0xFD, 0x21,
|
||||
0x6B, 0xFD, 0x21, 0x6F, 0xFD, 0x21, 0x82, 0xFD, 0x21, 0xC5, 0xFD, 0x22, 0x6E, 0x70, 0xEB, 0xFD,
|
||||
0x21, 0x65, 0xFB, 0x21, 0x6B, 0xDA, 0x21, 0x6F, 0xFD, 0x21, 0x6E, 0xFD, 0x21, 0x72, 0xFD, 0xA0,
|
||||
0x02, 0xF2, 0x21, 0x74, 0xFD, 0x21, 0x65, 0xFD, 0xA1, 0x00, 0x72, 0x73, 0xFD, 0x21, 0x68, 0xFB,
|
||||
0x21, 0x63, 0xFD, 0xA0, 0x03, 0x12, 0x21, 0x9B, 0xFD, 0x21, 0xC5, 0xFD, 0x22, 0x65, 0x6F, 0xF4,
|
||||
0xFD, 0x21, 0x72, 0xFB, 0x21, 0x65, 0xFD, 0xA0, 0x03, 0x52, 0x22, 0x85, 0x99, 0xFD, 0xFD, 0xA4,
|
||||
0x03, 0x32, 0xC4, 0x61, 0x65, 0x6F, 0xFB, 0xF8, 0xF8, 0xF8, 0x21, 0x72, 0xF5, 0x21, 0xB3, 0xFD,
|
||||
0x21, 0xC3, 0xFD, 0xC4, 0x00, 0x51, 0x61, 0x6B, 0x74, 0x77, 0xFF, 0xB9, 0xFC, 0xC7, 0xFF, 0xE1,
|
||||
0xFF, 0xFD, 0xD7, 0x01, 0xF1, 0xC4, 0xC5, 0x61, 0x62, 0x63, 0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||||
0xFF, 0xE6, 0xFF, 0xF2, 0xFF, 0xFB, 0xFD, 0x5B, 0x41, 0x77, 0xFD, 0xFB, 0x21, 0x6F, 0xFC, 0x21,
|
||||
0x67, 0xFD, 0xC2, 0x00, 0x51, 0x6F, 0x7A, 0xFF, 0xFD, 0xFB, 0x48, 0xA0, 0x04, 0x52, 0x22, 0x85,
|
||||
0x99, 0xFD, 0xFD, 0xA4, 0x04, 0x32, 0xC4, 0x61, 0x65, 0x6F, 0xFB, 0xF8, 0xF8, 0xF8, 0x21, 0x6A,
|
||||
0xF5, 0x21, 0xB3, 0xFD, 0xA1, 0x00, 0x51, 0xC3, 0xFD, 0x41, 0x61, 0xFD, 0x57, 0xA0, 0x01, 0x61,
|
||||
0xC5, 0x02, 0x02, 0x65, 0x6F, 0x74, 0x79, 0x7A, 0xFD, 0x50, 0xFD, 0x50, 0xFF, 0xF9, 0xFD, 0x50,
|
||||
0xFF, 0xFD, 0xC2, 0x02, 0x02, 0x65, 0x75, 0xFD, 0x3E, 0xFD, 0x4E, 0x22, 0x73, 0x7A, 0xE5, 0xF7,
|
||||
0xA0, 0x04, 0x72, 0x21, 0x9B, 0xFD, 0x21, 0xC5, 0xFD, 0x21, 0x6F, 0xFD, 0x21, 0x69, 0xFD, 0x21,
|
||||
0x63, 0xFD, 0x21, 0x99, 0xFD, 0x21, 0xC4, 0xFD, 0x21, 0x69, 0xFD, 0xA0, 0x04, 0x92, 0x21, 0x74,
|
||||
0xFD, 0x21, 0x65, 0xFD, 0xA1, 0x04, 0xB2, 0x73, 0xFD, 0x21, 0x87, 0xFB, 0x22, 0xC4, 0x63, 0xFD,
|
||||
0xE0, 0x21, 0x99, 0xFB, 0x21, 0xC4, 0xFD, 0x21, 0x69, 0xFD, 0x22, 0x73, 0x77, 0xDE, 0xFD, 0x21,
|
||||
0x65, 0xFB, 0xA1, 0x00, 0x51, 0x69, 0xFD, 0xD9, 0x01, 0xF1, 0xC4, 0xC5, 0x61, 0x62, 0x63, 0x64,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 0x13, 0xE2, 0x13, 0xE2, 0x13, 0xE2, 0x13, 0xE2, 0x13,
|
||||
0xFF, 0xFD, 0xE2, 0x13, 0xE2, 0x13, 0xE2, 0x13, 0xE2, 0x13, 0xE2, 0x13, 0xE2, 0x13, 0xE2, 0x13,
|
||||
0xE2, 0x13, 0x41, 0x7A, 0xFC, 0xD8, 0x21, 0x6F, 0xFC, 0x45, 0x63, 0x6B, 0x70, 0x77, 0x72, 0xE1,
|
||||
0x69, 0xE1, 0x4A, 0xE1, 0x4A, 0xE1, 0x4A, 0xFF, 0xFD, 0x21, 0x6F, 0xF0, 0x21, 0x6D, 0xFD, 0xC1,
|
||||
0x03, 0x32, 0x73, 0xF7, 0x2C, 0x21, 0x6D, 0xFA, 0x42, 0x65, 0x6D, 0xFF, 0xFD, 0xF7, 0x38, 0x21,
|
||||
0x64, 0xF9, 0x21, 0x65, 0xFD, 0xA0, 0x0E, 0x92, 0x21, 0x65, 0xFD, 0x21, 0xBC, 0xFD, 0x21, 0xC5,
|
||||
0xFD, 0x21, 0x64, 0xFD, 0x21, 0x85, 0xFD, 0xC3, 0x00, 0x51, 0xC4, 0x6C, 0x72, 0xFF, 0xFD, 0xDF,
|
||||
0x53, 0xDF, 0x53, 0x41, 0x62, 0xE7, 0xCB, 0xA0, 0x0D, 0x72, 0x21, 0x82, 0xFD, 0x21, 0xC5, 0xFD,
|
||||
0x21, 0xB3, 0xFD, 0xC3, 0x06, 0x12, 0x7A, 0xC5, 0x64, 0xE8, 0x6A, 0xEA, 0xC4, 0xE8, 0x06, 0xC3,
|
||||
0x05, 0xC2, 0x6E, 0x74, 0x7A, 0xED, 0x69, 0xED, 0x69, 0xE0, 0xB2, 0x51, 0x64, 0xC4, 0xC5, 0x62,
|
||||
0x63, 0x66, 0x67, 0x68, 0x6B, 0x6C, 0x6D, 0x70, 0x72, 0x73, 0x74, 0x77, 0x7A, 0xFF, 0xE8, 0xED,
|
||||
0x59, 0xEA, 0x91, 0xE6, 0x36, 0xE9, 0xEB, 0xE6, 0x36, 0xE6, 0x36, 0xE6, 0x36, 0xE6, 0x36, 0xE6,
|
||||
0x36, 0xE6, 0x36, 0xE6, 0x36, 0xFF, 0xF4, 0xE9, 0xFD, 0xE6, 0x36, 0xE6, 0x36, 0xE6, 0x36, 0xA2,
|
||||
0x00, 0x51, 0xC3, 0x6F, 0xB1, 0xCC, 0xC5, 0x03, 0x32, 0x61, 0x65, 0x69, 0x6F, 0x75, 0xDF, 0x6D,
|
||||
0xDF, 0x6D, 0xDF, 0x6D, 0xDF, 0x6D, 0xDF, 0x6D, 0x21, 0x6F, 0xEE, 0x21, 0x65, 0xFD, 0x21, 0x72,
|
||||
0xFD, 0xA1, 0x00, 0x51, 0x65, 0xFD, 0x41, 0x74, 0xE0, 0xFD, 0xC2, 0x02, 0x02, 0x69, 0x6F, 0xF7,
|
||||
0x38, 0xFF, 0xFC, 0xA0, 0x11, 0x63, 0xA1, 0x04, 0x52, 0x72, 0xFD, 0x21, 0x74, 0xFB, 0x41, 0x6F,
|
||||
0xE3, 0x6D, 0xA0, 0x11, 0x92, 0x21, 0x62, 0xFD, 0xA0, 0x11, 0xB2, 0x21, 0x74, 0xFD, 0x21, 0x75,
|
||||
0xFD, 0x21, 0x7A, 0xFD, 0x21, 0x72, 0xFD, 0x21, 0x64, 0xFD, 0xC5, 0x04, 0x32, 0x61, 0x69, 0x7A,
|
||||
0x65, 0x6F, 0xFF, 0xE1, 0xFF, 0xE4, 0xFF, 0xEB, 0xE5, 0x41, 0xFF, 0xFD, 0x21, 0x72, 0xEE, 0x21,
|
||||
0x65, 0xFD, 0x22, 0x62, 0x70, 0xB8, 0xFD, 0xA0, 0x11, 0xD2, 0x21, 0x74, 0xFD, 0x21, 0x65, 0xFD,
|
||||
0xA1, 0x11, 0xF3, 0x73, 0xFD, 0x21, 0x87, 0xFB, 0x41, 0x9B, 0xEE, 0x63, 0x21, 0xC5, 0xFC, 0x21,
|
||||
0x6F, 0xFD, 0x21, 0x69, 0xFD, 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 0xFD, 0x41, 0x68,
|
||||
0xFE, 0x35, 0x21, 0x74, 0xFC, 0xA0, 0x15, 0x93, 0x21, 0x7A, 0xFD, 0x21, 0x73, 0xFD, 0x41, 0x64,
|
||||
0xD9, 0xF0, 0x21, 0x6E, 0xFC, 0x21, 0x65, 0xFD, 0x21, 0x68, 0xFD, 0x23, 0x65, 0x66, 0x6B, 0xE7,
|
||||
0xF0, 0xFD, 0xA0, 0x04, 0xD3, 0x21, 0x75, 0xFD, 0x21, 0x6B, 0xFD, 0x21, 0x6F, 0xFD, 0xA0, 0x0B,
|
||||
0xB2, 0x21, 0x70, 0xFD, 0x21, 0x6F, 0xFD, 0x21, 0x6B, 0xFD, 0x21, 0x7A, 0xFD, 0xA0, 0x15, 0xC4,
|
||||
0xA1, 0x01, 0x22, 0x6D, 0xFD, 0x21, 0x73, 0xFB, 0x21, 0x65, 0xFD, 0x21, 0x6E, 0xFD, 0xA0, 0x16,
|
||||
0x02, 0x21, 0x6D, 0xFD, 0x21, 0x61, 0xFD, 0x21, 0x68, 0xFD, 0x21, 0x67, 0xFD, 0x21, 0x6E, 0xFD,
|
||||
0x21, 0x69, 0xFD, 0x21, 0x6D, 0xFD, 0x24, 0x6E, 0x73, 0x7A, 0x72, 0xC5, 0xD4, 0xE5, 0xFD, 0x41,
|
||||
0x61, 0xDB, 0x01, 0x21, 0x6D, 0xFC, 0x21, 0x73, 0xFD, 0x21, 0x65, 0xB5, 0x21, 0x6D, 0xFD, 0xA0,
|
||||
0x13, 0x02, 0xA1, 0x00, 0x71, 0x6D, 0xFD, 0x21, 0x73, 0xFB, 0x21, 0x73, 0xFD, 0x21, 0x65, 0xFD,
|
||||
0x21, 0x6E, 0xFD, 0x22, 0x7A, 0x69, 0xE9, 0xFD, 0xA0, 0x16, 0x72, 0x21, 0x6E, 0xFD, 0x21, 0x61,
|
||||
0xFD, 0x21, 0x70, 0xFD, 0x21, 0x7A, 0xFD, 0x21, 0x73, 0xFD, 0x22, 0x73, 0x6B, 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x21, 0x73, 0xFD, 0x58, 0xC5, 0xC4, 0x62, 0x63, 0x66, 0x67,
|
||||
0x6B, 0x6D, 0x6E, 0x70, 0x73, 0x74, 0x72, 0x7A, 0x64, 0x2E, 0x68, 0x6A, 0x6C, 0x76, 0x77, 0x78,
|
||||
0x65, 0x75, 0xFF, 0x6B, 0xFC, 0x61, 0xFC, 0x50, 0xFC, 0x50, 0xFC, 0x50, 0xFC, 0x50, 0xFC, 0x50,
|
||||
0xFC, 0x50, 0xFF, 0x84, 0xFC, 0x50, 0xFC, 0x50, 0xFC, 0x50, 0xFF, 0x94, 0xFF, 0x9E, 0xFC, 0x86,
|
||||
0xFA, 0x00, 0xFA, 0x08, 0xFA, 0x08, 0xFA, 0x08, 0xFA, 0x08, 0xFA, 0x08, 0xFA, 0x08, 0xFF, 0xEA,
|
||||
0xFF, 0xFD, 0x41, 0x87, 0xF9, 0xBF, 0x45, 0x82, 0x84, 0x9B, 0xBA, 0xBC, 0xF9, 0xBB, 0xF9, 0xBB,
|
||||
0xF9, 0xBB, 0xF9, 0xBB, 0xF9, 0xBB, 0x41, 0x6D, 0xD7, 0xBA, 0x21, 0x72, 0xFC, 0x21, 0x61, 0xFD,
|
||||
0x41, 0x6E, 0xFC, 0x6E, 0x21, 0x69, 0xFC, 0x21, 0x62, 0xFD, 0x22, 0x68, 0x7A, 0xF3, 0xFD, 0x21,
|
||||
0x73, 0xFB, 0xA0, 0x16, 0xC2, 0x21, 0x63, 0xFD, 0x21, 0x61, 0xFD, 0x21, 0x7A, 0xFD, 0x41, 0x72,
|
||||
0xFC, 0x07, 0x21, 0x6F, 0xFC, 0x21, 0x6C, 0xFD, 0x21, 0x6B, 0xFD, 0xA0, 0x16, 0xE3, 0x21, 0x74,
|
||||
0xFD, 0x21, 0x6F, 0xFD, 0x21, 0x7A, 0xFD, 0x21, 0x61, 0xFD, 0x21, 0x66, 0xFD, 0x44, 0x6B, 0x72,
|
||||
0x6C, 0x73, 0xD1, 0x98, 0xFF, 0x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, 0x21, 0x72, 0xFD, 0x41,
|
||||
0x66, 0xE4, 0x4F, 0x21, 0x66, 0xFC, 0x21, 0x6F, 0xFD, 0x21, 0x68, 0xFD, 0x21, 0x68, 0xFD, 0x21,
|
||||
0x63, 0xFD, 0x21, 0x72, 0xFD, 0x41, 0x6D, 0xE6, 0x76, 0x21, 0x73, 0xFC, 0x21, 0x65, 0xFD, 0x21,
|
||||
0x72, 0xFD, 0x21, 0x67, 0xFD, 0x21, 0x6E, 0xFD, 0x59, 0xC5, 0xC4, 0x62, 0x63, 0x64, 0x66, 0x67,
|
||||
0x6D, 0x6E, 0x70, 0x73, 0x74, 0x7A, 0x6B, 0x2E, 0x68, 0x6A, 0x6C, 0x72, 0x76, 0x77, 0x78, 0x61,
|
||||
0x69, 0x6F, 0xFE, 0x22, 0xF9, 0x82, 0xF9, 0x71, 0xF9, 0x71, 0xF9, 0x71, 0xF9, 0x71, 0xF9, 0x71,
|
||||
0xF9, 0x71, 0xF9, 0x71, 0xF9, 0x71, 0xFF, 0xA9, 0xF9, 0x71, 0xF9, 0x71, 0xF9, 0xA7, 0xF7, 0x21,
|
||||
0xF7, 0x29, 0xF7, 0x29, 0xF7, 0x29, 0xF7, 0x29, 0xF7, 0x29, 0xF7, 0x29, 0xF7, 0x29, 0xFF, 0xD4,
|
||||
0xFF, 0xEA, 0xFF, 0xFD, 0xA0, 0x14, 0xB1, 0x21, 0x77, 0xFD, 0x21, 0x64, 0xFD, 0x41, 0x66, 0xF9,
|
||||
0xEC, 0x21, 0x66, 0xFC, 0x21, 0x61, 0xFD, 0x21, 0x77, 0xFD, 0x21, 0x74, 0xFD, 0x41, 0x72, 0xFE,
|
||||
0x75, 0x21, 0x65, 0xFC, 0x21, 0x66, 0xFD, 0x21, 0x73, 0xFD, 0x22, 0x66, 0x6B, 0xF0, 0xFD, 0x41,
|
||||
0x6F, 0xF7, 0x84, 0x59, 0xC4, 0xC5, 0x62, 0x63, 0x64, 0x66, 0x67, 0x68, 0x6A, 0x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0x65, 0xEC, 0xFD, 0x41, 0x6C, 0xD3, 0x22, 0x21,
|
||||
0x61, 0xFC, 0x21, 0x65, 0xFD, 0x21, 0x72, 0xFD, 0x21, 0x74, 0xFD, 0x41, 0x6B, 0xE2, 0xC5, 0x21,
|
||||
0x69, 0xFC, 0x21, 0x61, 0xFD, 0x22, 0x6E, 0x7A, 0xF3, 0xFD, 0xA0, 0x17, 0xA3, 0x21, 0x6C, 0xFD,
|
||||
0x21, 0x68, 0xFD, 0x21, 0x63, 0xFD, 0x21, 0x69, 0xFD, 0x21, 0x73, 0xFD, 0x21, 0x61, 0xFD, 0x21,
|
||||
0x7A, 0xFD, 0x21, 0x72, 0xFD, 0x5A, 0xC4, 0xC5, 0x62, 0x63, 0x64, 0x66, 0x67, 0x68, 0x6A, 0x6B,
|
||||
0x6C, 0x6E, 0x70, 0x72, 0x73, 0x74, 0x77, 0x7A, 0x6D, 0x2E, 0x76, 0x78, 0x61, 0x69, 0x6F, 0x75,
|
||||
0xF8, 0x15, 0xFD, 0x56, 0xF8, 0x04, 0xF8, 0x04, 0xF8, 0x04, 0xF8, 0x04, 0xF8, 0x04, 0xF8, 0x04,
|
||||
0xF8, 0x04, 0xFF, 0x5D, 0xF8, 0x04, 0xFF, 0x73, 0xF8, 0x04, 0xF8, 0x04, 0xFF, 0x80, 0xF8, 0x04,
|
||||
0xF8, 0x04, 0xF8, 0x04, 0xF8, 0x3A, 0xF5, 0xB4, 0xF5, 0xBC, 0xF5, 0xBC, 0xFF, 0x9D, 0xFF, 0xC1,
|
||||
0xFF, 0xE0, 0xFF, 0xFD, 0xC2, 0x14, 0x82, 0x6E, 0x2E, 0xF5, 0xD5, 0xF5, 0x65, 0x41, 0x73, 0xEF,
|
||||
0xFD, 0x21, 0x77, 0xFC, 0x21, 0x6F, 0xFD, 0x21, 0x6B, 0xFD, 0x21, 0x82, 0xFD, 0x41, 0x76, 0xEF,
|
||||
0x40, 0x22, 0xC5, 0x72, 0xF9, 0xFC, 0x57, 0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 0x5E, 0xFF, 0x15, 0xFF, 0x21, 0xF6, 0x5E, 0xF6, 0x5E, 0xFF, 0x2A,
|
||||
0xF6, 0x94, 0xF4, 0x0E, 0xF4, 0x16, 0xF4, 0x16, 0xFF, 0x48, 0xF4, 0x16, 0xF4, 0x16, 0xF4, 0x16,
|
||||
0xFF, 0x6C, 0xFF, 0xED, 0xC2, 0x14, 0x82, 0x2E, 0x7A, 0xF3, 0xC5, 0xF3, 0xCD, 0x45, 0x82, 0x84,
|
||||
0x9B, 0xBA, 0xBC, 0xF3, 0xBF, 0xF7, 0x71, 0xF7, 0x71, 0xF7, 0x71, 0xF7, 0x71, 0xD3, 0x02, 0x31,
|
||||
0xC4, 0xC5, 0x62, 0x63, 0x64, 0x66, 0x67, 0x68, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x70, 0x72, 0x73,
|
||||
0x74, 0x77, 0x2E, 0xF7, 0x64, 0xFF, 0xF0, 0xF7, 0x61, 0xF7, 0x61, 0xF7, 0x61, 0xF7, 0x61, 0xF7,
|
||||
0x61, 0xF7, 0x61, 0xF7, 0x61, 0xF7, 0x61, 0xF7, 0x61, 0xF7, 0x61, 0xF7, 0x61, 0xF7, 0x61, 0xF7,
|
||||
0x61, 0xF7, 0x61, 0xF7, 0x61, 0xF7, 0x61, 0xF3, 0xAC, 0x41, 0x6E, 0xF6, 0x1C, 0x21, 0x65, 0xFC,
|
||||
0x21, 0x67, 0xFD, 0x21, 0x74, 0xFD, 0x21, 0x6E, 0xFD, 0x41, 0x7A, 0xD1, 0x77, 0x21, 0x63, 0xFC,
|
||||
0x21, 0x6F, 0xFD, 0x21, 0x72, 0xFD, 0xA0, 0x18, 0x14, 0x21, 0x6B, 0xFD, 0x21, 0x63, 0xFD, 0x21,
|
||||
0x6F, 0xFD, 0x21, 0x74, 0xFD, 0x23, 0x65, 0x6B, 0x73, 0xE1, 0xEE, 0xFD, 0x57, 0xC4, 0xC5, 0x62,
|
||||
0x63, 0x64, 0x66, 0x67,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 0xC7, 0x02, 0x61, 0x72,
|
||||
0x75, 0x79, 0x61, 0x65, 0x69, 0x6F, 0xFF, 0xF2, 0xFF, 0xFB, 0xFF, 0xD1, 0xF0, 0x07, 0xF0, 0x07,
|
||||
0xF0, 0x07, 0xF0, 0x07, 0x22, 0x85, 0x99, 0xB9, 0xB9, 0x21, 0xB3, 0xB4, 0x41, 0x6B, 0xE9, 0xB1,
|
||||
0x21, 0x63, 0xFC, 0x21, 0x75, 0xFD, 0x21, 0x72, 0xFD, 0x21, 0x62, 0xFD, 0x21, 0x73, 0xFD, 0x41,
|
||||
0x63, 0xE9, 0x9E, 0x21, 0x75, 0xFC, 0x21, 0x72, 0xFD, 0x21, 0x62, 0xFD, 0x22, 0x6E, 0x73, 0xF0,
|
||||
0xFD, 0xC9, 0x02, 0x61, 0xC4, 0xC3, 0x61, 0x65, 0x69, 0x6F, 0x75, 0x79, 0x6E, 0xFF, 0xD3, 0xFF,
|
||||
0xD8, 0xFF, 0x8C, 0xFF, 0x8C, 0xFF, 0x8C, 0xFF, 0x8C, 0xFF, 0x8C, 0xFF, 0x8C, 0xFF, 0xFB, 0x41,
|
||||
0x72, 0xDB, 0xBC, 0x21, 0x74, 0xFC, 0x21, 0x73, 0xFD, 0x21, 0x69, 0xFD, 0x21, 0x6D, 0xFD, 0x21,
|
||||
0x68, 0xFD, 0x41, 0x65, 0xFC, 0xD3, 0x21, 0x73, 0xFC, 0x21, 0x66, 0xFD, 0xC8, 0x02, 0x61, 0x79,
|
||||
0x61, 0x63, 0x65, 0x66, 0x69, 0x6F, 0x75, 0xFF, 0x51, 0xEF, 0x87, 0xFF, 0xF3, 0xEF, 0x87, 0xFF,
|
||||
0xFD, 0xEF, 0x87, 0xEF, 0x87, 0xEF, 0x87, 0xC6, 0x02, 0x61, 0x79, 0x61, 0x65, 0x69, 0x6F, 0x75,
|
||||
0xFF, 0x36, 0xEF, 0x6C, 0xEF, 0x6C, 0xEF, 0x6C, 0xEF, 0x6C, 0xEF, 0x6C, 0xC5, 0x02, 0x61, 0x61,
|
||||
0x65, 0x69, 0x6F, 0x75, 0xEF, 0x57, 0xEF, 0x57, 0xEF, 0x57, 0xEF, 0x57, 0xEF, 0x57, 0x5D, 0x2E,
|
||||
0xC4, 0xC3, 0xC5, 0x62, 0x63, 0x64, 0x66, 0x67, 0x68, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x70, 0x72,
|
||||
0x73, 0x74, 0x77, 0x7A, 0x76, 0x78, 0x61, 0x65, 0x69, 0x6F, 0x75, 0x79, 0xEE, 0x19, 0xEE, 0xB6,
|
||||
0xEE, 0xCC, 0xF0, 0xA4, 0xF1, 0xC1, 0xF2, 0xE7, 0xF4, 0x6B, 0xF5, 0x1C, 0xF5, 0xC4, 0xF6, 0x3C,
|
||||
0xF6, 0xA5, 0xF7, 0x4A, 0xF7, 0xC5, 0xF8, 0xB7, 0xF9, 0x28, 0xFA, 0x5D, 0xFB, 0x2E, 0xFC, 0xA0,
|
||||
0xFD, 0x2E, 0xFD, 0xC8, 0xFE, 0x34, 0xFE, 0x86, 0xFE, 0xCC, 0xFF, 0x12, 0xFF, 0x3E, 0xFF, 0x83,
|
||||
0xFF, 0xBE, 0xFF, 0xD9, 0xFF, 0xEE,
|
||||
};
|
||||
|
||||
constexpr SerializedHyphenationPatterns pl_patterns = {
|
||||
0x3C4Eu,
|
||||
pl_trie_data,
|
||||
sizeof(pl_trie_data),
|
||||
};
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "../SerializedHyphenationTrie.h"
|
||||
#include "Epub/hyphenation/SerializedHyphenationTrie.h"
|
||||
|
||||
// Auto-generated by generate_hyphenation_trie.py. Do not edit manually.
|
||||
alignas(4) constexpr uint8_t ru_trie_data[] = {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "../SerializedHyphenationTrie.h"
|
||||
#include "Epub/hyphenation/SerializedHyphenationTrie.h"
|
||||
|
||||
// Auto-generated by generate_hyphenation_trie.py. Do not edit manually.
|
||||
alignas(4) constexpr uint8_t uk_trie_data[] = {
|
||||
|
||||
@@ -8,18 +8,27 @@
|
||||
#include <XmlParserUtils.h>
|
||||
#include <expat.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <new>
|
||||
|
||||
#include "../../Epub.h"
|
||||
#include "../Page.h"
|
||||
#include "../converters/ImageDecoderFactory.h"
|
||||
#include "../converters/ImageToFramebufferDecoder.h"
|
||||
#include "../htmlEntities.h"
|
||||
#include "Epub.h"
|
||||
#include "Epub/Page.h"
|
||||
#include "Epub/converters/ImageDecoderFactory.h"
|
||||
#include "Epub/converters/ImageToFramebufferDecoder.h"
|
||||
#include "Epub/htmlEntities.h"
|
||||
|
||||
// Minimum file size (in bytes) to show indexing popup - smaller chapters don't benefit from it
|
||||
constexpr size_t MIN_SIZE_FOR_POPUP = 10 * 1024; // 10KB
|
||||
constexpr size_t PARSE_BUFFER_SIZE = 1024;
|
||||
|
||||
// Hard cap on the number of anchor IDs recorded per chapter. Legitimate navigation
|
||||
// anchors (TOC entries, footnotes, cross-references) rarely exceed a few hundred per
|
||||
// chapter. A runaway count usually means a converter injected machine-generated IDs on
|
||||
// every text fragment (e.g. Kobo KePub spans). The cap prevents unbounded heap growth
|
||||
// on resource-constrained devices (~380KB heap). TOC anchors bypass this cap.
|
||||
constexpr size_t MAX_ANCHORS_PER_CHAPTER = 1024;
|
||||
|
||||
constexpr const char* HEADER_TAGS[] = {"h1", "h2", "h3", "h4", "h5", "h6"};
|
||||
constexpr const char* BLOCK_TAGS[] = {"p", "li", "div", "br", "blockquote"};
|
||||
constexpr const char* BOLD_TAGS[] = {"b", "strong"};
|
||||
@@ -47,6 +56,14 @@ const char* getAttribute(const XML_Char** atts, const char* attrName) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Returns true if the HTML element is a purely inline, non-navigable wrapper.
|
||||
// IDs on these elements are never meaningful navigation targets in epub content.
|
||||
// Reading-system converters (Kobo KePub, Calibre, etc.) frequently inject thousands
|
||||
// of such IDs for progress tracking or internal bookkeeping, and recording each one
|
||||
// as a navigation anchor exhausts the heap on memory-constrained devices.
|
||||
// Block-level, sectioning, and structural elements are always considered navigable.
|
||||
bool isNonNavigableInlineElement(const char* name) { return strcmp(name, "span") == 0; }
|
||||
|
||||
bool isInternalEpubLink(const char* href) {
|
||||
if (!href || href[0] == '\0') return false;
|
||||
if (strncmp(href, "http://", 7) == 0 || strncmp(href, "https://", 8) == 0) return false;
|
||||
@@ -65,6 +82,13 @@ bool isTableStructuralTag(const char* name) {
|
||||
return strcmp(name, "table") == 0 || strcmp(name, "tr") == 0 || strcmp(name, "td") == 0 || strcmp(name, "th") == 0;
|
||||
}
|
||||
|
||||
void ChapterHtmlSlimParser::applyDirectionToEntry(StyleStackEntry& entry, const CssStyle& css) {
|
||||
if (css.hasDirection()) {
|
||||
entry.hasDirection = true;
|
||||
entry.direction = css.direction;
|
||||
}
|
||||
}
|
||||
|
||||
// Update effective bold/italic/underline based on block style and inline style stack
|
||||
void ChapterHtmlSlimParser::updateEffectiveInlineStyle() {
|
||||
// Start with block-level styles
|
||||
@@ -72,6 +96,10 @@ void ChapterHtmlSlimParser::updateEffectiveInlineStyle() {
|
||||
effectiveItalic = currentCssStyle.hasFontStyle() && currentCssStyle.fontStyle == CssFontStyle::Italic;
|
||||
effectiveUnderline =
|
||||
currentCssStyle.hasTextDecoration() && currentCssStyle.textDecoration == CssTextDecoration::Underline;
|
||||
effectiveDirectionDefined = currentCssStyle.hasDirection();
|
||||
effectiveDirection = currentCssStyle.direction;
|
||||
effectiveSup = false;
|
||||
effectiveSub = false;
|
||||
|
||||
// Apply inline style stack in order
|
||||
for (const auto& entry : inlineStyleStack) {
|
||||
@@ -84,7 +112,51 @@ void ChapterHtmlSlimParser::updateEffectiveInlineStyle() {
|
||||
if (entry.hasUnderline) {
|
||||
effectiveUnderline = entry.underline;
|
||||
}
|
||||
if (entry.hasDirection) {
|
||||
effectiveDirectionDefined = true;
|
||||
effectiveDirection = entry.direction;
|
||||
}
|
||||
if (entry.hasSup) {
|
||||
effectiveSup = entry.sup;
|
||||
if (entry.sup) effectiveSub = false;
|
||||
}
|
||||
if (entry.hasSub) {
|
||||
effectiveSub = entry.sub;
|
||||
if (entry.sub) effectiveSup = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Keep inherited direction in the active empty text block so upcoming block starts
|
||||
// can inherit from non-block ancestors such as <html dir="rtl"> / <body dir="rtl">.
|
||||
if (currentTextBlock && currentTextBlock->isEmpty()) {
|
||||
auto& style = currentTextBlock->getBlockStyle();
|
||||
if (effectiveDirectionDefined) {
|
||||
style.directionDefined = true;
|
||||
style.isRtl = (effectiveDirection == CssTextDirection::Rtl);
|
||||
} else {
|
||||
style.directionDefined = false;
|
||||
style.isRtl = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChapterHtmlSlimParser::flushPendingAnchor() {
|
||||
if (pendingAnchorId.empty()) return;
|
||||
|
||||
// If the pending anchor is a TOC chapter boundary, force a page break after the previous
|
||||
// block is flushed so the chapter starts on a fresh page.
|
||||
if (std::find(tocAnchors.begin(), tocAnchors.end(), pendingAnchorId) != tocAnchors.end()) {
|
||||
if (currentPage && !currentPage->elements.empty()) {
|
||||
completePageFn(std::move(currentPage), xpathParagraphIndex, xpathListItemIndex);
|
||||
completedPageCount++;
|
||||
currentPage.reset(new Page());
|
||||
currentPageNextY = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Record deferred anchor after previous block is flushed (and any TOC page break)
|
||||
anchorData.push_back({std::move(pendingAnchorId), static_cast<uint16_t>(completedPageCount)});
|
||||
pendingAnchorId.clear();
|
||||
}
|
||||
|
||||
// flush the contents of partWordBuffer to currentTextBlock
|
||||
@@ -105,6 +177,11 @@ void ChapterHtmlSlimParser::flushPartWordBuffer() {
|
||||
if (isUnderline) {
|
||||
fontStyle = static_cast<EpdFontFamily::Style>(fontStyle | EpdFontFamily::UNDERLINE);
|
||||
}
|
||||
if (effectiveSup) {
|
||||
fontStyle = static_cast<EpdFontFamily::Style>(fontStyle | EpdFontFamily::SUP);
|
||||
} else if (effectiveSub) {
|
||||
fontStyle = static_cast<EpdFontFamily::Style>(fontStyle | EpdFontFamily::SUB);
|
||||
}
|
||||
|
||||
// flush the buffer
|
||||
partWordBuffer[partWordBufferIndex] = '\0';
|
||||
@@ -127,22 +204,79 @@ void ChapterHtmlSlimParser::startNewTextBlock(const BlockStyle& blockStyle) {
|
||||
const auto style = currentTextBlock->getBlockStyle();
|
||||
currentTextBlock->setBlockStyle(style.getCombinedBlockStyle(blockStyle, BlockStyle::CombineAxis::Vertical));
|
||||
|
||||
if (!pendingAnchorId.empty()) {
|
||||
anchorData.push_back({std::move(pendingAnchorId), static_cast<uint16_t>(completedPageCount)});
|
||||
pendingAnchorId.clear();
|
||||
}
|
||||
flushPendingAnchor();
|
||||
return;
|
||||
}
|
||||
|
||||
makePages();
|
||||
}
|
||||
// Record deferred anchor after previous block is flushed
|
||||
// If the pending anchor is a TOC chapter boundary, force a page break after the previous
|
||||
// block is flushed so the chapter starts on a fresh page.
|
||||
flushPendingAnchor();
|
||||
currentTextBlock.reset(new ParsedText(extraParagraphSpacing, hyphenationEnabled, focusReadingEnabled, blockStyle));
|
||||
wordsExtractedInBlock = 0;
|
||||
}
|
||||
|
||||
void ChapterHtmlSlimParser::emitHorizontalRule(const BlockStyle& blockStyle) {
|
||||
if (partWordBufferIndex > 0) {
|
||||
flushPartWordBuffer();
|
||||
}
|
||||
|
||||
if (currentTextBlock) {
|
||||
const BlockStyle parentBlockStyle = currentTextBlock->getBlockStyle();
|
||||
startNewTextBlock(parentBlockStyle);
|
||||
}
|
||||
|
||||
if (!currentPage) {
|
||||
currentPage.reset(new (std::nothrow) Page());
|
||||
if (!currentPage) {
|
||||
LOG_ERR("EHP", "Failed to create page for horizontal rule");
|
||||
return;
|
||||
}
|
||||
currentPageNextY = 0;
|
||||
}
|
||||
|
||||
const int16_t lineHeight = static_cast<int16_t>(renderer.getLineHeight(fontId) * lineCompression + 0.5f);
|
||||
const int16_t defaultVerticalSpacing = static_cast<int16_t>(lineHeight / 2);
|
||||
const int16_t topSpacing =
|
||||
static_cast<int16_t>((blockStyle.marginTop > 0 ? blockStyle.marginTop : defaultVerticalSpacing) +
|
||||
(blockStyle.paddingTop > 0 ? blockStyle.paddingTop : 0));
|
||||
const int16_t bottomSpacing =
|
||||
static_cast<int16_t>((blockStyle.marginBottom > 0 ? blockStyle.marginBottom : defaultVerticalSpacing) +
|
||||
(blockStyle.paddingBottom > 0 ? blockStyle.paddingBottom : 0));
|
||||
constexpr uint8_t ruleThickness = 2;
|
||||
const int16_t availableWidth =
|
||||
std::max<int16_t>(1, static_cast<int16_t>(viewportWidth - blockStyle.totalHorizontalInset()));
|
||||
const int16_t width = std::max<int16_t>(1, static_cast<int16_t>(availableWidth / 4));
|
||||
const int16_t xPos = static_cast<int16_t>(blockStyle.leftInset() + ((availableWidth - width) / 2));
|
||||
const int16_t totalHeight = static_cast<int16_t>(topSpacing + ruleThickness + bottomSpacing);
|
||||
|
||||
if (!currentPage->elements.empty() && currentPageNextY + totalHeight > viewportHeight) {
|
||||
completePageFn(std::move(currentPage), xpathParagraphIndex, xpathListItemIndex);
|
||||
completedPageCount++;
|
||||
currentPage.reset(new (std::nothrow) Page());
|
||||
if (!currentPage) {
|
||||
LOG_ERR("EHP", "Failed to create page after horizontal-rule page break");
|
||||
return;
|
||||
}
|
||||
currentPageNextY = 0;
|
||||
}
|
||||
|
||||
currentPageNextY += topSpacing;
|
||||
|
||||
auto pageRule = std::shared_ptr<PageHorizontalRule>(
|
||||
new (std::nothrow) PageHorizontalRule(width, ruleThickness, xPos, currentPageNextY));
|
||||
if (!pageRule) {
|
||||
LOG_ERR("EHP", "Failed to create PageHorizontalRule");
|
||||
return;
|
||||
}
|
||||
currentPage->elements.push_back(pageRule);
|
||||
currentPageNextY = static_cast<int16_t>(currentPageNextY + ruleThickness + bottomSpacing);
|
||||
|
||||
if (!pendingAnchorId.empty()) {
|
||||
anchorData.push_back({std::move(pendingAnchorId), static_cast<uint16_t>(completedPageCount)});
|
||||
pendingAnchorId.clear();
|
||||
}
|
||||
currentTextBlock.reset(new ParsedText(extraParagraphSpacing, hyphenationEnabled, focusReadingEnabled, blockStyle));
|
||||
wordsExtractedInBlock = 0;
|
||||
}
|
||||
|
||||
void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char* name, const XML_Char** atts) {
|
||||
@@ -161,9 +295,10 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
self->xpathListItemIndex++;
|
||||
}
|
||||
|
||||
// Extract class, style, and id attributes
|
||||
// Extract class, style, id, and dir attributes for CSS/RTL processing
|
||||
std::string classAttr;
|
||||
std::string styleAttr;
|
||||
std::string dirAttr;
|
||||
if (atts != nullptr) {
|
||||
for (int i = 0; atts[i]; i += 2) {
|
||||
if (strcmp(atts[i], "class") == 0) {
|
||||
@@ -171,8 +306,21 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
} else if (strcmp(atts[i], "style") == 0) {
|
||||
styleAttr = atts[i + 1];
|
||||
} else if (strcmp(atts[i], "id") == 0) {
|
||||
// Defer recording until startNewTextBlock, after previous block is flushed to pages
|
||||
self->pendingAnchorId = atts[i + 1];
|
||||
// Defer both anchor recording and TOC page breaks until startNewTextBlock,
|
||||
// after the previous block is flushed to pages via makePages().
|
||||
//
|
||||
// Skip IDs on non-navigable inline elements (e.g. <span>): these are never
|
||||
// link targets in epub content, but reading-system converters can inject tens
|
||||
// of thousands of them per chapter, exhausting the heap. TOC anchors are
|
||||
// always recorded regardless of element type, since they drive page breaks.
|
||||
const char* idValue = atts[i + 1];
|
||||
const bool isTocAnchor =
|
||||
std::find(self->tocAnchors.begin(), self->tocAnchors.end(), idValue) != self->tocAnchors.end();
|
||||
if (isTocAnchor || (!isNonNavigableInlineElement(name) && self->anchorData.size() < MAX_ANCHORS_PER_CHAPTER)) {
|
||||
self->pendingAnchorId = idValue;
|
||||
}
|
||||
} else if (strcmp(atts[i], "dir") == 0) {
|
||||
dirAttr = atts[i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,6 +340,24 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
}
|
||||
}
|
||||
|
||||
// HTML dir attribute overrides CSS direction (case-insensitive per HTML spec)
|
||||
if (!dirAttr.empty()) {
|
||||
if (strcasecmp(dirAttr.c_str(), "rtl") == 0) {
|
||||
cssStyle.direction = CssTextDirection::Rtl;
|
||||
cssStyle.defined.direction = 1;
|
||||
} else if (strcasecmp(dirAttr.c_str(), "ltr") == 0) {
|
||||
cssStyle.direction = CssTextDirection::Ltr;
|
||||
cssStyle.defined.direction = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Direction is inherited in HTML/CSS. If this element does not define one, carry
|
||||
// the currently active inherited direction into its computed style.
|
||||
if (!cssStyle.hasDirection() && self->effectiveDirectionDefined) {
|
||||
cssStyle.direction = self->effectiveDirection;
|
||||
cssStyle.defined.direction = 1;
|
||||
}
|
||||
|
||||
// Skip elements with display:none before all fast paths (tables, links, etc.).
|
||||
if (cssStyle.hasDisplay() && cssStyle.display == CssDisplay::None) {
|
||||
self->skipUntilDepth = self->depth;
|
||||
@@ -262,6 +428,11 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->tableDepth == 1 && strcmp(name, "hr") == 0) {
|
||||
self->depth += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (matches(name, IMAGE_TAGS, std::size(IMAGE_TAGS))) {
|
||||
std::string src;
|
||||
std::string alt;
|
||||
@@ -299,7 +470,7 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
|
||||
{
|
||||
// Resolve the image path relative to the HTML file
|
||||
std::string resolvedPath = FsHelpers::normalisePath(self->contentBase + src);
|
||||
std::string resolvedPath = FsHelpers::normalisePath(FsHelpers::decodeUriEscapes(self->contentBase + src));
|
||||
|
||||
if (ImageDecoderFactory::isFormatSupported(resolvedPath)) {
|
||||
// Create a unique filename for the cached image
|
||||
@@ -311,7 +482,7 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
std::string cachedImagePath = self->imageBasePath + std::to_string(self->imageCounter++) + ext;
|
||||
|
||||
// Extract image to cache file
|
||||
FsFile cachedImageFile;
|
||||
HalFile cachedImageFile;
|
||||
bool extractSuccess = false;
|
||||
if (Storage.openFileForWrite("EHP", cachedImagePath, cachedImageFile)) {
|
||||
extractSuccess = self->epub->readItemContentsToStream(resolvedPath, cachedImageFile, 4096);
|
||||
@@ -587,6 +758,7 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
entry.depth = self->depth;
|
||||
entry.hasUnderline = true;
|
||||
entry.underline = true;
|
||||
applyDirectionToEntry(entry, cssStyle);
|
||||
self->inlineStyleStack.push_back(entry);
|
||||
self->updateEffectiveInlineStyle();
|
||||
|
||||
@@ -600,6 +772,25 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
const auto userAlignmentBlockStyle = BlockStyle::fromCssStyle(
|
||||
cssStyle, emSize, static_cast<CssTextAlign>(self->paragraphAlignment), self->viewportWidth);
|
||||
|
||||
if (strcmp(name, "hr") == 0) {
|
||||
auto hrBlockStyle = BlockStyle::fromCssStyle(cssStyle, emSize, CssTextAlign::Left, self->viewportWidth);
|
||||
if (!self->embeddedStyle) {
|
||||
hrBlockStyle.marginLeft = 0;
|
||||
hrBlockStyle.marginRight = 0;
|
||||
hrBlockStyle.marginTop = 0;
|
||||
hrBlockStyle.marginBottom = 0;
|
||||
hrBlockStyle.paddingLeft = 0;
|
||||
hrBlockStyle.paddingRight = 0;
|
||||
hrBlockStyle.paddingTop = 0;
|
||||
hrBlockStyle.paddingBottom = 0;
|
||||
hrBlockStyle.textIndentDefined = false;
|
||||
hrBlockStyle.textIndent = 0;
|
||||
}
|
||||
self->emitHorizontalRule(hrBlockStyle);
|
||||
self->depth += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (matches(name, HEADER_TAGS, std::size(HEADER_TAGS))) {
|
||||
self->currentCssStyle = cssStyle;
|
||||
auto headerBlockStyle = BlockStyle::fromCssStyle(cssStyle, emSize, CssTextAlign::Center, self->viewportWidth);
|
||||
@@ -652,6 +843,7 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
entry.hasItalic = true;
|
||||
entry.italic = cssStyle.fontStyle == CssFontStyle::Italic;
|
||||
}
|
||||
applyDirectionToEntry(entry, cssStyle);
|
||||
self->inlineStyleStack.push_back(entry);
|
||||
self->updateEffectiveInlineStyle();
|
||||
} else if (matches(name, BOLD_TAGS, std::size(BOLD_TAGS))) {
|
||||
@@ -674,6 +866,7 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
entry.hasUnderline = true;
|
||||
entry.underline = cssStyle.textDecoration == CssTextDecoration::Underline;
|
||||
}
|
||||
applyDirectionToEntry(entry, cssStyle);
|
||||
self->inlineStyleStack.push_back(entry);
|
||||
self->updateEffectiveInlineStyle();
|
||||
} else if (matches(name, ITALIC_TAGS, std::size(ITALIC_TAGS))) {
|
||||
@@ -696,11 +889,29 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
entry.hasUnderline = true;
|
||||
entry.underline = cssStyle.textDecoration == CssTextDecoration::Underline;
|
||||
}
|
||||
applyDirectionToEntry(entry, cssStyle);
|
||||
self->inlineStyleStack.push_back(entry);
|
||||
self->updateEffectiveInlineStyle();
|
||||
} else if (strcmp(name, "sup") == 0 || strcmp(name, "sub") == 0) {
|
||||
if (self->partWordBufferIndex > 0) {
|
||||
self->flushPartWordBuffer();
|
||||
self->nextWordContinues = true;
|
||||
}
|
||||
StyleStackEntry entry;
|
||||
entry.depth = self->depth;
|
||||
if (strcmp(name, "sup") == 0) {
|
||||
entry.hasSup = true;
|
||||
entry.sup = true;
|
||||
} else {
|
||||
entry.hasSub = true;
|
||||
entry.sub = true;
|
||||
}
|
||||
self->inlineStyleStack.push_back(entry);
|
||||
self->updateEffectiveInlineStyle();
|
||||
} else if (strcmp(name, "span") == 0 || !isHeaderOrBlock(name)) {
|
||||
// Handle span and other inline elements for CSS styling
|
||||
if (cssStyle.hasFontWeight() || cssStyle.hasFontStyle() || cssStyle.hasTextDecoration()) {
|
||||
if (cssStyle.hasFontWeight() || cssStyle.hasFontStyle() || cssStyle.hasTextDecoration() ||
|
||||
cssStyle.hasDirection() || cssStyle.hasVerticalAlign()) {
|
||||
// Flush buffer before style change so preceding text gets current style
|
||||
if (self->partWordBufferIndex > 0) {
|
||||
self->flushPartWordBuffer();
|
||||
@@ -720,6 +931,16 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
entry.hasUnderline = true;
|
||||
entry.underline = cssStyle.textDecoration == CssTextDecoration::Underline;
|
||||
}
|
||||
applyDirectionToEntry(entry, cssStyle);
|
||||
if (cssStyle.hasVerticalAlign()) {
|
||||
if (cssStyle.verticalAlign == CssVerticalAlign::Super) {
|
||||
entry.hasSup = true;
|
||||
entry.sup = true;
|
||||
} else if (cssStyle.verticalAlign == CssVerticalAlign::Sub) {
|
||||
entry.hasSub = true;
|
||||
entry.sub = true;
|
||||
}
|
||||
}
|
||||
self->inlineStyleStack.push_back(entry);
|
||||
self->updateEffectiveInlineStyle();
|
||||
}
|
||||
@@ -1062,7 +1283,7 @@ bool ChapterHtmlSlimParser::parseAndBuildPages() {
|
||||
// Using DefaultHandlerExpand preserves normal entity expansion from DOCTYPE
|
||||
XML_SetDefaultHandlerExpand(parser, defaultHandlerExpand);
|
||||
|
||||
FsFile file;
|
||||
HalFile file;
|
||||
if (!Storage.openFileForRead("EHP", filepath, file)) {
|
||||
destroyXmlParser(parser);
|
||||
return false;
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "../FootnoteEntry.h"
|
||||
#include "../ParsedText.h"
|
||||
#include "../blocks/ImageBlock.h"
|
||||
#include "../blocks/TextBlock.h"
|
||||
#include "../css/CssParser.h"
|
||||
#include "../css/CssStyle.h"
|
||||
#include "Epub/FootnoteEntry.h"
|
||||
#include "Epub/ParsedText.h"
|
||||
#include "Epub/blocks/ImageBlock.h"
|
||||
#include "Epub/blocks/TextBlock.h"
|
||||
#include "Epub/css/CssParser.h"
|
||||
#include "Epub/css/CssStyle.h"
|
||||
|
||||
class Page;
|
||||
class GfxRenderer;
|
||||
@@ -61,6 +61,10 @@ class ChapterHtmlSlimParser {
|
||||
bool hasBold = false, bold = false;
|
||||
bool hasItalic = false, italic = false;
|
||||
bool hasUnderline = false, underline = false;
|
||||
bool hasDirection = false;
|
||||
CssTextDirection direction = CssTextDirection::Ltr;
|
||||
bool hasSup = false, sup = false;
|
||||
bool hasSub = false, sub = false;
|
||||
};
|
||||
std::vector<StyleStackEntry> inlineStyleStack;
|
||||
std::vector<BlockStyle> blockStyleStack; // accumulated block styles from open ancestor elements
|
||||
@@ -68,6 +72,10 @@ class ChapterHtmlSlimParser {
|
||||
bool effectiveBold = false;
|
||||
bool effectiveItalic = false;
|
||||
bool effectiveUnderline = false;
|
||||
bool effectiveDirectionDefined = false;
|
||||
CssTextDirection effectiveDirection = CssTextDirection::Ltr;
|
||||
bool effectiveSup = false;
|
||||
bool effectiveSub = false;
|
||||
int tableDepth = 0;
|
||||
int tableRowIndex = 0;
|
||||
int tableColIndex = 0;
|
||||
@@ -75,7 +83,8 @@ class ChapterHtmlSlimParser {
|
||||
// Anchor-to-page mapping: tracks which page each HTML id attribute lands on
|
||||
int completedPageCount = 0;
|
||||
std::vector<std::pair<std::string, uint16_t>> anchorData;
|
||||
std::string pendingAnchorId; // deferred until after previous text block is flushed
|
||||
std::string pendingAnchorId; // deferred until after previous text block is flushed
|
||||
std::vector<std::string> tocAnchors; // the list of anchors that are TOC chapter boundaries
|
||||
uint16_t xpathParagraphIndex = 0;
|
||||
uint16_t xpathListItemIndex = 0;
|
||||
|
||||
@@ -89,8 +98,11 @@ class ChapterHtmlSlimParser {
|
||||
|
||||
void updateEffectiveInlineStyle();
|
||||
void startNewTextBlock(const BlockStyle& blockStyle);
|
||||
void flushPendingAnchor();
|
||||
void flushPartWordBuffer();
|
||||
void makePages();
|
||||
static void applyDirectionToEntry(StyleStackEntry& entry, const CssStyle& css);
|
||||
void emitHorizontalRule(const BlockStyle& blockStyle);
|
||||
// XML callbacks
|
||||
static void XMLCALL startElement(void* userData, const XML_Char* name, const XML_Char** atts);
|
||||
static void XMLCALL characterData(void* userData, const XML_Char* s, int len);
|
||||
@@ -106,6 +118,7 @@ class ChapterHtmlSlimParser {
|
||||
const std::function<void(std::unique_ptr<Page>, uint16_t, uint16_t)>& completePageFn,
|
||||
const bool embeddedStyle, const std::string& contentBase,
|
||||
const std::string& imageBasePath, const uint8_t imageRendering = 0,
|
||||
std::vector<std::string> tocAnchors = {},
|
||||
const std::function<void()>& popupFn = nullptr, const CssParser* cssParser = nullptr)
|
||||
|
||||
: epub(epub),
|
||||
@@ -125,7 +138,8 @@ class ChapterHtmlSlimParser {
|
||||
embeddedStyle(embeddedStyle),
|
||||
imageRendering(imageRendering),
|
||||
contentBase(contentBase),
|
||||
imageBasePath(imageBasePath) {}
|
||||
imageBasePath(imageBasePath),
|
||||
tocAnchors(std::move(tocAnchors)) {}
|
||||
|
||||
~ChapterHtmlSlimParser() = default;
|
||||
bool parseAndBuildPages();
|
||||
|
||||
@@ -5,12 +5,31 @@
|
||||
#include <Serialization.h>
|
||||
#include <XmlParserUtils.h>
|
||||
|
||||
#include "../BookMetadataCache.h"
|
||||
#include <cctype>
|
||||
|
||||
#include "Epub/BookMetadataCache.h"
|
||||
|
||||
namespace {
|
||||
constexpr char MEDIA_TYPE_NCX[] = "application/x-dtbncx+xml";
|
||||
constexpr char MEDIA_TYPE_CSS[] = "text/css";
|
||||
constexpr char MEDIA_TYPE_IMAGE_PREFIX[] = "image/";
|
||||
constexpr char itemCacheFile[] = "/.items.bin";
|
||||
|
||||
bool startsWithImageMediaType(const std::string& mediaType) {
|
||||
constexpr size_t prefixLen = sizeof(MEDIA_TYPE_IMAGE_PREFIX) - 1;
|
||||
if (mediaType.size() < prefixLen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < prefixLen; ++i) {
|
||||
const char c = static_cast<char>(std::tolower(static_cast<unsigned char>(mediaType[i])));
|
||||
if (c != MEDIA_TYPE_IMAGE_PREFIX[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
bool ContentOpfParser::setup() {
|
||||
@@ -167,7 +186,7 @@ void XMLCALL ContentOpfParser::startElement(void* userData, const XML_Char* name
|
||||
if (strcmp(atts[i], "id") == 0) {
|
||||
itemId = atts[i + 1];
|
||||
} else if (strcmp(atts[i], "href") == 0) {
|
||||
href = FsHelpers::normalisePath(self->baseContentPath + atts[i + 1]);
|
||||
href = FsHelpers::normalisePath(FsHelpers::decodeUriEscapes(self->baseContentPath + atts[i + 1]));
|
||||
} else if (strcmp(atts[i], "media-type") == 0) {
|
||||
mediaType = atts[i + 1];
|
||||
} else if (strcmp(atts[i], "properties") == 0) {
|
||||
@@ -189,7 +208,14 @@ void XMLCALL ContentOpfParser::startElement(void* userData, const XML_Char* name
|
||||
serialization::writeString(self->tempItemStore, href);
|
||||
|
||||
if (itemId == self->coverItemId) {
|
||||
self->coverItemHref = href;
|
||||
// Some EPUBs set meta name="cover" to an XHTML wrapper item.
|
||||
// Only treat it as a cover image when the manifest media-type is image/*.
|
||||
if (startsWithImageMediaType(mediaType)) {
|
||||
self->coverItemHref = href;
|
||||
} else {
|
||||
LOG_DBG("COF", "Ignoring meta cover item '%s' with non-image media type: %s", itemId.c_str(),
|
||||
mediaType.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (mediaType == MEDIA_TYPE_NCX) {
|
||||
@@ -289,7 +315,7 @@ void XMLCALL ContentOpfParser::startElement(void* userData, const XML_Char* name
|
||||
if (strcmp(atts[i], "type") == 0) {
|
||||
type = atts[i + 1];
|
||||
} else if (strcmp(atts[i], "href") == 0) {
|
||||
guideHref = FsHelpers::normalisePath(self->baseContentPath + atts[i + 1]);
|
||||
guideHref = FsHelpers::normalisePath(FsHelpers::decodeUriEscapes(self->baseContentPath + atts[i + 1]));
|
||||
}
|
||||
}
|
||||
if (!guideHref.empty()) {
|
||||
|
||||
@@ -29,7 +29,7 @@ class ContentOpfParser final : public Print {
|
||||
XML_Parser parser = nullptr;
|
||||
ParserState state = START;
|
||||
BookMetadataCache* cache;
|
||||
FsFile tempItemStore;
|
||||
HalFile tempItemStore;
|
||||
std::string coverItemId;
|
||||
|
||||
// Index for fast idref→href lookup (used only for large EPUBs)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <Logging.h>
|
||||
#include <XmlParserUtils.h>
|
||||
|
||||
#include "../BookMetadataCache.h"
|
||||
#include "Epub/BookMetadataCache.h"
|
||||
|
||||
bool TocNavParser::setup() {
|
||||
parser = XML_ParserCreate(nullptr);
|
||||
@@ -126,13 +126,14 @@ void XMLCALL TocNavParser::endElement(void* userData, const XML_Char* name) {
|
||||
if (strcmp(name, "a") == 0 && self->state == IN_ANCHOR) {
|
||||
// Create TOC entry when closing anchor tag (we have all data now)
|
||||
if (!self->currentLabel.empty() && !self->currentHref.empty()) {
|
||||
std::string href = FsHelpers::normalisePath(self->baseContentPath + self->currentHref);
|
||||
const std::string rawTarget = self->baseContentPath + self->currentHref;
|
||||
const size_t pos = rawTarget.find('#');
|
||||
const std::string rawPath = pos == std::string::npos ? rawTarget : rawTarget.substr(0, pos);
|
||||
std::string href = FsHelpers::normalisePath(FsHelpers::decodeUriEscapes(rawPath));
|
||||
std::string anchor;
|
||||
|
||||
const size_t pos = href.find('#');
|
||||
if (pos != std::string::npos) {
|
||||
anchor = href.substr(pos + 1);
|
||||
href = href.substr(0, pos);
|
||||
anchor = FsHelpers::decodeUriEscapes(rawTarget.substr(pos + 1));
|
||||
}
|
||||
|
||||
if (self->cache) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <Logging.h>
|
||||
#include <XmlParserUtils.h>
|
||||
|
||||
#include "../BookMetadataCache.h"
|
||||
#include "Epub/BookMetadataCache.h"
|
||||
|
||||
bool TocNcxParser::setup() {
|
||||
parser = XML_ParserCreate(nullptr);
|
||||
@@ -145,13 +145,14 @@ void XMLCALL TocNcxParser::endElement(void* userData, const XML_Char* name) {
|
||||
// This is the safest place to push the data, assuming <navLabel> always comes before <content>.
|
||||
// NCX spec says navLabel comes before content.
|
||||
if (!self->currentLabel.empty() && !self->currentSrc.empty()) {
|
||||
std::string href = FsHelpers::normalisePath(self->baseContentPath + self->currentSrc);
|
||||
const std::string rawTarget = self->baseContentPath + self->currentSrc;
|
||||
const size_t pos = rawTarget.find('#');
|
||||
const std::string rawPath = pos == std::string::npos ? rawTarget : rawTarget.substr(0, pos);
|
||||
std::string href = FsHelpers::normalisePath(FsHelpers::decodeUriEscapes(rawPath));
|
||||
std::string anchor;
|
||||
|
||||
const size_t pos = href.find('#');
|
||||
if (pos != std::string::npos) {
|
||||
anchor = href.substr(pos + 1);
|
||||
href = href.substr(0, pos);
|
||||
anchor = FsHelpers::decodeUriEscapes(rawTarget.substr(pos + 1));
|
||||
}
|
||||
|
||||
if (self->cache) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user