Skip to content

feat(reader): elliptical translation bubbles with a shape preference - #1286

Merged
everpcpc merged 4 commits into
mainfrom
feat/reader-elliptical-bubbles
Oct 17, 2026
Merged

everpcpc merged 4 commits into
mainfrom
feat/reader-elliptical-bubbles

Conversation

@everpcpc

@everpcpc everpcpc commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

What

  • Translation overlay bubbles can now render as ellipses (new default) or rounded rectangles (the previous look) via a new "Bubble Shape" preference in Manga Translation settings, localized into all 10 supported languages.
  • Ellipse geometry follows the detector's box semantics, stamped per page as MangaTextBoxKind:
    • Text-tight boxes (rt_detr): the ellipse outgrows the box ×1.5 so corner glyphs stay covered (√2 is the minimum to touch them); text layout is unchanged.
    • Whole-bubble boxes (yolo): the ellipse stays inscribed in the box, preserving the original bubble outline, and the text area shrinks to 0.5 of the box so glyphs sit on the opaque core instead of the feathered rim.
  • Rounded rectangles hug the box for either box kind, reproducing the previous appearance.
  • Geometry (shape, scale, feather band, background and text frames) is shared in MangaBubbleBackground across iOS/macOS/tvOS.
  • The preference is rendering-only: it is excluded from the translation configuration stamp and takes effect through the existing settings-dismiss page refresh. Translations cached before this change decode as text: the outgrown ellipse keeps their text covered no matter which detector produced them.

Why

Manga speech bubbles are elliptical; a rounded rectangle reads as a caption box. The two detector families need different treatment: rt_detr boxes wrap the text, while yolo boxes already wrap the entire bubble — outgrowing the latter would paint white far beyond the original bubble into the surrounding art. The preference lets users who prefer the tighter caption-box look switch back.

Behavior notes: text-tight bubbles touching the page edge are clipped into a straight edge slightly more than before with the ellipse shape (the overlay clips at page bounds, and the background overflows by more than just the feather band), and in dense regions feathered edges of neighboring bubbles overlap more. Both follow from the larger ellipse footprint on text-tight boxes.

Validation

  • make build passes on iOS, macOS, and tvOS; make localize syncs the new keys and ./misc/translate.py list reports no missing translations.
  • artifacts/bubble-bg-check probe compiled against the modified sources: blob alpha (opaque core, transparent exterior, feather gradient) passes; ellipse text-tight background ≥ √2 of the box, ellipse whole-bubble background and rounded-rectangle backgrounds hug box + feather, whole-bubble text frame corners within 85% of the ellipse radius, rounded-rectangle text frame matching the small insets — all pass.
  • The probe's visual composite renders both ellipse treatments: the text-tight box is fully covered by its outgrown ellipse, and the whole-bubble box keeps its original border with the text frame centered on the opaque core.
  • Simulator end-to-end (iPhone 18 Pro, iOS 27) on a real manga CBZ, translating Japanese→Chinese through a local OpenAI-compatible endpoint: YOLO whole-bubble + ellipse repaints inscribed, preserving the original bubble outlines; YOLO + rounded rectangle hugs the boxes like the previous renderer; RT-DETR text-tight + ellipse outgrows ×1.5 and covers the original corner glyphs with no bleed-through. Vertical Chinese text lays out on the opaque core in every combination.

@everpcpc everpcpc changed the title feat(reader): render translation bubbles as ellipses sized per detector box kind feat(reader): elliptical translation bubbles with a shape preference Oct 17, 2026
@everpcpc
everpcpc merged commit 2dd62cf into main Oct 17, 2026
3 checks passed
@everpcpc
everpcpc deleted the feat/reader-elliptical-bubbles branch October 17, 2026 04:40
everpcpc added a commit that referenced this pull request Oct 17, 2026
#1288)

Manga translation bubbles are easier to read and no longer smudge the page.

- The bubble shape preference (ellipse vs. rounded rectangle, added in #1286) is removed; bubbles always render as rounded rectangles. Stored preferences carrying the old key decode harmlessly.
- For whole-bubble (YOLO) detection boxes, the white blob and its feather now stay inside the detected box, so the bubble's own border line survives instead of being painted over and blurred beyond it. The translated text sits in a centered 0.5 of the box, keeping a manga-like margin.
- Horizontal bubble text now shrinks until it actually fits (previously it could give up early and overflow onto the bubble's edge line).
- Tiny detected boxes always get a background: the feather is clamped so the opaque core never vanishes.
- Removes three now-unused localization keys (Bubble Shape / Ellipse / Rounded Rectangle). Pages cached between #1259 and #1286 keep their pre-existing rendering until re-detected, as their rows carry no box-kind field.
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