feat: a footnote is drawn at the foot of its anchor's page

The placement loop moves into placeLeaves(), which takes a per-page note
reservation off each contentEnd; a bounded fixed point re-runs it until the
reservation and the pages its own anchors land on agree. Each break now
carries the leaf offset it applies from, so an anchor below a line split
follows its half of the paragraph. Endnotes stay in flow and open their own
page, as LibreOffice collects them.
This commit is contained in:
Steffen Becker committed 2026-08-13 11:10:00 +00:00
1 parent 0c74fe94b1
commit f07e020f88
2 files changed
+551 -374

No files matched your search

+23 -8
View File
@@ -279,10 +279,13 @@
/* Footnotes and endnotes (notes.ts). Sizes and indents are LibreOffice's own Footnote
style; the separator values follow its style:footnote-sep — see
docs/architecture/notes.md, all of them probed. The dialog overrides them on :root. */
/* Registered, so getComputedStyle resolves them to px: pageBreaks.ts reserves the
separator's own band out of the page and an unregistered var reads back as "0.1cm". */
@property --note-sep-above { syntax: '<length>'; inherits: true; initial-value: 0.1cm; }
@property --note-sep-weight { syntax: '<length>'; inherits: true; initial-value: 0.5pt; }
@property --note-sep-below { syntax: '<length>'; inherits: true; initial-value: 0.1cm; }
.paper .tiptap {
--note-sep-rel-width: 25%;
--note-sep-weight: 0.5pt;
--note-sep-below: 0.1cm;
--note-sep-color: #000000;
--note-sep-align: left;
}
@@ -293,9 +296,11 @@
line-height: 0;
cursor: pointer;
}
/* Padding, not a margin, for the hanging indent: the box then still spans the whole
text width, which is what the separator's 25% is measured against. */
.paper .tiptap .note {
font-size: 10pt;
margin-left: 0.6cm;
padding-left: 0.6cm;
text-indent: -0.6cm;
}
/* The note's own marker is plain text at the baseline — LibreOffice's Footnote Symbol
@@ -315,12 +320,22 @@
left: var(--page-margin-left);
right: var(--page-margin-right);
}
/* The separator rides the first note of a page as a background line, so its 25% width
costs no element of its own; a border-top would always span the full text width. */
.paper .tiptap .note[data-note-page-first] {
padding-top: calc(var(--note-sep-weight) + var(--note-sep-below));
/* The separator hangs above the first note of a page, inside the band pageBreaks.ts
already reserved for it — so it costs the note's own box no height, which is what
keeps that height out of the reservation that produced it. A gradient, not a
border-top, because the line is only a quarter of the text width. */
.paper .tiptap .note[data-note-page-first]::after {
content: '';
position: absolute;
left: 0;
right: 0;
top: calc(-1 * (var(--note-sep-weight) + var(--note-sep-below)));
/* Drawn at least one device pixel: 0.5pt is 0.66px, which Chromium rounds away to
nothing. The reservation above still uses the true weight, as a hairline border
does — the line is a pixel wider than it measures, not the space it sits in. */
height: max(1px, var(--note-sep-weight));
background-image: linear-gradient(var(--note-sep-color), var(--note-sep-color));
background-size: var(--note-sep-rel-width) var(--note-sep-weight);
background-size: var(--note-sep-rel-width) 100%;
background-repeat: no-repeat;
background-position: var(--note-sep-align) top;
}