From caaf27427e05c113a64642c5287965344cb9a9d5 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 7 Jun 2026 00:03:54 -0400 Subject: [PATCH] feat(reader): apply RTL reading direction for fixed-layout manga/comics foliate's goLeft/goRight (and spread ordering) swap on book.dir === "rtl", but makeComicBook never sets dir, so manga/comic archives always paged left-to-right even when the metadata says right-to-left. For fixed-layout content, set this.book.dir = "rtl" from the readingDirection metadata after the book opens. Reflowable EPUBs are unaffected: they keep whatever direction foliate read from the OPF. This is scoped to isFixedLayout (FXL EPUB, PDF, comics) so it cannot reach the reflowable path. --- web/src/reader/reader.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/src/reader/reader.ts b/web/src/reader/reader.ts index c3b51c2..5fc5080 100644 --- a/web/src/reader/reader.ts +++ b/web/src/reader/reader.ts @@ -449,6 +449,13 @@ document.addEventListener("alpine:init", () => { this.book = this.view.book; this.isFixedLayout = this.view.isFixedLayout; if (this.isFixedLayout) { + // Manga/RTL comics: foliate's goLeft/goRight swap on book.dir === "rtl", + // but makeComicBook never sets dir. Apply it from metadata so RTL page + // turns (and spread ordering) read right-to-left. Reflowable EPUBs keep + // whatever direction foliate read from the OPF. + if (config.readingDirection === "rtl" && this.book.dir !== "rtl") { + this.book.dir = "rtl"; + } this.isPDF = (this.renderer as any).isPDF; this.renderer.addEventListener("zoom", () => { this.zoomPercent = this.renderer.zoomPercent;