FAILURE MAP
← Case archive

FA-80106 / Typography line breaking / Open access

Drop cap shaped paragraph: indent with drop cap · case 01

Paragraphs with a drop cap are also indented.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The first-line indent is applied whenever the line is first, even beside a cap.

THE FAILURE

The first-line indent is applied whenever the line is first, even beside a cap.

Unsuccessful approach: Indenting the first line after the cap is equally wrong.

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
        if 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: indent with drop cap', [[6, 6, 2, 1, 5, 5, 8, 3, 1, 3, 6, 5], 23, 3, 4, 2, 1], [[4, 17], [2, 11], [3, 14], [3, 16]]), ('regression: indent with drop cap', [[1, 8, 1, 7, 3, 7, 6, 2, 3, 1], 14, 3, 2, 2, 3], [[2, 9], [2, 9], [1, 3], [2, 14], [3, 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]]), ('regression: indent with drop cap', [[6, 2, 3, 8, 3, 7, 6, 4, 8, 4, 8, 7], 15, 2, 3, 1, 4], [[2, 8], [1, 3], [2, 12], [2, 14], [2, 13], [2, 13], [1, 7]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[5, 7, 6, 4, 3, 2, 3, 4, 2], 23, 2, 3, 2, 3], [[2, 12], [4, 18], [3, 11]]), ('control layout', [[3, 8, 5, 2, 7, 1, 4, 4, 3, 6], 20, 0, 5, 1, 4], [[2, 12], [4, 18], [4, 20]]), ('control layout', [[8, 5, 4, 4, 3, 7, 8, 8], 23, 3, 2, 1, 1], [[3, 18], [3, 16], [2, 17]])], [('regression: indent with drop cap', [[8, 3, 2, 8, 2, 3, 8, 5], 20, 2, 2, 1, 4], [[3, 14], [3, 15], [2, 14]]), ('regression: indent with drop cap', [[4, 4, 7, 8, 7], 15, 2, 4, 1, 3], [[2, 8], [1, 7], [1, 8], [1, 7]]), ('partial-repair probe', [[3, 7, 7, 8, 3, 3], 12, 3, 3, 2, 2], [[1, 2], [1, 7], [1, 7], [2, 12], [1, 3]]), ('partial-repair probe', [[1, 2, 3, 4, 7, 4, 2, 4, 8, 7, 3], 15, 2, 5, 1, 2], [[3, 7], [1, 4], [3, 15], [2, 13], [2, 11]]), ('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', [[8, 2, 3, 5, 8, 1, 2], 12, 0, 4, 1, 1], [[2, 11], [2, 9], [2, 10], [1, 2]]), ('control layout', [[3, 6, 1, 2, 8, 2, 1], 16, 0, 2, 1, 4], [[3, 12], [4, 16]])], [('regression: indent with drop cap', [[8, 5, 4, 6, 7, 3, 1, 5, 2, 7], 16, 3, 2, 1, 3], [[2, 13], [2, 11], [3, 13], [3, 16]]), ('regression: indent with drop cap', [[2, 8, 8, 2, 6, 1, 5], 17, 3, 4, 1, 3], [[2, 10], [2, 11], [2, 8], [1, 5]]), ('regression: indent with drop cap', [[2, 8, 3, 6, 4, 2, 4, 4, 5], 17, 2, 5, 2, 3], [[2, 10], [2, 10], [4, 17], [1, 5]]), ('partial-repair probe', [[1, 8, 7, 2, 8, 8, 4, 3, 7, 6], 19, 2, 4, 1, 3], [[2, 9], [2, 10], [2, 17], [3, 16], [1, 6]]), ('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, 4, 6, 1, 2, 8, 4, 4], 21, 3, 4, 2, 4], [[2, 11], [3, 11], [2, 13], [1, 4]]), ('control layout', [[5, 2, 8, 7, 8], 17, 3, 5, 2, 3], [[2, 7], [1, 8], [1, 7], [1, 8]])], [('regression: indent with drop cap', [[6, 4, 3, 3, 7, 6, 6], 20, 3, 5, 1, 1], [[3, 14], [2, 11], [2, 13]]), ('regression: indent with drop cap', [[1, 3, 5, 1, 1, 6], 23, 2, 5, 2, 3], [[5, 14], [1, 6]]), ('regression: indent with drop cap', [[2, 5, 2, 5, 1, 5, 4, 7, 8, 7, 3], 15, 2, 4, 2, 4], [[2, 7], [2, 8], [3, 12], [1, 7], [1, 8], [2, 11]]), ('partial-repair probe', [[6, 4, 6, 7, 1, 6, 6, 2, 5], 16, 2, 5, 2, 3], [[1, 5], [1, 4], [3, 16], [3, 16], [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', [[6, 3, 2, 8, 8, 1, 5, 1], 22, 0, 4, 2, 3], [[3, 13], [3, 19], [2, 7]]), ('control layout', [[3, 8, 3, 6, 6, 8, 4], 13, 0, 3, 1, 2], [[1, 3], [2, 12], [2, 13], [2, 13]])], [('regression: indent with drop cap', [[5, 8, 5, 4, 1, 5, 5, 1, 1, 5, 5, 2], 24, 2, 2, 2, 3], [[3, 19], [5, 20], [4, 16]]), ('regression: indent with drop cap', [[1, 2, 7, 6, 5, 2, 3], 17, 3, 5, 1, 3], [[3, 11], [1, 6], [2, 8], [1, 3]]), ('regression: indent with drop cap', [[3, 7, 1, 2, 5, 8, 5, 8, 1, 8], 15, 2, 4, 1, 4], [[2, 10], [3, 10], [2, 14], [2, 10], [1, 8]]), ('partial-repair probe', [[4, 3, 6, 5, 4, 2, 6, 2, 2, 4, 8], 14, 2, 2, 2, 3], [[2, 7], [1, 6], [3, 13], [3, 12], [2, 13]]), ('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', [[6, 5, 1, 7, 6, 2, 8, 8, 1, 3, 5, 5], 15, 0, 4, 2, 4], [[1, 6], [3, 15], [2, 9], [1, 8], [3, 14], [2, 11]]), ('control layout', [[3, 6, 1, 2, 5, 2, 3], 12, 0, 3, 2, 2], [[2, 10], [3, 10], [2, 6]])]]
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 fixtureActualExpectedOutcome
regression: indent with drop cap[[3, 15], [3, 13], [3, 14], [3, 16]][[4, 17], [2, 11], [3, 14], [3, 16]]Failed
regression: indent with drop cap[[1, 0], [2, 10], [1, 7], [2, 11], [3, 13], [1, 1]][[2, 9], [2, 9], [1, 3], [2, 14], [3, 8]]Failed
three-line drop cap[[2, 8], [1, 4], [2, 9], [3, 14]][[2, 8], [1, 4], [2, 9], [3, 14]]Passed
regression: indent with drop cap[[1, 5], [2, 6], [2, 12], [2, 14], [2, 13], [2, 13], [1, 7]][[2, 8], [1, 3], [2, 12], [2, 14], [2, 13], [2, 13], [1, 7]]Failed
no cap uses indent[[2, 9], [2, 11], [1, 2]][[2, 9], [2, 11], [1, 2]]Passed
control layout[[2, 12], [4, 18], [3, 11]][[2, 12], [4, 18], [3, 11]]Passed
control layout[[2, 12], [4, 18], [4, 20]][[2, 12], [4, 18], [4, 20]]Passed
control layout[[3, 18], [3, 16], [2, 17]][[3, 18], [3, 16], [2, 17]]Passed

SHA-256 / fbd7b7f90c54128c749ff6880c5e64a09282323ed34f5b250d6287b6c0a83f2b

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 li == cap_lines:
            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: indent with drop cap', [[6, 6, 2, 1, 5, 5, 8, 3, 1, 3, 6, 5], 23, 3, 4, 2, 1], [[4, 17], [2, 11], [3, 14], [3, 16]]), ('regression: indent with drop cap', [[1, 8, 1, 7, 3, 7, 6, 2, 3, 1], 14, 3, 2, 2, 3], [[2, 9], [2, 9], [1, 3], [2, 14], [3, 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]]), ('regression: indent with drop cap', [[6, 2, 3, 8, 3, 7, 6, 4, 8, 4, 8, 7], 15, 2, 3, 1, 4], [[2, 8], [1, 3], [2, 12], [2, 14], [2, 13], [2, 13], [1, 7]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[5, 7, 6, 4, 3, 2, 3, 4, 2], 23, 2, 3, 2, 3], [[2, 12], [4, 18], [3, 11]]), ('control layout', [[3, 8, 5, 2, 7, 1, 4, 4, 3, 6], 20, 0, 5, 1, 4], [[2, 12], [4, 18], [4, 20]]), ('control layout', [[8, 5, 4, 4, 3, 7, 8, 8], 23, 3, 2, 1, 1], [[3, 18], [3, 16], [2, 17]])], [('regression: indent with drop cap', [[8, 3, 2, 8, 2, 3, 8, 5], 20, 2, 2, 1, 4], [[3, 14], [3, 15], [2, 14]]), ('regression: indent with drop cap', [[4, 4, 7, 8, 7], 15, 2, 4, 1, 3], [[2, 8], [1, 7], [1, 8], [1, 7]]), ('partial-repair probe', [[3, 7, 7, 8, 3, 3], 12, 3, 3, 2, 2], [[1, 2], [1, 7], [1, 7], [2, 12], [1, 3]]), ('partial-repair probe', [[1, 2, 3, 4, 7, 4, 2, 4, 8, 7, 3], 15, 2, 5, 1, 2], [[3, 7], [1, 4], [3, 15], [2, 13], [2, 11]]), ('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', [[8, 2, 3, 5, 8, 1, 2], 12, 0, 4, 1, 1], [[2, 11], [2, 9], [2, 10], [1, 2]]), ('control layout', [[3, 6, 1, 2, 8, 2, 1], 16, 0, 2, 1, 4], [[3, 12], [4, 16]])], [('regression: indent with drop cap', [[8, 5, 4, 6, 7, 3, 1, 5, 2, 7], 16, 3, 2, 1, 3], [[2, 13], [2, 11], [3, 13], [3, 16]]), ('regression: indent with drop cap', [[2, 8, 8, 2, 6, 1, 5], 17, 3, 4, 1, 3], [[2, 10], [2, 11], [2, 8], [1, 5]]), ('regression: indent with drop cap', [[2, 8, 3, 6, 4, 2, 4, 4, 5], 17, 2, 5, 2, 3], [[2, 10], [2, 10], [4, 17], [1, 5]]), ('partial-repair probe', [[1, 8, 7, 2, 8, 8, 4, 3, 7, 6], 19, 2, 4, 1, 3], [[2, 9], [2, 10], [2, 17], [3, 16], [1, 6]]), ('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, 4, 6, 1, 2, 8, 4, 4], 21, 3, 4, 2, 4], [[2, 11], [3, 11], [2, 13], [1, 4]]), ('control layout', [[5, 2, 8, 7, 8], 17, 3, 5, 2, 3], [[2, 7], [1, 8], [1, 7], [1, 8]])], [('regression: indent with drop cap', [[6, 4, 3, 3, 7, 6, 6], 20, 3, 5, 1, 1], [[3, 14], [2, 11], [2, 13]]), ('regression: indent with drop cap', [[1, 3, 5, 1, 1, 6], 23, 2, 5, 2, 3], [[5, 14], [1, 6]]), ('regression: indent with drop cap', [[2, 5, 2, 5, 1, 5, 4, 7, 8, 7, 3], 15, 2, 4, 2, 4], [[2, 7], [2, 8], [3, 12], [1, 7], [1, 8], [2, 11]]), ('partial-repair probe', [[6, 4, 6, 7, 1, 6, 6, 2, 5], 16, 2, 5, 2, 3], [[1, 5], [1, 4], [3, 16], [3, 16], [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', [[6, 3, 2, 8, 8, 1, 5, 1], 22, 0, 4, 2, 3], [[3, 13], [3, 19], [2, 7]]), ('control layout', [[3, 8, 3, 6, 6, 8, 4], 13, 0, 3, 1, 2], [[1, 3], [2, 12], [2, 13], [2, 13]])], [('regression: indent with drop cap', [[5, 8, 5, 4, 1, 5, 5, 1, 1, 5, 5, 2], 24, 2, 2, 2, 3], [[3, 19], [5, 20], [4, 16]]), ('regression: indent with drop cap', [[1, 2, 7, 6, 5, 2, 3], 17, 3, 5, 1, 3], [[3, 11], [1, 6], [2, 8], [1, 3]]), ('regression: indent with drop cap', [[3, 7, 1, 2, 5, 8, 5, 8, 1, 8], 15, 2, 4, 1, 4], [[2, 10], [3, 10], [2, 14], [2, 10], [1, 8]]), ('partial-repair probe', [[4, 3, 6, 5, 4, 2, 6, 2, 2, 4, 8], 14, 2, 2, 2, 3], [[2, 7], [1, 6], [3, 13], [3, 12], [2, 13]]), ('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', [[6, 5, 1, 7, 6, 2, 8, 8, 1, 3, 5, 5], 15, 0, 4, 2, 4], [[1, 6], [3, 15], [2, 9], [1, 8], [3, 14], [2, 11]]), ('control layout', [[3, 6, 1, 2, 5, 2, 3], 12, 0, 3, 2, 2], [[2, 10], [3, 10], [2, 6]])]]
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 fixtureActualExpectedOutcome
regression: indent with drop cap[[4, 17], [2, 11], [3, 14], [3, 16]][[4, 17], [2, 11], [3, 14], [3, 16]]Passed
regression: indent with drop cap[[2, 9], [2, 9], [1, 3], [1, 7], [3, 13], [1, 1]][[2, 9], [2, 9], [1, 3], [2, 14], [3, 8]]Failed
three-line drop cap[[2, 8], [1, 4], [2, 9], [2, 10], [1, 3]][[2, 8], [1, 4], [2, 9], [3, 14]]Failed
regression: indent with drop cap[[2, 8], [1, 3], [1, 8], [2, 11], [2, 11], [2, 13], [1, 8], [1, 7]][[2, 8], [1, 3], [2, 12], [2, 14], [2, 13], [2, 13], [1, 7]]Failed
no cap uses indent[[2, 9], [2, 11], [1, 2]][[2, 9], [2, 11], [1, 2]]Passed
control layout[[2, 12], [4, 18], [3, 11]][[2, 12], [4, 18], [3, 11]]Passed
control layout[[2, 12], [4, 18], [4, 20]][[2, 12], [4, 18], [4, 20]]Passed
control layout[[3, 18], [3, 16], [2, 17]][[3, 18], [3, 16], [2, 17]]Passed

SHA-256 / f680174796eb18ce6509c0eb834d06c5d4d629ef7eb7005639e33e010a7f86c6

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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.891465+00:00.

Case digest / db7245a848527e68f17a847814879b7606376c57dbeeb6228948ddfe4bced95e