Skip to content

Reattach punctuation split off by the hyphenation pass#429

Open
neoden wants to merge 1 commit into
baskerville:masterfrom
neoden:fix/hyphenation-detached-punctuation
Open

Reattach punctuation split off by the hyphenation pass#429
neoden wants to merge 1 commit into
baskerville:masterfrom
neoden:fix/hyphenation-detached-punctuation

Conversation

@neoden

@neoden neoden commented Jun 12, 2026

Copy link
Copy Markdown

Fixes #428.

hyphenate_paragraph records one merge range per alphabetic run, so cleanup_paragraph only glues the syllables back together and the punctuation boxes it split off stay detached, corrupting every consumer of the page's text boxes (highlight/annotation text, search/define on a selection).

Record a single merge range spanning the whole token instead. cleanup_paragraph then reassembles the token exactly as it was before hyphenation — including tokens that gained no hyphenation points but were still split (e.g. can't, well-known, (word)).

Line breaking is unaffected: the boxes and penalties fed to total_fit are unchanged, and a full-book layout comparison (1200+ pages) shows identical page counts and line breaks, with only the text-box granularity restored.

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.

Hyphenation detaches punctuation from words in the selection text

1 participant