Commit bc91d9a
committed
fix(measuring): gate SD-2447 alignment heuristic on default stops only
The SD-2447 heuristic forces the last N tabs to bind to the last N
end/center/decimal stops. It was added because TOC styles often have
ONLY a right-aligned dot-leader stop, and tabStops gets seeded with
synthetic 0.5" defaults from origin (seedDefaultsFromZero=true).
Greedy then lands on a default 0.5" grid stop instead of the alignment
stop — hence the heuristic.
But for paragraphs with an EXPLICIT start-aligned stop ahead of the
alignment stop (TOC1 style with 'start@740, end@9360, end@10080':
template_format and similar Word lease templates), greedy correctly
lands on the start stop and the alignment stop downstream — no force
needed. The heuristic over-fires and binds tab 0 to the right
alignment stop, producing the broken render: leader BEFORE the title
with the page number jammed against it.
Fix: compute greedy first; only apply the heuristic when greedy would
land on a 'source: default' stop. When greedy already lands on an
explicit stop, use it. Mirrored in measuring/dom and remeasure.
Effect:
- template_format TOC: now renders '1. BUSINESS POINTS........1'
matching Word and the published baseline.
- HVY-25 / SD-2447 fixture / sd-1480 line 1: behavior preserved.
- All test suites pass (measuring-dom 332, layout-bridge 1192,
layout-engine 644).1 parent e9eaa04 commit bc91d9a
2 files changed
Lines changed: 24 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
874 | 874 | | |
875 | 875 | | |
876 | 876 | | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
877 | 882 | | |
878 | | - | |
| 883 | + | |
879 | 884 | | |
880 | 885 | | |
881 | 886 | | |
882 | 887 | | |
883 | 888 | | |
884 | 889 | | |
885 | 890 | | |
886 | | - | |
887 | | - | |
888 | | - | |
889 | | - | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
890 | 894 | | |
891 | 895 | | |
892 | 896 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1564 | 1564 | | |
1565 | 1565 | | |
1566 | 1566 | | |
1567 | | - | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
1568 | 1579 | | |
1569 | 1580 | | |
1570 | 1581 | | |
1571 | 1582 | | |
1572 | 1583 | | |
1573 | | - | |
1574 | | - | |
1575 | | - | |
1576 | | - | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
1577 | 1587 | | |
1578 | 1588 | | |
1579 | 1589 | | |
| |||
0 commit comments