Repository navigation
a break position counts LETTERS, and half of Points counted bytes - #8
Merged
Merged
Conversation
Points built its value array over the augmented word by BYTE index
(n := len(w), w[i:j], val[i+k]) and read it back by RUNE index
(L := len([]rune(word)), and val[t+1] for a break after t letters).
Those agree for exactly as long as every letter is one byte — which is every
English word and no French, German, Czech, Polish or Vietnamese one.
⛔ AND NOTHING FAILED LOUDLY. val[t+1] simply read a different slot, so an
accented word broke in the wrong place or not at all. The caller sees a
plausible number and has no way to know it is the wrong one.
MEASURED, WITH ITS CONTROL
Two words of the SAME letter structure, differing only in whether one letter
takes two bytes, under the single pattern a1b:
Points("xaby") = [2] the control: all ASCII, one byte per letter
Points("éaby") = [3] one letter along — the same word, shifted
and a word that is all multi-byte letters, where the mismatch is largest:
Points("ééèè") = [3] want [2]
The control is asserted FIRST and fails the test outright if it does not give
[2], because a comparison against a broken control measures nothing.
THE FIX
Everything counts letters: the augmented word becomes a []rune, the pattern
lookup slices it by rune, and the value array is indexed the same way it is
read.
⚠ ASCII BEHAVIOUR IS UNCHANGED, which is the thing to check rather than to
assume: TestPointsFollowsLiangsRule still gives hyphenation -> [2 6], and the
whole existing suite passes untouched. For a one-byte-per-letter word the two
indexings were already the same number.
Found during a bibliography pass over tex.web §§891-966 from a consumer
(go-tex/engine), which reads this package for every paragraph it sets.
Co-Authored-By: Claude Opus 5 <[email protected]>
tannevaled
added a commit
to go-tex/engine
that referenced
this pull request
Nov 13, 2026
…ghout (#774) go-typeset/hyphenation v1.0.1 (its #8) fixes an indexing mismatch: the value array was built over the augmented word by BYTE index and read back by RUNE index. The two agree for exactly as long as every letter is one byte — every English word and no French, German, Czech, Polish or Vietnamese one. ⛔ SO EVERY TEST HERE WENT ON PASSING while a whole class of input was set wrong. Nothing in this engine's suite used a multi-byte letter in a word long enough to hyphenate. MEASURED against tectonic 0.17.0, one paragraph at \hsize=72pt, the SAME English patterns on both sides (no babel, no language option): reference Une présenta-/tion … représentations élé-/mentaires … v1.0.0 Une présent-/ation … des représentat-/ions éléme-/ntaires … v1.0.1 Une présenta-/tion … représentations élémentaires … `éléme-ntaires` is the shape of the defect: a break between the m and the n of a syllable, where no pattern in hyphen.tex can put one, and displaced by exactly as many positions as the word has multi-byte letters before it. `présenta-tion` is the one word both engines break in the same place, and v1.0.1 matches the reference there. THE GATE, AND ITS MUTATION accenthyphen_test.go asserts the reference's break and the ABSENCE of the four offset breaks. Its mutation is the dependency itself — pinning go.mod back to v1.0.0 reddens it, which is how the two outputs above were produced, from two builds of this engine differing only in that line: accenthyphen_test.go:48: `présentation` is not broken where the reference breaks it (`présenta-` / `tion`) accenthyphen_test.go:57: the byte/rune offset is back: "éléme-" is in the page ⚠ WHAT THIS DOES NOT CLAIM. The corpus is English-language physics, so the papers that score here barely exercise it; this is not expected to move the fidelity number and no claim is made that it does. It is a defect fixed on its own witness, in a class the metric does not reach — the same shape as #716. Refs go-typeset/hyphenation#8. Co-authored-by: Claude Opus 5 <[email protected]>
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
a break position counts LETTERS, and half of
Pointscounted bytesPointsbuilt its value array over the augmented word by byte index(
n := len(w),w[i:j],val[i+k]) and read it back by rune index(
L := len([]rune(word)), andval[t+1]for a break aftertletters).Those agree for exactly as long as every letter is one byte — which is every
English word and no French, German, Czech, Polish or Vietnamese one.
⛔ And nothing failed loudly
val[t+1]simply read a different slot, so an accented word broke in the wrongplace or not at all. The caller sees a plausible number and has no way to know
it is the wrong one.
Measured, with its control
Two words of the SAME letter structure, differing only in whether one letter
takes two bytes, under the single pattern
a1b:and a word that is all multi-byte letters, where the mismatch is largest:
⚠ The control is asserted first and fails the test outright if it does not
give
[2]: a comparison against a broken control measures nothing.The fix
Everything counts letters — the augmented word becomes a
[]rune, the patternlookup slices it by rune, and the value array is indexed the way it is read.
⚠ ASCII behaviour is unchanged, which is the thing to check rather than
assume:
TestPointsFollowsLiangsRulestill giveshyphenation -> [2 6], andthe existing suite passes untouched. For a one-byte-per-letter word the two
indexings were already the same number.
Found during a bibliography pass over tex.web §§891–966 from a consumer
(go-tex/engine), which reads this package for every paragraph it sets.
🤖 Generated with Claude Code