Repository navigation
feat: EPUB text alignment and hyphenation settings (refs #286) - #302
Conversation
|
Thanks @chortya, the EPUB typesetting changes look good and CI is passing. GitHub still reports a conflict with |
7469625 to
9e92753
Compare
|
Thanks! Rebased onto current Heads-up: #301 and #302 both add a section at the same spot in |
Adds per-library Text alignment (Left/Justified) and Hyphenation (Auto/On/Off; Auto hyphenates justified text only) to the reader settings and the in-book options sheet, mapped to Readium textAlign and hyphens and applied live. Books that declare no language get the device language so the browser can hyphenate; RTL and CJK device languages are skipped because Readium derives layout from the language. Tests: JVM storage/fallback rules; on-device measurement of hyphenated words and flush lines on both spread pages, the no-language fallback, and the options-sheet controls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The in-book options and the library reader settings share one EpubTypesettingSettings composable, so both offer the same chips. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EpubTypesettingActivityInstrumentedTest runs on a single page: default ragged and unhyphenated, Justified hyphenates with flush lines, Off removes hyphens, Left with On hyphenates, and a book without a declared language is hyphenated in the device language. Adds the reader test hooks it needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The page language is checked for every hyphenating device language; the hyphenation check needs English, which the fixture text is in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9e92753 to
99c34d8
Compare
|
Updated on top of #301: resolved the docs conflicts, keeping both the OLED and the alignment/hyphenation sections. CI is green. |
van-geaux
left a comment
There was a problem hiding this comment.
Reviewed the latest head. No blocking correctness, security, lifecycle, or persistence issues found. Local verification passed 1,002 JVM tests, Android-test Kotlin compilation, lint, and debug APK assembly; GitHub build-and-test is also passing. The CRLF diff-check warning is limited to the repository's existing docs/testing.md line-ending convention.
…d on #302, refs #286) (#303) * feat: per-book language for read-aloud voices and hyphenation Readium picks one read-aloud language (book metadata, else the device locale) and lists only its voices, with no way to change it; the hyphenation fallback made the same assumption. Adds a Book language setting to the in-book options (This book): Auto shows whether it comes from the book or the device, and an override is remembered per book, sent to the EPUB navigator for hyphenation and to the read-aloud navigator for voices, and applied live during playback. Tests: JVM resolution and option rules; on-device voice lists with the system speech engine (Auto, live switch, start in override), page language and persistence across recreation, and the picker UI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: book-language changes during read-aloud preparation; lazy language picker - A book-language (or voice setting) change made while read-aloud is preparing is applied once the navigator exists. - The book-language picker is a dialog with a lazy list instead of a menu composing ~200 items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: book-language override also applies to chapters that declare a language Readium only injects its language into documents whose <html> declares none. The current-document bridge now also sets the override on <html> and <body> (lang and xml:lang) and restores the publisher's values on Auto, so hyphenation follows the chosen language in every chapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep each book's language choice separate per server profile The same book ID can exist on another server or account, so the per-book language override is now keyed by the active server profile (the boundary #309 uses for downloads and snapshots) as well as the reader key. Choices now survive switching profiles instead of being wiped for every profile. Signing out clears only the signed-out profile's choices, for BookOrbit, Kavita and Komga alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Contribution pause
The maintainer lifted the pause and invited split PRs in #286.
Summary
EPUB text was never hyphenated, and there was no setting for it or for justification. Two per-library settings are added. They appear in the in-book reader options (Typography) and in the library reader settings (shared
EpubTypesettingSettings):textAlign = START(follows text direction, so RTL books keep their own edge) /JUSTIFYhyphens; Auto hyphenates justified text onlyThe defaults (Left + Auto) keep today's rendering.
Browser hyphenation needs a content language. Books that declare none get the device language through Readium's
languagepreference (epubFallbackContentLanguage). This is skipped for RTL and CJK device languages, because Readium also derives RTL and vertical layout from the language and those scripts have no hyphenation patterns. All changes apply live without reopening the book. Older stored profiles default to Left + Auto.Verification
./gradlew :app:testDebugUnitTest— 953/953 pass (newEpubTypesettingPreferencesTest: storage round trip, legacy defaults, Auto rules, language fallback).:app:lintDebug— 0 errors.:app:assembleDebugsucceeds. No added trailing whitespace; line endings preserved.EpubTypesettingActivityInstrumentedTest2/2 — measured inside the reader WebView: default is ragged and unhyphenated; Justified hyphenates long words with flush lines; Off removes hyphens; Left + On hyphenates; a book without a declared language is hyphenated in the device language.ReadiumEpubOpenInstrumentedTest16/18; the 2 failures (selectsARealReadiumPositionForNonzeroServerPercentage,generatedEpubImageColorOverrideIsUniversalAndIdempotent) also fail onmainon this emulator (newtypesettingPreferencesMapToReadiumAlignmentHyphensAndLanguagepasses).EpubReaderOptionsOverlayInstrumentedTest4/9 (newepubAlignmentAndHyphenationChoicesUpdateOnlyTheirSettingspasses); the same 5 fail onmainon this emulator.🤖 Generated with Claude Code