Skip to content

Hyphenate and justify as Pages 15.4 does (B-023, W1 step 17) - #182

Merged
brahm merged 4 commits into
mainfrom
claude/project-thread-tlkrle
Nov 21, 2026
Merged

brahm merged 4 commits into
mainfrom
claude/project-thread-tlkrle

Conversation

@brahm

@brahm brahm commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Requested by Brahm · project thread

The third piece of step 17 of docs/phases/W1.md.

What changes

  • Text with no language set is hyphenated as English (en-US), as Pages 15.4 does. Pages '09 didn't hyphenate it.
  • Where a word breaks: Pages 15.4 breaks a word only before the first letter that doesn't fit, so the letter after the hyphen has to fit too, not just the hyphen. Measured on the new txt-09-hyphenation-widths case, where the same sentences repeat at measures 1 pt apart. With this rule Desk switches to "extraor-" at 98 pt and to "extraordi-" at 107 pt, the same widths as 15.4.
  • Words in the PDF: when a justified line spreads its letters by up to a tenth of an em, Desk makes each word one cluster, so the PDF keeps the word whole for copying and searching. Pages does this with character spacing. Before, readers saw words such as "tra di tional".
  • Corpus: txt-09-hyphenation-cases and txt-09-hyphenation-widths are added. justify-cases and txt-09-never-hyphenate now use the PDFs of Pages 15.4, and the manifest says so.

Moved to W2 (B-045)

Pages 15.4 breaks some words at different points because it uses the macOS dictionary, which can't be copied: pho-tographs, cel-ebration, extra-ordinarily and extraordinari-ly. So the three hyphenation documents can't match Pages whole, and their whole-document tests are left out, as the owner chose. This removes txt_09_words_never_hyphenated_match_pages. The rules are tested in desk-text instead. B-045 records the difference, moved from W1 to W2.

Not verified

  • Whether the "letter after the hyphen must fit" rule also applies to optional hyphens typed by hand. The cases only show automatic hyphenation. This goes on the list for the Mac in step 19.
  • justify-spacing and justify-space-limit keep their Pages '09 PDFs. The Mac lacks Liberation Mono and the corpus fonts, so 15.4 substituted Helvetica. They need those fonts installed on the Mac.
  • When the letters of a line spread by more than a tenth of an em, the words in Desk's PDF can still read as pieces.

Tests

  • fmt, clippy and check-backlog pass.
  • Every workspace test passes, and desk-ui passes 151 of 151.
  • New unit test: txt_09_a_word_breaks_only_before_the_first_letter_that_does_not_fit.
  • txt_09_automatic_hyphenation_breaks_words_by_their_language now checks that text with no language set breaks like English.

Generated by Claude Code

…does (B-023, work in progress)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NiPLVSJ4urMWCnygLAWw8C
…15.4 does (B-023, work in progress)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NiPLVSJ4urMWCnygLAWw8C
…ages 15.4 does (B-023, work in progress)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NiPLVSJ4urMWCnygLAWw8C
… hyphenates by (B-023, B-045)

Pages 15.4 breaks some words where only the dictionary of macOS does, so
the three hyphenation documents are not compared whole (B-045, moved to W2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NiPLVSJ4urMWCnygLAWw8C
@brahm brahm self-assigned this Nov 21, 2026
@brahm
brahm merged commit 187455b into main Nov 21, 2026
12 checks passed
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.

2 participants