Commit Graph
100 Commits
Author SHA1 Message Date
dtourolle 583366ae1d docs: add layout remediation spec
Twelve specs covering the defects found auditing the block/table rendering
path, plus the pagination dead-end and the broken background renderer.

Each spec carries a reproduction of the defect against 2a543d0, a design with
concrete signatures, and acceptance criteria. Five design invariants are stated
up front so future changes can be rejected by reference rather than re-argued.
2026-08-06 21:03:12 +02:00
dtourolleandClaude Opus 5 e000068384 Cache word widths and glyph bitmaps to cut page render time ~3.5x
Rendering a page re-measured and re-rasterised the same words constantly: at
1404x1872 a page issued ~2800 textlength calls and ~2500 draw.text calls for
fewer than 1000 distinct (font, string) pairs. Profiling a page turn showed
FreeType glyph rendering at 57% of total time and width measurement at 38% of
layout.

Both are now cached. Measured on Crime and Punishment at 1404x1872, one page:

    layout  35ms -> 19ms
    render  84ms -> 41ms
    total  120ms -> 60ms

Eviction ranks by use count rather than recency. Word frequency in prose is
Zipfian and stationary, so the words worth keeping are the ones used most, and
unlike recency this lets a document's own frequencies be seeded up front --
see prewarm_caches(). Two details keep the policy from costing more than it
saves, since get() runs once per word drawn:

  - counting is O(1) with no reordering, because structures that reorder on
    every hit measured 3-5ms/page slower than the hit rate they bought;
  - eviction samples 8 entries and drops the least used of those, rather than
    maintaining a global order.

Aging (halving all counts periodically) is on by default. Without it a font
size change drove the hit rate to 0% on a real access trace: every key was new
and the previous size's entries held counts nothing could beat.

Both caches are bounded, since the glyph bitmaps reach ~19MB over a long
session and the target is a 512MB Pi Zero 2. Defaults are 4MB of bitmaps and
8192 widths; configure_text_caches() tunes them. Cache size barely affects
speed (2MB is within 13% of unbounded) because a miss costs only one ~44us
rasterisation, so the bound can be set for memory, not throughput.

EreaderLayoutManager.prewarm_caches() counts the book's word frequencies and
preloads the most common ones, seeding each with its document frequency. This
moves that rasterisation to open time and cut misses by 27%, for ~15% faster
page turns at a one-off ~300ms cost. It is opt-in; nothing calls it yet.

Rendering is no longer bit-identical. PIL positions text at sub-pixel offsets,
so the cache buckets that phase, defaulting to 2 buckets per axis. Total ink
per page is unchanged and the mean pixel difference is 3.6/255 -- a fifth of
one step of a 16-level e-ink panel. subpixel_steps=4 halves that if wanted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 20:49:32 +02:00
dtourolle 2a543d0319 reduced redundant code
Python CI / test (3.10) (push) Successful in 2m23s
Python CI / test (3.12) (push) Successful in 2m15s
Python CI / test (3.13) (push) Successful in 2m11s
2025-11-11 21:19:41 +01:00
dtourolle 23d3278b50 update docs and gitignore
Python CI / test (3.10) (push) Successful in 2m23s
Python CI / test (3.12) (push) Successful in 2m13s
Python CI / test (3.13) (push) Successful in 2m10s
2025-11-11 18:19:49 +01:00
dtourolle 3bcd1bffb5 Tables now use ""dynamic page" allowing the contents to be anything that can be rendered ion a page.
Python CI / test (3.10) (push) Successful in 2m22s
Python CI / test (3.12) (push) Successful in 2m13s
Python CI / test (3.13) (push) Successful in 2m9s
2025-11-11 18:10:47 +01:00
dtourolle 889f27e1a3 added fotn change API and examples
Python CI / test (3.10) (push) Successful in 2m18s
Python CI / test (3.12) (push) Successful in 2m8s
Python CI / test (3.13) (push) Successful in 2m6s
2025-11-11 12:44:18 +01:00
dtourolle 9de67d958e cell height now dynamic in tables
Python CI / test (3.10) (push) Successful in 2m16s
Python CI / test (3.12) (push) Successful in 2m8s
Python CI / test (3.13) (push) Successful in 2m2s
2025-11-10 22:06:05 +01:00
dtourolle 41dc904755 fixed issue where last word was counted for spacing
Python CI / test (3.10) (push) Successful in 2m17s
Python CI / test (3.12) (push) Successful in 2m6s
Python CI / test (3.13) (push) Successful in 2m1s
2025-11-10 15:22:18 +01:00
dtourolle 8e720d4037 fix table in cell wrapping
Python CI / test (3.10) (push) Successful in 2m17s
Python CI / test (3.13) (push) Has been cancelled
Python CI / test (3.12) (push) Has been cancelled
2025-11-10 15:15:03 +01:00
dtourolle 5afad2ca07 added line wrapping to table 2025-11-10 14:33:30 +01:00
dtourolle 303179865d tests for author names and metadata extraction
Python CI / test (3.10) (push) Successful in 2m16s
Python CI / test (3.12) (push) Successful in 2m7s
Python CI / test (3.13) (push) Successful in 2m2s
2025-11-10 13:54:36 +01:00
dtourolle fb52178cc6 fix for regresssion in fw/bw navigation
Python CI / test (3.10) (push) Successful in 2m15s
Python CI / test (3.12) (push) Successful in 2m7s
Python CI / test (3.13) (push) Successful in 2m0s
2025-11-10 13:25:04 +01:00
dtourolle 890a0e768b fix for reverse redering on restart
Python CI / test (3.10) (push) Successful in 2m10s
Python CI / test (3.12) (push) Successful in 2m2s
Python CI / test (3.13) (push) Successful in 1m56s
2025-11-10 13:17:20 +01:00
dtourolle a8e459bce5 fixed issue with cover and image rendering
Python CI / test (3.10) (push) Successful in 2m10s
Python CI / test (3.12) (push) Successful in 2m3s
Python CI / test (3.13) (push) Successful in 1m57s
2025-11-10 13:06:21 +01:00
dtourolle 9fb6792e10 fix missing images in paras
Python CI / test (3.10) (push) Successful in 2m6s
Python CI / test (3.12) (push) Successful in 1m58s
Python CI / test (3.13) (push) Successful in 1m51s
2025-11-09 22:25:23 +01:00
dtourolle 40c1b913ec doc updates
Python CI / test (3.10) (push) Has been cancelled
Python CI / test (3.12) (push) Has been cancelled
Python CI / test (3.13) (push) Has been cancelled
2025-11-09 22:06:42 +01:00
dtourolle cc34c79495 more examples
Python CI / test (3.10) (push) Successful in 2m6s
Python CI / test (3.12) (push) Successful in 1m57s
Python CI / test (3.13) (push) Successful in 1m52s
2025-11-09 21:40:59 +01:00
dtourolle 12ebddaa79 more examples 2025-11-09 21:40:50 +01:00
dtourolle 2b14517344 adding more fonts
Python CI / test (3.10) (push) Successful in 2m2s
Python CI / test (3.12) (push) Successful in 1m52s
Python CI / test (3.13) (push) Successful in 1m47s
2025-11-09 21:17:26 +01:00
dtourolle 849ba2f60f Added press state, fixed font registry
Python CI / test (3.10) (push) Successful in 2m2s
Python CI / test (3.12) (push) Successful in 1m52s
Python CI / test (3.13) (push) Successful in 1m47s
2025-11-09 17:45:53 +01:00
dtourolle 9ae8ddddca fixed example
Python CI / test (3.10) (push) Has been cancelled
Python CI / test (3.12) (push) Has been cancelled
Python CI / test (3.13) (push) Has been cancelled
2025-11-09 17:21:17 +01:00
dtourolle 50b9aa5431 fixed issue with bounding box height being wrong
Python CI / test (3.10) (push) Has been cancelled
Python CI / test (3.12) (push) Has been cancelled
Python CI / test (3.13) (push) Has been cancelled
2025-11-09 17:10:50 +01:00
dtourolle 56c2c21021 fix backwards rendering
Python CI / test (3.10) (push) Successful in 7m36s
Python CI / test (3.12) (push) Successful in 7m19s
Python CI / test (3.13) (push) Successful in 7m5s
2025-11-09 15:56:00 +01:00
dtourolle 73700baf87 CI fix
Python CI / test (3.10) (push) Successful in 7m50s
Python CI / test (3.12) (push) Successful in 8m34s
Python CI / test (3.13) (push) Successful in 8m9s
2025-11-09 09:16:10 +01:00
dtourolle 8b833eef0b more fstring fixes
Python CI / test (push) Successful in 6m46s
2025-11-09 00:15:25 +01:00
dtourolle 78745c4e29 more fstring fixes 2025-11-09 00:15:07 +01:00
dtourolle 10612fefae undoing more autoflake8 damage
Python CI / test (push) Failing after 43s
2025-11-09 00:11:48 +01:00
dtourolle ce7293824e fixing unterminated fsting
Python CI / test (push) Failing after 46s
2025-11-09 00:09:04 +01:00
dtourolle 8dce1569c0 fixed typo
Python CI / test (push) Failing after 46s
2025-11-09 00:05:14 +01:00
dtourolle f070121e5c bumpy version
Python CI / test (push) Failing after 45s
2025-11-08 23:59:53 +01:00
dtourolle 4c99282aef setup cfg file
Python CI / test (push) Failing after 46s
2025-11-08 23:46:28 +01:00
dtourolle 781a9b6c08 auto flake and corrections 2025-11-08 23:46:15 +01:00
dtourolle 1ea870eef5 yet more tests 2025-11-08 19:52:19 +01:00
dtourolle 00314c9b4f ADDITIOANL TEST
Python CI / test (push) Successful in 6m49s
2025-11-08 19:39:10 +01:00
dtourolle af18b1794a update readme 2025-11-08 19:25:32 +01:00
dtourolle 13d20c28c5 Api for changing sizes dynamically
Python CI / test (push) Successful in 6m54s
2025-11-08 18:22:58 +01:00
dtourolle f8baf155e9 ereader manager tests 2025-11-08 12:59:57 +01:00
dtourolle b65c35d96d Add missing tests
Python CI / test (push) Successful in 6m40s
2025-11-08 12:43:39 +01:00
dtourolle 5c0b22569a fix tests 2025-11-08 12:42:17 +01:00
dtourolle 39622c7dd7 integration of functional elements
Python CI / test (push) Successful in 6m46s
2025-11-08 10:17:01 +01:00
dtourolle ea93681aaf refactoring the mixin system
Python CI / test (push) Successful in 6m46s
2025-11-08 08:08:02 +01:00
dtourolle 49d4e551f8 Some clean up and added interactable images.
Python CI / test (push) Successful in 6m34s
2025-11-07 22:56:35 +01:00
dtourolle 15305011dc moved gestures to application
Python CI / test (push) Successful in 6m36s
2025-11-07 22:18:24 +01:00
dtourolle 9bc9c96e14 clean up examples
Python CI / test (push) Successful in 6m37s
2025-11-07 21:35:43 +01:00
dtourolle 496f3bf334 end2end table layouter
Python CI / test (push) Successful in 6m35s
2025-11-07 21:13:01 +01:00
dtourolle 5fe4db4cbe more refactoring
Python CI / test (push) Successful in 6m36s
2025-11-07 20:34:28 +01:00
dtourolle 03918fc716 complete the table rendering
Python CI / test (push) Successful in 6m37s
2025-11-07 19:45:47 +01:00
dtourolle b1553f1628 refactor continues
Python CI / test (push) Successful in 6m35s
2025-11-07 19:26:32 +01:00
dtourolle f72c6015c6 more reorg
Python CI / test (push) Successful in 47s
2025-11-07 19:14:37 +01:00
dtourolle 33e2cbc363 remove application from library
Python CI / test (push) Failing after 6m29s
2025-11-07 18:48:36 +01:00
dtourolle 6bb43db8d5 fix examples
Python CI / test (push) Successful in 9m48s
2025-11-06 18:01:22 +01:00
dtourolle c90e9ec580 allow example images
Python CI / test (push) Has been cancelled
2025-11-06 18:00:06 +01:00
dtourolle bde846bc3e example in use
Python CI / test (push) Has been cancelled
2025-11-06 17:58:35 +01:00
dtourolle 1bd9fdb551 more repo cleaning
Python CI / test (push) Successful in 10m0s
2025-11-06 17:40:34 +01:00
dtourolle 84229ad4da update tests
Python CI / test (push) Successful in 10m1s
2025-11-05 22:47:49 +01:00
dtourolle 5e3170497e removed scrolling viewport 2025-11-05 22:38:28 +01:00
dtourolle e6c17ef8a8 updating viewport
Python CI / test (push) Successful in 7m51s
2025-11-04 23:34:23 +01:00
dtourolle dfa225fdcb fix test
Python CI / test (push) Successful in 7m48s
2025-11-04 23:03:30 +01:00
dtourolle d542f08dd0 new page per chapter 2025-11-04 22:59:58 +01:00
dtourolle 562b4cf5d0 repo cleaning
Python CI / test (push) Successful in 6m43s
2025-11-04 22:46:50 +01:00
dtourolle c9b928f88d clean up repo 2025-11-04 22:46:09 +01:00
dtourolle 84654f2110 clean up repo
Python CI / test (push) Has been cancelled
2025-11-04 22:44:50 +01:00
dtourolle 55fdcbcb6d fix flake8
Python CI / test (push) Has been cancelled
2025-11-04 22:41:05 +01:00
dtourolle 37505d3dcc Fix tests for CI?
Python CI / test (push) Failing after 7m45s
2025-11-04 22:30:04 +01:00
dtourolle 9ba35d2fa8 add BW image conversion 2025-11-04 22:09:26 +01:00
dtourolle 25d36566d0 fix cover issue, add copyleft text 2025-11-04 20:05:34 +01:00
dtourolle 12d6fcd5db Cleaning unusued prototypes
Python CI / test (push) Failing after 6m20s
2025-11-04 19:36:34 +01:00
dtourolle 993095caf9 Update repo
Python CI / test (push) Failing after 6m22s
2025-11-04 19:25:44 +01:00
dtourolle 25e7f1423e ereader module
Python CI / test (push) Failing after 6m25s
2025-11-04 18:39:38 +01:00
dtourolle 4fe5f8cf60 Added links
Python CI / test (push) Failing after 6m34s
2025-11-04 13:39:21 +01:00
dtourolle de18b1c2cc Working version for ebook rendering!! 2025-11-04 12:57:15 +01:00
dtourolle fdb3023919 fix all tests
Python CI / test (push) Failing after 7m0s
2025-10-06 22:28:48 +02:00
dtourolle 718027f3c8 Fix tests
Python CI / test (push) Failing after 5m26s
2025-09-12 21:23:56 +02:00
dtourolle 65ab46556f big update with ok rendering
Python CI / test (push) Failing after 3m55s
2025-08-27 22:22:54 +02:00
dtourolle 36281be77a simplification of fonts
Python CI / test (push) Failing after 6m1s
2025-07-12 17:49:58 +02:00
dtourolle b1c4a1c125 added document layouter
Python CI / test (push) Failing after 4m51s
2025-06-28 22:02:39 +02:00
dtourolle 56a6ec19e8 Large clean up
Python CI / test (push) Failing after 5m5s
2025-06-28 21:10:30 +02:00
dtourolle d0153c6397 Fix tests
Python CI / test (push) Successful in 5m17s
2025-06-22 19:26:40 +02:00
dtourolle ae15fe54e8 new style handling
Python CI / test (push) Successful in 5m17s
2025-06-22 13:42:15 +02:00
dtourolle edac4de5b4 use font registry rather than make each time
Python CI / test (push) Successful in 5m6s
2025-06-21 11:38:53 +02:00
dtourolle ff5f840646 Added line overflow test
Python CI / test (push) Successful in 5m16s
2025-06-21 10:59:41 +02:00
dtourolle 210358913a added tests to ensure border is respected.
Python CI / test (push) Successful in 4m50s
2025-06-08 17:29:42 +02:00
dtourolle 27d029350a fixe
Python CI / test (push) Successful in 5m7s
2025-06-08 17:24:01 +02:00
dtourolle 8c0223a57a more cleaning
Python CI / test (push) Has been cancelled
2025-06-08 17:19:14 +02:00
dtourolle f6ae60217f clean up 2025-06-08 17:17:09 +02:00
dtourolle a014de854e fix to use same font in CI and local tests
Python CI / test (push) Failing after 4m7s
2025-06-08 17:10:47 +02:00
dtourolle c28cd0e6ea fix for CI
Python CI / test (push) Failing after 4m6s
2025-06-08 17:03:18 +02:00
dtourolle df775ee462 view port based browser and test
Python CI / test (push) Has been cancelled
2025-06-08 17:00:41 +02:00
dtourolle 4325c983b1 Fiuxed test from older version
Python CI / test (push) Failing after 4m8s
2025-06-08 15:24:43 +02:00
dtourolle 57d1b5f75c Adsditional fix 2025-06-08 15:11:35 +02:00
dtourolle 8d892bfe28 New alignement handlers
Python CI / test (push) Failing after 4m28s
2025-06-08 14:08:29 +02:00
dtourolle 9baafe85bf removed old tests
Python CI / test (push) Failing after 4m27s
2025-06-08 13:52:15 +02:00
dtourolle a0a26ef345 more fixes
Python CI / test (push) Has been cancelled
2025-06-08 13:49:34 +02:00
dtourolle 8c35cbf5ce Improved handling of pagnination.
Python CI / test (push) Failing after 4m8s
2025-06-08 13:29:44 +02:00
dtourolle 80edfcca84 fix to layout
Python CI / test (push) Failing after 4m10s
2025-06-07 22:34:42 +02:00
dtourolle 3f0b2747d2 Addtitional rending stuff... 2025-06-07 22:32:54 +02:00
dtourolle 4e65fe3e67 fixed some rendering issues
Python CI / test (push) Failing after 4m50s
2025-06-07 21:11:37 +02:00
dtourolle 899182152a add some additional tests
Python CI / test (push) Failing after 4m51s
2025-06-07 20:16:38 +02:00
dtourolle c981fbd1c0 additional tests 2025-06-07 19:56:11 +02:00
dtourolle 3f9bd0072e test for concrete
Python CI / test (push) Successful in 48s
2025-06-07 19:43:59 +02:00