Skip to content

Layout engine: multi-column layout, footnotes and endnotes - #845

Merged
KnifeLemon merged 1 commit into
builtin-enginesfrom
engine/columns-notes
Oct 30, 2026
Merged

KnifeLemon merged 1 commit into
builtin-enginesfrom
engine/columns-notes

Conversation

@KnifeLemon

Copy link
Copy Markdown
Owner

Project 4 item Layout engine: multi-column layout, footnotes and endnotes, on top of the tables item (#842).

Columns

  • A section's newspaper columns at their gap, with the separator line when the section has one. Text fills a column, then the next, then the next page.
  • A column break starts the next column (a page in a one-column section). 한글's stored lines that started a column (stored flag bit 1) start one.
  • Columns changing on a page (한글 다단 설정 나누기, Word's continuous section break): the columns before are balanced, the first ones taking the odd line as 한글 does, and the new ones start under them.
  • Section ends are not balanced. Neither 한글 nor Word does it: hwpxlib's three-column sample leaves the last page's lines in its first column.

Footnotes and endnotes

  • References: they show their number raised, in the section's note format. That format is 한글 각주/미주 모양, now read from hp:footNotePr / hp:endNotePr: the number type and the characters around it. 한글's stored note numbers are used; for other sources the notes are counted on through the document.
  • Footnotes go to the foot of their page, set as 한글 sets them, which was measured against 한글's PDFs:
    • each note is as high as its text, from its first paragraph's space before, without the spacing below its last line;
    • the section's space goes between notes, the last note ending at the body's bottom;
    • the separator line takes the section's space above and below it, and its length is 5 cm, 2 cm, a third of the column, the column, or a set length. 한글 confirmed each length code.
  • Lines with footnotes: a line whose footnotes don't fit moves on with them. Notes referenced in table cells go to the page the table ends on.
  • Endnotes start a page after the body, as 한글 does, or follow the text when the section says so (beneathText).
  • Stored line starts now move past note numbers and field text the model doesn't count. Paragraphs with page-number fields keep 한글's lines too, instead of being re-broken.

Measured against 한글 (PDFs exported by 한글 automation)

Document Pages Lines Placement
hwplib 각주미주 2/2 100% <I>, <II> under a full-width line at 한글's place; endnote on page 2 at 한글's baseline; footnotes within 0.8 pt
hwpxlib MultiColumn (3 columns) 2/2 100% same columns
Column change written by Filee — — balanced 4 | 3 like 한글

The render matrix's columns feature now matches rhwp line for line. For notes, Filee follows 한글: the endnote goes on page 2 and the numbers use the section format. rhwp differs here, so that compare is allow-listed with the reason, and the feature expects 한글's 2 pages.

Not yet (documented in docs/ENGINES.md)

  • Columns of different widths (sameSz="0") share the width equally.
  • Footnotes go across the text width even in columns. 한글 puts them under each column.
  • The separator line is always solid.
  • A note's own number isn't raised where the section asks for it.

Tests

  • PageComposerTests: columns fill and flow; column break; separator; balance when columns change; footnotes at the page foot with 한글's spacing; a line pushed with its note; numbering and endnotes on a new page; section note formats and endnotes beneath the text.
  • The full engine suite passes, along with dotnet format.

🤖 Generated with Claude Code

The page composer fills a section's newspaper columns at their gap, with
a separator line where the section has one: a column, the next, then the
next page. A column break starts the next column, and 한글's stored lines
that started a column start one. Columns changing on a page (한글 다단
설정 나누기, Word's continuous section break) balance the columns before,
the first ones taking the odd line as 한글 does; section ends are left
as they are, as in 한글 and Word.

Note references show their number raised, in the section's note format
(한글 각주/미주 모양, now read from footNotePr/endNotePr), with 한글's own
numbers. Footnotes stack at the foot of the page as 한글 sets them: each
as high as its text without the spacing below its last line, the
section's space between them and around the separator line (5 cm, 2 cm,
a third of the column, the column, or a length); a line whose footnotes
don't fit moves on with them. Endnotes start a page after the body, or
follow the text where the section says so. Stored line starts move past
note numbers and field text the model doesn't count, so paragraphs with
fields keep 한글's lines too.

Measured against 한글's own PDFs: hwplib's 각주미주 sample and hwpxlib's
three-column sample have every line as 한글's, on 한글's pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KnifeLemon KnifeLemon added the built-in engines Filee: built-in engines (Project 4), on the builtin-engines branch, not released yet label Oct 30, 2026
@KnifeLemon
KnifeLemon merged commit 3955a66 into builtin-engines Oct 30, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

built-in engines Filee: built-in engines (Project 4), on the builtin-engines branch, not released yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant