FA-80171 / Typography line breaking / Open access
Kerning and ligature line measure: interword space count · case 01
Every line measures one space too wide.
ROOT CAUSE
Spaces are counted once per word instead of once per gap.
VERIFIED REPAIR
Count len(words) - 1 spaces per line.
Unsuccessful approach: Subtracting two spaces undercounts lines.
Case contract
Input [words, width]. Glyph widths: i,l,j,.,, 4; t,f 6; m 15; w 14; M 16; W 18; other lowercase 10; other uppercase 13; space 5. Within a word, fi/fl/ff form ligatures (11/11/12) with no kerning into or out of them; case-sensitive kern pairs apply between adjacent glyphs; "|" is a non-joiner (invisible, blocks ligatures and kerning). No kerning across spaces. Greedy fill. Return [[text, width]].
Why this case matters
Line breaking decides where paragraphs wrap on screen and in print; a wrong decision point shifts every following line.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, width = x
W = {'i': 4, 'l': 4, 'j': 4, '.': 4, ',': 4, 't': 6, 'f': 6, 'm': 15, 'w': 14, 'M': 16, 'W': 18}
LIG = {'fi': 11, 'fl': 11, 'ff': 12}
KERN = {'AV': -3, 'VA': -3, 'To': -2, 'Ta': -2, 'Yo': -2, 'LT': -3, 'Wa': -2, 'av': -1, 'va': -1, 'y.': -2, 'r.': -2, 'l.': -1, 'f.': -1, 'Va': -2}
SPACE = 5
def glyph(c):
return W.get(c, 13 if c.isupper() else 10)
def measure(w):
total, prev, i = 0, None, 0
while i < len(w):
if w[i] == '|':
prev = None
i += 1
continue
pair = w[i:i + 2]
if pair in LIG:
total += LIG[pair]
prev = None
i += 2
continue
g = w[i]
total += glyph(g)
if prev is not None:
total += KERN.get(prev + g, 0)
prev = g
i += 1
return total
def line_width(ws):
return sum(measure(t) for t in ws) + SPACE * len(ws)
lines, cur = [], []
for w in words:
cand = cur + [w]
if not cur or line_width(cand) <= width:
cur = cand
else:
lines.append(cur)
cur = [w]
if cur:
lines.append(cur)
return [[' '.join(t.replace('|', '') for t in ln), line_width(ln)] for ln in lines]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('cross-word pair must not kern', [['LA', 'Vat'], 200], [['LA Vat', 58]]), ('regression: interword space count', [['av', 'Av', 'Av'], 104], [['av Av Av', 75]]), ('regression: interword space count', [['office', 'wolf|like', 'fl.', 'y.', 'fl.'], 72], [['office', 46], ['wolflike', 62], ['fl. y. fl.', 52]]), ('regression: interword space count', [['staff.', 'Av', 'Av', 'Av', 'LT'], 91], [['staff. Av', 70], ['Av Av LT', 79]]), ('case-sensitive pair', [['Av', 'av'], 200], [['Av av', 47]]), ('ligature then period', [['fl.', 'fi,'], 200], [['fl. fi,', 35]]), ('regression: interword space count', [['fly.', 'Yo'], 126], [['fly. Yo', 49]]), ('regression: interword space count', [['Av', 'av', 'fly.'], 95], [['Av av fly.', 75]])], [('regression: interword space count', [['flow', 'fly.', 'Wavy', 'Ta', 'fly.', 'Vat'], 120], [['flow fly. Wavy', 113], ['Ta fly. Vat', 81]]), ('regression: interword space count', [['staff.', 'LA|VALLE', 'Av', 'Yo'], 106], [['staff.', 42], ['LAVALLE', 88], ['Av Yo', 49]]), ('regression: interword space count', [['Av', 'LA', 'Tofu', 'y.'], 125], [['Av LA Tofu y.', 113]]), ('regression: interword space count', [['fi', 'fi', 'AVAIL', 'Tofu'], 58], [['fi fi', 27], ['AVAIL', 59], ['Tofu', 37]]), ('cross-word pair must not kern', [['LA', 'Vat'], 200], [['LA Vat', 58]]), ('non-joiner blocks ligature', [['shelf|life'], 200], [['shelflife', 64]]), ('regression: interword space count', [['wolf|like', 'our', 'wolf|like', 'Yo', 'fly.', 'Tofu'], 41], [['wolflike', 62], ['our', 30], ['wolflike', 62], ['Yo', 21], ['fly.', 23], ['Tofu', 37]]), ('regression: interword space count', [['AT', 'staff.', 'raffle', 'fly.'], 77], [['AT staff.', 73], ['raffle fly.', 74]])], [('regression: interword space count', [['office', 'LT', 'VIA', 'Av', 'dry.'], 77], [['office LT', 74], ['VIA Av', 67], ['dry.', 32]]), ('regression: interword space count', [['Yo', 'AVAIL', 'flow'], 53], [['Yo', 21], ['AVAIL', 59], ['flow', 35]]), ('regression: interword space count', [['fi', 'Vat'], 42], [['fi', 11], ['Vat', 27]]), ('regression: interword space count', [['dry.', 'y.', 'Tofu', 'av', 'av', 'LA', 'Vat'], 46], [['dry.', 32], ['y.', 12], ['Tofu', 37], ['av av', 43], ['LA', 26], ['Vat', 27]]), ('ligature then period', [['fl.', 'fi,'], 200], [['fl. fi,', 35]]), ('non-joiner blocks ligature', [['shelf|life'], 200], [['shelflife', 64]]), ('regression: interword space count', [['Ta', 'fi', 'LA|VALLE', 'shelf|life', 'y.', 'Wavy'], 47], [['Ta fi', 37], ['LAVALLE', 88], ['shelflife', 64], ['y.', 12], ['Wavy', 45]]), ('regression: interword space count', [['LT', 'wolf|like'], 126], [['LT wolflike', 90]])], [('regression: interword space count', [['staff.', 'AVAIL', 'LA', 'LA|VALLE'], 42], [['staff.', 42], ['AVAIL', 59], ['LA', 26], ['LAVALLE', 88]]), ('regression: interword space count', [['Tofu', 'fi'], 74], [['Tofu fi', 53]]), ('regression: interword space count', [['LT', 'y.', 'flow', 'dry.'], 58], [['LT y.', 40], ['flow', 35], ['dry.', 32]]), ('regression: interword space count', [['fly.', 'Ta', 'fl.'], 68], [['fly. Ta', 49], ['fl.', 15]]), ('ligature then period', [['fl.', 'fi,'], 200], [['fl. fi,', 35]]), ('cross-word pair must not kern', [['LA', 'Vat'], 200], [['LA Vat', 58]]), ('regression: interword space count', [['Av', 'LA', 'Av', 'LA', 'Av', 'wolf|like'], 128], [['Av LA Av LA', 113], ['Av wolflike', 90]]), ('regression: interword space count', [['Tofu', 'Ta', 'staff.', 'LA|VALLE', 'Vat', 'fi', 'LT'], 88], [['Tofu Ta', 63], ['staff.', 42], ['LAVALLE', 88], ['Vat fi LT', 71]])], [('regression: interword space count', [['av', 'dry.', 'LA|VALLE', 'raffle', 'LA|VALLE', 'av'], 82], [['av dry.', 56], ['LAVALLE', 88], ['raffle', 46], ['LAVALLE', 88], ['av', 19]]), ('regression: interword space count', [['fi', 'dry.', 'fly.', 'flow', 'AT', 'Yo'], 68], [['fi dry.', 48], ['fly. flow', 63], ['AT Yo', 52]]), ('regression: interword space count', [['LT', 'Vat', 'office', 'LA', 'dry.', 'dry.', 'dry.'], 122], [['LT Vat office', 106], ['LA dry. dry.', 100], ['dry.', 32]]), ('regression: interword space count', [['LA', 'office', 'fl.', 'VIA', 'LA'], 96], [['LA office', 77], ['fl. VIA LA', 90]]), ('case-sensitive pair', [['Av', 'av'], 200], [['Av av', 47]]), ('non-joiner blocks ligature', [['shelf|life'], 200], [['shelflife', 64]]), ('regression: interword space count', [['staff.', 'y.', 'dry.', 'wolf|like', 'Av'], 136], [['staff. y. dry.', 96], ['wolflike Av', 90]]), ('regression: interword space count', [['our', 'av', 'staff.', 'Av'], 56], [['our av', 54], ['staff.', 42], ['Av', 23]])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| cross-word pair must not kern | [['LA Vat', 63]] | [['LA Vat', 58]] | Failed |
| regression: interword space count | [['av Av Av', 80]] | [['av Av Av', 75]] | Failed |
| regression: interword space count | [['office', 51], ['wolflike', 67], ['fl. y. fl.', 57]] | [['office', 46], ['wolflike', 62], ['fl. y. fl.', 52]] | Failed |
| regression: interword space count | [['staff. Av', 75], ['Av Av LT', 84]] | [['staff. Av', 70], ['Av Av LT', 79]] | Failed |
| case-sensitive pair | [['Av av', 52]] | [['Av av', 47]] | Failed |
| ligature then period | [['fl. fi,', 40]] | [['fl. fi,', 35]] | Failed |
| regression: interword space count | [['fly. Yo', 54]] | [['fly. Yo', 49]] | Failed |
| regression: interword space count | [['Av av fly.', 80]] | [['Av av fly.', 75]] | Failed |
SHA-256 / 1e4f97526e7e8af7569126ea7c7afe77fe06db4bf4ccfc5c416e54893cd794e7
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, width = x
W = {'i': 4, 'l': 4, 'j': 4, '.': 4, ',': 4, 't': 6, 'f': 6, 'm': 15, 'w': 14, 'M': 16, 'W': 18}
LIG = {'fi': 11, 'fl': 11, 'ff': 12}
KERN = {'AV': -3, 'VA': -3, 'To': -2, 'Ta': -2, 'Yo': -2, 'LT': -3, 'Wa': -2, 'av': -1, 'va': -1, 'y.': -2, 'r.': -2, 'l.': -1, 'f.': -1, 'Va': -2}
SPACE = 5
def glyph(c):
return W.get(c, 13 if c.isupper() else 10)
def measure(w):
total, prev, i = 0, None, 0
while i < len(w):
if w[i] == '|':
prev = None
i += 1
continue
pair = w[i:i + 2]
if pair in LIG:
total += LIG[pair]
prev = None
i += 2
continue
g = w[i]
total += glyph(g)
if prev is not None:
total += KERN.get(prev + g, 0)
prev = g
i += 1
return total
def line_width(ws):
return sum(measure(t) for t in ws) + SPACE * max(len(ws) - 2, 0)
lines, cur = [], []
for w in words:
cand = cur + [w]
if not cur or line_width(cand) <= width:
cur = cand
else:
lines.append(cur)
cur = [w]
if cur:
lines.append(cur)
return [[' '.join(t.replace('|', '') for t in ln), line_width(ln)] for ln in lines]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('cross-word pair must not kern', [['LA', 'Vat'], 200], [['LA Vat', 58]]), ('regression: interword space count', [['av', 'Av', 'Av'], 104], [['av Av Av', 75]]), ('regression: interword space count', [['office', 'wolf|like', 'fl.', 'y.', 'fl.'], 72], [['office', 46], ['wolflike', 62], ['fl. y. fl.', 52]]), ('regression: interword space count', [['staff.', 'Av', 'Av', 'Av', 'LT'], 91], [['staff. Av', 70], ['Av Av LT', 79]]), ('case-sensitive pair', [['Av', 'av'], 200], [['Av av', 47]]), ('ligature then period', [['fl.', 'fi,'], 200], [['fl. fi,', 35]]), ('regression: interword space count', [['fly.', 'Yo'], 126], [['fly. Yo', 49]]), ('regression: interword space count', [['Av', 'av', 'fly.'], 95], [['Av av fly.', 75]])], [('regression: interword space count', [['flow', 'fly.', 'Wavy', 'Ta', 'fly.', 'Vat'], 120], [['flow fly. Wavy', 113], ['Ta fly. Vat', 81]]), ('regression: interword space count', [['staff.', 'LA|VALLE', 'Av', 'Yo'], 106], [['staff.', 42], ['LAVALLE', 88], ['Av Yo', 49]]), ('regression: interword space count', [['Av', 'LA', 'Tofu', 'y.'], 125], [['Av LA Tofu y.', 113]]), ('regression: interword space count', [['fi', 'fi', 'AVAIL', 'Tofu'], 58], [['fi fi', 27], ['AVAIL', 59], ['Tofu', 37]]), ('cross-word pair must not kern', [['LA', 'Vat'], 200], [['LA Vat', 58]]), ('non-joiner blocks ligature', [['shelf|life'], 200], [['shelflife', 64]]), ('regression: interword space count', [['wolf|like', 'our', 'wolf|like', 'Yo', 'fly.', 'Tofu'], 41], [['wolflike', 62], ['our', 30], ['wolflike', 62], ['Yo', 21], ['fly.', 23], ['Tofu', 37]]), ('regression: interword space count', [['AT', 'staff.', 'raffle', 'fly.'], 77], [['AT staff.', 73], ['raffle fly.', 74]])], [('regression: interword space count', [['office', 'LT', 'VIA', 'Av', 'dry.'], 77], [['office LT', 74], ['VIA Av', 67], ['dry.', 32]]), ('regression: interword space count', [['Yo', 'AVAIL', 'flow'], 53], [['Yo', 21], ['AVAIL', 59], ['flow', 35]]), ('regression: interword space count', [['fi', 'Vat'], 42], [['fi', 11], ['Vat', 27]]), ('regression: interword space count', [['dry.', 'y.', 'Tofu', 'av', 'av', 'LA', 'Vat'], 46], [['dry.', 32], ['y.', 12], ['Tofu', 37], ['av av', 43], ['LA', 26], ['Vat', 27]]), ('ligature then period', [['fl.', 'fi,'], 200], [['fl. fi,', 35]]), ('non-joiner blocks ligature', [['shelf|life'], 200], [['shelflife', 64]]), ('regression: interword space count', [['Ta', 'fi', 'LA|VALLE', 'shelf|life', 'y.', 'Wavy'], 47], [['Ta fi', 37], ['LAVALLE', 88], ['shelflife', 64], ['y.', 12], ['Wavy', 45]]), ('regression: interword space count', [['LT', 'wolf|like'], 126], [['LT wolflike', 90]])], [('regression: interword space count', [['staff.', 'AVAIL', 'LA', 'LA|VALLE'], 42], [['staff.', 42], ['AVAIL', 59], ['LA', 26], ['LAVALLE', 88]]), ('regression: interword space count', [['Tofu', 'fi'], 74], [['Tofu fi', 53]]), ('regression: interword space count', [['LT', 'y.', 'flow', 'dry.'], 58], [['LT y.', 40], ['flow', 35], ['dry.', 32]]), ('regression: interword space count', [['fly.', 'Ta', 'fl.'], 68], [['fly. Ta', 49], ['fl.', 15]]), ('ligature then period', [['fl.', 'fi,'], 200], [['fl. fi,', 35]]), ('cross-word pair must not kern', [['LA', 'Vat'], 200], [['LA Vat', 58]]), ('regression: interword space count', [['Av', 'LA', 'Av', 'LA', 'Av', 'wolf|like'], 128], [['Av LA Av LA', 113], ['Av wolflike', 90]]), ('regression: interword space count', [['Tofu', 'Ta', 'staff.', 'LA|VALLE', 'Vat', 'fi', 'LT'], 88], [['Tofu Ta', 63], ['staff.', 42], ['LAVALLE', 88], ['Vat fi LT', 71]])], [('regression: interword space count', [['av', 'dry.', 'LA|VALLE', 'raffle', 'LA|VALLE', 'av'], 82], [['av dry.', 56], ['LAVALLE', 88], ['raffle', 46], ['LAVALLE', 88], ['av', 19]]), ('regression: interword space count', [['fi', 'dry.', 'fly.', 'flow', 'AT', 'Yo'], 68], [['fi dry.', 48], ['fly. flow', 63], ['AT Yo', 52]]), ('regression: interword space count', [['LT', 'Vat', 'office', 'LA', 'dry.', 'dry.', 'dry.'], 122], [['LT Vat office', 106], ['LA dry. dry.', 100], ['dry.', 32]]), ('regression: interword space count', [['LA', 'office', 'fl.', 'VIA', 'LA'], 96], [['LA office', 77], ['fl. VIA LA', 90]]), ('case-sensitive pair', [['Av', 'av'], 200], [['Av av', 47]]), ('non-joiner blocks ligature', [['shelf|life'], 200], [['shelflife', 64]]), ('regression: interword space count', [['staff.', 'y.', 'dry.', 'wolf|like', 'Av'], 136], [['staff. y. dry.', 96], ['wolflike Av', 90]]), ('regression: interword space count', [['our', 'av', 'staff.', 'Av'], 56], [['our av', 54], ['staff.', 42], ['Av', 23]])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| cross-word pair must not kern | [['LA Vat', 53]] | [['LA Vat', 58]] | Failed |
| regression: interword space count | [['av Av Av', 70]] | [['av Av Av', 75]] | Failed |
| regression: interword space count | [['office', 46], ['wolflike', 62], ['fl. y. fl.', 47]] | [['office', 46], ['wolflike', 62], ['fl. y. fl.', 52]] | Failed |
| regression: interword space count | [['staff. Av', 65], ['Av Av LT', 74]] | [['staff. Av', 70], ['Av Av LT', 79]] | Failed |
| case-sensitive pair | [['Av av', 42]] | [['Av av', 47]] | Failed |
| ligature then period | [['fl. fi,', 30]] | [['fl. fi,', 35]] | Failed |
| regression: interword space count | [['fly. Yo', 44]] | [['fly. Yo', 49]] | Failed |
| regression: interword space count | [['Av av fly.', 70]] | [['Av av fly.', 75]] | Failed |
SHA-256 / 4052ce24748137c132e7569ba2ec7c4ed234341e6bf4ec08f542cce7e04d5a44
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, width = x
W = {'i': 4, 'l': 4, 'j': 4, '.': 4, ',': 4, 't': 6, 'f': 6, 'm': 15, 'w': 14, 'M': 16, 'W': 18}
LIG = {'fi': 11, 'fl': 11, 'ff': 12}
KERN = {'AV': -3, 'VA': -3, 'To': -2, 'Ta': -2, 'Yo': -2, 'LT': -3, 'Wa': -2, 'av': -1, 'va': -1, 'y.': -2, 'r.': -2, 'l.': -1, 'f.': -1, 'Va': -2}
SPACE = 5
def glyph(c):
return W.get(c, 13 if c.isupper() else 10)
def measure(w):
total, prev, i = 0, None, 0
while i < len(w):
if w[i] == '|':
prev = None
i += 1
continue
pair = w[i:i + 2]
if pair in LIG:
total += LIG[pair]
prev = None
i += 2
continue
g = w[i]
total += glyph(g)
if prev is not None:
total += KERN.get(prev + g, 0)
prev = g
i += 1
return total
def line_width(ws):
return sum(measure(t) for t in ws) + SPACE * (len(ws) - 1)
lines, cur = [], []
for w in words:
cand = cur + [w]
if not cur or line_width(cand) <= width:
cur = cand
else:
lines.append(cur)
cur = [w]
if cur:
lines.append(cur)
return [[' '.join(t.replace('|', '') for t in ln), line_width(ln)] for ln in lines]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('cross-word pair must not kern', [['LA', 'Vat'], 200], [['LA Vat', 58]]), ('regression: interword space count', [['av', 'Av', 'Av'], 104], [['av Av Av', 75]]), ('regression: interword space count', [['office', 'wolf|like', 'fl.', 'y.', 'fl.'], 72], [['office', 46], ['wolflike', 62], ['fl. y. fl.', 52]]), ('regression: interword space count', [['staff.', 'Av', 'Av', 'Av', 'LT'], 91], [['staff. Av', 70], ['Av Av LT', 79]]), ('case-sensitive pair', [['Av', 'av'], 200], [['Av av', 47]]), ('ligature then period', [['fl.', 'fi,'], 200], [['fl. fi,', 35]]), ('regression: interword space count', [['fly.', 'Yo'], 126], [['fly. Yo', 49]]), ('regression: interword space count', [['Av', 'av', 'fly.'], 95], [['Av av fly.', 75]])], [('regression: interword space count', [['flow', 'fly.', 'Wavy', 'Ta', 'fly.', 'Vat'], 120], [['flow fly. Wavy', 113], ['Ta fly. Vat', 81]]), ('regression: interword space count', [['staff.', 'LA|VALLE', 'Av', 'Yo'], 106], [['staff.', 42], ['LAVALLE', 88], ['Av Yo', 49]]), ('regression: interword space count', [['Av', 'LA', 'Tofu', 'y.'], 125], [['Av LA Tofu y.', 113]]), ('regression: interword space count', [['fi', 'fi', 'AVAIL', 'Tofu'], 58], [['fi fi', 27], ['AVAIL', 59], ['Tofu', 37]]), ('cross-word pair must not kern', [['LA', 'Vat'], 200], [['LA Vat', 58]]), ('non-joiner blocks ligature', [['shelf|life'], 200], [['shelflife', 64]]), ('regression: interword space count', [['wolf|like', 'our', 'wolf|like', 'Yo', 'fly.', 'Tofu'], 41], [['wolflike', 62], ['our', 30], ['wolflike', 62], ['Yo', 21], ['fly.', 23], ['Tofu', 37]]), ('regression: interword space count', [['AT', 'staff.', 'raffle', 'fly.'], 77], [['AT staff.', 73], ['raffle fly.', 74]])], [('regression: interword space count', [['office', 'LT', 'VIA', 'Av', 'dry.'], 77], [['office LT', 74], ['VIA Av', 67], ['dry.', 32]]), ('regression: interword space count', [['Yo', 'AVAIL', 'flow'], 53], [['Yo', 21], ['AVAIL', 59], ['flow', 35]]), ('regression: interword space count', [['fi', 'Vat'], 42], [['fi', 11], ['Vat', 27]]), ('regression: interword space count', [['dry.', 'y.', 'Tofu', 'av', 'av', 'LA', 'Vat'], 46], [['dry.', 32], ['y.', 12], ['Tofu', 37], ['av av', 43], ['LA', 26], ['Vat', 27]]), ('ligature then period', [['fl.', 'fi,'], 200], [['fl. fi,', 35]]), ('non-joiner blocks ligature', [['shelf|life'], 200], [['shelflife', 64]]), ('regression: interword space count', [['Ta', 'fi', 'LA|VALLE', 'shelf|life', 'y.', 'Wavy'], 47], [['Ta fi', 37], ['LAVALLE', 88], ['shelflife', 64], ['y.', 12], ['Wavy', 45]]), ('regression: interword space count', [['LT', 'wolf|like'], 126], [['LT wolflike', 90]])], [('regression: interword space count', [['staff.', 'AVAIL', 'LA', 'LA|VALLE'], 42], [['staff.', 42], ['AVAIL', 59], ['LA', 26], ['LAVALLE', 88]]), ('regression: interword space count', [['Tofu', 'fi'], 74], [['Tofu fi', 53]]), ('regression: interword space count', [['LT', 'y.', 'flow', 'dry.'], 58], [['LT y.', 40], ['flow', 35], ['dry.', 32]]), ('regression: interword space count', [['fly.', 'Ta', 'fl.'], 68], [['fly. Ta', 49], ['fl.', 15]]), ('ligature then period', [['fl.', 'fi,'], 200], [['fl. fi,', 35]]), ('cross-word pair must not kern', [['LA', 'Vat'], 200], [['LA Vat', 58]]), ('regression: interword space count', [['Av', 'LA', 'Av', 'LA', 'Av', 'wolf|like'], 128], [['Av LA Av LA', 113], ['Av wolflike', 90]]), ('regression: interword space count', [['Tofu', 'Ta', 'staff.', 'LA|VALLE', 'Vat', 'fi', 'LT'], 88], [['Tofu Ta', 63], ['staff.', 42], ['LAVALLE', 88], ['Vat fi LT', 71]])], [('regression: interword space count', [['av', 'dry.', 'LA|VALLE', 'raffle', 'LA|VALLE', 'av'], 82], [['av dry.', 56], ['LAVALLE', 88], ['raffle', 46], ['LAVALLE', 88], ['av', 19]]), ('regression: interword space count', [['fi', 'dry.', 'fly.', 'flow', 'AT', 'Yo'], 68], [['fi dry.', 48], ['fly. flow', 63], ['AT Yo', 52]]), ('regression: interword space count', [['LT', 'Vat', 'office', 'LA', 'dry.', 'dry.', 'dry.'], 122], [['LT Vat office', 106], ['LA dry. dry.', 100], ['dry.', 32]]), ('regression: interword space count', [['LA', 'office', 'fl.', 'VIA', 'LA'], 96], [['LA office', 77], ['fl. VIA LA', 90]]), ('case-sensitive pair', [['Av', 'av'], 200], [['Av av', 47]]), ('non-joiner blocks ligature', [['shelf|life'], 200], [['shelflife', 64]]), ('regression: interword space count', [['staff.', 'y.', 'dry.', 'wolf|like', 'Av'], 136], [['staff. y. dry.', 96], ['wolflike Av', 90]]), ('regression: interword space count', [['our', 'av', 'staff.', 'Av'], 56], [['our av', 54], ['staff.', 42], ['Av', 23]])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| cross-word pair must not kern | [['LA Vat', 58]] | [['LA Vat', 58]] | Passed |
| regression: interword space count | [['av Av Av', 75]] | [['av Av Av', 75]] | Passed |
| regression: interword space count | [['office', 46], ['wolflike', 62], ['fl. y. fl.', 52]] | [['office', 46], ['wolflike', 62], ['fl. y. fl.', 52]] | Passed |
| regression: interword space count | [['staff. Av', 70], ['Av Av LT', 79]] | [['staff. Av', 70], ['Av Av LT', 79]] | Passed |
| case-sensitive pair | [['Av av', 47]] | [['Av av', 47]] | Passed |
| ligature then period | [['fl. fi,', 35]] | [['fl. fi,', 35]] | Passed |
| regression: interword space count | [['fly. Yo', 49]] | [['fly. Yo', 49]] | Passed |
| regression: interword space count | [['Av av fly.', 75]] | [['Av av fly.', 75]] | Passed |
SHA-256 / 0411e96faffea14d3468660e0874445a2e51b5c5539953d0e77948c7fd739f4a
Verification & scope
A deterministic toy typesetting model with integer widths and a stipulated rule set; it does not claim conformance to any engine. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:49:51.508686+00:00.
Case digest / 9879b381dd5cb7f29858378122b6257ecb2345541beee6f063ea4e68c022a32c