Remove the duplicate page-break planner and page-layout cache

This commit is contained in:
gloamxun committed 2026-10-19 14:10:08 +08:00
1 parent dd3a20890d
commit b4ee4c1330
8 files changed
+40 -1591

No files matched your search

+21 -19
View File
@@ -9,32 +9,34 @@ family and true scaled small caps; inline box geometry (`\fbox`, `\makebox`,
footnotes/`\thanks`; figure/table `[htbp]` placement approximations; page
styles (plain/fancy, `\thispagestyle`, fancyhdr headers/footers, `\thepage`);
geometry-aware `\textwidth`/`\textheight` named length registers; table of
contents and figure/table lists; and native PDF rectangles for rules and
frames (vendored genpdf `fill_rect`/`draw_rect`, no image XObjects).
contents and figure/table lists; native PDF rectangles; unified pagination
(`build_positioned_pages` is the only page builder and no separate break
planner remains).
## 1. Unified pagination
## 1. Deferred float queue
- Extract the current duplicated planner (`build_page_break_plan`) and renderer
(`build_positioned_pages`) vertical logic into one page builder returning an
ordered list of placed items, then use it for both page-break decisions and
final painting. This is the prerequisite for a true deferred float queue.
- Figures/tables currently place immediately from their source position. Add a
per-page float queue with `\textfraction`/`\topfraction` tuning so a later
float can move ahead of text while preserving source order numbers.
## 2. Base font size (implemented)
## 2. Paragraph alignment declarations (remaining)
- `DocumentModel.base_font_size` is set by the class option (default 11)
and threaded through both the page planner and the positioned renderer:
body lines, headings (`article_heading_font_size`), title material, lists,
tables, block boxes, footnotes, and the default `\parindent` (15pt for
10/12pt, 17pt for 11pt).
- `\raggedright`/`\raggedleft` are parsed as no-ops. Thread a per-paragraph
alignment into `Block::Paragraph`, then select natural spaces rather than
justification in `boxworks_line_break`/`cached_paragraph_lines`.
## 3. Table of contents and lists (implemented)
## 3. True vertical boxes (remaining)
- Parser placeholders are expanded after parsing into headings plus entries
from numbered sections and captions; entry runs carry a `TocPage` reference
that is resolved by re-laying out once page numbers are known. Dotted
leaders are not implemented.
- `\vbox`/`\vtop` currently map to a full-width block `\parbox`. A real VBox
needs a vertical-material capture with its own natural width, baseline, and
nested line/box children in the positioned renderer.
## 4. PDF painting and title blocks (remaining)
## 4. Contents leaders (remaining)
- TOC/list entries use infinite glue for right-aligned page numbers. Dotted
leaders require a glue item that repeats a character across its stretch.
## 5. Custom title blocks (remaining)
- Let a document-level `\renewcommand{\maketitle}` contribute a real title
block once the engine's title model can run box material.