kumiori 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.en.md +104 -0
  2. package/CHANGELOG.md +104 -0
  3. package/README.en.md +10 -6
  4. package/README.md +10 -6
  5. package/dist-browser/chunks/{UTIF-D5qoainF.js → UTIF-Br536cfi.js} +4 -4
  6. package/dist-browser/chunks/{ccitt-7WmwG6OA.js → ccitt-DuYpUkox.js} +5 -5
  7. package/dist-browser/chunks/{cgm-DUIP-hbA.js → cgm-Blvzv6Sp.js} +5 -5
  8. package/dist-browser/chunks/{el-monoton-BVsCvfmZ.js → el-monoton-vcesHl--.js} +4 -4
  9. package/dist-browser/chunks/{en-gb-Cjtf0A6r.js → en-gb-DAIgCw5-.js} +4 -4
  10. package/dist-browser/chunks/{en-us-B_UiZPbu.js → en-us-BzUSGdOw.js} +4 -4
  11. package/dist-browser/chunks/{eps-_CPowVcQ.js → eps-BFOW93N0.js} +6 -6
  12. package/dist-browser/chunks/{epsInfo-BUAZ97F-.js → epsInfo-D7b8OFlX.js} +3 -3
  13. package/dist-browser/chunks/{export-contract-OHP-GNO0.js → export-contract-J-x2aLjv.js} +3 -3
  14. package/dist-browser/chunks/{la-7qtmi2aU.js → la-DRKqnbhl.js} +4 -4
  15. package/dist-browser/chunks/{load-BRpJTflg.js → load-ftVKpJYM.js} +11 -11
  16. package/dist-browser/chunks/{matrix-BcBTRcOc.js → matrix-DxjvN-4S.js} +2 -2
  17. package/dist-browser/chunks/{metafile-BikFmcYd.js → metafile-CdWE2Vpy.js} +4 -4
  18. package/dist-browser/chunks/{pako-Dl02IHsa.js → pako-BwlM3ygd.js} +3 -3
  19. package/{dist-lib/pixels-ByXzkjlj.js → dist-browser/chunks/pixels-BvYSA32R.js} +2 -2
  20. package/dist-browser/chunks/{rolldown-runtime-Bra2mvh4.js → rolldown-runtime-BV67vctc.js} +2 -2
  21. package/dist-browser/chunks/{ru-BMiVc5Ts.js → ru-C-K8QVC6.js} +4 -4
  22. package/dist-browser/chunks/{sniff-B_ueafAB.js → sniff-CqYWlxhA.js} +1367 -1367
  23. package/dist-browser/chunks/{strokeOutline-DA-aSg5C.js → strokeOutline-yLvGVz8Y.js} +4 -4
  24. package/dist-browser/chunks/{uk-ChOFgYc8.js → uk-DsJ1E5t7.js} +4 -4
  25. package/dist-browser/kumiori.js +39082 -34193
  26. package/dist-cli/assets/{cgm-CVN2h83E.js → cgm-DNhYr9YE.js} +2 -2
  27. package/dist-cli/assets/{drawioStencil-Bzai2moR.js → drawioStencil-FTgn0IEy.js} +2 -2
  28. package/dist-cli/assets/{eps-BK1bEizE.js → eps-L8amQ51W.js} +2 -2
  29. package/dist-cli/assets/{load-BwlOZ5Bc.js → load-O0H7f7JT.js} +3 -3
  30. package/dist-cli/assets/{metafile-DmYDB8sR.js → metafile-xjD5AdL9.js} +2 -2
  31. package/dist-cli/cli.js +9405 -1763
  32. package/dist-lib/{api-DB-5PKHp.js → api-DG-iGARW.js} +36826 -31937
  33. package/dist-lib/{cgm-CkwJobkQ.js → cgm-CAP3l6Ps.js} +19 -19
  34. package/dist-lib/{eps-D9WVND82.js → eps-BVpP3M6Z.js} +219 -219
  35. package/dist-lib/{epsInfo-BUAZ97F-.js → epsInfo-D7b8OFlX.js} +3 -3
  36. package/dist-lib/index.js +11 -11
  37. package/dist-lib/{load-plWCtVUv.js → load-WPgVW8G9.js} +3 -3
  38. package/dist-lib/{metafile-BOfMQbwN.js → metafile-DIpYelkX.js} +16 -16
  39. package/dist-lib/node.js +4 -4
  40. package/{dist-browser/chunks/pixels-ByXzkjlj.js → dist-lib/pixels-BvYSA32R.js} +2 -2
  41. package/dist-lib/types/api.d.ts +35 -1
  42. package/dist-lib/types/areaResources.d.ts +9 -1
  43. package/dist-lib/types/assets.d.ts +21 -0
  44. package/dist-lib/types/color.d.ts +4 -1
  45. package/dist-lib/types/colorGlyphPdf.d.ts +7 -1
  46. package/dist-lib/types/compat.d.ts +12 -0
  47. package/dist-lib/types/cssCascade.d.ts +35 -1
  48. package/dist-lib/types/cssSelector.d.ts +42 -3
  49. package/dist-lib/types/cssText.d.ts +23 -0
  50. package/dist-lib/types/foContext.d.ts +19 -0
  51. package/dist-lib/types/foExpr.d.ts +7 -0
  52. package/dist-lib/types/footnotes.d.ts +17 -1
  53. package/dist-lib/types/geometry.d.ts +5 -0
  54. package/dist-lib/types/gridTracks.d.ts +51 -0
  55. package/dist-lib/types/htmlImport.d.ts +62 -15
  56. package/dist-lib/types/htmlPaged.d.ts +5 -0
  57. package/dist-lib/types/htmlPrepare.d.ts +8 -1
  58. package/dist-lib/types/index.d.ts +3 -2
  59. package/dist-lib/types/inlineLayout.d.ts +18 -1
  60. package/dist-lib/types/layoutEngine.d.ts +157 -4
  61. package/dist-lib/types/lnode.d.ts +26 -0
  62. package/dist-lib/types/pageFlow.d.ts +34 -0
  63. package/dist-lib/types/paint.d.ts +3 -1
  64. package/dist-lib/types/pdfFlatten.d.ts +165 -0
  65. package/dist-lib/types/pdfLibPatches.d.ts +28 -4
  66. package/dist-lib/types/pdfRenderer.d.ts +23 -0
  67. package/dist-lib/types/pdfStandard.d.ts +17 -7
  68. package/dist-lib/types/pdfxVerify.d.ts +4 -0
  69. package/dist-lib/types/sourceRef.d.ts +20 -1
  70. package/dist-lib/types/svgFilterRaster.d.ts +61 -1
  71. package/dist-lib/types/types.d.ts +332 -7
  72. package/package.json +1 -1
package/CHANGELOG.en.md CHANGED
@@ -4,6 +4,110 @@
4
4
 
5
5
  Version numbers follow [Semantic Versioning](https://semver.org/). During 0.x, incompatible changes may also be released in a minor version (such as 0.2.0).
6
6
 
7
+ ## 0.4.0 (2026-11-19)
8
+
9
+ - **Centring with `auto` left and right margins** (HTML, every style. **Typesetting results change**): the margins were made lengths from the estimate of the containing block width at import time, so inside a table cell (where the estimate is close to the whole table width) the margins went into the content width that decides the column widths, and that column took most of the table while the other columns shrank to their minimum width (the same for boxes with a fixed width inside `<td align="center">` and `<center>`). When the place was narrower than the estimate, the margins did not shrink and the box overflowed. The margins are now shared out from the width of the place at layout time, and count as 0 when measuring the content width (CSS 2.1 §10.3.3, §10.3.7, §17.4, CSS Sizing 3 §5.1). Other changes: (1) a table with a fixed width and collapsed borders (`border-collapse: collapse`; tables in the default style `kumiori` are collapsed too) centred with `margin: 0 auto` or `align="center"` moves right by the width of its outer border, and the space left and right is now equal (it was shifted left by the part of the border that sticks out; 0.75pt for a table with `border="1"`, 6pt for a 6pt outer border) (2) a table with only `margin-left: auto`, and absolutely or fixed positioned boxes with `left`, `right` and `width` all set, go to the right (they stayed on the left) (3) floated tables and `display: inline-table` tables are not centred by `auto` margins (they were centred; in CSS 2.1 §10.3.5 and §10.3.9 `auto` margins are 0) (4) inside right-to-left text (`direction: rtl`), a box or table wider than its place overflows to the left (it overflowed to the right; by the rule of §10.3.3 the `auto` margins become 0 and `margin-left` is solved again, as in Chrome) (5) a box inside a vertical parent is centred top to bottom by `auto` in `margin-top` and `margin-bottom` (the left and right `auto` were read) (6) a box or the rest of a table that runs onto a page of a different width (such as after `:first`) is centred again for the width of that page (it kept the margins of the first page)
10
+ - **The base of percentages** (HTML, every style. **Typesetting results change**): percentages in `width`, `max-width`, `min-width`, `padding`, `margin` and `text-indent` (and `calc()` with percentages) were made lengths from the estimate of the containing block width at import time (which takes off only what normal-flow blocks take), so inside floats, inline-blocks, absolutely positioned boxes, flex and grid items, columns of a multi-column box and table cells the width of the outer box was the base, and boxes overflowed (a `width: 50%` box in a column of `columns: 2` took the full column width; `width: 50%` in a 100pt grid column was 150pt). For an element that names a page with `page` (`@page body { margin: … }`), the base was also the page area of the unnamed `@page`. They are now resolved at layout time against the actual containing block where the box is placed (CSS 2.1 §10.2, §8.3, §8.4, §10.4, CSS Paged Media 3 §10.1; in vertical text the base of `padding` and `margin` is the height of the containing block, CSS Writing Modes 4 §7.2; inside a page-margin box the base is the margin box). When measuring the content width, percentage widths count as `auto`, `padding`, `margin` and minimums as 0, and maximums as none (CSS Sizing 3 §5.2.1). Also: (1) percentages in `width` and `max-width` of images are resolved against the width of the box that sets the line (the default style's `img { max-width: 100% }` now works inside grid columns and columns of a multi-column box; it was resolved against the body width and the image overflowed the column) (2) a table or image with `width="100%"` in a cell of an auto-layout table does not widen the outer table (it widened the column of that cell nearly to the page width; as in browsers) (3) the column count from `column-width` and percentages in `column-gap` are decided by the width at layout time too (`columns: 40pt` in a cell about 110pt wide: 3 columns → 2) (4) percentages of normal-flow blocks in the body are the same as before
11
+ - **Pages with different margins, and fixed boxes** (HTML, every style. **Typesetting results change**: only documents with pages whose margins or sizes differ by `:first`, `:left`, `:right` or named pages): percentage widths and margins, and the position and size of fixed boxes (`position: fixed`), were decided on the page area of the unnamed `@page`, so on a `:first` page with wider margins a `width: 100%` box and fixed boxes overflowed the body area. They are now decided on the page area of the page where the box is placed, and a box that runs over pages is resolved for each fragment with the width of its page (CSS Paged Media 3 §3, CSS Fragmentation 3 §5.1; fixed boxes are placed again on each page)
12
+ - **Content widths (min-content and max-content)** (HTML, every style. **Typesetting results change**): boxes sized by their content (columns of auto-layout tables, floats, inline-blocks, `width: max-content` and so on) counted the following wrongly. (1) A block whose width is given as a length inside a cell of an auto-layout table was counted by the length of its lines, not by the width of the box (the box overflowed the cell). The outer width of the box (width and margins) is now counted. Percentage widths count as `auto`, and `max-width` and `min-width` given as lengths limit the content width (CSS Sizing 3 §5.1, §5.2.1) (2) the max-content width of a list (`ul`, `ol`, elements with `display: list-item`) in a cell was counted as the full length of the measuring line (the whole table width), so the other columns shrank to their minimum width. The indent plus the content width of the items is now counted (the same with or without markers) (3) the width of an inline-block is decided by shrink-to-fit, as for floats (a list inside took the full page width) (4) the content width of a grid container is decided by its length columns and the content widths of its `fr` and `auto` columns (a grid inside a float took the full page width) (5) the content width of a paragraph with `text-align-last: justify` or `text-align: justify-all` does not count the length added by justification (a cell with a heading spread by justification took the whole table width) (6) a vertical inline-block with `auto` height is as long as its content (it was longer than its content). Column widths of XSL-FO tables do not change
13
+ - **Propagation of breaks (`break-before`, `break-after`, `break-inside`)** (HTML, every style. **Typesetting results change**: only documents with breaks): as in CSS Fragmentation 3 §3.1.1, they now propagate out of tables, rows of flex and grid containers, and multi-column boxes. (1) Tables: `break-before` on the first child and `break-after` on the last child of a cell become the break before and after the row (they were not read; as in Chrome), and the break before the first row and after the last row becomes the break before and after the table. Breaks on `tr` and on `thead`, `tbody` and `tfoot`, and `break-inside: avoid` on them, are read too (`break-before` on the first row or the first `tbody`, `break-after` on the last row, and breaks between `tbody` elements did not work). In a table with a `thead`, a forced break at the first body row (on `tr`, `tbody` or the first child of a cell) starts the table, header included, on the next page (`tr` and `tbody` did not break, and the first child of a cell left only the header on the previous page) (2) flex and grid: `break-before` and `break-after` on an item break before and after the row of that item (`break-before` on a grid item sent only that item to the next page, and `break-after` on a flex item did not work). `break-inside: avoid` on an item and `break-after: avoid` on the last item work too (3) multi-column boxes: `page`, `left` and `right` in `break-before` and `break-after` inside go to the first column of the next page (before, `page` went to the next column on the same page, and `left` and `right` went to the next page without a blank page (landing on the wrong side) when the current page was already on the requested side, and to the next column on the same page otherwise). A break on the first child becomes the break before the multi-column box. In a balanced multi-column box, the column height stays within the rest of the page even when an unbreakable block falls on the boundary between columns (the first column overflowed the bottom of the page) (4) `left` and `right` at the same break point take the value of the later element, once (CSS Fragmentation 3 §4.3; both used to apply and an extra blank page went in: `break-after: left` with `break-before: right` gave 4 pages, now 3)
14
+ - **Named pages (`page`) and renumbering pages** (HTML, every style. **Typesetting results change**: only documents written as below): (1) `page` on `body` and `html` is read, and the document starts on that page (CSS Paged Media 3 §8.1; it was not read) (2) `page` on list items (`li`) switches the page too (3) `page` where the page cannot be switched (table rows, flex and grid items, boxes inside multi-column boxes and table cells, and so on) is reported in the warnings as unsupported CSS instead of being ignored silently (4) `counter-reset: page` on `body` and `html` gives the number of the first page (it was not read) (5) where pages of the same name follow each other, a box whose `page` names the same page and that has a forced page break and `counter-reset: page` renumbers the pages too (it did not; `counter-reset: page` on a box without `page`, inside unnamed pages, still does not renumber) (6) also in documents without `page`, when the first content of `body` was text not wrapped in an element, the next block was sent to the second page (it is now set on one page) (7) in HTML, no blank page is inserted for renumbering pages (the page counter of CSS Paged Media 3 §6.1 has no rule that inserts blank pages; blank pages come only from `left`, `right`, `recto` and `verso` of `break-before` and `break-after`: CSS Fragmentation 3 §3.1), and left and right pages (the choice of `@page :left` and `:right`, the blank pages of `left`, `right`, `recto` and `verso` breaks, and `inside` and `outside` of `float` and `text-align`) are decided not by the parity of the page number but by the order of the pages from the start of the document (which sheet it is; a blank page counts as one) (CSS Paged Media 3 §3.3: left and right pages alternate, and the first page is a right page; in a vertical (`vertical-rl`) document it is a left page; right-to-left horizontal (`direction: rtl`) documents also start on a right page, while in §3.3 they start on a left page). Renumbering the pages does not change the left and right of the spreads. When 0.3.0 switched to a page of another name and renumbered the pages, it inserted a blank page at the end of the previous pages to match the parity of the new number (making the page after page 1 page 5 gave "1 | blank | 5", now "1 | 5"; page 5 is the second sheet, so it is a left page), and it decided left and right by the parity of the page number. **Typesetting results change**: documents that renumber pages no longer get blank pages for the renumbering, and the `:left` and `:right` of the pages after the renumbering and the blank pages of `left` and `right` breaks change (usually there are fewer pages, but there can be more; `break-before: right` that renumbers to 4 gave "1 | blank | blank | 5", now "1 | blank | 4"). In documents whose first page number is even (`counter-reset: page 2` on the first element, and so on), the left and right of every page are swapped (the first page is set as a right page instead of a left page, and the pages alternate from there). A `break-before: right` at the start of the document gets no blank page before it, and the blank pages of later `left` and `right` breaks move (a document with `counter-reset: page 2` on the first element and a later `break-before: right` goes from 2 pages to 3). Documents that do not renumber pages do not change. The compatibility styles (`--style ah`, `weasyprint`, `vivliostyle`) and XSL-FO are as before (they insert the blank page before renumbering, and decide left and right by the parity of the page number)
15
+ - **Grid columns (`grid-template-columns`)** (HTML, every style. **Typesetting results change**: only documents with grids. How column widths are decided is detailed in section 13.2 of the HTML and CSS volume of the Conformance Guide):
16
+ - `em`, `rem` and `calc()` in column sizes, and relative lengths inside `minmax()`, are made absolute in the computed value (such a column was treated as `1fr` and shared equally: with 10pt text, `5em 1fr` 300pt wide went from 150 + 150pt to 50 + 250pt; CSS Values 4 §6)
17
+ - `0fr` is no longer made `1fr`, and when the `fr` factors add up to less than 1, only that share of the remaining space is divided (`0.2fr 0.3fr` 300pt wide went from 120 + 180pt to 60 + 90pt; CSS Grid 1 §12.7.1)
18
+ - the number of repetitions of `repeat(auto-fill, minmax(100px, 1fr))` is counted from the container width (300pt wide: 3 columns of 100pt → 4 columns of 75pt; CSS Grid 1 §7.2.3.2)
19
+ - line names (such as `[a]`) are not counted as columns (they were counted as `1fr` columns: the two items of `[a] 100pt [b] 1fr` 300pt wide went from 50pt and 100pt to 100pt and 200pt). `minmax()` with a function holding commas, such as `minmax(min(100%, 200px), 1fr)`, is read too (CSS Grid 1 §7.2)
20
+ - a `minmax()` column whose maximum is a length is grown up to that length first, and the rest goes to the other columns (`minmax(100px, 200px) 1fr` 400pt wide went from 200 + 200pt to 150 + 250pt; CSS Grid 1 §12.6). The factor of `minmax(0, 2fr)` is 2 (it was 1: `minmax(0, 2fr) 1fr` 300pt wide went from 150 + 150pt to 200 + 100pt)
21
+ - invalid track lists (negative lengths, nested `repeat()`, `minmax()` with an `fr` minimum, `auto-fill` with `fr`, and so on) drop the whole declaration, and the previous declaration stays (CSS Grid 1 §7.2, CSS 2.1 §4.2; a negative column was read as 0: `-10px 1fr` after `100pt 100pt` went from a 0pt column and a column with the rest to 100 + 100pt)
22
+ - a column whose math function (`min()`, `calc()` and so on) gives a negative result becomes a 0 column, without dropping the declaration (CSS Values 4 §10.12; `min(10px, -5px) 1fr` 300pt wide was not read and the previous declaration (`100pt 100pt`) stayed → 0 + 300pt)
23
+ - very large `fr` factors and percentages (`1e307fr`, `1e400%` and so on) are clamped to values that can be handled (the column widths became Infinity or NaN; CSS Values 4 §10.9)
24
+ - the column widths are decided from the actual content width of the container at layout time (they were decided from the width estimated while importing (the body width and so on), so inside flex items, table cells and grid items the columns overflowed the container: `1fr 1fr` in a `flex: 1` item next to a 250pt sibling in a 400pt flex container went from 200 + 200pt to 75 + 75pt)
25
+ - the width of a grid inside a box sized by its content, such as a float or an inline-block, is decided from the content widths (max-content) of the items of all the rows (it took the full body width: `1fr 1fr` with one letter in each item inside a float went from 240.9 + 240.9pt to 5 + 5pt; items spanning columns with `grid-column: span 2` are counted too; CSS Grid 1 §12.7.1)
26
+ - `fr` and `auto` columns are not made narrower than the automatic minimum size of their items (the narrowest width of the content, such as a long word or a table) (they were shared equally and the word ran into the next column: in `1fr 1fr` 150pt wide, the column of a long word went from 75pt (the word overflowing by 78.3pt) to 153.3pt; when the minimums add up to more than the container, the grid overflows; CSS Grid 1 §6.6, §12.7.1). Children of an item with `width: 100%` and images with the default `img { max-width: 100% }` do not widen the column
27
+ - the column of an item with `min-width` or a length `width` is not made narrower than that width (the columns were shared equally and the item ran into the next column: in `1fr 1fr` 300pt wide, the column of an item with `width: 200pt` went from 150pt to 200pt, and the next column is 100pt; CSS Grid 1 §6.6)
28
+ - a `minmax(auto, 80px)` column grows up to its maximum of 80px, and the minimum measured from the content is limited to 80px too (it was treated as `1fr` and shared equally: `minmax(auto, 80px) 1fr` 300pt wide went from 150 + 150pt to 60 + 240pt; the column of an item with `min-width: 150px` is 112.5pt, the minimum not being limited; CSS Grid 1 §6.6, §12.5)
29
+ - `auto` columns are still counted as `1fr` and shared, so an image that is itself an item in an `auto` column (with the default `max-width: 100%`) shrinks to the shared column width (a 600×400px image in `auto 1fr` 300pt wide went from 300pt (running into the next column) to 150pt; Chrome widens the `auto` column to the image, 295pt)
30
+ - known limitation: the number of repetitions of `repeat(auto-fill, …)` and `repeat(auto-fit, …)` is still decided from the width estimated while importing, so where the container is narrower than the estimate, the columns may overflow the container (`repeat(auto-fill, minmax(100px, 1fr))` in a `flex: 0 0 110pt` item has 6 columns of 75pt, counted from the 481.9pt body width)
31
+ - large grids take longer to set (a 4-column grid of 3,200 items takes about 1.7 times as long as in 0.3.0; the content widths of the items are measured at layout time to decide the column widths)
32
+ - **Image sizes** (HTML, every style. **Typesetting results change**: only images written as below. How the sizes are decided is detailed in sections 3.5 and 13.1 of the HTML and CSS volume of the Conformance Guide):
33
+ - the `width` and `height` attributes of `img` and `object` are read as presentational hints (HTML §15.4.3), and the author's CSS `width` and `height` take priority over the attributes (an image with 600×400 attributes and `style="height: 100pt"` in a 200pt wide place went from 200×44.4pt to 200×100pt with the default style `kumiori`)
34
+ - an image with attributes whose width is shrunk by the default style's (`kumiori`) `img { max-width: 100% }` shrinks its height by the aspect ratio too, as in 0.3.0 (an image with 600×400 attributes in a 200pt wide place is 200×133.3pt; also inside grid items, multi-column boxes and table cells; CSS 2.1 §10.4)
35
+ - an image with attributes whose width is shrunk by the author's `max-width` (also `max-inline-size`) keeps the height of the attribute (as in browsers: with the author's `img { max-width: 100% }`, an image with 600×400 attributes in a 200pt wide place went from 200×133.3pt to 200×300pt; with `height: auto` in CSS it shrinks by the aspect ratio as before; CSS 2.1 §10.4)
36
+ - flex containers shrink image items (they did not, and the image ran into the next item). The height of the shrunk image stays the height of the attribute (as in Chrome; CSS Flexbox 1 §9.7): in a 200pt wide container, an image with 600×400 attributes and `min-width: 0` next to a 150pt item went from 200×133.3pt to 50×300pt. An image with `flex: 0 0 100pt; min-width: 0` (also `flex-basis: 50%`) went from 200×133.3pt to 100×300pt
37
+ - flex also shrinks images with `overflow: hidden`, images with a length `min-width` (`min-width: 40pt` in the example above gives 50×300pt), and, even without a next item, images with `min-width: 0` whose own padding, border and margin make the item wider than the container (160×300pt with 10pt padding, a 5pt border and a 5pt margin)
38
+ - an image item with a width (also by attributes) in a flex container is placed without shrinking below its automatic minimum size (only the item width was shrunk and the image ran into the next item: in a 200pt wide container, an image with `width: 150pt` next to a 150pt item makes the next item shrink to 50pt; CSS Flexbox 1 §4.5)
39
+ - the automatic minimum size of an image that is itself a flex item is limited by a length `max-width` (it was not, for images whose size is not known while importing, such as `data:` SVG: a 300×200px image with `flex: 0 0 30%; max-width: 50px` went from 225pt (running into the next item) to 37.5pt; as in browsers; CSS Flexbox 1 §4.5)
40
+ - an image with `flex: 1` grows, and its height stays the height of the attribute (it did not grow: in a 200pt wide container, an image with 20×10 attributes went from 15×7.5pt to 200×7.5pt; as in Chrome; CSS Flexbox 1 §9.7)
41
+ - an image with attributes widened by `min-width` or `min-height` keeps the other size of the attribute (it was widened by the aspect ratio: an image with 100×50 attributes and `min-width: 150pt` went from 150×75pt to 150×37.5pt, and with `min-height: 100pt` from 200×100pt to 75×100pt; as in browsers; CSS 2.1 §10.4)
42
+ - an image with attributes for which the author writes only `max-height` has only its height limited (it was shrunk by the aspect ratio: an image with 600×400 attributes and `max-height: 100pt` in a 500pt wide place went from 150×100pt to 450×100pt; as in browsers). When the default style's (`kumiori`) `max-width` shrinks the width too, the aspect ratio is kept as before (150×100pt in a 200pt wide place)
43
+ - for `min-*` and `max-*` on an image with only one size given, the given size is changed only by its own `min-*` and `max-*`, and the other comes from the aspect ratio and then gets its own `min-*` and `max-*` (an image with a 2:1 aspect ratio and `width: 40pt; max-height: 10pt` went from 20×10pt to 40×10pt; CSS 2.1 §10.4, §10.3.2, §10.6.2)
44
+ - images that cannot be read and SVG without a size are sized by the aspect ratio of the attributes (an image with 200×100 attributes and `width: 100pt; height: auto` went from 100×75pt to 100×50pt; HTML §15.4.3)
45
+ - `width="0"` and `height="0"` (and 0 in CSS) are valid sizes (0 was taken as no size, and the image was drawn at its natural size; CSS 2.1 §10.2)
46
+ - **Relative lengths, `calc()` and percentages in values** (HTML, every style. **Typesetting results change**: only documents written as below): values that kept relative units in the computed value, which the reading side could not read and dropped, are now made absolute lengths (`calc()` with percentages becomes a sum of a percentage and a length) and read (CSS Values 4 §6, §10.11; none of them gave a warning). (1) Lengths such as `em` and `rem` in `background-size` (the background image was drawn at its natural size as if no size were given: an icon with `background: url(icon.svg) no-repeat 0.65em center / 1.25em 1.25em` was drawn large over the text; CSS Backgrounds 3 §3.9; percentages and `auto`, `cover`, `contain` stay as they are) (2) lengths in `em`, `rem`, `calc()` and `var()` in `box-shadow` and `filter: drop-shadow()` (the shadow was not drawn) (3) `calc(percentage ± length)` in `border-radius`, `background-position` and `background-size` (they were dropped) (4) percentages, `calc()` and font-size keywords in declarations of page-margin boxes, `@footnote`, `::footnote-call` and `@page` (`@top-center { font-size: 150% }` stayed at 10pt). `em` in a page-margin box is based on the font size of the page context (`@page`) (5) percentages in `letter-spacing` and `word-spacing` are relative to the font size (CSS Text 4 §8.1, §8.2; they were relative to the containing block width, and letters were spaced far apart)
47
+ - **Zero and negative values** (HTML, every style. **Typesetting results change**: only documents written as below): (1) `font-size: 0` is a valid value and the text is set at size 0 (CSS Fonts 4 §2.4; with `line-height: normal` the line height is 0 too. 0 was dropped and the parent font size kept, so a paragraph hidden with `font-size: 0`, such as a paragraph marking a page break, took the height of a line) (2) `rowspan="0"` spans all the remaining rows of the row group (HTML §4.9.11; it spanned 1 row) (3) negative values of properties where they are invalid (`padding`, `width`, `height`, `min-*`, `max-*`, `gap`, `column-width`, `flex-basis`, border widths, `font-size`, `background-size`) drop the whole declaration (they were used, and `padding-left: -10pt` pushed the content out to the left). A negative result of `calc()` becomes 0 (CSS Values 4 §10.12)
48
+ - **Sizes of gradient backgrounds** (HTML, every style. **Typesetting results change**: only documents with `background-size` on a gradient background, or a gradient background on `html` or `body`): percentages in `background-size` of a gradient background are read, and a size of 0 draws nothing (the whole box was painted). Gradient backgrounds of `@page` read `background-size` and repetition too. Gradient backgrounds of `html` and `body` are drawn on the page like other backgrounds (they were not drawn; CSS Backgrounds 3 §2.11.1)
49
+ - **Area Tree types** (typesetting results do not change): to carry the `calc(percentage ± length)` above, the area types were widened. The radii in `corners` of `borderRadius` may now be a sum of a percentage and a length, `{ pct, len }` (`pct` is the percentage number, 10 for 10%; `len` is in pt; they were only lengths or percentage strings; the type is `RadiusLength`). `backgroundImage` (and the images in `under`) gained `xOffset` and `yOffset` (lengths added to percentage positions) and `widthOffset` and `heightOffset` (lengths added to percentage sizes), and `fitPosition` of image areas gained `xOffset` and `yOffset` (lengths added to percentage positions; all in pt). The version of the Area Tree JSON (3) does not change
50
+ - **API**: added `typesetToPdf(text, options, pdfOptions)`, which makes only the PDF, and `Typesetter.typesetToPdf` on the container (the same PDF, warnings and page count as calling `toPdf(pdfOptions)` after `typeset`; the result is `{ pdf, pageCount, warnings, layoutMs }`, of type `TypesetPdfResult`). It turns the pages into area trees one at a time, writes each and releases it, so it never holds the area tree of the whole document, and documents of thousands of pages use less memory. `layoutMs` does not include the time to turn the pages into area trees. The type of the `toPdf` options is now exported as `PdfOptions` (unchanged in content)
51
+ - **Low-memory mode** (the command's `--low-memory`, `lowMemory` of the API's `typesetToPdf`; type `TypesetPdfOptions`): the re-layouts that settle page number references do not reuse the pages of the previous pass, and the intermediate layout tree of each page-sequence is released once it has been laid out. From the second pass on, the static content is laid out and the pages are turned into area trees as each page-sequence is finished, to collect the fonts and images used (collected again if the pass does not settle). After the passes settle, the document is laid out once more to write the PDF. The PDF and the warnings are the same as with reuse. For the FO of the PostgreSQL documentation (3,231 pages), the maximum live heap goes from about 2.3GB to about 0.9GB (the most is used while reading the FO; it can be typeset with a 1GB heap limit), and the time from 160 s to 231 s (with a 4GB limit)
52
+ - **HTML default style** (changes the typeset result only for documents typeset with the default style `kumiori` whose author sets the font or alignment on `html` (`:root`)): the default style's font (`serif`) and alignment (`justify`) are now set on `html` instead of `body`. An author's `html { font-family: … }` or `html { text-align: … }` used to be overridden by the default value on `body` and never reached the document (the browser default style sets neither on `body`, so in a browser the author's value applies; CSS Cascade 4 §6.1, §7.2). Documents that set neither, or set them on `body`, do not change. The Python 3.14 documentation typeset with Sphinx's print CSS (`html { font-family: Fira Sans }`) now has its body text in Fira Sans instead of the default font (Tinos)
53
+ - **vertical-align of inline boxes** (changes the typeset result for HTML documents that set the values below on inline text elements): `vertical-align: top`, `bottom`, `middle`, `text-top` and `text-bottom` are now read for non-replaced inline boxes (`span`, `::before` and so on; CSS 2.1 §10.8.1; horizontal lines. Previously they were all silently aligned to the baseline. `top`, `bottom` and the others were already read for images). An inline box is the line-height box (the first available font's ascent and descent plus the half-leading). `top` and `bottom` align the box of the element and its contents (the aligned subtree, per line fragment) with the top or bottom of the line box, and widen the line if it is taller. `middle` aligns the box's centre with the parent's baseline plus half the x-height, and `text-top` and `text-bottom` align the box's top or bottom with the top or bottom of the parent's content area. The "•" in the table of contents of Sphinx's print CSS (`font-size: 30pt; line-height: 10pt; vertical-align: bottom`) now sits in the middle of the line instead of floating above it, and no longer widens the line (as in WeasyPrint and Chromium). Images and inline-blocks that are themselves `top` or `bottom` inside a `top` or `bottom` element are not put in the outer element's subtree, and each is aligned by its own value
54
+ - **@page padding** (changes the typeset result only for HTML documents that set `padding` in `@page`): the padding of the page box (`padding` and the four sides such as `padding-top`) is read, and the body area shrinks by it. Margin boxes (`@top-center` and so on) sit in the page margin, so they do not move. Before, it was ignored (with `@page { padding-top: 1em }` of the Sphinx print CSS, the body started just below the page margin, about one line higher than WeasyPrint). Percentages are against the page width for left and right, and against the page height for top and bottom. Negative values are invalid
55
+ - **Targets of target-counter()** (changes the typeset result only for HTML documents that refer to targets with two or more `#`, such as `href="#a#b"`): the target id is looked up by the URL fragment (everything after the first `#`; `a#b` for `#a#b`), the same way as link targets. Before, it was looked up by the part after the last `#` (`b`), so table-of-contents entries whose links do not resolve still got page numbers (such as `href="#document-tutorial/interpreter#invoking-the-interpreter"` in the table of contents of Sphinx single-file HTML; such references now give "?" and a warning, like other missing references)
56
+ - **Percentages of top and bottom for relative positioning** (changes the typeset result only for HTML documents that set `top` or `bottom` as a percentage on a `position: relative` box): when the height of the containing block is definite, the box is offset by that percentage of the height. With a containing block of indefinite height, it stays auto (no offset) as before. The height counts as definite for boxes whose `height` is a length, and for flex items stretched to the container height (items with auto height and stretch in a one-line container whose line has the container height). The containing block is the nearest block ancestor (CSS 2.1 §10.1). The `height` of inline elements and of `display: contents` elements is not used (inside inline elements, boxes are still not offset). Flex and grid items, however, are block boxes even when their `display` is an inline value (such as a `span`), so they become containing blocks (CSS Display 3 §2.7). Before, percentages were not read and the box was not offset
57
+ - **WeasyPrint behaviour** (changes the typeset result only for HTML documents typeset with `--style weasyprint`): to match WeasyPrint, (1) lines that hold only empty markers (such as `<span id="…"></span>`) break margin collapsing (the margins before and after are added; the other styles collapse them as the CSS specification says), (2) `target-counter()` references whose target is not found give empty text (the other styles give "?"; both warn), and (3) when a wrapping flex container (`flex-wrap: wrap`) of definite height has a single line, the line gets the container height whatever `align-content` is (the other styles do so only for `align-content` `normal` and `stretch`, as the specification says). In documents with the Sphinx print CSS, the space before headings, the deeper table-of-contents entries and the position of the cover title become the same as in WeasyPrint
58
+ - **Reading declarations of margin boxes and @footnote** (changes the typeset result only for HTML documents written as below): they are read the same way as for document elements. (1) Border longhands of margin boxes (such as `@top-right`): `border-bottom-width`, `-style`, `-color`, and `border-width`, `border-style`, `border-color`. Before, only the shorthands (`border`, `border-bottom` and so on) were read, and borders written with longhands were not drawn (the line under the header of the Sphinx print CSS). (2) Translucent border and background colors of margin boxes are drawn over what is below, instead of as an opaque color mixed with white paper. Background color names (such as `red`) are read too (before, only colors starting with `#`). (3) Longhands of the `@footnote` separator (such as `border-top-width`), and the `margin` and `padding` shorthands
59
+ - **Properties of the page context, margin boxes and @footnote** (changes the typeset result only for HTML documents that use the properties below): properties of CSS Paged Media 3 Appendix A that apply to the page context and margin boxes, and were not read, are read now. (1) `border` of `@page` (shorthands and longhands; the initial width is `medium`; drawn inside the page margin, and the body area shrinks by its width) and `outline`, (2) `background-image` of margin boxes (url() and gradients, also via the `background` shorthand; the initial position is the top left) and `outline`, (3) `min-width`, `max-width`, `min-height` and `max-height` of margin boxes (the widths of the boxes on the top and bottom edges are redistributed with the three boxes together), (4) `max-height` of `@footnote` (the upper limit of the footnote area height in CSS GCPM 3; footnotes beyond it move to the next page. Once a footnote has been moved to the next page by the limit, the footnotes after it move too, so footnotes stay in document order. The limit is not applied on footnote-only pages added after the end of the body; §2.4.2)
60
+ - **Initial width of borders of margin boxes and the footnote separator** (changes the typeset result only for HTML documents that set a border (such as `border: solid`) without a width on margin boxes (such as `@top-center`) or on the `@footnote` separator): a border without a width gets the initial `medium`, the same as for document elements (CSS Backgrounds 3 §3.2). The width goes from 1.5pt to 2.25pt. With `--style ah`, `thin`, `medium` and `thick` of margin boxes are 1, 3 and 5pt (the same as for document elements; the footnote separator is 2.25pt). Borders whose width is given as a length do not change
61
+ - **Nested named pages** (changes the typeset result only for HTML documents that set `page` on blocks deeper than body's children): page names are taken from in-flow blocks at any depth, not only from blocks directly under body (CSS Paged Media 3; `auto` boxes use the parent's name). In documents that wrap everything in one box (such as `div.book` of DocBook HTML), the named pages of the front matter, part title pages and the index (with their running heads and page number styles) now take effect. Enclosing boxes are split at the switch; the start margin and border stay on the first fragment and the end ones on the last. In the split fragments, `height`, `min-height`, `max-height` and `aspect-ratio` apply to the first fragment only, and boxes with `box-decoration-break: clone` also get their border and padding at the splits (CSS Break 3 §5.3, §5.4). Where nesting is too deep and has been flattened (128 levels), the page name does not change
62
+ - **Page number style of target-counter()** (changes the typeset result only for HTML documents that refer with `target-counter(…, page)` to pages numbered in another style, such as roman front matter): without a counter style the number is decimal, and a third argument (such as `lower-roman`) gives that style (CSS GCPM 3; the same as `counter()`). Before, the style argument was not read and the target page's own numbering was used
63
+ - **Page number reference text on pages reused in re-layouts** (changes the typeset result only where the error below appeared, in documents with page number references typeset in the default mode (not `--low-memory`)): in the re-layouts that settle page number references (`fo:page-number-citation` in XSL-FO, `target-counter()` in HTML), when the pages of the previous pass were reused and only the reference text was replaced, characters shifted by one could appear where the value had a different number of digits ("1" and "3" alternating where "13" should be, with the link rectangle one character too narrow). This error was already in 0.3.0. The text is now replaced only when the number of characters, the kinds of characters, the font, the advances and the widths are the same and no character that takes part in kerning is replaced; otherwise that page-sequence is laid out again. References with kerning (`font-kerning`, `axf:kerning-mode`), whose glyph positions could differ from a re-layout, are fixed too. Both now give the same result as `--low-memory`, which does not reuse pages (in a 1,082-page document, the difference in extracted text between the default and `--low-memory` goes from 360 lines to 0)
64
+ - **Border widths in WeasyPrint behaviour** (changes the typeset result only for borders whose width is not a whole number of px, in HTML documents typeset with `--style weasyprint`): border widths are not snapped to pixels (as in WeasyPrint; a `0.3pt` line is drawn 0.3pt wide). Before, as in browsers (Chrome), widths under 1px were rounded up to 1px (0.75pt) and wider ones were floored to pixels
65
+ - **Warning for footnote-display: block** (no change to the typeset result): `footnote-display: block` (the initial value in CSS GCPM 3, and exactly how Kumiori places footnotes) is no longer reported as unsupported CSS. `inline` and `compact` are still reported (the tables in chapter 16 of the conformance document are updated too)
66
+ - **Effort limit for large documents** (changes the typeset result only for large documents with more than 50,000 input nodes): the limit on the number of flows made in one layout pass (the default of `LayoutOptions.maxMeasureFlows`) is now the larger of 100,000 and twice the number of input nodes, instead of a fixed 100,000. Before, documents of thousands of pages hit the limit even without deep nesting, after which content widths were no longer measured and multicol was laid out in one column (the three-column index of the 2781-page PostgreSQL documentation became one column). Inputs whose nesting makes the effort explode are still stopped
67
+ - **break-inside: avoid rows taller than a page** (changes the typeset result only for HTML documents whose table rows or list items with `break-inside: avoid` are taller than a page): a row that does not fit even on a new page is split inside, relaxing avoid (CSS Fragmentation 3). Before, it was not split and overflowed the bottom of the page (long rows of the function tables in the PostgreSQL documentation). The Antenna House compatible style (`--style ah`) is unchanged
68
+ - **Formats of footnote calls and markers** (changes the typeset result only for HTML documents written as below): (1) rules whose pseudo-element follows a selector (such as `span.footnote-body::footnote-call`) are read too (before, only `::footnote-call` and `*::footnote-call` were read, and the size and content of the call were missed). (2) When the contents of `::footnote-call` and `::footnote-marker` differ, the marker at the start of the footnote body uses the `::footnote-marker` format (before, it used the call's format, and the ". " of `counter(footnote) ". "` was lost). Which footnotes a rule naming elements applies to is described in the item "Footnote number formats per footnote" below
69
+ - **Column balancing and lines taller than a column** (changes the typeset result only for multicol with a line taller than the average column height, such as a large inline image): when searching for the smallest column height that fits the column count, a height at which a line did not fit even at the top of an empty column (and overflowed) no longer counts as fitting. Before, a column height lower than that line was chosen, the line overflowed the column, and "a line does not fit on the page" was reported (the three-column index of the PostgreSQL documentation)
70
+ - **Position of background images of @page and margin boxes** (changes the typeset result only for HTML documents with a background image in `@page`, a margin box or the root element (html, body)): the position, the size (percentages, `cover`, `contain`) and the origin of repetition of the `@page` background image are determined inside the page margin and border (the padding area of the page box) (CSS Paged Media 3 §3.1; CSS Backgrounds 3 §2.8, §2.9; it is still painted up to the bleed). Before, the sheet was the reference, so even in documents that give a position, the position was measured from the edges of the sheet (when the top and bottom or left and right margins differ, the `center` position changes too). The background of margin boxes was already relative to the padding area of the box. Without a position the image is placed at the initial top left (`0% 0%`; before, the `@page` background was centered on the sheet). With one value, the other axis is `center` (before, it was the top or left edge). Length positions (such as `10mm 20mm`), positions with offsets from the edges (such as `right 10px bottom 5px`), and `em`, `rem` and `calc()` in positions are read too. Declarations with values that cannot be made into lengths are invalid. Percentages of `background-size` are read too (backgrounds of `@page`, margin boxes and the root element). For a `@page` background with `background-attachment: fixed`, the page box including its margins (the whole trimmed sheet; the trim corners even with bleed) is the reference for the position and size (CSS Paged Media 3 §3.1; both the longhand and `fixed` in the `background` shorthand are read). `fixed` on document elements is still unsupported (painted like `scroll`). When `background-size` (`cover`, `contain`) is given for the background of `@page`, a margin box or the root element without `background-repeat`, the image repeats, as the initial value `repeat` says (CSS Backgrounds 3 §2.4; 0.3.0 did not repeat with `cover` or `contain`). So `@page { background: url(…); background-size: cover }`, which covered the whole sheet with one image in 0.3.0, now repeats an image sized to the area inside the margins over the margins and the bleed as well. To cover the whole sheet with one image, give `background-attachment: fixed` and `no-repeat`
71
+ - **Footnote number formats per footnote** (changes the typeset result only for HTML documents that give different `::footnote-call` and `::footnote-marker` formats to different kinds of footnotes): the formats of the call and the marker at the start of the footnote body (the text around the number and the counter style in content), and the size and so on of the call, come from the rules that match that footnote element (layered by specificity and order; CSS GCPM 3 §2.6, §2.7). Rules that name elements (such as `.a::footnote-call`) apply only to the footnotes they match, and footnotes they do not match get the default format (the same as 0.3.0). Rules without a selector (`::footnote-call`, `*::footnote-call`) apply to all footnotes. How the marker at the start of the footnote body is placed (`list-style-position` of `::footnote-marker`) is also decided per footnote. Before, one format for the whole document was used for every footnote
72
+ - **Continuation pages for footnotes and floats** (changes the typeset result only for documents whose continuation of footnotes and floats after the body runs beyond 50 pages): the pages added after the end of the body for the continuation of footnotes and floats are no longer cut off at 50 pages; pages are added until the continuation has been placed (0.3.0 dropped what went beyond 50 pages; in single-column flows and multicol alike). When no progress is made because footnotes or floats cannot be placed on any page (what is carried over does not change for 3 pages in a row), it stops, with a warning giving the number of footnotes and floats dropped. As a safeguard, the number of pages is limited to twice the sum of the number of indivisible units (lines and boxes without children) of the footnotes carried over and the number of floats carried over (not less than 50 pages). The effort of splitting a long footnote onto continuation pages is now proportional to the size of the footnote (it was quadratic in the number of lines: a footnote of 40,000 lines (200KB) took 218 s, and now takes 2.3 s). Splitting a footnote with a very large number of lines (such as 200,000) no longer stops with an exception (RangeError) (a bug since 0.3.0)
73
+ - **Border widths of the default style** (changes the typeset result for borders whose width is not a whole number of px, in HTML documents typeset with the default style `kumiori`): border widths are not snapped to pixels (a `0.3pt` line is drawn 0.3pt wide and a `1pt` line 1pt; a PDF has no screen pixels). Before, as in browsers (Chrome), widths under 1px were rounded up to 1px (0.75pt) and wider ones were floored to whole px. The styles that follow browsers (`browser`, `browser-margin`, `vivliostyle`) still round. In documents with many thin borders, line positions and page breaks change (the English conformance guide goes from 127 to 125 pages)
74
+ - **hsl() and hsla() in XSL-FO** (changes the typeset result only for XSL-FO documents typeset in compatibility mode (`--compat antenna`) that use `hsl()` or `hsla()` for colors): these Antenna House extension color functions are read (only a hue without a unit (degrees) is read, and values with a unit (`deg`, `turn`, `rad`, `grad`) are reported as unreadable colors; saturation, lightness and alpha are 0%–100% or 0.0–1.0). Before, they were dropped as unsupported colors. In spec mode they are reported as values read only with the compatibility option
75
+ - **The lh unit in XSL-FO** (changes the typeset result only for XSL-FO documents that use `lh` in lengths): in compatibility mode (`--compat antenna`), any length (`space-before`, `space-after`, `margin-*`, positions, sizes and so on) is read relative to the line height of the element (`font-size` is relative to the parent's line height; it cannot be used in `line-height`, which is not read and is reported; before, only border widths were read, and other lengths were dropped as unsupported). As `lh` is not a unit of XSL 1.1, in spec mode it is not read and is reported (before, border widths were read)
76
+ - **Warnings for missing targets** (no change to the typeset result): warnings for missing targets of page number references (`target-counter()`, `fo:page-number-citation`) and bookmarks are grouped into one line per kind (the count and the first 10 ids). Before, one line per id was given, which came to thousands of lines in documents with many references to missing targets
77
+ - **Condensing in XSL-FO (overflow="condense")** (changes the typeset result only for XSL-FO documents typeset in compatibility mode with `overflow="condense"` on `fo:block-container`): this Antenna House extension is read. When the content exceeds the height to fit in, the font size or the line height is reduced to fit, by the methods of `axf:overflow-condense` (`font-size` (default), `line-height`). The height to fit in is the height of a container whose `height` or `max-height` is definite (also in table cells, list item bodies and `fo:static-content`, and in absolutely positioned containers; `min-height` if `max-height` is less than `min-height`). A container of indefinite height is fitted into the body area (one page) if it is a keep-together container in the body flowing onto pages; otherwise it is not condensed and a warning is given. Font sizes given as absolute values inside are not changed (a font size written on the container itself is condensed). Inner condensing containers are not changed by the outer condensing. Nor are the font size and line height of elements with `axf:overflow-condense="none"` (`fo:inline`, `fo:block` and so on) and their content. Lower limits are `axf:overflow-condense-limit-font-size` (a length) and `-limit-line-height` (a ratio to the font size), with an initial value of 0. A method with a lower limit reduces down to the limit, and if the content still does not fit at the end, it is left overflowing with a warning (with `hidden` or `error-if-overflow` after the limit, it is clipped, with the box height set to `height`, or without it to the height to fit in, but not less than `min-height`; `repeat` is reported as unsupported). A method without a lower limit that cannot make the content fit at all does not reduce (if no method makes it fit, it is left overflowing with a warning). `axf:overflow-condense` (except `none`) and `-limit-*` are inherited by child elements. In nested condensing, the result of condensing the same container under the same conditions is reused, and the number of content measurements made for the inner containers is limited per outermost condensing container (the larger of 10,000 and 40 times the number of nodes inside that container; ordinary nesting of two or three levels does not hit it however many inner containers there are). When the limit is hit, the remaining containers inside that container are laid out without condensing, and one warning is given only if containers that do not fit because they were left uncondensed this way remain in the result placed on the pages (other outermost containers are still condensed; condensing containers in static content laid out on every page are counted afresh on each page, so they do not hit the limit however many pages there are). Before, it was unsupported and the content overflowed. Condensing in vertical writing, `font-stretch`, `letter-spacing` and condensing in `fo:inline-container` are reported as unsupported. In spec mode it is not read and is reported
78
+ - **Breaks and span="all" in XSL-FO multi-column containers** (**changes the typeset result** only for XSL-FO documents with `page`, `even-page` or `odd-page` of `break-before` / `break-after`, or `span="all"`, inside an `fo:block-container` with `axf:column-count` (the Antenna House extension for multi-column layout); in spec mode and in compatibility mode): (1) `page`, `even-page` and `odd-page` inside the columns are page breaks (XSL 1.1 §7.20.1, §7.20.2, §4.8: the first (last) area generated by the FO is placed first (last) on a page). Before (since 0.3.0), `page` was a column break to the next column on the same page, and `odd-page` and `even-page` went to the next page without a blank page (of the wrong parity) when the current page already had the requested parity, and to the next column on the same page otherwise. Now the remaining columns are left empty and the content continues in the first column of the next page (a blank page is inserted when the parity does not match, and the page master with `blank-or-not-blank="blank"` applies to it), and the column set before the break is not balanced. Page breaks in `break-before` of the first child and `break-after` of the last child of the multi-column container become breaks before and after the container (before, they had no effect). Inside a multi-column container with a fixed height (which cannot continue across pages), they are column breaks (before, `odd-page` and `even-page` left columns empty for the blank page, and the content after them overflowed the box and was lost) (2) Blocks with `span="all"` are placed across the width of the container and split the columns before and after them also in multi-column containers that continue across pages (before, only containers that fit on one page were split, and in containers that continued across pages they were placed inside a column). `span="all"` inside nested blocks is also brought up directly under the container and takes effect (following the product's samples; before, it had no effect, and in spec mode, where the content of the container is wrapped in a block for the container's indents, `span="all"` on its children did not take effect either). The pieces of the split blocks and containers are treated as continuations of the same FO (`id` is kept on every piece, and `fo:page-number-citation-last` gives the page of the last piece; `text-indent` applies only to the first line of the first piece). `break-before="column"` at the head of the first column of a new column set does not leave a column empty (the break condition is already satisfied) (3) Multi-column layout with `column-count` on `fo:region-body` already followed these rules and does not change
79
+ - **keep-together and the spaces at the start and end of columns in XSL-FO multi-column containers** (**changes the typeset result** mainly for XSL-FO documents that use an `fo:block-container` with `axf:column-count` / `column-count` (the Antenna House extension for multi-column layout), in spec mode and in compatibility mode. The changes for HTML multi-column layout, multi-column layout of `fo:region-body` and XSL-FO documents without multi-column layout say so at the start of the line. How fitting in a single column is measured, and other details, are in the "Multi-Column Layout" section of `docs/en/xslfo-import.md` and section 12.3 of the HTML and CSS volume of the Conformance Guide):
80
+ - when balancing the columns of a multi-column container, a block, block-container or table with `keep-together.within-column="always"` (also `within-page` and `keep-together="always"`) is not split across two columns if it fits in a single column (before, balancing lowered the columns and broke it at the column boundary: a container holding only a four-line block went from 2 + 2 lines to 4 lines in the first column; XSL 1.1 §7.20.3). Content that does not fit in a single column is still split and stays on the page as before
81
+ - `space-before` / `space-after` with `conditionality="discard"` (the default) at the start and end of the columns of a multi-column container are discarded (the columns are treated as reference areas; XSL 1.1 §4.3.1, §6.5.3): in a container starting with `space-before="10pt"`, the first line of the first column sat 10pt lower than that of the second → at the same height. `space-after="20pt"` of the last block of a column is discarded, and the block after the container moves up by 20pt. `retain` spaces, `margin-top` and `margin-bottom` are kept as before
82
+ - the same spaces are discarded at the start and end of the area of a block with `span="all"` in a multi-column container (before, `space-before` / `space-after` around the span block and `space-before` at the head of the following column set were kept: a span block surrounded by 10pt spaces moves up by 10pt, and the first line of the column after it, with `space-before="8pt"`, by 28pt)
83
+ - a `discard` `space-before` of a multi-column container moved to the head of the next page because little room is left on the page is discarded (before, it was kept at the head of the next page: a container with `space-before="10pt"` moves up by 10pt; XSL 1.1 §4.3.1)
84
+ - when checking whether the line at the head of a column of a multi-column container fits, the space discarded there is not counted (before, balancing made the columns taller by that space: a container with three lines and a three-line block with `space-before="20pt"` went from 56pt to 36pt high). This also fixes the last row of a table split across two columns sometimes disappearing (a four-row table in compatibility mode, with `space-before` on the blocks in cells with borders, went from 2 + 1 rows and a warning to 2 + 2 rows)
85
+ - HTML multi-column layout (`columns`; every style): a block or table with `break-inside: avoid` / `avoid-column` is not split across two columns by balancing if it fits in a single column (before, it was split: a four-line block with `break-inside: avoid` went from 2 + 2 lines to 4 lines in the first column; CSS Fragmentation 3 §3.3). Content that does not fit in a single column is still split as before
86
+ - HTML multi-column layout with `--style ah`: the space discarded at the head of a column (`margin-top` of `p` and the like) is not counted when checking whether a line fits in the column (before, lines sometimes overflowed the balanced columns and disappeared, with the warning that the content does not fit in the multi-column container: a nine-line paragraph in three columns went from 2, 3 and 2 lines (two lines lost) to 3, 3 and 3 lines)
87
+ - multi-column layout of `fo:region-body` (`column-count`): `margin-bottom` of a block with `span="all"` is kept in compatibility mode too (it was discarded: after a span block with `margin-bottom="10pt"`, the lines of the columns move down by 10pt; spec mode keeps it as before)
88
+ - XSL-FO documents without multi-column layout: a `space-before` of the first block of the flow, discarded at the head of the page, is not counted when checking whether a line fits on the page (before, the bottom of the page was left empty by that space and lines were moved to the next page: a 16-line paragraph starting with `space-before="100pt"` went from 13 + 3 lines on two pages to one page; XSL 1.1 §4.3.1)
89
+ - **XSL-FO drop caps (`axf:initial-letters`)** (new feature; **changes the typeset result** only for XSL-FO documents with `axf:initial-letters`, in both the spec and the compatibility mode): the Antenna House drop-cap extension is now read (before, it was reported as unsupported, the letter was not enlarged, and a leading image stayed at its own size in the line). The first letter of an `fo:block` (with the punctuation around it; a word-initial Dutch `IJ` counts as two letters) or its first image is set several lines tall at the start of the line, and the following lines flow beside it, with the same mechanism as HTML `initial-letter`. Values read: the number of lines (`<number>`), a length (`<length>`), the number of lines to sink (`<integer>`, `drop`, `raise`), `adjacent` and `<integer2>` (also indent lines after the drop cap) of `axf:initial-letters`; `axf:initial-letters-end-indent` (space after the drop cap per line), `-first-line-head-height` (`cap-height`, `x-height`, `auto`: align to the x-height when lowercase small caps follow), `-width`, `-text-align`, `-color`, `-leading-punctuation="hide"` and `-leading-punctuation-position="hang"` (the `dcem` and `ic` units in these lengths are read in every mode). The `text-indent` of the block holding the drop cap shifts the drop-cap box (the `dcem` unit is read only in the compatibility mode; the spec mode reports and ignores it). Blocks after a block shorter than the drop cap's lines are also indented beside the drop-cap box (with `adjacent` too, as far as the box reaches); a block with a gap (`space-before`, `space-after` and so on) between it and the previous block, and a block with `clear`, is moved below the drop-cap box. Right-to-left horizontal text puts the drop cap at the right edge, and vertical writing is also set. Nothing happens when an `fo:block` with `axf:initial-letters`, an `fo:inline-container` and similar come before the letter, or when `text-align` is other than `start`, `left` or `justify`. Not supported (reported as warnings): the size and color of leading punctuation (`<length>` and `<color>` of `-leading-punctuation`), intruding it (`intrude` and the length of `-leading-punctuation-position`), `-leading-punctuation-shift`, `axf:initial-letters-start-intrusion="first-line"`, and ruby as the first letter. The descender of the letter (the part of g below the baseline) is not counted in the height of the drop-cap box. A `space-before` that is discarded at the head of a page, a column or a table cell (`conditionality="discard"`) is not counted for the position of the drop-cap box either, as for the lines (the box is not placed lower than the lines by the discarded space)
90
+ - **initial-letter and floats at the head of a column** (changes the typeset result only for HTML documents typeset with `--style ah` that have `initial-letter` or a float in a paragraph with `margin-top` at the head of a column in multi-column layout, and HTML documents in any style that have a float in the first paragraph, with `margin-top`, of a list item (`li`)): the `margin-top` discarded at the head of the column or of the list item is not counted for the position of the initial letter box and the float either, as for the lines (before, only the initial letter box and the float were moved down by the discarded margin and did not line up with the lines; in a list item, the item marker was moved down to the height of the float too)
91
+ - **Absolutely positioned boxes in multi-column layouts** (**changes the typeset result** only for documents with an absolutely positioned box inside a multi-column layout: XSL-FO `fo:block-container` with `axf:column-count` or `column-count` and `fo:region-body` with `column-count`, and HTML `position: absolute` inside `columns`): each trial layout that balances the columns added the box to the page, so the same box was drawn many times (about ten) on top of itself; it is now placed once (since 0.3.0)
92
+ - **Speed and memory** (no change to the typeset result): less memory for typesetting XSL-FO documents of thousands of pages. (1) The layout passes repeated to settle page number references (tables of contents and so on) no longer turn the pages into the area tree; only the pass that settles is turned into the area tree (previously every pass built the area tree of the whole document, and the next pass was laid out while the previous tree was still held). (2) When the area tree is built, the intermediate layout tree of each page is released as soon as the page has been turned into areas. (3) When reading FO, the "attributes read" remembered for each element are limited to the attributes written on the element (previously the names of all properties the importer asked for were remembered for every element, including those not written). (4) Leader dots aligned to a grid (`leader-alignment`) no longer copy empty margins and borders for every dot. (5) In the intermediate layout tree, the drawing data of a glyph (character, font, size, colour, position) is shared among glyphs with the same data, and the fields of a glyph node fit inside one object (about 370 → about 200 bytes per glyph). (6) Glyph areas without decorations are built without the fields that have no value (`backgroundColor`, `sourceId`) (about 336 → about 312 bytes per glyph; the Area Tree written as JSON does not change). (7) The Node command, with `typesetToPdf`, writes the PDF page by page and releases the intermediate layout tree of each page once it is written (it never holds the area tree of the whole document; the area tree of a page is built twice, once to collect the fonts and images used and once to draw it). The result of `typeset` (`areaTree`, `toPdf`, `renderPage`) still holds the area tree of the whole document. The command's report "layout N ms" no longer includes the time to turn the pages into area trees (it is part of writing the PDF). Typesetting the FO of the PostgreSQL documentation (37.7MB, 3,231 pages) with the command: previously it stopped at Node's default heap limit, and could be typeset once the limit was raised to 13GB (maximum heap in use, including garbage not yet collected, about 9.4GB; layout time 199 s). Now it can be typeset with a 3GB heap limit (maximum live heap after GC about 2.3GB). With a 4GB limit, the total time is 160 s. The PDF is the same apart from the creation date (and the document ID derived from it). (8) When writing the PDF, the operators of each finished page are turned into the compressed bytes they are saved as, and released (previously the operators of every page were kept as small objects until saving). The PDF is the same, down to the compressed bytes. Typesetting the same document with `typeset` and calling `toPdf`: maximum live heap about 3.2GB → about 2.8GB (what writing the PDF adds goes from about 0.4GB to about 0.03GB). (9) Images: an image in a file passed with the document is no longer kept twice; once it has been copied into the image store, the read contents of the file are dropped (this frees memory for files whose contents are given as a function, as the command does). When only the PDF is made (the command, `typesetToPdf`), the image store's contents of each raster image are also dropped once it has been embedded in the PDF (if the same contents are referred to in other ways, not until the last reference has been embedded; SVG is kept; an image an SVG refers to from inside is kept until that SVG has been embedded, and if there is an SVG with foreignObject or a use pointing at an external SVG, all are kept to the end; a dropped image does not become an unreadable image when laid out again). Typesetting a 240-page FO with 240 images (570MB in all) with the command: maximum resident set size about 2.57GB → about 1.62GB (`--low-memory`: about 2.70GB → about 1.70GB; `typeset` and `toPdf`: about 2.02GB). The PDF is the same
93
+ - **Images embedded in the PDF** (no change to the typeset result): when the same image file is referred to in different ways (upper and lower case, `./`, references with `#…`, paths from other directories, CSS `url()` and `img`, inside and outside SVG), the image is embedded in the PDF only once, and the same image is drawn everywhere (ISO 32000-2 §8.8, §8.9.5). Before, it was embedded again for each reference. The PDF gets smaller, and where and how images are drawn does not change. Different files with the same contents are still embedded separately
94
+ - **Translucent text colors in HTML** (changes the typeset result only for HTML documents that use colors with alpha (`rgba()`, `hsla()`, `#rrggbbaa` and so on) for text, text decoration lines, emphasis marks or ruby): text is drawn with its alpha, over what is below (CSS Color 4 §4.2, §5; ca and CA of the PDF ExtGState). The same goes for the text color of margin boxes. Before, it was drawn as an opaque color mixed with white paper, so on a colored background the background did not show through and the text looked whitish. This is the behavior of PDF/X-4 and output other than PDF/X (how translucent text is drawn in PDF/X-1a and X-3, which do not allow transparency, depends on transparency flattening)
95
+ - **Transparent text color** (changes the typeset result only for HTML documents that set `color: transparent` (or a color with zero opacity, such as `rgba(…, 0)` or `#rrggbb00`, or one whose opacity is 0 in 8 bits, such as `rgba(…, 0.001)`) for text): text in a color with zero opacity is not drawn (it still takes up space, and text positions and line breaks do not change; CSS Color 4 §4.1, §6.3). Text in colors whose opacity becomes 0 in 8 bits (such as `rgba(…, 0.001)` or `rgb(… / 0.1%)`), which would be invisible if drawn, is not drawn either (nor are text decorations, emphasis marks and ruby in such colors). Underlines, borders, emphasis marks and so on that use `currentColor` are not drawn either (§6.4). If a child sets `color` again, it is drawn in that color. Before, a color with zero opacity was treated as not specified, and the text was drawn in the parent's color (an error from before 0.3.0). As `background-clip: text` is not supported, with styles that paint text with the background (such as a gradient), the background fills the whole box and the text is not drawn (before, text in the parent's color appeared over it)
96
+ - **Paint-only effects of fixed-position boxes and margin boxes** (changes the typeset result only for HTML documents that set `transform`, `opacity`, `outline` or `clip` on `position: fixed` boxes, or `outline` on margin boxes or `@page`): the transform, opacity, outline and clip of fixed-position boxes are drawn on every page where the box appears (CSS 2.1 §9.6.1, §11.1.2; CSS Transforms 1; CSS Color 4 §3.3; CSS UI 4 §3). Before, the copies made for each page did not get the effects: transform and opacity were silently dropped, and outline and clip were reported as unsupported. Outlines of margin boxes and `@page` are drawn the same way as for document elements (they follow the rounded corners of margin boxes; before, they were drawn as separate border-only boxes, and margin-box outlines were reported as unsupported although they were drawn)
97
+ - **PDF/X-1a** (`pdfx: { version: 'X-1a' }` and `'X-1a:2003'` in the API, `--pdfx x1a` and `x1a:2003` on the command line): PDF/X-1a (CMYK and spot colors only, no transparency), long used by Japanese printers, can now be written. :2001 is PDF 1.3 (`GTS_PDFXVersion` `PDF/X-1:2001` and `GTS_PDFXConformance` `PDF/X-1a:2001` in Info), :2003 is PDF 1.4. No XMP is written, and a registered printing condition name is enough (a profile, if given, must be CMYK). The written PDF is read back and checked against the rules known from public descriptions (version, encryption, markers, output intent, boxes, color spaces, transparency, font embedding, annotations within the bleed area), and an error is thrown if it does not meet them. Not checked against the text of the PDF/X standards (ISO 15930-1, -4)
98
+ - **Transparency flattening for PDF/X-1a and X-3**: transparency (CSS opacity, colors with alpha, images with alpha, translucency, masks and blend modes in SVG) is replaced with opaque objects, keeping the appearance as far as possible. When only a single-color fill (the background of a rectangular or rounded box, rotated ones included, or the white page) lies under a transparent object, the CMYK color is computed with the Normal compositing formula (ISO 32000-2 §11.3.3) and the object is drawn as an opaque vector object (text stays text). Otherwise the area is rasterized together with what lies under it into a CMYK image (300ppi; 600ppi where text under 12pt is involved), with a warning (images of glyphs on the same line are merged into one; a warning also says when text within rasterized areas loses quality and can no longer be selected as text). An error is thrown if transparency that cannot be flattened remains (such as transparency of color glyphs; PDF/X-4 is suggested). Overlapping areas are composited in CMYK (as in printing), so they look slightly different from screen viewers that composite in RGB. PDF/X-4 and non-PDF/X output keep transparency
99
+ - **Changes in PDF/X-3 output** (only for documents that use transparency or contain grey-only images): transparency is flattened (see above) instead of being kept with a warning. Transparency that cannot be flattened is an error instead of a warning. The written PDF is read back and checked against the PDF/X-1a rules with the ban on device-independent color (ICCBased, Lab, CalRGB, CalGray) lifted, and an error is thrown if it does not meet them
100
+ - **Grey-only images in PDF/X** (only for PDF/X-1a, X-3 and X-4 output of documents with grey-only images): images whose pixels are all R = G = B (RGB and RGBA PNGs, 16-bit and 1-bit grey PNGs, grey + alpha PNGs, RGB JPEGs) are embedded as DeviceGray images instead of DeviceRGB (the same tones; ISO 32000-2 §8.6.4.2). They used to be written as DeviceRGB (a bug since 0.3.0), leaving RGB images in PDF/X
101
+ - **Development** (typesetting results do not change): when run from npm, `npm run ci:local` runs the npm main script (`npm_execpath`) directly with the Node that runs the script, without a shell. On Windows too, `npm.cmd` is not run and the arguments are passed as they are, so the deprecation warning from Node 24 about passing an argument list to a shell does not appear. In the node-min job, npm also runs on the same Node when the lowest supported Node is put first in PATH. When run directly as `node scripts/ci-local.mjs`, the `npm` in PATH is called as before
102
+ - **Security and robustness against crafted input** (protection of time and memory when typesetting documents written by others on a server; typesetting results of valid documents do not change; limits and their grounds are in the source comments):
103
+ - Regular expressions that took time quadratic in the input length now read the text once from the front: `width` and `height` in the start tag of SVG images (long runs of spaces), grid `repeat()` (a `repeat(` without a comma and long runs of spaces), and runs of unclosed `url(` (computed lengths of `filter`, `box-shadow` and the like, `background` of `@page`, `background-position`, and XSL-FO `axf:printer-marks`; an unclosed `url(` ends at the end of the value: CSS Syntax 3 §4.3.6)
104
+ - Deeply nested math functions such as `calc()` (in computed values of `filter`, `box-shadow`, `grid-template-columns` and others) took time proportional to depth × length and overflowed the stack, so the whole document could not be typeset
105
+ - The selector before `::footnote-call` and `::footnote-marker` is matched with the same matcher as the cascade (short selectors over deep nesting or many siblings took exponential time). The memo for matching selectors that mix combinator kinds has a total budget per cascade; once it is spent, such selectors are not applied and a warning is given (valid documents do not reach it)
106
+ - Paragraphs with many line breaks around comments, tables with many `rowspan="0"` cells, documents with many named pages and track lists with large `repeat()` counts are typeset in time proportional to their size
107
+ - Documents with many `span="all"` blocks deep inside nested blocks of a multi-column container (XSL-FO `axf:column-count`): the number of fragments made to lift the spans out is limited; spans beyond the limit are set within the columns and reported by the importer
108
+ - When an SVG filter is approximated with shapes, the number of clipping rectangles for primitive subregions and the number of layers no longer grow exponentially with stacked `feComposite` and `feMerge` (with too many layers, the approximation is dropped and the filter is computed in pixels)
109
+ - When flattening transparency for PDF/X-1a and X-3: the 72 ppi floor of the rasterization resolution is gone, and the pixel limit of one image is always kept (very large pages made images of billions of pixels. **Typesetting results change** only for large pages where rasterizing the whole page exceeds the limit: the resolution goes below 72 ppi, and the lowered resolution is reported in the warning. An area beyond the limit even at 1 ppi is an error, since it cannot be rasterized). The objects under a translucent object are looked up through a grid index of the page (each translucent glyph walked all objects drawn on the page)
110
+
7
111
  ## 0.3.0 (2026-11-16)
8
112
 
9
113
  A release that adds draw.io diagrams, plugins that add image formats, PDF/X-4 and more, and widens what SVG can draw. While in 0.x, it is a minor release because it includes fixes that change typesetting results.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,110 @@
4
4
 
5
5
  版の番号は [セマンティック バージョニング](https://semver.org/lang/ja/) に従います。0.x の間は、互換の無い変更も minor の版 (0.2.0 など) で出すことがあります。
6
6
 
7
+ ## 0.4.0 (2026-11-19)
8
+
9
+ - **左右の `margin` が `auto` の箱の寄せ方** (HTML のどのスタイルでも。**組版の結果が変わる**): 余白を、読み込みのときの包含ブロックの幅の見積もりから長さにしていたので、表のセルの中 (見積もりは表の全体の幅に近い) では、列の幅を決める内容の幅にその余白が入り、その列が表の幅のほとんどを取ってほかの列が最小の幅まで縮んでいた (`<td align="center">`・`<center>` の中の、幅の決まった箱も同じ)。置く場所が見積もりより狭いと、余白が縮まずに箱がはみ出してもいた。余白は組むときに置く場所の幅から配り、内容の幅を測るときは 0 とする (CSS 2.1 §10.3.3・§10.3.7・§17.4・CSS Sizing 3 §5.1)。ほかに変わる所: (1) 罫線を重ねる (`border-collapse: collapse`。既定のスタイル `kumiori` の表もこれ) 幅の決まった表を `margin: 0 auto`・`align="center"` で寄せると、外枠の罫線の太さほど右へ動き、左右の空きが同じになる (前は、外へ出る罫線の分だけ左に寄っていた。`border="1"` の表で 0.75pt、6pt の外枠で 6pt) (2) `margin-left: auto` だけの表と、`left`・`right`・`width` の決まった絶対配置・固定配置の箱は、右に寄る (前は左のまま) (3) float の表と `display: inline-table` の表は、auto の余白で寄せない (前は中央に寄せていた。CSS 2.1 §10.3.5・§10.3.9 では auto の余白は 0) (4) 右から左 (`direction: rtl`) の中の、置く場所より広い箱・表は、左へはみ出す (前は右へはみ出した。§10.3.3 の決まりで auto の余白が 0 になり、`margin-left` を決め直す。Chrome と同じ) (5) 縦書きの親の中の箱は、`margin-top`・`margin-bottom` の auto で上下の中央に寄せる (前は左右の auto を読んでいた) (6) 幅の違うページ (`:first` など) へまたぐ箱・表の続きは、そのページの幅で寄せ直す (前は、最初のページの余白のまま置いた)
10
+ - **百分率の基準** (HTML のどのスタイルでも。**組版の結果が変わる**): `width`・`max-width`・`min-width`・`padding`・`margin`・`text-indent` の百分率 (百分率を含む `calc()` も) を、読み込みのときの包含ブロックの幅の見積もり (ふつうの流れのブロックの分しか引かない) で長さにしていたので、float・inline-block・絶対配置の箱・flex と grid の項目・段組の段・表のセルの中では、その外の箱の幅が基準になり、箱がはみ出していた (`columns: 2` の段の中の `width: 50%` の箱が段の幅いっぱい、幅 100pt の grid の列の中の `width: 50%` が 150pt)。`page` で名前付きのページ (`@page body { margin: … }`) を指定した要素も、名前の無い `@page` の領域の幅が基準になっていた。いまは、組むときに、箱を置く実際の包含ブロックの幅で解く (CSS 2.1 §10.2・§8.3・§8.4・§10.4・CSS Paged Media 3 §10.1。縦書きの中の `padding`・`margin` は包含ブロックの高さが基準: CSS Writing Modes 4 §7.2。余白の箱の中は、余白の箱が基準)。中身の幅を測るときは、百分率の幅は auto、`padding`・`margin`・下限は 0、上限は none とする (CSS Sizing 3 §5.2.1)。ほかに: (1) 画像の `width`・`max-width` の百分率も、行を組む箱の幅で解く (既定のスタイルの `img { max-width: 100% }` が、grid の列・段組の段の中で効く。前は本文の幅で解き、列からはみ出していた) (2) 自動の配置の表のセルの中の `width="100%"` の表・画像は、外の表を広げない (前は、そのセルの列をページの幅近くまで広げていた。ブラウザと同じ) (3) `column-width` からの段の数と、`column-gap` の百分率も、組むときの幅で決める (幅 110pt ほどのセルの中の `columns: 40pt` が 3 段 → 2 段) (4) 本文の中の、ふつうの流れのブロックの百分率は、前と同じ
11
+ - **ページごとに違う余白と、固定配置の箱** (HTML のどのスタイルでも。**組版の結果が変わる**: `:first`・`:left`・`:right`・名前付きのページで、余白か大きさの違うページのある文書だけ): 百分率の幅・余白と、固定配置 (`position: fixed`) の箱の位置と大きさを、名前の無い `@page` の領域で決めていたので、余白の広い `:first` のページでは `width: 100%` の箱と固定配置の箱が本文の領域からはみ出していた。箱を置くページの領域で決め、ページをまたいだ箱は、断片ごとにそのページの幅で決める (CSS Paged Media 3 §3・CSS Fragmentation 3 §5.1。固定配置の箱は、ページごとに置き直す)
12
+ - **中身の幅 (min-content・max-content)** (HTML のどのスタイルでも。**組版の結果が変わる**): 中身の幅で大きさの決まる箱 (自動の配置の表の列・float・inline-block・`width: max-content` など) で、次のものを数え違えていた。(1) 自動の配置の表のセルの中の、幅を長さで書いたブロックを、その箱の幅でなく中の行の長さで数えていた (箱がセルからはみ出していた)。箱の外側の幅 (幅と余白) を数える。百分率の幅は auto として数え、長さの `max-width`・`min-width` は中身の幅を抑える (CSS Sizing 3 §5.1・§5.2.1) (2) セルの中のリスト (`ul`・`ol`・`display: list-item` の要素) の最大の幅を、測る行の長さいっぱい (表の幅いっぱい) と数えていたので、ほかの列が最小の幅まで縮んでいた。字下げと項目の中身の幅で数える (記号の有無で変わらない) (3) inline-block の幅を、float と同じ shrink-to-fit で決める (中のリストが、ページの幅いっぱいになっていた) (4) grid の容器の中身の幅を、長さの列と、fr・auto の列の中身の幅から決める (float の中の grid が、ページの幅いっぱいになっていた) (5) `text-align-last: justify`・`text-align: justify-all` の段落の中身の幅に、両端揃えで広げた長さを数えない (均等割りの見出しのセルが、表の幅いっぱいになっていた) (6) 高さが auto の縦書きの inline-block は、中身の長さになる (前は、中身より長くなっていた)。XSL-FO の表の列の幅は変わらない
13
+ - **区切り (`break-before`・`break-after`・`break-inside`) の伝え方** (HTML のどのスタイルでも。**組版の結果が変わる**: 区切りを書いた文書だけ): CSS Fragmentation 3 §3.1.1 のとおり、表・flex と grid の行・段組の外へ伝える。(1) 表: セルの中身の最初の子の `break-before`・最後の子の `break-after` を行の前・後ろの区切りに (前は読まなかった。Chrome と同じ)、最初の行の前・最後の行の後ろの区切りは表の前・後ろの区切りにする。`tr` と、`thead`・`tbody`・`tfoot` の区切りと `break-inside: avoid` も読む (前は、最初の行・最初の `tbody` の `break-before`、最後の行の `break-after`、`tbody` の間の区切りが効かなかった)。`thead` のある表で、本体の最初の行 (`tr`・`tbody`・セルの最初の子) の強制の区切りは、見出しごと表を次のページから始める (前は、`tr`・`tbody` では区切らず、セルの最初の子では見出しだけを前のページに残した) (2) flex・grid: 項目の `break-before`・`break-after` は、その項目のある行の前・後ろで区切る (前は、grid の項目の `break-before` で、その項目だけを次のページへ送り、flex の項目の `break-after` は効かなかった)。項目の `break-inside: avoid`、最後の項目の `break-after: avoid` も効く (3) 段組: 中の `break-before`・`break-after` の `page`・`left`・`right` は、次のページの最初の段へ送る (前は、`page` は同じページの次の段へ送り、`left`・`right` は、いまのページが指定と同じ側なら白ページを入れずに次のページ (逆の側) へ、違う側なら同じページの次の段へ送った)。段組の最初の子の区切りも、段組の前の区切りにする。釣り合わせる段組で、分けられない塊が段の境目に来ても、段の高さはページの残りの高さまで (前は 1 段目がページの下へはみ出した) (4) 同じ区切りの所の `left`・`right` の指定は、後ろの要素の値で 1 度だけ効かせる (CSS Fragmentation 3 §4.3。前は両方を効かせ、白ページが余分に入った: `break-after: left` と `break-before: right` で 4 ページ → 3 ページ)
14
+ - **名前付きのページ (`page`) と、ページ番号の振り直し** (HTML のどのスタイルでも。**組版の結果が変わる**: 下の書き方をした文書だけ): (1) `body`・`html` の `page` を読み、文書の最初のページからそのページにする (CSS Paged Media 3 §8.1。前は読まなかった) (2) リストの項目 (`li`) の `page` でもページを切り替える (3) ページを切り替えられない所 (表の行、flex・grid の項目、段組・表のセルの中の箱など) の `page` は、黙って無視せず、未対応の CSS として警告に出す (4) `body`・`html` の `counter-reset: page` を、最初のページの番号にする (前は読まなかった) (5) 同じ名前のページが続く所でも、`page` に前と同じ名前を書いた箱に、強制の改ページと `counter-reset: page` があれば、ページ番号を振り直す (前は振り直さなかった。`page` を書かない箱 (名前の無いページの中) の `counter-reset: page` では、これまでどおり振り直さない) (6) `page` を書かない文書でも、`body` の最初の中身が要素で包まない字のとき、次のブロックを 2 ページ目へ送っていた (1 ページに組む) (7) HTML では、ページ番号の振り直しのために白ページを入れず (CSS Paged Media 3 §6.1 の page のカウンターに、白ページを入れる決まりは無い。白ページを入れるのは `break-before`・`break-after` の `left`・`right`・`recto`・`verso` だけ: CSS Fragmentation 3 §3.1)、左右のページ (`@page :left`・`:right` の選び方、`left`・`right`・`recto`・`verso` の区切りの白ページ、`float`・`text-align` の `inside`・`outside`) を、ページ番号の偶奇でなく、文書の最初からのページの順 (何枚目か。白ページも 1 枚と数える) で決める (CSS Paged Media 3 §3.3: 左右のページは交互に来て、最初のページは右ページ。縦書き (`vertical-rl`) の文書は左ページ。横書きの右から左 (`direction: rtl`) の文書も右ページから組む。§3.3 では左ページから)。ページ番号を振り直しても、見開きの左右は変わらない。0.3.0 は、名前の違うページへ切り替えて番号を振り直すとき、振り直した番号の偶奇に合わせる白ページを、前のページの続きの終わりに入れ (1 ページ目の次を 5 ページ目にすると「1 | 白 | 5」→「1 | 5」。5 は 2 枚目なので、左ページ)、左右をページ番号の偶奇で決めていた。**組版の結果が変わる**: ページ番号を振り直す文書は、振り直しのための白ページが無くなり、振り直した後のページの `:left`・`:right` と、`left`・`right` の区切りの白ページが変わる (ページ数は減ることが多いが、増えることもある。番号を 4 に振り直す `break-before: right` は「1 | 白 | 白 | 5」→「1 | 白 | 4」)。最初のページの番号を偶数にする文書 (最初の要素の `counter-reset: page 2` など) は、文書の全部のページの左右が入れ替わる (最初のページを、左ページでなく右ページで組み、その後も交互に組む)。文書の頭の `break-before: right` の前には白ページを入れなくなり、後ろの `left`・`right` の区切りでは、白ページの入る所が変わる (最初の要素の `counter-reset: page 2` と、後ろの `break-before: right` の文書は、2 枚 → 3 枚)。ページ番号を振り直さない文書は変わらない。互換のスタイル (`--style ah`・`weasyprint`・`vivliostyle`) と XSL-FO は、これまでどおり (振り直しの前に白ページを入れ、左右はページ番号の偶奇で決める)
15
+ - **grid の列 (`grid-template-columns`)** (HTML のどのスタイルでも。**組版の結果が変わる**: grid を使う文書だけ。列の幅の決め方の詳細は、対応仕様説明書の HTML と CSS 編の 13.2):
16
+ - 列の長さの `em`・`rem`・`calc()` と、`minmax()` の中の相対の長さを、計算値で絶対の長さにする (前は、その列を `1fr` として等分した: 字の大きさ 10pt・幅 300pt の `5em 1fr` が 150 + 150pt → 50 + 250pt。CSS Values 4 §6)
17
+ - `0fr` を `1fr` にせず、fr の係数の和が 1 未満なら、残りの場所のその割合だけを分ける (幅 300pt の `0.2fr 0.3fr` が 120 + 180pt → 60 + 90pt。CSS Grid 1 §12.7.1)
18
+ - `repeat(auto-fill, minmax(100px, 1fr))` の回数を、容器の幅から数える (幅 300pt で、100pt の 3 列 → 75pt の 4 列。CSS Grid 1 §7.2.3.2)
19
+ - 線の名前 (`[a]` など) を列に数えない (前は `1fr` の列として数えた: 幅 300pt の `[a] 100pt [b] 1fr` の 2 つの項目が 50pt と 100pt → 100pt と 200pt)。`minmax(min(100%, 200px), 1fr)` のような、関数の中にカンマのある `minmax()` も読む (CSS Grid 1 §7.2)
20
+ - 最大が長さの `minmax()` の列は、その長さまで先に伸ばし、残りをほかの列で分ける (幅 400pt の `minmax(100px, 200px) 1fr` が 200 + 200pt → 150 + 250pt。CSS Grid 1 §12.6)。`minmax(0, 2fr)` の比は 2 (前は 1: 幅 300pt の `minmax(0, 2fr) 1fr` が 150 + 150pt → 200 + 100pt)
21
+ - 無効な並び (負の長さ・`repeat()` の入れ子・最小が `fr` の `minmax()`・`auto-fill` と `fr` の組み合わせなど) は、宣言ごと捨て、前の宣言が残る (CSS Grid 1 §7.2・CSS 2.1 §4.2。前は負の列を 0 として読んだ: `100pt 100pt` の後の `-10px 1fr` が、0pt の列と残りの列 → 100 + 100pt)
22
+ - 数学の関数 (`min()`・`calc()` など) の結果が負の列は、宣言を捨てずに 0 の列にする (CSS Values 4 §10.12。幅 300pt の `min(10px, -5px) 1fr` が、前は読めずに前の宣言 (`100pt 100pt`) のまま → 0 + 300pt)
23
+ - とても大きい `fr` の係数・百分率 (`1e307fr`・`1e400%` など) を、扱える範囲の値に収める (前は列の幅が Infinity・NaN になった。CSS Values 4 §10.9)
24
+ - 列の幅を、組むときの容器の実際の内容の幅で決める (前は、読み込みのときの幅の見積もり (本文の幅など) で決めたので、flex の項目・表のセル・grid の項目の中で、列が容器からはみ出した: 幅 400pt の flex の容器で幅 250pt の隣と並ぶ `flex: 1` の項目の中の `1fr 1fr` が 200 + 200pt → 75 + 75pt)
25
+ - float・inline-block など、中身の幅で大きさの決まる箱の中の grid の幅を、全部の行の項目の中身の幅 (max-content) から決める (前は本文の幅いっぱいに広がった: float の中の、中身が 1 字ずつの `1fr 1fr` が 240.9 + 240.9pt → 5 + 5pt。列をまたぐ `grid-column: span 2` の項目も数える。CSS Grid 1 §12.7.1)
26
+ - `fr`・`auto` の列を、その列の項目の自動の最小の大きさ (長い語・表など、中身の最も狭い幅) より狭くしない (前は等分して、語が隣の列に重なった: 幅 150pt の `1fr 1fr` の、長い語の列が 75pt (語が 78.3pt はみ出す) → 153.3pt。列の最小の和が容器より広ければ grid がはみ出す。CSS Grid 1 §6.6・§12.7.1)。項目の中の `width: 100%` の子と、既定の `img { max-width: 100% }` の画像では、列を広げない
27
+ - `min-width`・長さの `width` を書いた項目の列は、その幅より狭くしない (前は等分し、項目が隣の列に重なった: 幅 300pt の `1fr 1fr` の `width: 200pt` の項目の列が 150pt → 200pt、隣の列は 100pt。CSS Grid 1 §6.6)
28
+ - `minmax(auto, 80px)` の列は、最大の 80px まで伸ばし、中身から測る下限も 80px までにする (前は `1fr` として等分した: 幅 300pt の `minmax(auto, 80px) 1fr` が 150 + 150pt → 60 + 240pt。`min-width: 150px` の項目の列は、下限を抑えずに 112.5pt。CSS Grid 1 §6.6・§12.5)
29
+ - `auto` の列は、これまでどおり `1fr` と同じに数えて分けるので、`auto` の列に置いた画像そのもの (既定の `max-width: 100%`) は、分けた列の幅に縮む (幅 300pt の `auto 1fr` の 600×400px の画像が 300pt (隣の列に重なる) → 150pt。Chrome は、`auto` の列を画像の幅まで広げて 295pt)
30
+ - 知られた制限: `repeat(auto-fill, …)`・`repeat(auto-fit, …)` の回数は、いまも読み込みのときの幅の見積もりで決めるので、見積もりより狭い所では、列が容器からはみ出すことがある (`flex: 0 0 110pt` の項目の中の `repeat(auto-fill, minmax(100px, 1fr))` は、本文の幅 481.9pt から数えた 75pt の 6 列)
31
+ - 大きな grid は、組む時間が延びる (項目 3,200 個の 4 列の grid で、0.3.0 の約 1.7 倍。列の幅を決めるために、組むときに項目の中身の幅を測る)
32
+ - **画像の大きさ** (HTML のどのスタイルでも。**組版の結果が変わる**: 下の書き方をした画像だけ。大きさの決め方の詳細は、対応仕様説明書の HTML と CSS 編の 3.5・13.1):
33
+ - `img`・`object` の `width`・`height` の属性を、表示のための指定 (HTML §15.4.3) として読み、作成者の CSS の `width`・`height` を属性より優先する (属性 600×400 の画像の `style="height: 100pt"` が、幅 200pt の所で、既定のスタイル `kumiori` で 200×44.4pt → 200×100pt)
34
+ - 既定のスタイル `kumiori` の `img { max-width: 100% }` で幅が縮む属性の画像は、0.3.0 と同じに、高さも縦横比で縮む (属性 600×400 の画像が、幅 200pt の所で 200×133.3pt。grid の項目・段組・表のセルの中でも。CSS 2.1 §10.4)
35
+ - 作成者の `max-width` (`max-inline-size` も) で幅が縮む属性の画像は、高さを属性の高さのままにする (ブラウザと同じ。作成者の `img { max-width: 100% }` の、属性 600×400 の画像が、幅 200pt の所で 200×133.3pt → 200×300pt。CSS で `height: auto` を書けば、前と同じに縦横比で縮む。CSS 2.1 §10.4)
36
+ - flex の容器が、画像の項目を縮める (前は縮めず、画像が隣の項目に重なった)。縮めた画像の高さは、属性の高さのまま (Chrome と同じ。CSS Flexbox 1 §9.7): 幅 200pt の容器で、`min-width: 0` の属性 600×400 の画像と幅 150pt の隣が、200×133.3pt → 50×300pt。`flex: 0 0 100pt; min-width: 0` (`flex-basis: 50%` も) の画像は 200×133.3pt → 100×300pt
37
+ - flex が画像を縮めるのは、ほかに、`overflow: hidden` の画像、長さの `min-width` の画像 (上の例で `min-width: 40pt` なら 50×300pt)、隣が無くても、画像そのものの padding・border・margin で項目が容器を超える `min-width: 0` の画像 (padding 10pt・border 5pt・margin 5pt で 160×300pt)
38
+ - flex の容器の、幅を書いた (属性も) 画像の項目は、自動の最小の大きさより縮めずに並べる (前は項目の幅だけを縮め、画像が隣の項目に重なった: 幅 200pt の容器の `width: 150pt` の画像と幅 150pt の隣は、隣が 50pt に縮む。CSS Flexbox 1 §4.5)
39
+ - 画像そのものの flex の項目の自動の最小の大きさを、長さの `max-width` で抑える (`data:` の SVG など、読み込むときに大きさの分からない画像で、前は抑えなかった: `flex: 0 0 30%; max-width: 50px` の 300×200px の画像が 225pt (隣に重なる) → 37.5pt。ブラウザと同じ。CSS Flexbox 1 §4.5)
40
+ - `flex: 1` の画像を伸ばし、高さは属性の高さのまま (前は伸ばさなかった: 幅 200pt の容器の、属性 20×10 の画像が 15×7.5pt → 200×7.5pt。Chrome と同じ。CSS Flexbox 1 §9.7)
41
+ - `min-width`・`min-height` で広げる属性の画像は、もう一方を属性の大きさのままにする (前は縦横比で広げた: 属性 100×50 の画像の `min-width: 150pt` が 150×75pt → 150×37.5pt、`min-height: 100pt` が 200×100pt → 75×100pt。ブラウザと同じ。CSS 2.1 §10.4)
42
+ - 作成者が `max-height` だけを書いた属性の画像は、高さだけを抑える (前は縦横比で縮めた: 属性 600×400 の画像の `max-height: 100pt` が、幅 500pt の所で 150×100pt → 450×100pt。ブラウザと同じ)。既定のスタイル `kumiori` の `max-width` で幅も縮むときは、前と同じに縦横比を保つ (幅 200pt の所で 150×100pt)
43
+ - 片方の大きさだけを書いた画像の `min-*`・`max-*` は、書いた向きはその向きの `min-*`・`max-*` でだけ変え、もう一方を縦横比から出してから、その向きの `min-*`・`max-*` を当てる (縦横比 2:1 の画像の `width: 40pt; max-height: 10pt` が 20×10pt → 40×10pt。CSS 2.1 §10.4・§10.3.2・§10.6.2)
44
+ - 読めない画像・大きさの無い SVG は、属性の縦横比で大きさを決める (属性 200×100 の画像の `width: 100pt; height: auto` が 100×75pt → 100×50pt。HTML §15.4.3)
45
+ - `width="0"`・`height="0"` (CSS の 0 も) を有効な大きさにする (前は 0 を指定なしとして、画像本来の大きさで描いた。CSS 2.1 §10.2)
46
+ - **相対の長さ・`calc()`・百分率の値** (HTML のどのスタイルでも。**組版の結果が変わる**: 下の書き方をした文書だけ): 計算値に相対の単位を残して、読む側が読めずに捨てていたものを、絶対の長さ (百分率を含む `calc()` は、百分率と長さの和) にして読む (CSS Values 4 §6・§10.11。どれも警告が出ていなかった)。(1) `background-size` の `em`・`rem` などの長さ (前は、大きさの指定が無いものとして、背景の画像を本来の大きさで描いた: `background: url(icon.svg) no-repeat 0.65em center / 1.25em 1.25em` のアイコンが大きく描かれ、字に重なっていた。CSS Backgrounds 3 §3.9。百分率と `auto`・`cover`・`contain` はそのまま) (2) `box-shadow`・`filter: drop-shadow()` の `em`・`rem`・`calc()`・`var()` の長さ (前は影を描かなかった) (3) `border-radius`・`background-position`・`background-size` の `calc(百分率 ± 長さ)` (前は捨てた) (4) 余白の箱・`@footnote`・`::footnote-call`・`@page` の宣言の、百分率・`calc()`・字の大きさのキーワード (前は `@top-center { font-size: 150% }` が 10pt のままだった)。余白の箱の `em` は、ページの文脈 (`@page`) の字の大きさが基準 (5) `letter-spacing`・`word-spacing` の百分率は、字の大きさに対する割合 (CSS Text 4 §8.1・§8.2。前は、包含ブロックの幅に対する割合で、字の間が大きく空いた)
47
+ - **0 と負の値** (HTML のどのスタイルでも。**組版の結果が変わる**: 下の書き方をした文書だけ): (1) `font-size: 0` を有効な値として、字の大きさ 0 で組む (CSS Fonts 4 §2.4。`line-height: normal` の行の高さも 0。前は 0 を捨てて親の字の大きさのままにしていたので、`font-size: 0` で隠した段落 (改ページの印の段落など) が 1 行の高さを取っていた) (2) `rowspan="0"` は、行のまとまりの残りの行すべてにまたがる (HTML §4.9.11。前は 1 行) (3) 負の値が無効な性質 (`padding`・`width`・`height`・`min-*`・`max-*`・`gap`・`column-width`・`flex-basis`・罫線の太さ・`font-size`・`background-size`) の負の値は、宣言ごと捨てる (前は負の値で組み、`padding-left: -10pt` で中身が左へはみ出した)。`calc()` の結果の負の値は 0 にする (CSS Values 4 §10.12)
48
+ - **グラデーションの背景の大きさ** (HTML のどのスタイルでも。**組版の結果が変わる**: グラデーションの背景に `background-size` を書いた文書と、`html`・`body` にグラデーションの背景を書いた文書だけ): グラデーションの背景の `background-size` の百分率を読み、大きさ 0 では描かない (前は、箱の全体に塗った)。`@page` のグラデーションの背景でも `background-size`・繰り返しを読む。`html`・`body` のグラデーションの背景を、ほかの背景と同じにページに描く (前は描かなかった。CSS Backgrounds 3 §2.11.1)
49
+ - **Area Tree の型** (組版の結果は変わらない): 上の `calc(百分率 ± 長さ)` を運ぶために、領域の型を広げた。`borderRadius` の `corners` の半径に、百分率と長さの和 `{ pct, len }` (`pct` は百分率の数。10% なら 10。`len` は pt) を足した (前は長さか百分率の字だけ。型は `RadiusLength`)。`backgroundImage` (と `under` の画像) に `xOffset`・`yOffset` (百分率の位置に足す長さ)・`widthOffset`・`heightOffset` (百分率の大きさに足す長さ) を、画像の領域の `fitPosition` に `xOffset`・`yOffset` (百分率の位置に足す長さ) を足した (どれも pt)。Area Tree の JSON の版 (3) は変わらない
50
+ - **API**: PDF だけを作る `typesetToPdf(text, options, pdfOptions)` と、器の `Typesetter.typesetToPdf` を足した (`typeset` の後に `toPdf(pdfOptions)` を呼ぶのと同じ PDF・警告・ページ数。結果は `{ pdf, pageCount, warnings, layoutMs }`、型は `TypesetPdfResult`)。ページを 1 枚ずつ領域の木にして書き、書いたページを手放すので、文書全体の領域の木を持たず、数千ページの文書で使うメモリが少ない。`layoutMs` は、ページを領域の木にする時間を含まない。`toPdf` の設定の型を `PdfOptions` として出した (中身は前と同じ)
51
+ - **メモリ節約** (コマンドの `--low-memory`・API の `typesetToPdf` の `lowMemory`。型は `TypesetPdfOptions`): ページ番号の参照を決めるための組み直しで、前の回のページを使い回さず、組み終えた page-sequence の組版の途中の木を手放す。2 回目からの回では、page-sequence を組み終えるごとに柱などを組んでページを領域の木にし、使う書体・画像を集める (回が決まらなければ集め直す)。決まった後で、もう 1 度組んで PDF に書く。PDF と警告は、使い回すときと同じ。PostgreSQL の文書の FO (3,231 ページ) で、生きているヒープの最大が約 2.3GB → 約 0.9GB (いちばん多いのは FO の読み込みの所。ヒープの上限 1GB で組める)、時間は 160 秒 → 231 秒 (上限 4GB で)
52
+ - **HTML の既定のスタイル** (組版の結果が変わる: 既定のスタイル `kumiori` で組み、作成者が `html` (`:root`) に書体か行揃えを書いた文書だけ): 既定のスタイルの書体 (`serif`) と行揃え (`justify`) を、`body` ではなく `html` に当てる。作成者の `html { font-family: … }`・`html { text-align: … }` が、`body` で既定の値に上書きされて文書の中に届かなかった (ブラウザの既定のスタイルは `body` に当てないので、ブラウザでは作成者の値になる。CSS Cascade 4 §6.1・§7.2)。何も書かない文書と、`body` に書いた文書は変わらない。Sphinx の印刷用の CSS (`html { font-family: Fira Sans }`) で組んだ Python 3.14 の文書は、本文が既定の書体 (Tinos) から Fira Sans になった
53
+ - **行内の箱の vertical-align** (組版の結果が変わる: 行内の文字の要素に下の値を指定した HTML の文書): 置き換えでない行内の箱 (`span`・`::before` など) の `vertical-align: top`・`bottom`・`middle`・`text-top`・`text-bottom` を読む (CSS 2.1 §10.8.1。横書きの行。前は、どれも黙って基線にそろえていた。画像の `top`・`bottom` などは前から読む)。行内の箱は line-height の高さの箱 (最初に使える書体の上下に半行間を足したもの)。`top`・`bottom` は、その要素と中身 (aligned subtree。行ごとの断片) の箱を行の箱の上端・下端にそろえ、行より高ければ行を広げる。`middle` は箱の中央を親の基線から x-height の半分の高さに、`text-top`・`text-bottom` は箱の上端・下端を親の内容の領域の上端・下端にそろえる。Sphinx の印刷用の CSS の目次の「•」(`font-size: 30pt; line-height: 10pt; vertical-align: bottom`) が、行の上へ浮かずに行の中ほどに来て、行も広がらなくなった (WeasyPrint・Chromium と同じ)。`top`・`bottom` の要素の中の、自分も `top`・`bottom` の画像・inline-block は、外の要素の部分木に入れず、それぞれ自分の揃え方で揃える
54
+ - **@page の padding** (組版の結果が変わる: `@page` に `padding` を書いた HTML の文書だけ): ページの箱の内側の余白 (`padding`・`padding-top` などの 4 辺) を読み、本文の領域をその分だけ狭める。余白の箱 (`@top-center` など) はページの余白の中に置くので動かない。前は読まずに無視していた (Sphinx の印刷用の CSS の `@page { padding-top: 1em }` で、本文がページの余白のすぐ下から始まり、WeasyPrint より 1 行ほど上から組んでいた)。百分率は、左右は用紙の幅、上下は用紙の高さに対して。負の値は無効
55
+ - **target-counter() の飛び先** (組版の結果が変わる: `#` を 2 つ以上含む飛び先 (`href="#a#b"` など) を参照する HTML の文書だけ): 飛び先の id を、URL の fragment (最初の `#` の後ろ全部。`#a#b` なら `a#b`) で引く。リンクの飛び先と同じ引き方。前は最後の `#` の後ろ (`b`) で引いていたので、リンクの飛べない目次の項目にもページ番号が出ていた (Sphinx の 1 ファイルの HTML の目次の `href="#document-tutorial/interpreter#invoking-the-interpreter"` など。そうした参照は、ほかの見つからない参照と同じに「?」と警告になる)
56
+ - **相対配置の top・bottom の百分率** (組版の結果が変わる: `position: relative` の箱に `top`・`bottom` を百分率で書いた HTML の文書だけ): 包含ブロックの高さが決まっていれば、その高さに対する割合でずらす。高さの決まっていない包含ブロックでは、これまでどおり auto (ずらさない)。高さが決まっているとみなすのは、`height` が長さの箱と、容器の高さに伸ばす flex の項目 (行が容器の高さになる 1 行の容器の、高さが auto で stretch の項目)。包含ブロックは、いちばん近いブロックの祖先 (CSS 2.1 §10.1)。行内の要素・`display: contents` の要素の `height` は使わない (行内の要素の中では、これまでどおりずらさない)。ただし、flex・grid の容器の項目は、`display` が行内の値のまま (`span` など) でもブロックの箱になるので、包含ブロックになる (CSS Display 3 §2.7)。前は百分率を読まず、ずらさなかった
57
+ - **WeasyPrint の組み方** (組版の結果が変わる: `--style weasyprint` で組む HTML の文書だけ): WeasyPrint に合わせて、(1) 中身の無い目印 (`<span id="…"></span>` など) だけの行を、マージンの相殺を断つものとして扱う (前後のマージンを足す。ほかのスタイルは、CSS の仕様どおり相殺する)、(2) 見つからない `target-counter()` の参照を空にする (ほかのスタイルは「?」。どちらも警告は出す)、(3) 高さの決まった折り返しの flex の容器 (`flex-wrap: wrap`) の行が 1 つなら、`align-content` に関わらず行を容器の高さにする (ほかのスタイルは、仕様どおり `align-content` が `normal`・`stretch` のときだけ)。Sphinx の印刷用の CSS の文書で、見出しの前の空き・目次の深い項目・表紙の題の位置が WeasyPrint と同じになる
58
+ - **余白の箱・@footnote の宣言の読み方** (組版の結果が変わる: 下の書き方をした HTML の文書だけ): 文書の要素と同じに読む。(1) 余白の箱 (`@top-right` など) の罫線の個別の指定 (`border-bottom-width`・`-style`・`-color`、`border-width`・`border-style`・`border-color`)。前は一括指定 (`border`・`border-bottom` など) だけを読み、個別の指定で書いた罫線を描かなかった (Sphinx の印刷用の CSS のヘッダーの下の線)。(2) 余白の箱の半透明の罫線・背景の色を、白い紙に重ねた不透明の色にせず、下の色と重ねて描く。背景の色の名前 (`red` など) も読む (前は `#` で始まる色だけ)。(3) `@footnote` の区切り線の個別の指定 (`border-top-width` など) と、`margin`・`padding` の一括指定
59
+ - **ページ文脈・余白の箱・@footnote の性質** (組版の結果が変わる: 下の性質を書いた HTML の文書だけ): CSS Paged Media 3 付録 A の、ページ文脈・余白の箱に効く性質のうち、読んでいなかったものを読む。(1) `@page` の `border` (一括指定・個別の指定。太さの初期値は `medium`。ページの余白の内側に描き、本文の領域をその太さだけ狭める) と `outline`、(2) 余白の箱の `background-image` (url()・グラデーション。`background` の一括指定も。位置の初期値は左上) と `outline`、(3) 余白の箱の `min-width`・`max-width`・`min-height`・`max-height` (上下の辺の箱の幅は、3 つの箱をまとめて分け直す)、(4) `@footnote` の `max-height` (CSS GCPM 3 の、脚注の領域の高さの上限。超える脚注は次のページへ送る。上限で次のページへ送った脚注があれば、その後の脚注も次のページへ送り、脚注は文書の順に並ぶ。本文の終わりの後に足す、脚注だけのページでは、上限を当てない。§2.4.2)
60
+ - **余白の箱・脚注の区切り線の罫線の太さの初期値** (組版の結果が変わる: 余白の箱 (`@top-center` など) か `@footnote` の区切り線に、太さを書かずに罫線 (`border: solid` など) を書いた HTML の文書だけ): 太さを書かない罫線を、文書の要素と同じ初期値の `medium` にする (CSS Backgrounds 3 §3.2)。太さが 1.5pt → 2.25pt になる。`--style ah` では、余白の箱の `thin`・`medium`・`thick` を 1・3・5pt にする (文書の要素と同じ。脚注の区切り線は 2.25pt)。太さを長さで書いた罫線は変わらない
61
+ - **入れ子の名前付きページ** (組版の結果が変わる: body の直下より深い所のブロックに `page` を書いた HTML の文書だけ): ページの名前を、body の直下のブロックだけでなく、流れの中のどの深さのブロックでも見る (CSS Paged Media 3。`auto` の箱は親の名前)。文書全体を 1 つの箱で包む文書 (DocBook の HTML の `div.book` など) で、前付け・部の扉・索引の名前付きページ (柱・ノンブルの書式) が効くようになる。包む箱は切り替えの所で分け、上の余白・罫線は最初の断片、下のものは最後の断片に残す。分けた断片では、`height`・`min-height`・`max-height`・`aspect-ratio` を最初の断片だけに当て、`box-decoration-break: clone` の箱は、分けた所にも罫線と内側の余白を付ける (CSS Break 3 §5.3・§5.4)。入れ子が深すぎて平らにした所 (128 段) では、ページの名前を変えない
62
+ - **target-counter() のページ番号の数え方** (組版の結果が変わる: 数え方の違うページ (ローマ数字の前付けなど) を `target-counter(…, page)` で参照する HTML の文書だけ): 数え方を書かなければ 10 進の数字にし、3 つめの引数 (`lower-roman` など) があればその数え方にする (CSS GCPM 3。`counter()` と同じ)。前は数え方の引数を読まず、参照先のページの表記をそのまま使っていた
63
+ - **組み直しで使い回したページの、ページ番号の参照の字** (組版の結果が変わる: ページ番号の参照のある文書を、既定のモード (`--low-memory` でない) で組んで、下の誤りが出ていた所だけ): ページ番号の参照 (XSL-FO の `fo:page-number-citation`・HTML の `target-counter()`) を決める組み直しで、前の回のページを使い回して参照の字だけを差し替えるとき、桁の違う値の所に 1 字ずつずれた字が出ることがあった (「13」のところに「1」と「3」が交互に出る。リンクの枠も 1 字分狭い)。0.3.0 からある誤り。差し替えるのは、字数・字の種類・書体・送り・幅が同じで、詰め (カーニング) に加わる字を置き換えないときだけにし、確かめられなければ、その page-sequence を組み直す。カーニング (`font-kerning`・`axf:kerning-mode`) の付いた参照で、字の位置が組み直したときとずれることがあったのも直した。どちらも、使い回さない `--low-memory` と同じ結果になる (1,082 ページの文書で、既定と `--low-memory` の取り出した字の違いが 360 行 → 0 行)
64
+ - **WeasyPrint の組み方の罫線の太さ** (組版の結果が変わる: `--style weasyprint` で組む HTML の文書の、1px の整数倍でない太さの罫線だけ): 罫線の太さを画素に丸めない (WeasyPrint と同じ。`0.3pt` の線は 0.3pt で描く)。前は、ブラウザ (Chrome) と同じに 1px 未満を 1px (0.75pt) に切り上げ、それより太い線は画素に切り捨てていた
65
+ - **footnote-display: block の警告** (組版の結果は変わらない): `footnote-display: block` (CSS GCPM 3 の初期値で、Kumiori の脚注の置き方そのもの) を、未対応の CSS として警告しない。`inline`・`compact` は、これまでどおり未対応として知らせる (対応仕様説明書の 16 章の表も直した)
66
+ - **大きな文書の、組む手間の上限** (組版の結果が変わる: 入力の節が 5 万を超える大きな文書だけ): 組版の 1 回の通しで作る流れの数の上限 (`LayoutOptions.maxMeasureFlows` の既定) を、一定の 10 万から「10 万か、入力の節の数の 2 倍の大きい方」にする。前は、入れ子が浅くても数千ページの文書が上限に当たり、以後の箱の中身の幅を測らず、段組を 1 段に組んでいた (PostgreSQL の文書 2781 ページの、3 段組の索引が 1 段になった)。入れ子で組む回数が爆発する入力は、これまでどおり止める
67
+ - **1 ページに入らない break-inside: avoid の行** (組版の結果が変わる: `break-inside: avoid` の表の行・リストの項目が、1 ページより高い HTML の文書だけ): 新しいページにも入らない行は、avoid を緩めて行の中で分ける (CSS Fragmentation 3)。前は分けずに、ページの下へはみ出させていた (PostgreSQL の文書の関数の表の長い行)。アンテナハウス互換のスタイル (`--style ah`) は、これまでどおり
68
+ - **脚注の参照の印・本文の頭の印の書式** (組版の結果が変わる: 下の書き方をした HTML の文書だけ): (1) 疑似要素の前に選択子の付いた規則 (`span.footnote-body::footnote-call` など) も読む (前は `::footnote-call`・`*::footnote-call` だけを読み、参照の印の大きさや content を読み落とした)。(2) `::footnote-call` と `::footnote-marker` の content が違えば、本文の頭の印は `::footnote-marker` の書式にする (前は参照の印の書式を使い、`counter(footnote) ". "` の「. 」が抜けた)。名指しした規則がどの脚注に効くかは、下の「脚注の番号の書式を脚注ごとに」の項
69
+ - **段組の釣り合わせと、段より高い行** (組版の結果が変わる: 平均の段の高さより高い行 (大きな行内の画像など) のある段組だけ): 段数に収まる最小の段の高さを探すとき、空の段の先頭でも入らずにはみ出させた行のある高さを、収まるとみなさない。前は、その行より低い段の高さを選び、行が段からはみ出して「行がページに収まりません」と警告した (PostgreSQL の文書の 3 段組の索引)
70
+ - **@page・余白の箱の背景画像の位置** (組版の結果が変わる: `@page`・余白の箱・根元の要素 (html・body) に背景画像を書いた HTML の文書だけ): `@page` の背景画像の位置・大きさ (百分率・`cover`・`contain`)・繰り返しの並べ始めを、ページの余白と罫線の内側 (ページの箱の padding の領域) で決める (CSS Paged Media 3 §3.1・CSS Backgrounds 3 §2.8・§2.9。塗るのは、これまでどおり塗り足しまで)。前は用紙を基準にしていたので、位置を書いた文書でも、位置が用紙の端からになっていた (上下・左右で余白が違うと、`center` の位置も変わる)。余白の箱の背景は、前から、その箱の padding の領域が基準。位置を書かなければ初期値の左上 (`0% 0%`) に置く (前は `@page` の背景を用紙の中央に置いていた)。値が 1 つなら、もう一方の軸は `center` にする (前は上・左の端だった)。長さの位置 (`10mm 20mm` など)、端からの距離の位置 (`right 10px bottom 5px` など)、位置の `em`・`rem`・`calc()` も読む。長さにできない値の宣言は無効にする。`background-size` の百分率も読む (`@page`・余白の箱・根元の要素の背景)。`background-attachment: fixed` の `@page` の背景は、余白を含むページの箱 (仕上がりの用紙の全体。塗り足しがあっても、仕上がりの角) を、位置と大きさの基準にする (CSS Paged Media 3 §3.1。個別の指定と、`background` の一括指定の中の `fixed` を読む)。文書の要素の `fixed` は、これまでどおり未対応 (`scroll` と同じに描く)。`@page`・余白の箱・根元の要素の背景に `background-size` (`cover`・`contain`) を書いても、`background-repeat` を書かなければ、初期値の `repeat` のとおり繰り返す (CSS Backgrounds 3 §2.4。0.3.0 は、`cover`・`contain` では繰り返さなかった)。そのため、0.3.0 では用紙の全体を 1 枚で覆っていた `@page { background: url(…); background-size: cover }` は、余白の内側に合わせた大きさの画像を、余白・塗り足しにも繰り返して並べる。用紙の全体を 1 枚で覆うには、`background-attachment: fixed` と `no-repeat` を書く
71
+ - **脚注の番号の書式を脚注ごとに** (組版の結果が変わる: 脚注の種類ごとに `::footnote-call`・`::footnote-marker` の書式を変える HTML の文書だけ): 脚注の参照の印・本文の頭の印の書式 (content の前後の文字と数え方) と、参照の印の大きさなどを、その脚注の要素に当たる規則から決める (詳細度と書いた順で重ねる。CSS GCPM 3 §2.6・§2.7)。要素を名指しした規則 (`.a::footnote-call` など) は当たる脚注にだけ効き、当たらない脚注は既定の書式 (0.3.0 と同じ)。選択子の無い規則 (`::footnote-call`・`*::footnote-call`) は、すべての脚注に効く。本文の頭の印の置き方 (`::footnote-marker` の `list-style-position`) も、脚注ごとに決める。前は、どの脚注にも文書全体で 1 つの書式を使っていた
72
+ - **脚注・float の続きのページ** (組版の結果が変わる: 本文の後の、脚注・float の続きが 50 ページを超える文書だけ): 本文の終わりの後に、脚注・float の続きのために足すページを、50 ページで打ち切らずに、続きを置き終えるまで足す (0.3.0 は、50 ページを超える分を置かずに捨てていた。1 段の流れ・段組とも)。どのページにも置けない脚注・float があって進まなくなったら (送るものが 3 ページ続けて変わらなければ) 止め、欠けた脚注・float の数を警告に出す。念のための上限は、送る脚注の、それ以上分けられない単位 (行と、子の無い箱) の数と、送る float の数の和の 2 倍 (50 ページより少なくはしない)。長い脚注を続きのページへ分ける手間を、脚注の大きさに比例させた (前は行の数の 2 乗で、4 万行・200KB の脚注で 218 秒かかったのが 2.3 秒)。行のとても多い脚注 (20 万行など) を分けると、例外 (RangeError) で止まったのも直した (0.3.0 からある誤り)
73
+ - **既定のスタイルの罫線の太さ** (組版の結果が変わる: 既定のスタイル (`kumiori`) で組む HTML の文書の、1px の整数倍でない太さの罫線): 罫線の太さを画素に丸めない (`0.3pt` の線は 0.3pt、`1pt` の線は 1pt で描く。PDF には画面の画素が無い)。前は、ブラウザ (Chrome) と同じに、1px 未満を 1px (0.75pt) に切り上げ、それより太い線は 1px の単位に切り捨てていた。ブラウザに合わせるスタイル (`browser`・`browser-margin`・`vivliostyle`) は、これまでどおり丸める。細い罫線の多い文書では、行の位置やページの区切りが変わる (対応仕様説明書の英語版は 127 → 125 ページ)
74
+ - **XSL-FO の hsl()・hsla()** (組版の結果が変わる: 互換モード (`--compat antenna`) で、色に `hsl()`・`hsla()` を書いた XSL-FO の文書だけ): アンテナハウスの拡張の色の関数を読む (色相は単位の無い数 (度) だけを読み、単位の付いた値 (`deg`・`turn`・`rad`・`grad`) は読めない色として知らせる。彩度・輝度・透明度は 0%〜100% か 0.0〜1.0)。前は未対応の色として捨てていた。仕様モードでは、互換の指定のときだけの値として警告に出す
75
+ - **XSL-FO の lh の単位** (組版の結果が変わる: 長さに `lh` を書いた XSL-FO の文書だけ): 互換モード (`--compat antenna`) では、`space-before`・`space-after`・`margin-*`・位置・大きさなど、どの長さでも、その要素の行の高さを基準に読む (`font-size` は親の行の高さが基準。`line-height` には使えず、読まずに知らせる。前は罫線の太さだけで、ほかは未対応の長さとして捨てていた)。`lh` は XSL 1.1 に無い単位なので、仕様モードでは読まずに警告に出す (前は罫線の太さだけ読んでいた)
76
+ - **見つからない飛び先の警告** (組版の結果は変わらない): ページ番号の参照 (`target-counter()`・`fo:page-number-citation`) としおりの、見つからない飛び先の警告を、種類ごとに 1 行にまとめる (件数と、初めの 10 個の id)。前は id ごとに 1 行ずつ出し、飛び先の無い参照の多い文書では数千行になった
77
+ - **XSL-FO の詰め込み (overflow="condense")** (組版の結果が変わる: 互換モードで、`fo:block-container` に `overflow="condense"` を書いた XSL-FO の文書だけ): アンテナハウスの拡張の詰め込みを読む。中身が収める高さを超えるなら、`axf:overflow-condense` の方法 (`font-size` (既定)・`line-height`) で字の大きさか行の高さを詰めて収める。収める高さは、`height`・`max-height` を決めた容器ならその高さ (表のセル・リストの本体・`fo:static-content` の中や、絶対配置の容器でも。`max-height` が `min-height` より小さければ `min-height`)。高さの決まらない容器は、ページに流す本文の keep-together の容器なら本文の領域 (1 ページ) に詰め、ほかは詰めずに警告に出す。中で絶対の値を書いた字の大きさは変えない (容器そのものに書いた字の大きさは詰める)。入れ子の内側の詰め込みの容器は、外の詰め込みで変えない。`axf:overflow-condense="none"` を書いた要素 (`fo:inline`・`fo:block` など) とその中身の字の大きさ・行の高さも、外の詰め込みで変えない。下限は `axf:overflow-condense-limit-font-size` (長さ)・`-limit-line-height` (字の大きさに対する比) で、初期値は 0。下限を書いた方法は下限まで縮め、最後まで収まらなければ、はみ出したまま警告に出す (下限の後ろに `hidden`・`error-if-overflow` を書けば、箱の高さを `height` (無ければ収める高さ。`min-height` より小さくはしない) にして切り抜く。`repeat` は未対応として知らせる)。下限の無い方法でどうしても収まらなければ、その方法では縮めない (どの方法でも収まらなければ、はみ出したまま警告に出す)。`axf:overflow-condense` (`none` を除く)・`-limit-*` は、子の要素へ受け継ぐ。入れ子の詰め込みでは、同じ容器を同じ条件で詰めた結果を使い回し、中の容器のために中身を測る回数に、いちばん外の詰め込みの容器ごとの上限 (10000 と、その容器の中の節の数の 40 倍の、大きい方。ふつうの 2〜3 段の入れ子は、中の容器が多くても当たらない) を置く。上限に当たれば、その容器の中の、以後の容器を詰めずに組み、ページに置いた結果に、そうして詰めなかったために収まらない容器が残るときだけ、警告を 1 度出す (ほかの、いちばん外の容器は詰める。毎ページ組む柱の詰め込みの容器は、ページごとに数え直すので、ページが多くても当たらない)。前は未対応として、中身をはみ出させていた。縦書き・`font-stretch`・`letter-spacing` と `fo:inline-container` の詰め込みは未対応として知らせる。仕様モードでは読まずに警告に出す
78
+ - **XSL-FO の段組の中の区切りと span="all"** (**組版の結果が変わる**: `axf:column-count` の `fo:block-container` (アンテナハウスの拡張の段組) の中に、`break-before`・`break-after` の `page`・`even-page`・`odd-page` か `span="all"` を書いた XSL-FO の文書だけ。仕様モードでも互換モードでも): (1) 段組の中の `page`・`even-page`・`odd-page` を、ページの区切りにする (XSL 1.1 §7.20.1・§7.20.2・§4.8: その FO の最初 (最後) の領域を、ページの最初 (最後) に置く)。前は (0.3.0 から)、`page` は段の区切りにして同じページの次の段へ送り、`odd-page`・`even-page` は、いまのページの偶奇が指定と同じなら白ページを挟まずに次のページ (偶奇の合わないページ) へ、違えば同じページの次の段へ送った。いまは、残りの段を空けて、次のページ (偶奇が合わなければ白ページを挟む。白ページには `blank-or-not-blank="blank"` のページのマスターが当たる) の最初の段から続け、区切りの前の段の組は釣り合わせない。段組の最初の子の `break-before`・最後の子の `break-after` のページの区切りは、段組の前・後ろの区切りにする (前は効かなかった)。高さを決めた段組 (ページをまたげない) の中では、段の区切りにする (前は `odd-page`・`even-page` で白ページの分の段を空け、後ろの中身が箱からはみ出して消えた) (2) `span="all"` のブロックは、ページをまたぐ段組でも、コンテナの幅に置き、その前後で段の組を分ける (前は、1 ページに収まる段組でだけ分け、ページをまたぐ段組では段の中に置いた)。入れ子のブロックの中の `span="all"` も、コンテナの直下へ出して効かせる (製品の見本に合わせる。前は効かず、仕様モードでは、コンテナの字下げの包みの中に入るので、子の `span="all"` も効かなかった)。分けたブロック・コンテナの断片は、同じ FO の続きとして扱う (`id` はどの断片にも付き、`fo:page-number-citation-last` は最後の断片のページ。`text-indent` は最初の断片の最初の行だけ)。新しい段の組の最初の段の頭の `break-before="column"` では、段を空けない (区切りの条件が、もう満たされている) (3) `fo:region-body` の `column-count` の段組は、もとからこの決まりのとおりで、変わらない
79
+ - **XSL-FO の段組の中の keep-together と、段の頭・終わりの余白** (**組版の結果が変わる**: おもに `axf:column-count`・`column-count` の `fo:block-container` (アンテナハウスの拡張の段組) を使う XSL-FO の文書。仕様モードでも互換モードでも。HTML の段組・`fo:region-body` の段組・段組でない XSL-FO の文書で変わるものは、行の頭にそう書く。1 段に入るかの数え方などの詳細は、`docs/xslfo-import.md` の「段組」の節と、対応仕様説明書の HTML と CSS 編の 12.3):
80
+ - 段組のコンテナの釣り合わせで、`keep-together.within-column="always"` (`within-page`・`keep-together="always"` も) のブロック・ブロックコンテナ・表を、1 段に入るなら 2 つの段に分けない (前は、段を低くして段の境目で割った: 4 行だけのブロックが 2 行 + 2 行 → 1 段目に 4 行。XSL 1.1 §7.20.3)。1 段に入らないものは、これまでどおり分けてページに収める
81
+ - 段組のコンテナの段の頭と終わりの、`conditionality="discard"` (既定) の `space-before`・`space-after` を捨てる (段を参照領域として扱う。XSL 1.1 §4.3.1・§6.5.3): `space-before="10pt"` で始まる段組の 1 段目の最初の行が、2 段目より 10pt 下 → 同じ高さ。段の最後のブロックの `space-after="20pt"` を捨て、段組の後ろのブロックが 20pt 上がる。`retain` の余白と、`margin-top`・`margin-bottom` は、これまでどおり残す
82
+ - 段組のコンテナの `span="all"` のブロックの領域の頭と終わりでも、同じく捨てる (前は、span のブロックの前後の `space-before`・`space-after` と、後ろの段の組の頭の `space-before` を残した: 10pt の余白で囲んだ span のブロックが 10pt、その後ろの `space-before="8pt"` の段の最初の行が 28pt 上がる)
83
+ - ページの残りが少ないので次のページの頭へ送る段組のコンテナの、`discard` の `space-before` を捨てる (前は、次のページの頭に残した: `space-before="10pt"` の段組が 10pt 上がる。XSL 1.1 §4.3.1)
84
+ - 段組のコンテナの段の頭の行が入るかを確かめるときに、頭で捨てる余白を数えない (前は、釣り合わせで、その分だけ段を高くした: 3 行と、`space-before="20pt"` の 3 行のブロックの段組の高さが 56pt → 36pt)。2 段に分かれる表の最後の行が消えることがあったのも直る (互換モードの、罫線のあるセルの中のブロックに `space-before` のある 4 行の表が、2 行 + 1 行と警告 → 2 行 + 2 行)
85
+ - HTML の段組 (`columns`。どのスタイルでも): `break-inside: avoid`・`avoid-column` のブロック・表を、1 段に入るなら、釣り合わせで 2 つの段に分けない (前は分けた: 4 行だけの `break-inside: avoid` のブロックが 2 行 + 2 行 → 1 段目に 4 行。CSS Fragmentation 3 §3.3)。1 段に入らないものは、これまでどおり分ける
86
+ - HTML の段組の `--style ah`: 段の頭で捨てる余白 (`p` の `margin-top` など) を、行が段に入るかの判定で数えない (前は、釣り合わせた段から行がはみ出して消え、「段組のコンテナに内容が収まりません」の警告が出ることがあった: 3 段の段組の 9 行の段落が 2・3・2 行 (2 行が消える) → 3・3・3 行)
87
+ - `fo:region-body` の段組 (`column-count`): 互換モードでも、`span="all"` のブロックの `margin-bottom` を残す (前は捨てた: `margin-bottom="10pt"` の span のブロックの後ろの段の行が 10pt 下がる。仕様モードは、これまでどおり残す)
88
+ - 段組でない XSL-FO の文書: 流れの最初のブロックの、ページの頭で捨てる `space-before` を、行がページに入るかの判定で数えない (前は、その分だけページの下を空けて行を次のページへ送った: `space-before="100pt"` で始まる 16 行の段落が、13 行 + 3 行の 2 ページ → 1 ページ。XSL 1.1 §4.3.1)
89
+ - **XSL-FO のドロップキャップ (`axf:initial-letters`)** (新しい機能。**組版の結果が変わる**: `axf:initial-letters` を書いた XSL-FO の文書だけ。仕様モードでも互換モードでも): アンテナハウスの拡張のドロップキャップを読む (前は未対応として警告に出し、字を大きくせず、最初の画像はそのままの大きさで行に入れていた)。`fo:block` の最初の字 (前後の約物を含む。オランダ語の語頭の `IJ` は 2 字) か最初の画像を、数行の高さにして行の頭に置き、続く行をその横に回り込ませる。HTML の `initial-letter` と同じ仕組みで組む。読む値: `axf:initial-letters` の行の数 (`<number>`)・長さ (`<length>`)・沈める行の数 (`<integer>`・`drop`・`raise`)・`adjacent`・`<integer2>` (字の行の後ろも字下げ)。`axf:initial-letters-end-indent` (字の後ろの行ごとの空き)・`-first-line-head-height` (`cap-height`・`x-height`・`auto`: small-caps の小文字が続けば x-height に合わせる)・`-width`・`-text-align`・`-color`・`-leading-punctuation="hide"`・`-leading-punctuation-position="hang"` (これらの長さの中の `dcem`・`ic` の単位は、どのモードでも読む)。字を置くブロックの `text-indent` は、字の箱をずらす量にする (`dcem` の単位は、互換モードのときだけ読む。仕様モードでは警告に出して読まない)。字の箱の行の数より短いブロックの後ろのブロックも、字の箱の横に字下げする (`adjacent` でも、字の箱の範囲まで)。前のブロックとの間に空き (`space-before`・`space-after` など) のあるブロックと、`clear` のブロックは、字の箱の下へ送る。右から左へ書く横組みでは右の端に、縦書きでも組む。字の前に `axf:initial-letters` を書いた `fo:block`・`fo:inline-container` などがあるブロックと、`text-align` が `start`・`left`・`justify` 以外のブロックでは何もしない。対応していないもの (警告に出す): 先行する約物の大きさ・色 (`-leading-punctuation` の `<length>`・`<color>`)・食い込ませ (`-leading-punctuation-position` の `intrude`・長さ)・`-leading-punctuation-shift`・`axf:initial-letters-start-intrusion="first-line"`・最初の字がルビ。字の下がり (g などの字の、基線より下の形) は、字の箱の高さに数えない。ページ・段・表のセルの頭で捨てる `space-before` (`conditionality="discard"`) は、行と同じく、字の箱の位置にも数えない (字の箱を、捨てた余白の分だけ行より下に置かない)
90
+ - **段組の段の頭の initial-letter と float** (組版の結果が変わる: `--style ah` で組む HTML の文書の、段組の段の頭の段落に `initial-letter` か float があり、その段落に `margin-top` があるものと、どのスタイルでも、リストの項目 (`li`) の最初の段落に float があり、その段落に `margin-top` があるものだけ): 段の頭・リストの項目の頭で捨てる `margin-top` を、行と同じく、最初の字の箱と float の位置にも数えない (前は、最初の字の箱と float だけが、捨てた余白の分だけ下にずれ、行と揃わなかった。リストの項目では、項目の記号も float と同じ高さに下がっていた)
91
+ - **段組の中の絶対配置の箱** (**組版の結果が変わる**: 段組の中に絶対配置の箱を置いた文書だけ。XSL-FO の `axf:column-count`・`column-count` の `fo:block-container` と `fo:region-body` の `column-count`、HTML の `columns` の中の `position: absolute`): 段を釣り合わせる試し組みのたびに、箱をページに積んでいて、同じ箱が何度も (10 回ほど) 重ねて描かれていたのを、1 度だけ置くようにした (0.3.0 から)
92
+ - **速さ・メモリ** (組版の結果は変わらない): 数千ページの XSL-FO を組むときのメモリを減らした。(1) ページ番号の参照 (目次など) を決めるために組み直す回では、ページを領域の木 (Area Tree) にせず、収束した回だけを領域の木にする (前は回ごとに文書全体の領域の木を作り、前の回の木を持ったまま次の回を組んだ)。(2) 領域の木にするときは、ページを領域にしたら、そのページの組版の途中の木を手放す。(3) FO の読み込みで、要素ごとに覚える「読んだ属性」を、要素に書かれた属性だけにする (前は、読もうとした性質の名前を、書かれていないものまで要素ごとに覚えた)。(4) 格子に合わせて並べるリーダーの点 (`leader-alignment`) で、点ごとに空の余白・罫線を写さない。(5) 組版の途中の字のノードの、字の描き方 (字・書体・大きさ・色・位置) を、同じ中身の字で 1 つにまとめ、字のノードの欄を 1 つのオブジェクトの中に収める (字 1 つあたり約 370 → 約 200 バイト)。(6) 飾りの無い字の領域を、値の無い欄 (`backgroundColor`・`sourceId`) を持たない形で作る (字 1 つあたり約 336 → 約 312 バイト。JSON に書いた Area Tree は変わらない)。(7) Node のコマンドは、`typesetToPdf` で、PDF をページごとに書き、書いたページの組版の途中の木を手放す (文書全体の領域の木を 1 度に持たない。ページの領域の木は、使う書体・画像を集めるときと描くときの 2 度作る)。`typeset` の結果 (`areaTree`・`toPdf`・`renderPage`) は、これまでどおり文書全体の領域の木を持つ。コマンドの報告の「組版 N ms」は、ページを領域の木にする時間を含まなくなった (PDF を書く時間に入る)。PostgreSQL の文書の FO (37.7MB・3,231 ページ) をコマンドで組むと、前は Node の既定のヒープの上限で止まり、上限を 13GB に広げると組めた (使っているヒープ (捨てる前のごみを含む) の最大は約 9.4GB、組版の時間は 199 秒)。いまは、ヒープの上限 3GB で組める (GC の後に生きている量の最大は約 2.3GB)。上限 4GB で組むと、全体の時間は 160 秒。組んだ PDF は、作った日時 (と、日時から作る文書の ID) のほかは同じ。(8) PDF を書くとき、描き終えたページの命令を、保存のときと同じに圧縮したバイト列にして手放す (前は、ページの命令を、細かいオブジェクトのまま保存まで持った)。PDF は、圧縮したバイト列まで同じ。同じ文書を `typeset` で組んで `toPdf` を呼ぶと、生きているヒープの最大が約 3.2GB → 約 2.8GB (PDF を書く間に増える分が約 0.4GB → 約 0.03GB)。(9) 画像: 文書と一緒に渡したファイルの画像は、画像の置き場に写したら、読んだ中身の覚えを捨てる (前は同じ画像を 2 度持った。中身を関数で渡したファイル (コマンドはこれ) で空く)。PDF だけを作るとき (コマンド・`typesetToPdf`) は、ラスター画像を PDF に埋め込むごとに、置き場の中身も捨てる (同じ中身を別の書き方で参照する所があれば、最後の参照を埋め込むまで捨てない。SVG は捨てない。SVG が中から参照する画像は、その SVG を埋め込むまで残し、foreignObject・外の SVG を指す use のある SVG があれば、すべて最後まで残す。捨てた画像は、組み直しても読めない画像にならない)。画像 240 枚 (計 570MB) の 240 ページの FO をコマンドで組むと、プロセスの常駐の大きさの最大が約 2.57GB → 約 1.62GB (`--low-memory` は約 2.70GB → 約 1.70GB。`typeset` で組んで `toPdf` を呼ぶと約 2.02GB)。PDF は同じ
93
+ - **PDF に埋め込む画像** (組版の結果は変わらない): 同じ画像のファイルを別の書き方 (大文字と小文字・`./`・`#…` の付いた参照・別のディレクトリからの道・CSS の `url()` と `img`・SVG の中と外) で参照しても、PDF に埋め込む画像は 1 つにし、どこからも同じ画像を描く (ISO 32000-2 §8.8・§8.9.5)。前は参照ごとに重ねて埋め込んでいた。PDF が小さくなり、描く位置と形は変わらない。中身が同じでも別のファイルは、これまでどおり別々に埋め込む
94
+ - **HTML の半透明の字の色** (組版の結果が変わる: 字・文字の飾りの線・圏点・ルビの色に、透明度の付いた色 (`rgba()`・`hsla()`・`#rrggbbaa` など) を書いた HTML の文書だけ): 字を、透明度つきのまま、下の色と重ねて描く (CSS Color 4 §4.2・§5。PDF の ExtGState の ca・CA)。余白の箱の字の色も同じ。前は、白い紙に重ねた不透明の色にして描いていたので、色の付いた背景の上では、背景が透けずに白っぽい色になっていた。PDF/X-4 と PDF/X でない出力の動き (透明を使えない PDF/X-1a・X-3 で、半透明の字をどう描くかは、透明を平らにする処理による)
95
+ - **透明の字の色** (組版の結果が変わる: 字の色に `color: transparent` (や `rgba(…, 0)`・`#rrggbb00` などの不透明度 0 の色、8 ビットで 0 になる `rgba(…, 0.001)` などの色) を書いた HTML の文書だけ): 不透明度 0 の色の字を描かない (字は場所を取り、字の位置と行分けは変わらない。CSS Color 4 §4.1・§6.3)。8 ビットにすると不透明度が 0 になる色 (`rgba(…, 0.001)`・`rgb(… / 0.1%)` など。描いても見えない) の字 (と、字の飾り・圏点・ルビ) も、同じに描かない。`currentColor` を使う下線・罫線・圏点なども描かない (§6.4)。子が `color` を書き直せば、その色で描く。前は、不透明度 0 の色を指定が無いものとして扱い、親の色で描いていた (0.3.0 より前からの誤り)。`background-clip: text` には対応していないので、字を背景 (グラデーションなど) で塗る書き方では、背景が箱いっぱいに出て、字は描かれない (前は、その上に親の色の字が出ていた)
96
+ - **固定配置の箱・余白の箱の、描くときだけの効果** (組版の結果が変わる: `position: fixed` の箱に `transform`・`opacity`・`outline`・`clip` を書いた HTML の文書と、余白の箱・`@page` に `outline` を書いた HTML の文書だけ): 固定配置の箱の変換・不透明度・輪郭線・切り抜きを、出すページごとに描く (CSS 2.1 §9.6.1・§11.1.2、CSS Transforms 1、CSS Color 4 §3.3、CSS UI 4 §3)。前は、ページごとに写した箱に効果が付かず、変換と不透明度は黙って落ち、輪郭線と切り抜きは未対応と知らせていた。余白の箱・`@page` の輪郭線は、文書の要素と同じ仕組みで描く (余白の箱の角丸にも沿う。前は、罫線だけの別の箱として描き、余白の箱の輪郭線を描いているのに未対応と知らせていた)
97
+ - **PDF/X-1a** (API の `pdfx: { version: 'X-1a' }`・`'X-1a:2003'`、コマンドの `--pdfx x1a`・`x1a:2003`): 日本の印刷所で長く使われてきた PDF/X-1a (CMYK と特色だけ。透明は使えない) を出せるようにした。:2001 は PDF 1.3 (Info の `GTS_PDFXVersion` は `PDF/X-1:2001`、`GTS_PDFXConformance` は `PDF/X-1a:2001`)、:2003 は PDF 1.4。XMP は書かず、印刷条件は登録名だけでよい (プロファイルを渡すなら CMYK のもの)。書き出した PDF を読み直して、公開の説明による決まり (版・暗号化・印・出力意図・ボックス・色空間・透明・書体の埋め込み・塗り足しまでの範囲の注釈) に合うかを調べ、合わなければ誤りとして投げる。PDF/X の規格 (ISO 15930-1・-4) の本文では確かめていない
98
+ - **PDF/X-1a・X-3 の透明を平らにする**: 透明 (CSS の opacity・透明度つきの色・透明度つきの画像・SVG の半透明・マスク・描画モード) を、見た目をできるだけ変えずに、透明の無い物に置き換える。透明な物の下が 1 色の塗り (矩形・角丸の箱の背景 (回した箱も)・ページの白) だけなら、描画モード Normal の合成の式 (ISO 32000-2 §11.3.3) で CMYK の色を計算し、ベクタのまま不透明な色で描く (字は文字のまま)。ほかは、その範囲を下の物と合わせて CMYK の画像 (300ppi。12pt 未満の字が掛かる所は 600ppi) にして置き、警告に出す (同じ行の字の画像は 1 つにまとめる。画像にした所に字が掛かれば、字の質が落ちて文字として選べなくなることも警告に出す)。平らにできない透明 (色つきの字形の透明など) が残れば誤りにする (PDF/X-4 を勧める)。重なった所の色は CMYK で合成するので (印刷と同じ)、RGB で合成する画面のビューアの見た目とは少し違う。PDF/X-4 と PDF/X でない出力は、透明のまま
99
+ - **PDF/X-3 の出力の変わる所** (透明を使う文書と、灰色だけの画像のある文書だけ): 透明を警告して残すのをやめ、平らにする (上の項)。平らにできない透明は、警告ではなく誤りになる。書き出した PDF を読み直して、PDF/X-1a の決まりから機器によらない色 (ICCBased・Lab・CalRGB・CalGray) の禁止を外した決まりで調べ、合わなければ誤りにする
100
+ - **PDF/X の灰色だけの画像** (PDF/X-1a・X-3・X-4 の出力の、灰色だけの画像のある文書だけ): 画素がすべて R = G = B の画像 (RGB・RGBA の PNG、16 ビット・1 ビットの灰色の PNG、灰色 + α の PNG、RGB の JPEG) を、DeviceRGB ではなく DeviceGray の画像で埋め込む (濃さは同じ。ISO 32000-2 §8.6.4.2)。前は DeviceRGB のまま書いていて (0.3.0 からある誤り)、PDF/X に RGB の画像が残っていた
101
+ - **開発** (組版の結果は変わらない): `npm run ci:local` は、npm から走らせたとき、npm の本体 (`npm_execpath`) を、スクリプトを動かしている Node で直に動かす (シェルを通さない)。Windows でも `npm.cmd` を動かさず、引数をそのまま渡すので、Node 24 からの、シェルに引数の並びを渡す呼び方の非推奨の警告が出ない。node-min のジョブで、下限の Node を PATH の先頭に置いたときも、npm が同じ Node で動く。`node scripts/ci-local.mjs` で直に走らせたときは、これまでどおり PATH の `npm` を呼ぶ
102
+ - **安全性・細工した入力への強さ** (他人の書いた文書をサーバで組むときの、時間とメモリの守り。正当な文書の組版の結果は変わらない。上限の値と根拠は各ソースのコメント):
103
+ - 長さの 2 乗の手間になっていた正規表現を、前から 1 度読む形にした: SVG の画像の開始タグの `width`・`height` (長い空白)、grid の `repeat()` (カンマの無い `repeat(` と長い空白)、閉じない `url(` の並び (`filter`・`box-shadow` などの長さの計算値・`@page` の `background`・`background-position`・XSL-FO の `axf:printer-marks`。閉じない `url(` は、値の終わりで閉じる: CSS Syntax 3 §4.3.6)
104
+ - 入れ子の深い `calc()` などの数学の関数 (`filter`・`box-shadow`・`grid-template-columns` などの計算値): 深さ × 長さの手間と、スタックがあふれて文書全体が組めなかったのを直した
105
+ - `::footnote-call`・`::footnote-marker` の規則の前の選択子を、カスケードと同じ照合で引く (短い選択子と深い入れ子・多い兄弟で、手間が指数で伸びていた)。結合子の種類の混ざった選択子の照合の覚えに、1 回のカスケードの合計の予算を置き、超えた後のそのような選択子は当てずに警告を出す (正当な文書は届かない量)
106
+ - 注釈を挟んだ改行の多い段落・`rowspan="0"` のセルの多い表・名前付きのページの多い文書・grid の `repeat()` の回数の多い列の並びを、大きさに比例する手間で組む
107
+ - 段組のコンテナ (XSL-FO の `axf:column-count`) の中の、深い入れ子のブロックの中に多くの `span="all"` を置いた文書: 外へ出す span の断片の数に上限を置き、超えた後ろの span は段の中に組んで、読み込みの報告に出す
108
+ - SVG の filter を図形で近似するとき、部分領域で切る矩形の数と、層の数が、`feComposite`・`feMerge` を重ねると指数で増えていたのを止める (層が多ければ、近似をやめて画素で計算する)
109
+ - PDF/X-1a・X-3 で透明を平らにするとき: 画像にする解像度の下限 (72ppi) をやめ、1 つの画像の画素の数の上限を必ず守る (とても大きなページで、何十億画素の画像を作っていた。**組版の結果が変わる**: ページの全体を画像にする所が上限を超える大きなページだけ、解像度が 72ppi より下がる。下げた解像度は警告に出る。1ppi でも上限を超える範囲は、画像にできないとして誤りにする)。半透明の物の下の物を、ページを格子に分けた索引で引く (半透明の字ごとに、ページの描いた物を全部たどっていた)
110
+
7
111
  ## 0.3.0 (2026-11-16)
8
112
 
9
113
  draw.io の図・画像の形式を足すプラグイン・PDF/X-4 などを足し、SVG の描ける範囲を広げた版。0.x の間なので、組版の結果が変わる修正も含めて minor の版にします。