[!TIP] Audience: Anyone running batch text/image pipelines, or anyone tempted to add a “global cleanup rule” to a tool. Core goal: Document four bugs hit while re-typesetting 113 manga volumes—and honestly list what is still unfixed afterward. Problem–Solution Mapping:

  • ~1,100 bubbles corrupted (e.g., 门→斗, 技→找) → The re-typesetting script ran an OCR confusion-fix table on already-proofread translations; split out a dedicated re-render text cleaner without apply_confusions.
  • Random 一一 in narrow bubbles → Japanese prolonged sound mark ー rendered verbatim in a box misclassified as horizontal 1-char-per-line; normalize ー/ー to —— and rotate 90° for vertical layout.
  • Black text invisible on black bubbles/night panels → A blanket FORCE_BLACK_TEXT rule I added days earlier; switched to median background luminance inside the box (< 128 → pure white, else pure black).
  • Blind full re-render would stamp hundreds of OCR hallucination strings onto pages → Added looks_like_ocr_noise() guard; matched 314 / 122,500 boxes (0.26%) and kept original artwork untouched.

Bottom line first: I assumed OCR was misreading characters. Turned out every single mess across 113 volumes was caused by my own “clever” rules.

On the evening of November 16, I flipped through some finished manga volumes generated by comicgen and immediately saw something off. “Why didn’t you knock on the door (敲门)?” was printed as 敲斗. “Basketball technique (技术)” became 找术. Narrow vertical bubbles had 一一 floating inside them. The next day, I noticed dark bubbles and night panels had pure black text on black backgrounds, basically invisible unless I leaned into the monitor.

Sorting all of this out took two days and two full re-renders across 113 volumes (three long-running series: 74 + 24 + 15 volumes).

1. Corrupting My Own Proofread Translations (~1,100 Boxes)

When I saw 敲斗 and 找术, I blamed OCR. Reading the code proved OCR innocent.

pipeline/proofread.py has a single-character CONFUSIONS map meant strictly for raw OCR output—fixing common scan misreads like 门→斗, 技→找, 枪→抢, 眼→跟, 悠→你, 狼→很, 肥→吧.

The bug was in retext_volume.py: during re-typesetting, it applied that OCR map unconditionally to already-proofread Chinese translations. Perfectly good text was being actively mangled by my own fixer.

Scanning the entire library showed roughly 1,100 boxes damaged:

  • 眼 → 跟: 309
  • 门 → 斗: 243
  • 技 → 找: 195
  • 枪 → 抢: 49
  • 悠 → 你: 26
  • 狼 → 很: 19
  • 肥 → 吧: 19

The fix was straightforward: split out proofread.render_text() for re-typesetting—Traditional-to-Simplified conversion, dash normalization, and noise filtering only, never calling apply_confusions. The confusion map stays strictly on the OCR side.

2. The Mysterious 一一, Plus 314 Hidden OCR Hallucinations

The 一一 artifact came from two bugs stacking on top of each other:

  1. Japanese prolonged sound marks (ー) left over from OCR were rendered as-is.
  2. Direction detection (guess_direction) returned the wrong answer on single-column vertical boxes and laid them out as “horizontal, one character per line”—turning two dashes into two stacked horizontal bars that read like 一一.

I normalized ー/ー to —— (leaving full-width - untouched so numbers and model codes don’t break) and rotated dash glyphs 90° in vertical and 1-char-per-line narrow boxes so they draw as a continuous vertical line.

While digging into that, I caught a nastier trap: .text.jsonl contained hundreds of OCR hallucination strings (runs of dates, legal clauses, ranking tables, blocks with zero Chinese characters, or raw kana dumps). They hadn’t shown up in the finished volumes only because those pages had never been re-rendered before. A blind full re-render to fix the confusion bug would have stamped all that garbage straight onto the artwork.

I added looks_like_ocr_noise() to skip rendering those boxes and leave the original art intact. Tested across 122,500 boxes in the full library: 314 hits (0.26%), with only 3 false positives (all page header/footer numbers).

3. Black Text on Black Panels: My Own Rule Biting Back

Right after finishing the 113-volume text re-render at noon on November 17, I spotted the black-on-black panels.

That one was also self-inflicted. Back on November 6, I thought color sampling and text outlines looked messy, so I added FORCE_BLACK_TEXT: all translated text is pure solid black, no stroke, no color sampling. It looked crisp on white speech bubbles—and completely vanished on black bubbles, night scenes, and dark sound-effect panels.

The fix in render.py computes the median background grayscale luminance inside the text box (median rather than mean, because screentones and leftover strokes inside bubbles skew the average): luminance < 128 uses pure white; otherwise pure black. Still strictly two colors, still no outlines.

I also updated the re-typesetting trigger so any page containing a dark-background box is forced to re-render, and added a --summary flag to the batch runner so a fresh run wouldn’t skip every volume marked “done” in the previous pass.

4. Results Across 113 Volumes—and What’s Still Unfixed

By 8:00 PM on November 17, both full passes over all 113 volumes finished cleanly (113/113 exit code 0).

Spot-checking previously broken pages:

  • Corrupted words (敲门, 篮球技术, 格斗技巧, 死鱼眼) were restored, and vertical dashes rendered as continuous vertical lines.
  • Garbage boxes (such as English chapter titles) stayed untouched on the original artwork.
  • For dark-background white text, I spot-checked 36 dark boxes across 7 volumes: 36/36 turned white with 0 black-on-black leftovers, while light-background pages remained black.

Plenty is still unfixed, and I’m listing it plainly:

  1. Vertical direction detection is still flawed. guess_direction can still misclassify single-column vertical boxes. I tried a simple “tall-and-narrow = vertical” rule, which caused wide bubbles to overflow entire pages, so I reverted it. Fixing it properly requires rewriting vertical layout fitting.
  2. Two remaining issue logs: the re-render exported 201 boxes where long sentences still overflow even at the 10pt minimum font size, and 957 boxes (868 rows in the exported CSV) where stray kana still appear inside Chinese sentences. Neither was touched in this pass.
  3. The download page still served the older package when I first published this post earlier today: Downloads pointed to v0.4.2 (built Nov 5), while these Nov 16–17 fixes and 10 unpushed local commits hadn’t been released yet. (Same-day update, Nov 24: right after publishing, I switched to the new Gemini 4 Carbon to audit that local backlog in comic-gen. It caught 3 ruff warnings, 1 mypy tuple-type mismatch in render.py, and bare top-level zhconv imports in proofread.py / retext_volume.py that broke tests inside the clean CPU-packaging venv. After fixing all checks and sanitizing hardcoded local paths in scripts and docs, I skipped 0.4.3 and shipped v0.5.0—bundling real JPEG encoding for .jpg outputs (~1/3 the file size), --glossary, EasyOCR punctuation cleanup, auto white text on dark panels, and rotated vertical dashes. The Downloads page is now updated to v0.5.0.)

The takeaway from this two-day detour is simple: before adding a global “cleanup” or “force” rule to a batch pipeline, don’t just check the handful of pages it fixes—sample the whole library to see what it breaks. Both my confusion table and FORCE_BLACK_TEXT looked great on single test pages, and turned into a mess the moment they hit 113 volumes.