Commit Graph
2 Commits
Author SHA1 Message Date
DesignCraft contributor 125eb7594a Break Indian-script words at line ends without a hyphen
A word in an Indian script (Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu,
Kannada, Malayalam) that is hyphenated at a line end now splits between syllables with no
hyphen drawn, and the breaker keeps no room for one. Latin and other scripts keep the hyphen.

- shape::breaks_without_hyphen decides by the letter the break follows (the last one before
  any soft hyphens), so Knuth-Plass, the single-line composer and line layout agree.
- hyphen_width is 0 after such a letter; the greedy breaker measures a soft hyphen's hyphen
  after the glyph before it, as Knuth-Plass and line layout already do.
- A break at a zero-width automatic hyphen is still a hyphenated line (it counts toward the
  consecutive-hyphen limit); `auto` tells it from the break after an explicit '-'.

Tests: hyphenated Hindi and Malayalam lines draw no hyphen (fails without the change);
hyphenated English lines still end in one.
2026-11-30 00:18:51 +05:30
DesignCraft contributor ba0ebd36b6 Hyphenate Hindi, Malayalam, Tamil and eight other Indian languages
Enable hypher's Indic patterns (Santhosh Thottingal's hyph-utf8 0.9.0, MIT) for Hindi,
Marathi, Bengali, Assamese, Gujarati, Punjabi, Odia, Tamil, Telugu, Kannada and Malayalam,
and offer those languages in the Language menu with their names mapped to BCP 47 tags.
Sanskrit is left out: its patterns carry a free-form licence outside the allowlist.

Two fixes make the patterns usable:

- Viramas, nuktas and ZWJ/ZWNJ are not Unicode-alphabetic, so hyphenation split a word
  such as विद्यार्थी at each conjunct into fragments too short to break. They now count as
  word characters.
- A hyphenation point was put after the first glyph of a cluster (the one owning its bytes)
  instead of its last. In Devanagari वि is drawn as ि then व, so the break fell between them
  and produced an empty hyphenated line. The point now goes after the cluster's last glyph,
  and suppress_hyphens matches the cluster's end for its trailing glyphs.

Tests: patterns per language, words hyphenated across conjuncts, joiners and nuktas kept in
words, a composed Hindi/Malayalam paragraph whose hyphenated lines end at syllable prefixes,
and Indian language names mapped to tags. Each new test fails without its fix.
2026-11-30 00:18:51 +05:30