Skip to content

feat(pdf): read ViewerPreferences Direction as book.dir - #75

Merged
chrox merged 1 commit into
mainfrom
feat/pdf-viewer-preferences-direction
Aug 15, 2026
Merged

feat(pdf): read ViewerPreferences Direction as book.dir#75
chrox merged 1 commit into
mainfrom
feat/pdf-viewer-preferences-direction

Conversation

@chrox

@chrox chrox commented Aug 14, 2026

Copy link
Copy Markdown
Member

PDFs bound right-to-left (Japanese photo books, manga) declare it in the catalog's ViewerPreferences as /Direction /R2L. Surface it as book.dir so the fixed-layout renderer pairs and orders two-page spreads right-to-left and page navigation follows the reading direction.

Covered by a browser test in the readest app (pdf-viewer-preferences-direction.browser.test.ts) that loads minimal R2L-flagged and unflagged PDFs through makePDF and asserts book.dir.

Part of readest/readest#5591.

🤖 Generated with Claude Code

PDFs bound right-to-left (Japanese photo books, manga) declare it in the
catalog's ViewerPreferences as /Direction /R2L. Surface it as book.dir
so the fixed-layout renderer pairs and orders two-page spreads
right-to-left and page navigation follows the reading direction.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@chrox
chrox merged commit 2691386 into main Aug 15, 2026
2 checks passed
chrox added a commit to readest/readest that referenced this pull request Aug 15, 2026
readest/foliate-js#75 was squash merged, so point the submodule at the
commit on main instead of the feature branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@chrox
chrox deleted the feat/pdf-viewer-preferences-direction branch August 15, 2026 08:32
chrox added a commit to readest/readest that referenced this pull request Aug 15, 2026
* fix(reader): target the active book when the settings shortcut opens the dialog

The Shift+F shortcut opened the settings dialog without setting its book
key, so the dialog ran in bookless mode: writing mode and other per-book
changes were saved under an empty key, nothing applied to the open book,
and recreateViewer('') threw Book not found. Pass the sidebar book key
like the view menu entry does.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(reader): right-to-left page order for fixed-layout books, closes #5591

Books bound right-to-left (Japanese photo books, manga, RTL PDFs) showed
two-page spreads paired and ordered left-to-right with no discoverable
way to fix it.

Add a Right-to-Left Pages toggle to the view menu's fixed-layout section
next to the spread controls. It drives the existing per-book writingMode
setting (horizontal-rl / horizontal-tb) so it stays consistent with the
Layout panel and persists like any view setting.

Auto-detect the binding for PDFs that declare it: makePDF now surfaces
the catalog's ViewerPreferences /Direction /R2L as book.dir, and the
viewSettings.rtl derivation considers the loaded document's dir so
page-turn taps and swipes follow the reading direction.

Mirror the @pdfjs alias into the browser vitest config so browser tests
can load foliate-js/pdf.js, and translate the new label across all
locales along with the previously untranslated Send Document Metadata
key that extraction surfaced.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(reader): bump foliate-js to the merged R2L direction commit

readest/foliate-js#75 was squash merged, so point the submodule at the
commit on main instead of the feature branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 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