Repository navigation
Replies: 1 comment 1 reply
|
You have this fork https://github.com/zrn-ns/crosspoint-jp which add vertical Japanese support. Make sure it support your device variant before flashing. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
CrossPoint already handles horizontal CJK reading well (per-character line breaking, basic kinsoku, ruby annotations, CJK fonts from SD). What's missing is vertical writing mode (縦書き / tategaki): characters top-to-bottom, columns flowing right-to-left. This is the default typesetting for most Japanese fiction and very common for Traditional Chinese books in Taiwan and Hong Kong. Stock firmware doesn't support it, and as far as I can tell none of the community forks do either.
I've done a feasibility analysis of the codebase and believe this is implementable in stages with acceptable effort and no runtime performance cost. I'd like to coordinate before starting, since it touches the section cache format and the reader core (Phase 1 territory), even though the feature itself is squarely Phase 2 ("complex script support where realistic on ESP32 hardware").
Scope fit
What the codebase already has
ParsedTextsplits CJK runs into single-codepoint tokens at break opportunities (cjkCharacterBreakByteOffsets,lib/Epub/Epub/ParsedText.cpp).、。」!?/ no-break-after「(rules (ParsedText.cpp:65–155).<ruby>/<rt>parsing and rendering — horizontal only today..cpfonton-demand glyph loading already solves the font-size problem.GfxRenderer::drawTextRotated90CW(lib/GfxRenderer/GfxRenderer.cpp:2124) exists as a compile-time template path — currently used for UI labels only.What's missing (the actual work)
ChapterHtmlSlimParser::addLineToPage). Vertical mode needs columns broken against viewport height, placed right-to-left. Conceptually an axis swap, applied through line breaking, page assembly, justification, and ruby placement.TextBlockstores only a horizontal per-word position (wordXpos), andsection.binhas no writing-mode field. Needs a format extension +SECTION_FILE_VERSIONbump (existing invalidation logic handles migration).writing-mode/-epub-writing-mode(CSS parser) norpage-progression-direction(OPF spine) are parsed today. I propose starting with a manual per-book setting and adding auto-detection later.lib/MiniBidi(do_shape()).Proposed staging
I'd open Stage 1 as a focused PR first, targeting
develop.Performance / memory
Layout cost is paid once at section-build time and cached to
section.bin— vertical layout is the same class of work as horizontal with axes swapped, so page turns stay as fast as today. Glyph rotation goes through the existing compile-time template (no per-pixel runtime cost). CJK glyphs already stream from SD via the existing ring buffer, so DRAM pressure doesn't change. This should work on the C3, not just the S3.Design consideration: column direction as a parameter
Traditional Mongolian is also written vertically but with columns flowing left-to-right, and would additionally require contextual glyph shaping (cursive joining, like Arabic rotated 90° — but unlike Arabic, Unicode encodes no presentation forms for Mongolian, so the existing
do_shape()approach doesn't transfer). I don't propose implementing Mongolian now — the shaping work is a separate, much larger problem — but I'd design the layout path with column direction as a parameter rather than hardcoding right-to-left, so the door stays open.Questions for maintainers
wordXpos), or a writing-mode flag in the header with axis interpretation at render time?I can supply sample EPUBs (Japanese fiction with ruby, Traditional Chinese vertical layout) and test on real hardware. Happy to iterate on the approach before writing any code.
All reactions