FA-80121 / Typography line breaking / Open access
Drop cap shaped paragraph: overwide word placement · case 01
Empty lines are emitted before words wider than the shaped measure.
ROOT CAUSE
Only fitting words may start a line, so an overwide word first flushes an empty line.
VERIFIED REPAIR
Place an overwide word alone on an empty line.
Unsuccessful approach: Allowing overflow only on the first line still emits empty later lines.
Case contract
Input [word widths, width, cap lines, cap width, gap, indent]. With a drop cap its first letter moves into the cap (first word loses one unit) and the first cap-lines lines are narrowed by cap width + gap; the first-line indent applies only without a cap. Greedy fill with unit spaces; a word too wide for an empty line is set alone. Return [[words on line, used 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, cap_lines, cap_width, gap, indent = x
lens = list(words)
if cap_lines > 0:
lens[0] = lens[0] - 1
def avail(li):
base = width
if li < cap_lines:
base -= cap_width + gap
elif cap_lines == 0 and li == 0:
base -= indent
return base
lines = []
cur = []
used = 0
for w in lens:
li = len(lines)
need = w if not cur else used + 1 + w
if need <= avail(li):
cur.append(w)
used = need
else:
lines.append([len(cur), used])
cur = [w]
used = w
if cur:
lines.append([len(cur), used])
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('partial-repair probe', [[6, 6, 2, 2, 1], 12, 3, 5, 1, 3], [[1, 5], [1, 6], [2, 5], [1, 1]]), ('partial-repair probe', [[2, 2, 3, 7, 1, 1, 4, 6, 2, 2], 22, 0, 3, 1, 1], [[6, 21], [4, 17]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[5, 5, 3, 1], 24, 0, 5, 1, 4], [[4, 17]]), ('control layout', [[1, 6, 1, 5], 22, 0, 3, 2, 1], [[4, 16]])], [('regression: overwide word placement', [[8, 7, 4, 7, 5, 3, 4], 12, 2, 4, 2, 4], [[1, 7], [1, 7], [2, 12], [2, 9], [1, 4]]), ('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('partial-repair probe', [[6, 6, 4, 3, 1, 1, 6, 2, 3], 21, 3, 3, 1, 2], [[3, 17], [5, 17], [1, 3]]), ('partial-repair probe', [[2, 3, 3, 8, 8, 2, 7, 8, 7, 6, 1], 15, 0, 2, 1, 1], [[3, 10], [1, 8], [2, 11], [1, 7], [1, 8], [2, 14], [1, 1]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('control layout', [[7, 3, 6, 1], 23, 0, 4, 1, 1], [[4, 20]]), ('control layout', [[3, 2, 3, 6, 1], 22, 0, 4, 1, 3], [[5, 19]])], [('regression: overwide word placement', [[8, 7, 4, 7, 5, 3, 4], 12, 2, 4, 2, 4], [[1, 7], [1, 7], [2, 12], [2, 9], [1, 4]]), ('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('partial-repair probe', [[2, 2, 2, 3, 8, 4, 3, 5, 4, 4], 15, 0, 2, 1, 2], [[4, 12], [2, 13], [3, 14], [1, 4]]), ('partial-repair probe', [[2, 2, 3, 7, 3, 4], 13, 2, 4, 1, 4], [[3, 8], [1, 7], [2, 8]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[6, 5, 1, 3], 24, 2, 5, 1, 4], [[4, 17]]), ('control layout', [[4, 1, 2, 2, 2, 1], 21, 0, 5, 2, 3], [[6, 17]])], [('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('partial-repair probe', [[7, 5, 7, 4, 5, 4, 7], 14, 2, 4, 2, 2], [[1, 6], [1, 5], [2, 12], [2, 10], [1, 7]]), ('partial-repair probe', [[3, 6, 7, 8, 3, 7], 14, 3, 2, 2, 1], [[2, 9], [1, 7], [1, 8], [2, 11]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[3, 1, 1, 3, 4], 18, 0, 3, 1, 2], [[5, 16]]), ('control layout', [[5, 5, 3, 1], 24, 0, 5, 1, 4], [[4, 17]])], [('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('partial-repair probe', [[6, 2, 7, 1, 8, 8], 17, 0, 5, 2, 1], [[2, 9], [2, 9], [2, 17]]), ('partial-repair probe', [[8, 3, 1, 2, 7, 3, 4, 3, 4, 5], 15, 0, 2, 1, 1], [[3, 14], [3, 14], [3, 13], [1, 5]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[1, 4, 6, 3], 21, 0, 5, 1, 2], [[4, 17]]), ('control layout', [[8, 4, 1, 2, 1], 23, 0, 3, 1, 1], [[5, 20]])]]
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 |
|---|---|---|---|
| regression: overwide word placement | [[0, 0], [1, 7], [1, 7], [2, 12], [1, 8], [2, 10], [1, 4]] | [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]] | Failed |
| regression: overwide word placement | [[0, 0], [1, 7], [2, 3], [2, 12]] | [[1, 7], [2, 3], [1, 8], [1, 3]] | Failed |
| partial-repair probe | [[1, 5], [1, 6], [2, 5], [1, 1]] | [[1, 5], [1, 6], [2, 5], [1, 1]] | Passed |
| partial-repair probe | [[6, 21], [4, 17]] | [[6, 21], [4, 17]] | Passed |
| three-line drop cap | [[2, 8], [1, 4], [2, 9], [3, 14]] | [[2, 8], [1, 4], [2, 9], [3, 14]] | Passed |
| no cap uses indent | [[2, 9], [2, 11], [1, 2]] | [[2, 9], [2, 11], [1, 2]] | Passed |
| control layout | [[4, 17]] | [[4, 17]] | Passed |
| control layout | [[4, 16]] | [[4, 16]] | Passed |
SHA-256 / 3517d879f2e02f741673166fe8073dbe4cc3aa95dfcc39aa19d7d6146e99717c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, width, cap_lines, cap_width, gap, indent = x
lens = list(words)
if cap_lines > 0:
lens[0] = lens[0] - 1
def avail(li):
base = width
if li < cap_lines:
base -= cap_width + gap
elif cap_lines == 0 and li == 0:
base -= indent
return base
lines = []
cur = []
used = 0
for w in lens:
li = len(lines)
need = w if not cur else used + 1 + w
if need <= avail(li) or len(lines) == 0:
cur.append(w)
used = need
else:
lines.append([len(cur), used])
cur = [w]
used = w
if cur:
lines.append([len(cur), used])
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('partial-repair probe', [[6, 6, 2, 2, 1], 12, 3, 5, 1, 3], [[1, 5], [1, 6], [2, 5], [1, 1]]), ('partial-repair probe', [[2, 2, 3, 7, 1, 1, 4, 6, 2, 2], 22, 0, 3, 1, 1], [[6, 21], [4, 17]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[5, 5, 3, 1], 24, 0, 5, 1, 4], [[4, 17]]), ('control layout', [[1, 6, 1, 5], 22, 0, 3, 2, 1], [[4, 16]])], [('regression: overwide word placement', [[8, 7, 4, 7, 5, 3, 4], 12, 2, 4, 2, 4], [[1, 7], [1, 7], [2, 12], [2, 9], [1, 4]]), ('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('partial-repair probe', [[6, 6, 4, 3, 1, 1, 6, 2, 3], 21, 3, 3, 1, 2], [[3, 17], [5, 17], [1, 3]]), ('partial-repair probe', [[2, 3, 3, 8, 8, 2, 7, 8, 7, 6, 1], 15, 0, 2, 1, 1], [[3, 10], [1, 8], [2, 11], [1, 7], [1, 8], [2, 14], [1, 1]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('control layout', [[7, 3, 6, 1], 23, 0, 4, 1, 1], [[4, 20]]), ('control layout', [[3, 2, 3, 6, 1], 22, 0, 4, 1, 3], [[5, 19]])], [('regression: overwide word placement', [[8, 7, 4, 7, 5, 3, 4], 12, 2, 4, 2, 4], [[1, 7], [1, 7], [2, 12], [2, 9], [1, 4]]), ('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('partial-repair probe', [[2, 2, 2, 3, 8, 4, 3, 5, 4, 4], 15, 0, 2, 1, 2], [[4, 12], [2, 13], [3, 14], [1, 4]]), ('partial-repair probe', [[2, 2, 3, 7, 3, 4], 13, 2, 4, 1, 4], [[3, 8], [1, 7], [2, 8]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[6, 5, 1, 3], 24, 2, 5, 1, 4], [[4, 17]]), ('control layout', [[4, 1, 2, 2, 2, 1], 21, 0, 5, 2, 3], [[6, 17]])], [('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('partial-repair probe', [[7, 5, 7, 4, 5, 4, 7], 14, 2, 4, 2, 2], [[1, 6], [1, 5], [2, 12], [2, 10], [1, 7]]), ('partial-repair probe', [[3, 6, 7, 8, 3, 7], 14, 3, 2, 2, 1], [[2, 9], [1, 7], [1, 8], [2, 11]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[3, 1, 1, 3, 4], 18, 0, 3, 1, 2], [[5, 16]]), ('control layout', [[5, 5, 3, 1], 24, 0, 5, 1, 4], [[4, 17]])], [('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('partial-repair probe', [[6, 2, 7, 1, 8, 8], 17, 0, 5, 2, 1], [[2, 9], [2, 9], [2, 17]]), ('partial-repair probe', [[8, 3, 1, 2, 7, 3, 4, 3, 4, 5], 15, 0, 2, 1, 1], [[3, 14], [3, 14], [3, 13], [1, 5]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[1, 4, 6, 3], 21, 0, 5, 1, 2], [[4, 17]]), ('control layout', [[8, 4, 1, 2, 1], 23, 0, 3, 1, 1], [[5, 20]])]]
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 |
|---|---|---|---|
| regression: overwide word placement | [[8, 53]] | [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]] | Failed |
| regression: overwide word placement | [[5, 24]] | [[1, 7], [2, 3], [1, 8], [1, 3]] | Failed |
| partial-repair probe | [[5, 20]] | [[1, 5], [1, 6], [2, 5], [1, 1]] | Failed |
| partial-repair probe | [[10, 39]] | [[6, 21], [4, 17]] | Failed |
| three-line drop cap | [[8, 38]] | [[2, 8], [1, 4], [2, 9], [3, 14]] | Failed |
| no cap uses indent | [[5, 24]] | [[2, 9], [2, 11], [1, 2]] | Failed |
| control layout | [[4, 17]] | [[4, 17]] | Passed |
| control layout | [[4, 16]] | [[4, 16]] | Passed |
SHA-256 / e3636cea0dc83414f3d5eb7ff88c478230461e3da33381732bc81ae73ed6440f
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, width, cap_lines, cap_width, gap, indent = x
lens = list(words)
if cap_lines > 0:
lens[0] = lens[0] - 1
def avail(li):
base = width
if li < cap_lines:
base -= cap_width + gap
elif cap_lines == 0 and li == 0:
base -= indent
return base
lines = []
cur = []
used = 0
for w in lens:
li = len(lines)
need = w if not cur else used + 1 + w
if need <= avail(li) or not cur:
cur.append(w)
used = need
else:
lines.append([len(cur), used])
cur = [w]
used = w
if cur:
lines.append([len(cur), used])
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('partial-repair probe', [[6, 6, 2, 2, 1], 12, 3, 5, 1, 3], [[1, 5], [1, 6], [2, 5], [1, 1]]), ('partial-repair probe', [[2, 2, 3, 7, 1, 1, 4, 6, 2, 2], 22, 0, 3, 1, 1], [[6, 21], [4, 17]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[5, 5, 3, 1], 24, 0, 5, 1, 4], [[4, 17]]), ('control layout', [[1, 6, 1, 5], 22, 0, 3, 2, 1], [[4, 16]])], [('regression: overwide word placement', [[8, 7, 4, 7, 5, 3, 4], 12, 2, 4, 2, 4], [[1, 7], [1, 7], [2, 12], [2, 9], [1, 4]]), ('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('partial-repair probe', [[6, 6, 4, 3, 1, 1, 6, 2, 3], 21, 3, 3, 1, 2], [[3, 17], [5, 17], [1, 3]]), ('partial-repair probe', [[2, 3, 3, 8, 8, 2, 7, 8, 7, 6, 1], 15, 0, 2, 1, 1], [[3, 10], [1, 8], [2, 11], [1, 7], [1, 8], [2, 14], [1, 1]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('control layout', [[7, 3, 6, 1], 23, 0, 4, 1, 1], [[4, 20]]), ('control layout', [[3, 2, 3, 6, 1], 22, 0, 4, 1, 3], [[5, 19]])], [('regression: overwide word placement', [[8, 7, 4, 7, 5, 3, 4], 12, 2, 4, 2, 4], [[1, 7], [1, 7], [2, 12], [2, 9], [1, 4]]), ('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('partial-repair probe', [[2, 2, 2, 3, 8, 4, 3, 5, 4, 4], 15, 0, 2, 1, 2], [[4, 12], [2, 13], [3, 14], [1, 4]]), ('partial-repair probe', [[2, 2, 3, 7, 3, 4], 13, 2, 4, 1, 4], [[3, 8], [1, 7], [2, 8]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[6, 5, 1, 3], 24, 2, 5, 1, 4], [[4, 17]]), ('control layout', [[4, 1, 2, 2, 2, 1], 21, 0, 5, 2, 3], [[6, 17]])], [('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('partial-repair probe', [[7, 5, 7, 4, 5, 4, 7], 14, 2, 4, 2, 2], [[1, 6], [1, 5], [2, 12], [2, 10], [1, 7]]), ('partial-repair probe', [[3, 6, 7, 8, 3, 7], 14, 3, 2, 2, 1], [[2, 9], [1, 7], [1, 8], [2, 11]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[3, 1, 1, 3, 4], 18, 0, 3, 1, 2], [[5, 16]]), ('control layout', [[5, 5, 3, 1], 24, 0, 5, 1, 4], [[4, 17]])], [('regression: overwide word placement', [[8, 1, 1, 8, 3], 12, 3, 4, 2, 2], [[1, 7], [2, 3], [1, 8], [1, 3]]), ('regression: overwide word placement', [[8, 7, 3, 8, 8, 6, 3, 4], 12, 3, 5, 1, 2], [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]]), ('partial-repair probe', [[6, 2, 7, 1, 8, 8], 17, 0, 5, 2, 1], [[2, 9], [2, 9], [2, 17]]), ('partial-repair probe', [[8, 3, 1, 2, 7, 3, 4, 3, 4, 5], 15, 0, 2, 1, 1], [[3, 14], [3, 14], [3, 13], [1, 5]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[1, 4, 6, 3], 21, 0, 5, 1, 2], [[4, 17]]), ('control layout', [[8, 4, 1, 2, 1], 23, 0, 3, 1, 1], [[5, 20]])]]
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 |
|---|---|---|---|
| regression: overwide word placement | [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]] | [[1, 7], [1, 7], [1, 3], [1, 8], [1, 8], [2, 10], [1, 4]] | Passed |
| regression: overwide word placement | [[1, 7], [2, 3], [1, 8], [1, 3]] | [[1, 7], [2, 3], [1, 8], [1, 3]] | Passed |
| partial-repair probe | [[1, 5], [1, 6], [2, 5], [1, 1]] | [[1, 5], [1, 6], [2, 5], [1, 1]] | Passed |
| partial-repair probe | [[6, 21], [4, 17]] | [[6, 21], [4, 17]] | Passed |
| three-line drop cap | [[2, 8], [1, 4], [2, 9], [3, 14]] | [[2, 8], [1, 4], [2, 9], [3, 14]] | Passed |
| no cap uses indent | [[2, 9], [2, 11], [1, 2]] | [[2, 9], [2, 11], [1, 2]] | Passed |
| control layout | [[4, 17]] | [[4, 17]] | Passed |
| control layout | [[4, 16]] | [[4, 16]] | Passed |
SHA-256 / b7afedb1b8af45fb04e613cb8054ba0c0d2eb54df89e473eae5d5c704a6152b5
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:50.954903+00:00.
Case digest / 00d8b64201324d3848c10edc744d4db133c9630f40beaf30f953c87cdfb454e1