Skip to content

Add Shiori, Aizome's PDF reader, drawing with hayro in a worker per document - #135

Merged
bitemyapp merged 21 commits into
mainfrom
aizome-pdf-reader
Oct 30, 2026
Merged

bitemyapp merged 21 commits into
mainfrom
aizome-pdf-reader

Conversation

@bitemyapp

@bitemyapp bitemyapp commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Adds Shiori 栞 (Documents), Aizome's PDF reader: a native Rust app that draws pages with hayro, a PDF renderer in Rust whose own crates forbid unsafe, from bitemyapp's fork of it. hayro runs in a separate worker process for each open document: a document can panic it or keep it busy, and the SIMD decoders Shiori turns on (hayro-syntax's unsafe feature) run unsafe code on its bytes.

Engine

GPL and AGPL engines are out: MuPDF, Poppler, xpdf and Ghostscript. pdf.js needs a web engine, and parser crates like lopdf don't draw pages. That left PDFium (BSD/Apache) and hayro (MIT/Apache). Over the pdf.js corpus they were as fast as each other at the median, but hayro's tail was much longer, and only PDFium gave a reader character boxes, search, links and the outline. So Shiori first drew with PDFium (docs/test-results/pdf-engines-2026-10-28.json).

The fork (bitemyapp/hayro, branch aizome-perf) now takes 0.49× PDFium's time over the corpus pages all three engines drew, faster on 1,077 of 1,189 pages (docs/test-results/hayro-fork-2026-10-28.json). This PR now draws with it, and builds what PDFium gave the reader on hayro's parser. PDFium and libpdfium are gone from the package.

Through Shiori's own path, over the same 1,012 files, back to back on one laptop (docs/test-results/shiori-hayro-2026-10-28.json):

PDFium's worker hayro's
Files opened, drawn, read and searched 985 995
A file, p50 / p99 / slowest 24 / 136 / 931 ms 15 / 82 / 356 ms
The 983 files both did 29.9 s 17.4 s
Stopped at 20 s / crashed / tiles not drawn 2 / 1 / 2 none

What's in it

  • Worker per document (aizome-shiori --worker): a watchdog restarts a worker that dies or hangs, and the failure costs at most one page at one size (it's tried again at another zoom, unless it has failed at two). A panic in hayro costs only the job it was on, and the document stays open. The app refuses a drawing it couldn't have asked for (too large, of a page the document hasn't, or past its page's edge) and lets go of drawings and hits for pages the window doesn't have; the worker leaves out geometry JSON can't carry (an infinite or NaN link box), rather than have the app take it for crashed. A worker started again that can't open the file, or finds no pages in it, goes, and what showed stays, with the toolbar saying why. The app keeps the text and links of 48 pages. Workers also use PR_SET_PDEATHSIG, NO_NEW_PRIVS and an 8 GiB address-space limit.
  • Reading features: fit width or page, zoom, pinch, middle-button panning, a sidebar with thumbnails or the outline (marking the entry being read), find with every hit highlighted, text selection and copy across pages (pages not yet read are read first), links (followed on click, selectable by dragging, their destination shown in the toolbar), passwords, Get Info, Go to Page (also from the page number), Escape for Find, the selection and full screen, your place, zoom and sidebar remembered per document, and reload when the file changes. A changed file is opened by a worker of its own while the last version's worker keeps drawing it, so a half-written file leaves the last version showing and still usable.
  • Built on hayro's parser:
    • Text (pdftext.rs): glyphs in the order the page draws them, with boxes a line high. Spaces and line ends are inferred from gaps and line changes. Overprinted glyphs count once, /ActualText replaces the glyphs it covers, and vertical text reads down.
    • Find over that text, which matches across white space, ligatures, soft hyphens and case.
    • Links, explicit and named destinations, the outline and metadata (document.rs).
    • Permissions, from Pdf::permissions, which the fork added.
  • Fonts a document names but doesn't embed (fonts.rs): hayro's built-in Foxit fonts stand in for Latin ones. For Chinese, Japanese and Korean, the worker takes the first outline font fontconfig lists for the language that actually has its characters (Noto Sans CJK in Aizome's session).
  • Prefetch: the page above and below the view are drawn whole and kept, with their text and links. Sidebar rows ask for neighbouring thumbnails three rows ahead. A small scroll and back sends the worker nothing (tested).
  • Scrolling: a custom page widget moves already-drawn pixels, so a scroll notch at 2× takes 0.17 ms (a full canvas redraw took 9.9 ms).
  • Zooming shows in the next frame (standin.rs). While a zoom's tiles come, Shiori makes what stands in for the part of each tile in view, at exactly its size, from the last zoom's drawings (bilinear, on up to 16 threads, into reused buffers), and the window copies it one to one like the drawings. The window used to scale the old drawings itself as it drew, bicubic and on one thread, which took 357–533 ms a step at 4K. Drawings also come back from the worker without copies, through a 1 MiB pipe; sidestep-ui's Image gains from_premultiplied_rgba and premultiplied_pixels for this.
  • Packaging:
    • The fork is pinned by revision in Shiori's Cargo.toml.
    • The workspace patches moxcms to bitemyapp/moxcms (one change, proposed as Compute gamma tables from transfer characteristics once awxkee/moxcms#209). It also patches zune-core to the zune-image fork hayro uses, so Nix's vendoring sees one zune-core. That patch names the branch, as hayro does, or Cargo would see two sources; Cargo.lock pins the commit.
    • Both patches apply to the whole Aizome workspace, so everything built on image gets them: the compositor, the shell, the toolkit's sidestep-engine and Shashin. image still decodes JPEGs with crates.io zune-jpeg 0.5.15, now compiled against the forked zune-core, and manages colour with the forked moxcms. Shashin's tests pass the same as on main.
    • package.nix has cargoLock.outputHashes for the three git repositories.
    • application/pdf defaults to Shiori in Aizome sessions, the app has an icon and a shell catalog entry, and there is an aizome-checks.shiori VM check.
    • DEVELOPERS.md says how far the two patches reach, what to check when moving either fork, how to move each (zune-core is named by branch, so a plain cargo update moves it; cargo update -p zune-core --precise REV chooses its commit), and what dropping each would take.
  • Merged with main at d717500 (Nisshi, Show application startup failures and per-launch logs #144 and Add Nisshi, Aizome's log viewer, with Application Launches (#144) and Open in Logs #149), resolving conflicts in README.md, desktop/aizome/Cargo.toml and desktop/aizome/README.md; it had been rebased on Move Aizome's toolkit into Sekka as Sukumo #139, Clean up Aizome when its login session is terminated #140 and Stop describing a sidestep input in DEVELOPERS.md #143 before. The Sidestep re-pin (22125b1) is gone, as main no longer has Sidestep. Add Utsushi, Aizome's media player, built to spare the battery #136 (Utsushi) conflicts with this PR (Cargo.lock, the workspace members, the mime list, docs and icons): whichever lands second needs a rebase, a regenerated Cargo.lock keeping both sets of git sources and hashes, and its VM check again.

Changed in review

  • A file being written: a changed file is opened by a worker of its own while the last version's worker goes on drawing it; the new one takes over only once it has opened the file and found pages. Before, a half-written file left the window with a worker that had no document and answered nothing: zooms stayed blurred, pages not yet drawn stayed blank, and Find and Copy never finished.
  • A worker started again that can't open the file keeps the view, where it used to become an error page. The toolbar says "The file changed and can't be read yet; this is how it was." only when the file's time or size differ from those of the version showing; then the next change is tried. If they're the same (the reopen hit the 30 s watchdog, or the file couldn't be read for a moment), it says the page reader couldn't open the file again (or stopped, or took too long, doing so) and that Reload (❖R) tries again. A Reload that can't open a file that hasn't changed says the same.
  • A worker started again that finds no pages in a changed file goes, instead of being kept and failing every drawing (pages marked "couldn't be drawn" until the next reload).
  • What the worker sends: non-finite geometry (a link box of 10^40 points) is left out rather than sent as JSON null, which the app read as a crash. A drawing of a page past the last, or past a page's edge, stops the worker in the engine and is let go in the app, as are search hits on such a page; one such drawing could panic every Shiori window.
  • Closing while a worker starts: a document closed just as its worker started no longer leaves that worker running until Shiori exits. The check is a function of its own now, tested in both orders.
  • Docs: the DEVELOPERS.md note on the workspace patches above; the corpus record names its PDFium baseline as this PR's 6edff0e (built at the time as 52a7ee2, a merge the rebase dropped); the PR text no longer says Shashin and sidestep-engine decode JPEGs through the forks.

Testing

Component tests, the aizome package and the VM check ran on wx-workstation on this head (893f006), merged with main at d717500. The other results say where and on which head they ran.

  • Component tests: cargo test -p aizome-shiori passes: 34 unit, 7 worker and 32 headless tests, and the budget test. aizome-kit's tests pass. Clippy (--all-targets -D warnings, both crates) and rustfmt are clean. sidestep-ui's library tests passed in Sukumo's workspace in an earlier round.
    • Each review fix has a test that fails without it. On the previous head's app, the new tests fail as they should: the unchanged file is said to have changed, and the worker that found no pages is kept. The close-while-starting test fails with its check taken out. The first round's tests failed on the unfixed merge (the worker replaced, a panic at layout.rs:205, a worker taken for crashed on a link). One more test covers a worker that dies while the file is half written: the view stays, and the whole file is read once written.
    • The unchanged-file test makes the file unreadable with chmod 000 (its time and size don't change), so it skips itself when run as root.
    • The worker tests run real workers over generated documents and a qpdf-encrypted fixture.
    • The headless tests include the Night and Day goldens, drawn again with hayro after the review changes (the highlights and the contents' mark).
    • One headless test checks that a zoom shows stand-ins at once, with their ink where the drawings put it, and lets them go once drawn.
  • Corpus: the table above; no worker stopped, crashed or failed a tile.
  • Budget: tests/budget.rs gives Page Down 3.2 ms p50 at load average 2 to 3, within the 4 ms budget. It was 5.7 ms at load average 10 before. The test measures the window with its drawings made, so the engine isn't in it. After the review changes, on runnymede: a notch 0.09 ms p50, Page Down 1.25 ms p50 and 2.03 ms p95. It now measures zooming too, at 2880 × 1800: a zoom step 4.3–4.4 ms p50 and 4.4–4.6 ms p95, at the budget because every pixel changes (it was 382 and 508 ms), and pinching 3.5 and 4.0 ms (it was 357 and 474–479 ms). A step over 16 ms fails the test.
  • Zoom on a real book: a 6 MB book of A4 pages in a 3800 × 2000-pixel window. A zoom step's first frame takes 4.5–5.0 ms, and the tiles in view are sharp 35–53 ms after the key. Pinching takes 3.6 ms (p50) and 4.8 ms (p95) a frame zooming in, and 5.4 and 6.3 ms zooming out.
  • Package: nix build .#aizome (release-lto, with its check phase: the toolkit, Yukimi, aizome-shell and aizome-sys suites) passes on this head. The package has aizome-shiori, its desktop file and icon, and no PDFium in its closure. Shashin's tests passed the same as on main with the patched zune-core and moxcms, on ce63cc9, whose Cargo.lock this head keeps unchanged. A dry run of the DEVELOPERS.md commands showed that cargo update -p zune-core --precise moves zune-core and hayro's zune-jpeg together, from one repository.
  • VM: nix build .#aizome-checks.shiori passed on 4a6747e on wx-workstation, again on 6323368 (rebased, with the review changes) and cf8c174 (with the zoom work), both on runnymede, and on this head on wx-workstation. It:
    • opens a document;
    • checks that its worker is the package's own program with no libpdfium mapped;
    • finds two hits through the worker and goes to the second;
    • replaces a SIGKILLed worker with the window kept;
    • checks the PDF default.

Not tested

  • Physical hardware: none of this ran on the X1 Carbon. Worth trying there:
    • a LaTeX edit loop (latexmk -pvc) with one build left broken, so the PDF is truncated. The toolbar should say the file changed and can't be read yet, while zoom, scrolling, Find and Copy still work on the last version; the next good build should swap in.
    • zooming, pinching, Page Down, middle-button panning and a CJK document.
    • xdg-open and a double-click in Hako on a PDF opening Shiori, with a default of your own in ~/.config/mimeapps.list still winning.
  • ISO qualification: not run. The zune-core and moxcms patches reach the compositor and shell, so on a new ISO, check that wallpapers, icons and Shashin's JPEG and PNG thumbnails look as before.
  • The watchdog path: the 30 s Open watchdog firing on an unchanged file is tested by sending the app the event, not by a slow open.

Limits

  • Files PDFium reads that hayro doesn't (2 of 1,012): issue15590, whose objects have lost their << and >>, and poppler-85140-0, where hayro (like qpdf) finds no pages.
  • Drawing differences: where the drawings differ, PDFium is still right on knockout groups, a blend mode, transfer functions and some fonts that aren't embedded. Vertical text doesn't take a font's vertical forms yet.
  • Not done yet: printing, form filling (forms display), annotations, a two-page view, page labels (Page iv), a dark reading mode for pages, and a seccomp or Landlock sandbox for the worker.

Open questions

Follow-ups

  • Confine Shiori's worker with seccomp or Landlock. The process split contains crashes and hangs, not code execution.
  • In the engine, treat a frame that fails to decode as a failed reply for the job in hand rather than a dead worker. The worker leaves out what JSON can't carry, so this is defence in depth only.
  • A worker started again after a crash that reads a changed file with a different (non-zero) page count carries on with the old layout until watch reloads it, within 1.5 s. Out-of-layout drawings and hits are let go, so this is only cosmetic.

The release workflow is untouched.

🤖 Generated with Claude Code

@bitemyapp

Copy link
Copy Markdown
Owner Author

Re-pinned Sidestep to aizome-combined (bitemyapp/sidestep#8, 853fbb3) in 22125b1. That commit changes only the flake input, its lock and vendor/sidestep, which agree. The combined branch is aizome plus bitemyapp/sidestep#6 (Utsushi's video layer) and bitemyapp/sidestep#7 (Omperor's clipboard reading and text attachments); every open Aizome PR now pins it, ahead of Sidestep moving into Sekka's tree.

Revalidated on wx-workstation against that Sidestep:

  • cargo build --locked --workspace passes.
  • Shiori's tests, unit and integration, all pass. They needed the dev shell's rustc wrapper run under bash on wx-workstation; see the note below.
  • aizome-checks.shiori (NixOS VM) passes.
  • aizome-shell's the_whole_screen and pictures_of_the_lock_screen goldens differ on wx-workstation by the same amount with either Sidestep (65.09% and 23.10% of pixels). The tests load their wallpapers from /home/callen/work/aizome-design/..., which exists only on the laptop.

Note: scripts/rustc-wrapper starts with #!/bin/sh. Where /bin/sh is dash, as on wx-workstation, dash drops CARGO_BIN_EXE_aizome-* (hyphenated names) before rustc runs. Every test that uses env!("CARGO_BIN_EXE_…") then fails to compile in nix develop .#aizome; this happens on main too. NixOS and the Nix sandbox use bash, so they're unaffected.

🤖 Generated with Claude Code

@bitemyapp bitemyapp changed the title Add Shiori, Aizome's PDF reader, drawing with PDFium in a worker per document Add Shiori, Aizome's PDF reader, drawing with hayro in a worker per document Oct 29, 2026
bitemyapp and others added 15 commits October 29, 2026 17:18
…r per document

Shiori 栞 (Documents) reads PDFs in Aizome's look: pages in one column,
fit-width/fit-page/stepped zoom with pinches and ❖-scroll about the
pointer, the outline and page thumbnails in a sidebar, find with every
hit shown, text selection and copy across pages, links, password-locked
documents, Get Info, Go to Page, your place and zoom kept per document,
and files that change while open read again in place.

PDFium was chosen over hayro (the other engine without a GPL/AGPL
licence) after drawing the pdf.js corpus with both: equal median speed,
a much shorter tail, and the text, search, link, outline and form APIs a
reader needs. nixpkgs builds it from source; the package puts it on the
run path. Each document gets its own `aizome-shiori --pdfium-worker`
process: a file that makes PDFium abort or loop costs a page, and the
app starts another worker. The worker asks fontconfig where fonts are,
so documents naming fonts they don't embed (CJK) draw on NixOS.

Pages are drawn as 1024-pixel tiles for exactly the zoom and scale, by a
widget that scrolls by moving pixels (0.23 ms a notch at 2x, from 9.9 ms
with a canvas). The pages either side of the view are drawn ahead and
kept, the worker is asked again only when the wanted set changes, and
the sidebar draws the rows either side of those that show.

The evaluation and the corpus runs are recorded in
docs/test-results/pdf-engines-2026-10-28.json and
desktop/aizome/docs/shiori.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ice pass

`aizome-checks.shiori` boots the Aizome session and drives the packaged
reader with real keys: a document opens with the package's libpdfium in
its worker, find goes through the worker, a SIGKILLed worker is replaced
with the window open, and application/pdf defaults to Shiori.

The toolbar's "PDFium stopped; Shiori started it again." gives way to the
page number after about ten seconds; lasting notices stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stet, pdfrum, pdfboss, pdf_oxide and zpdf all take 2.3 to 6.9 times
PDFium's time over the pdf.js corpus; hayro master takes 1.28 times, and
a local branch of it with glyph, image and mesh caches takes 0.88 times.
Shiori keeps PDFium for now; shiori.md says what moving would need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Five runs of the pdf.js corpus on wx-workstation, pinned to one CCD,
with PDFium, hayro master, the fork before reduced-size JPEGs and the
fork now: the fork takes 0.575 of PDFium's total over the 1,189 pages
all drew in under 5 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Eleven more changes on the fork (aizome-perf at ad5920e6, with a row
limit added to the zune-jpeg fork): five runs on wx-workstation put it
at 0.521 of PDFium's total over the 1,189 pages all drew in under 5 s,
faster on 961 of them and behind on the rest by 149 ms in all. 144
corpus pages change from the build before, by at most 2 levels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fork at 72fd16cb takes 0.50 of PDFium's time over the 1,189 corpus
pages all three engines drew, faster on 1,068 and behind on the rest by
89 ms. This round's changes, with instruction counts, the quiet and the
loaded runs, the Type 3 cache's glyph-edge changes and the suite results
are in the record, and the remaining gaps now give their reasons:
meshes, vello_cpu's layers under soft masks, the PostScript interpreter,
predefined CJK CMaps, and moxcms building an output curve of 65,536 pow
calls for every transform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fork at 30c45b88 takes 0.488 of PDFium's time over the 1,189
corpus pages all three engines drew, faster on 1,077 and behind on the
rest by 67 ms, with every page as at 72fd16cb. Predefined CJK CMaps are
embedded as tables searched in place, PostScript functions are compiled
to instructions on registers, and moxcms (through a fork) computes the
sRGB curve once rather than for every transform, so the CJK and
PostScript pages and ICC set-up are now faster than PDFium's. The
record lists what's left: meshes, vello_cpu's layers under soft masks
and nested groups, and the first sRGB curve a Lab space builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shiori's worker now reads documents with bitemyapp/hayro's aizome-perf
branch, a memory-safe PDF renderer in Rust about twice as fast as
PDFium over the pdf.js corpus, and writes on hayro's parser what PDFium
gave the reader:

- each page's characters and boxes (pdftext.rs): glyphs in the order the
  page draws them, boxes a line high, spaces and line ends inferred from
  gaps and line changes, overprinted glyphs once, /ActualText in place
  of what it covers, vertical text read down;
- find over that text, with white space, ligatures, soft hyphens and
  case handled, a rectangle for each line a hit crosses;
- links, destinations (explicit and named) and the outline
  (document.rs), metadata as PDF text strings, and an encrypted
  document's permissions, which the fork now gives;
- fonts a document names but doesn't carry: hayro's built-in Foxit
  fonts, and for Chinese, Japanese and Korean ones whatever fontconfig
  matches for the language (fonts.rs).

A panic costs only the job it was on, and the worker carries on with
the document open; one that dies or spends too long on a page is
replaced as before. The flag is --worker; the package no longer carries
or loads libpdfium, and its Cargo vendoring has hashes for the hayro,
zune-image and moxcms forks, the last patched in for the workspace.

Over the pdf.js corpus through Shiori's path (examples/corpus.rs), on
the same laptop back to back: 993 of 1,012 files opened, drawn, read and
searched (PDFium: 985), 14 ms a file at the median and 78 at p99 (24 and
176), 16.4 s over the 981 files both did (30.7 s), and none stopped or
crashed its worker (PDFium: 2 stopped at 20 s, 1 crash). The example
now treats a document with no pages as done.

cargo test -p aizome-shiori passes unchanged (21 unit, 6 worker and 15
headless tests, and the Night and Day goldens PDFium's drawings made),
as does the budget test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fork now reads documents encrypted only for their attachments
(their stream and string filters Identity), which asked for a password
or failed to open, and searches for pages past a page tree that reads
as empty. The Nix vendoring failed on two zune-core 0.5.3s (crates.io's
for the image crate, the zune-image fork's for hayro); the workspace now
patches crates.io's to the fork's branch, so there's one.

Over the pdf.js corpus through Shiori's path, back to back with PDFium's
worker on the same laptop: 995 of 1,012 files opened, drawn, read and
searched (PDFium's: 985), 15 ms a file at the median and 82 at p99 (24
and 136), and 17.4 s over the 983 files both did (29.9 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The worker took fontconfig's best match for a Chinese, Japanese or
Korean collection's language, which can be a Latin font (Noto Sans, on a
system with Noto Sans CJK too): hayro finds a stand-in's glyphs through
their Unicode, and a font without them drew the wrong glyphs. It now
walks fontconfig's sorted list and takes the first outline font with a
character of the language (あ, 中 or 한), and passes the face of a
collection without the named instance fontconfig packs above it (Noto
Sans CJK is a variable collection), which gave no face at all.

pdf.js's vertical_rotated_fallback_glyphs, whose Japanese font isn't
embedded, now draws its あ in Noto Sans CJK, down its columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Page Down is within the budget at load average 2 to 3 (3.19 ms p50) and
was over it at 10.5; the test measures the window with its drawings
already made, so the engine isn't in it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…scape

Fixes from review:

- A link is followed when the press on it ends where it began; dragged
  from, it's text to select, so a URL in a paper can be copied and a
  stray press doesn't open a browser.
- Escape empties the find field, then closes Find, then lets the
  selection go, then leaves full screen (as in Sumi and Shashin). Full
  screen shows Find while it's open; it used to open out of sight.
- Copying a selection over pages whose text hadn't come (passed over
  with the scroll bar) asks the worker for them and copies once they
  have; it used to leave them out without a word. The toolbar counts
  them down meanwhile.
- A page that couldn't be drawn is marked at that size only, and asked
  for at another zoom, unless it has failed at two sizes already.
- A search the worker gave up on says it stopped, rather than
  "Searching…" for good.
- The app refuses a drawing larger than it could have asked for before
  reading its pixels (the worker runs SIMD decoders with unsafe code on
  the document's bytes), and cuts a page's text whose characters and
  boxes don't pair up.
- The app keeps the text and links of 48 pages, not of every page read.
- /ActualText over glyphs that turn keeps those glyphs' text, rather than
  dropping it.
- The docs no longer call hayro memory-safe as Shiori builds it, and the
  tests no longer say PDFium.

Refinements:

- Find's hits are yellow and the current one orange with an edge, the
  same in Night and Day, as pages are paper in both.
- The toolbar says where the link under the pointer goes; the page
  number opens Go to Page when pressed; Previous and Next Page give
  their shortcuts.
- The contents mark the entry being read, or the closed branch it's in.
- The sidebar, and its tab, are kept with your place.
- The middle button drags the pages, and a horizontal scroll bar shows
  for pages wider than the window.
- A selection held past the window's edge goes on scrolling.
- Get Info says when the document was made and changed.

cargo test -p aizome-shiori: 26 unit, 26 headless and 6 worker tests
pass; the Night and Day goldens are drawn again (hayro, the new
highlights and the contents' mark). The budget test: a notch 0.09 ms
p50, Page Down 1.25 ms p50 and 2.03 p95 on runnymede.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bitemyapp and others added 6 commits October 29, 2026 20:59
A zoom step's first frame scaled the last zoom's drawings as the window
drew them: bicubic, on one thread, every size there was over each other.
At 4K it took 357-533 ms, and while the new tiles came each frame took
another 55-77 ms, so zooming felt slow and laggy.

- Shiori makes the stand-ins itself (standin.rs): for the part of each
  tile in view, exactly its size, from the nearest size that has each
  band of rows (bilinear, reusing each scaled row across the rows it
  serves; from drawings over twice as large, the mean of four pixels),
  on up to 16 threads, into the buffers of earlier stand-ins whose
  images have gone. The window copies them one to one, as it does the
  drawings, and lets each go as its drawing comes.
- Drawings come back without copies: the worker writes its pixmap as it
  is through a 1 MiB pipe, and the app reads it into the buffer the image
  keeps. sidestep-ui's Image gains from_premultiplied_rgba and
  premultiplied_pixels for this.

On a 6 MB book of A4 pages in a 3800 x 2000-pixel window, a zoom step's
first frame now takes 4.5-5.0 ms, and the tiles in view are sharp 35-53
ms after the key; pinching takes 3.6/4.8 ms a frame (p50/p95) zooming in
and 5.4/6.3 zooming out. The budget test (2880 x 1800) gains a zoom step,
4.3-4.4 ms p50 (382 ms before), at the 4 ms budget as every pixel
changes, and pinching, 3.5 ms (357 ms before); a step over 16 ms fails it.
A headless test checks that a zoom shows stand-ins at once, with their
ink where the drawings put it, and lets them go once drawn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… worker sends

When an open document's file changed, Shiori replaced its worker with
one opening the new file straight away. If that file couldn't be read
yet (a LaTeX build that failed, a download still being written), the
window kept its old drawings but its only worker had no document, and
it answered nothing: a zoom stayed blurred, pages not yet drawn stayed
blank, and Find and Copy never finished, until the file changed again.
Now the newer file is opened by a worker of its own while the one that
read the last version goes on drawing it; the new worker takes over only
once it has opened the file and found pages, and otherwise it goes and
the last version stays usable. A worker started again after a failure
that finds the file unreadable now leaves what showed in place too,
rather than replacing the window with an error.

JSON has no infinity or NaN, so a link rectangle a document makes
infinite (a /Rect of 10^40 points) went out as null; the app couldn't
read the reply, took the worker for crashed and restarted it, and four
such pages in a minute gave up on the document. The worker now leaves
such links and hit rectangles out, gives such characters no box and
such pages A4's size.

The app checked only a drawing's width and height, so a worker sending
a drawing of a page past the last could panic every Shiori window. The
engine now also stops a worker that sends a drawing of a page its
document hasn't, or of a part past the page's edge, and the app lets go
of drawings and search hits for pages its window doesn't have.

A document closed while its worker was starting no longer leaves that
worker running until Shiori exits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The record of Shiori's hayro worker against its PDFium worker named
52a7ee2 as the PDFium build, a merge with main that the branch's
rebase dropped and that won't be on main after a squash merge. It now
says so, and names 6edff0e, the commit in the pull request's history
whose Shiori that build had, so the comparison can be rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ages go

When a worker started again after a failure couldn't open the file,
Shiori kept the window's view and said the file had changed and couldn't
be read yet, even when it hadn't: a reopen stopped by the 30-second
watchdog under load, or a file that couldn't be read for a moment, was
put down to a change, and nothing said that Reload would try again.
Shiori now keeps the file's time and size as of the version that shows,
says the file changed only when they differ, and otherwise says that the
page reader couldn't open the file again (or stopped, or took too long,
doing so) and that Reload tries again. A Reload that can't open a file
that hasn't changed says the same.

A worker started again that opened a changed file with no pages (one
being written again, say) was kept, and failed every drawing asked of
it, marking pages as unreadable until the next reload. It now goes, as a
newer file with no pages does, and what showed stays.

The check that stops a worker that starts as its document closes is a
function of its own now, with a test of both orders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The workspace's [patch.crates-io] for zune-core and moxcms came in for
Shiori's hayro, but Cargo applies it to every crate in the workspace:
the compositor, the toolkit and so the shell and every app build image
against the forks. DEVELOPERS.md now says so, what to check when moving
either fork, how to move each (zune-core is named by branch, so a plain
cargo update moves it), and what dropping each would take.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bitemyapp added a commit that referenced this pull request Oct 30, 2026
Main now has Shiori (#135). The conflicts take both sides, as in the
release-candidate tree: the workspace members, lock file, app catalog,
icons, module and docs list both apps. Shiori's full-screen test gains
the window state's new suspended field from this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant