kumiori 0.4.0 → 0.6.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 (190) hide show
  1. package/CHANGELOG.en.md +137 -47
  2. package/CHANGELOG.md +95 -5
  3. package/README.en.md +60 -306
  4. package/README.md +60 -306
  5. package/THIRD_PARTY_NOTICES.md +2644 -63
  6. package/dist-browser/THIRD_PARTY_NOTICES.md +2644 -63
  7. package/dist-browser/chunks/{UTIF-Br536cfi.js → UTIF-CB7QpC03.js} +4 -4
  8. package/dist-browser/chunks/bg-BHkWBdmK.js +16 -0
  9. package/dist-browser/chunks/ca-CLlkRkVU.js +18 -0
  10. package/dist-browser/chunks/callContext-B0aKFxzs.js +98 -0
  11. package/dist-browser/chunks/{ccitt-DuYpUkox.js → ccitt-zKTiYBne.js} +203 -328
  12. package/dist-browser/chunks/{cgm-Blvzv6Sp.js → cgm-BYXND-Lt.js} +508 -505
  13. package/dist-browser/chunks/cy-BY4_JDK8.js +20 -0
  14. package/dist-browser/chunks/da-CsG7AHvT.js +20 -0
  15. package/dist-browser/chunks/de-1901-DSuSYjhi.js +20 -0
  16. package/dist-browser/chunks/de-1996-B77PsMmO.js +20 -0
  17. package/dist-browser/chunks/de-ch-1901-BCOLXvd-.js +20 -0
  18. package/dist-browser/chunks/el-monoton-B_TpVuH7.js +20 -0
  19. package/dist-browser/chunks/en-gb-Cqb1Ks_t.js +20 -0
  20. package/dist-browser/chunks/en-us-B3tVDBHW.js +10 -0
  21. package/dist-browser/chunks/{eps-BFOW93N0.js → eps-B_0j0eX4.js} +1617 -1614
  22. package/dist-browser/chunks/epsInfo-BAniBFe7.js +33 -0
  23. package/dist-browser/chunks/es-BC8rc6n4.js +20 -0
  24. package/dist-browser/chunks/{sniff-CqYWlxhA.js → es-BXkrL5AZ.js} +6 -10
  25. package/dist-browser/chunks/esm-1L_VrSzb.js +11959 -0
  26. package/dist-browser/chunks/esm-B9N-jNux.js +1537 -0
  27. package/dist-browser/chunks/et-FQX9D5Tv.js +20 -0
  28. package/dist-browser/chunks/eu-CADvIbQb.js +39 -0
  29. package/dist-browser/chunks/{export-contract-J-x2aLjv.js → export-contract-BbbwqBzG.js} +3 -3
  30. package/dist-browser/chunks/fi-BIkMpMfd.js +9 -0
  31. package/dist-browser/chunks/fr-CBFdzRvP.js +20 -0
  32. package/dist-browser/chunks/ga-DJaPfnhm.js +20 -0
  33. package/dist-browser/chunks/gl-DGevCHr4.js +9 -0
  34. package/dist-browser/chunks/hr-bftpeWZg.js +40 -0
  35. package/dist-browser/chunks/hu-8HD8lzAY.js +96365 -0
  36. package/dist-browser/chunks/imageInfo-Dr3-_PDq.js +136 -0
  37. package/dist-browser/chunks/imageLimits-BNE4vKzW.js +778 -0
  38. package/dist-browser/chunks/is-cTsI-jVB.js +18 -0
  39. package/dist-browser/chunks/it-B2LlJQmC.js +20 -0
  40. package/dist-browser/chunks/la-D9Xb8xYk.js +20 -0
  41. package/dist-browser/chunks/{load-ftVKpJYM.js → load-DdrxdcBX.js} +3933 -2789
  42. package/dist-browser/chunks/lt-CVoaZiBe.js +20 -0
  43. package/dist-browser/chunks/{matrix-DxjvN-4S.js → matrix-B5FnADSk.js} +2 -2
  44. package/dist-browser/chunks/{metafile-CdWE2Vpy.js → metafile-DptHG7TB.js} +573 -572
  45. package/dist-browser/chunks/nb-BUmdhV6O.js +17 -0
  46. package/dist-browser/chunks/nl-CjmaftXs.js +20 -0
  47. package/dist-browser/chunks/{pako-BwlM3ygd.js → pako-GQeNQtI7.js} +4 -4
  48. package/dist-browser/chunks/pixels-6XFJVQ7a.js +411 -0
  49. package/dist-browser/chunks/pl-CIdOeNJN.js +20 -0
  50. package/dist-browser/chunks/{epsInfo-D7b8OFlX.js → psFilters-B5cwwBCH.js} +4 -29
  51. package/dist-browser/chunks/pt-B_XiZgDR.js +35 -0
  52. package/dist-browser/chunks/{rolldown-runtime-BV67vctc.js → rolldown-runtime-BgYtpjgF.js} +20 -6
  53. package/dist-browser/chunks/ru-D59C1Hnv.js +18 -0
  54. package/dist-browser/chunks/sh-cyrl-OIQoxj7t.js +18 -0
  55. package/dist-browser/chunks/sh-latn-Ch7jGS2Z.js +18 -0
  56. package/dist-browser/chunks/sk-B9t8mYnS.js +20 -0
  57. package/dist-browser/chunks/sl-BIcTOy-o.js +20 -0
  58. package/dist-browser/chunks/sniff-DkrGZ2aV.js +45 -0
  59. package/dist-browser/chunks/{strokeOutline-yLvGVz8Y.js → strokeOutline-l2xN2FSn.js} +37 -37
  60. package/dist-browser/chunks/sv-CAQHcWz1.js +18 -0
  61. package/dist-browser/chunks/tr-CXyCGZVy.js +18 -0
  62. package/dist-browser/chunks/uk-BPNl3LhJ.js +20 -0
  63. package/dist-browser/kumiori.js +49186 -39673
  64. package/dist-cli/THIRD_PARTY_NOTICES.md +2644 -63
  65. package/dist-cli/assets/callContext-DjdP5mw2.js +175 -0
  66. package/dist-cli/assets/{cgm-DNhYr9YE.js → cgm-BghxgcD_.js} +11 -9
  67. package/dist-cli/assets/drawioPin-D4FbRxne.js +2026 -0
  68. package/dist-cli/assets/{drawioStencil-FTgn0IEy.js → drawioStencil-BSMGOn9D.js} +34 -16
  69. package/dist-cli/assets/{eps-L8amQ51W.js → eps-DYToaw7H.js} +25 -22
  70. package/dist-cli/assets/epsInfo-BYw7E7_Q.js +65 -0
  71. package/dist-cli/assets/imageLimits-CJwrsFd4.js +1106 -0
  72. package/dist-cli/assets/{load-O0H7f7JT.js → load-Bo3ySXQb.js} +93 -34
  73. package/dist-cli/assets/{metafile-xjD5AdL9.js → metafile-BhJ2ragE.js} +7 -6
  74. package/dist-cli/cli.js +51805 -37885
  75. package/dist-lib/THIRD_PARTY_NOTICES.md +2644 -63
  76. package/dist-lib/{api-DG-iGARW.js → api-AFNmZl7M.js} +20726 -11218
  77. package/dist-lib/callContext-B0aKFxzs.js +98 -0
  78. package/dist-lib/{cgm-CAP3l6Ps.js → cgm-B7nKv2jt.js} +512 -511
  79. package/dist-lib/{eps-BVpP3M6Z.js → eps-CSf22yLI.js} +1668 -1667
  80. package/dist-lib/epsInfo-BAniBFe7.js +33 -0
  81. package/dist-lib/imageInfo-gS8ZraZD.js +136 -0
  82. package/dist-lib/imageLimits-BNE4vKzW.js +778 -0
  83. package/dist-lib/index.js +882 -11
  84. package/dist-lib/{load-WPgVW8G9.js → load-CVKiKdwi.js} +3037 -2978
  85. package/dist-lib/{metafile-DIpYelkX.js → metafile-C98crjki.js} +592 -592
  86. package/dist-lib/node.js +1259 -47
  87. package/dist-lib/types/api.d.ts +212 -27
  88. package/dist-lib/types/areaTree.d.ts +5 -2
  89. package/dist-lib/types/assets.d.ts +37 -1
  90. package/dist-lib/types/callContext.d.ts +87 -0
  91. package/dist-lib/types/canvasRenderer.d.ts +46 -5
  92. package/dist-lib/types/colorGlyph.d.ts +5 -20
  93. package/dist-lib/types/colorGlyphCanvas.d.ts +2 -1
  94. package/dist-lib/types/colorGlyphPdf.d.ts +4 -3
  95. package/dist-lib/types/colorGlyphSvg.d.ts +8 -0
  96. package/dist-lib/types/cssCascade.d.ts +13 -15
  97. package/dist-lib/types/cssSelector.d.ts +34 -0
  98. package/dist-lib/types/cssUnsupported.d.ts +26 -2
  99. package/dist-lib/types/diagnostics.d.ts +83 -0
  100. package/dist-lib/types/documentResources.d.ts +2 -5
  101. package/dist-lib/types/drawio/drawio.d.ts +16 -1
  102. package/dist-lib/types/drawio/drawioHashes.d.ts +9 -0
  103. package/dist-lib/types/drawio/drawioPin.d.ts +11 -0
  104. package/dist-lib/types/drawio/drawioStencil.d.ts +22 -5
  105. package/dist-lib/types/drawio/drawioXml.d.ts +1 -1
  106. package/dist-lib/types/drawio/load.d.ts +2 -0
  107. package/dist-lib/types/drawio/options.d.ts +6 -1
  108. package/dist-lib/types/epsInfo.d.ts +0 -8
  109. package/dist-lib/types/errors.d.ts +57 -0
  110. package/dist-lib/types/foDom.d.ts +7 -0
  111. package/dist-lib/types/foMathFallback.d.ts +0 -7
  112. package/dist-lib/types/foPageMaster.d.ts +2 -0
  113. package/dist-lib/types/fontKind.d.ts +29 -0
  114. package/dist-lib/types/fontLoader.d.ts +8 -1
  115. package/dist-lib/types/fontManager.d.ts +105 -7
  116. package/dist-lib/types/fontMapping.d.ts +6 -0
  117. package/dist-lib/types/fontkitShaping.d.ts +9 -9
  118. package/dist-lib/types/footnotes.d.ts +4 -1
  119. package/dist-lib/types/gradientStops.d.ts +15 -0
  120. package/dist-lib/types/gridTracks.d.ts +2 -0
  121. package/dist-lib/types/htmlImport.d.ts +15 -2
  122. package/dist-lib/types/htmlPaged.d.ts +17 -1
  123. package/dist-lib/types/htmlParserStack.d.ts +0 -13
  124. package/dist-lib/types/htmlPrepare.d.ts +3 -1
  125. package/dist-lib/types/hyphenation.d.ts +19 -2
  126. package/dist-lib/types/iccRegistry.d.ts +35 -0
  127. package/dist-lib/types/imageFormats.d.ts +11 -1
  128. package/dist-lib/types/imageInfo.d.ts +8 -0
  129. package/dist-lib/types/imageLimits.d.ts +23 -6
  130. package/dist-lib/types/index.d.ts +31 -8
  131. package/dist-lib/types/indexCitation.d.ts +4 -6
  132. package/dist-lib/types/inlineFlatten.d.ts +1 -1
  133. package/dist-lib/types/inlineLayout.d.ts +53 -21
  134. package/dist-lib/types/languageTag.d.ts +28 -0
  135. package/dist-lib/types/layoutEngine.d.ts +344 -10
  136. package/dist-lib/types/limits.d.ts +575 -0
  137. package/dist-lib/types/linkPolicy.d.ts +6 -2
  138. package/dist-lib/types/linkedomModules.d.ts +4 -0
  139. package/dist-lib/types/lnode.d.ts +6 -0
  140. package/dist-lib/types/mathContent.d.ts +0 -5
  141. package/dist-lib/types/mathLayout.d.ts +0 -11
  142. package/dist-lib/types/messages.d.ts +4 -15
  143. package/dist-lib/types/node.d.ts +13 -6
  144. package/dist-lib/types/nodeFonts.d.ts +4 -1
  145. package/dist-lib/types/nodeSystemFonts.d.ts +95 -0
  146. package/dist-lib/types/pageRaster.d.ts +142 -0
  147. package/dist-lib/types/paint.d.ts +35 -3
  148. package/dist-lib/types/pdfContentStreams.d.ts +9 -0
  149. package/dist-lib/types/pdfFlatten.d.ts +5 -24
  150. package/dist-lib/types/pdfImage.d.ts +105 -0
  151. package/dist-lib/types/pdfImageEmbed.d.ts +97 -0
  152. package/dist-lib/types/pdfLibPatches.d.ts +17 -1
  153. package/dist-lib/types/pdfPageLabels.d.ts +20 -0
  154. package/dist-lib/types/pdfRenderer.d.ts +118 -16
  155. package/dist-lib/types/pdfStandard.d.ts +82 -11
  156. package/dist-lib/types/pdfStreamGuard.d.ts +44 -0
  157. package/dist-lib/types/pdfTags.d.ts +113 -0
  158. package/dist-lib/types/pdfaVerify.d.ts +2 -0
  159. package/dist-lib/types/pdfxVerify.d.ts +52 -0
  160. package/dist-lib/types/pixels.d.ts +1 -1
  161. package/dist-lib/types/psGraphics.d.ts +0 -9
  162. package/dist-lib/types/psInterp.d.ts +0 -8
  163. package/dist-lib/types/resourceUse.d.ts +16 -0
  164. package/dist-lib/types/resources.d.ts +15 -0
  165. package/dist-lib/types/snapshot.d.ts +91 -0
  166. package/dist-lib/types/snapshotCss.d.ts +57 -0
  167. package/dist-lib/types/sourceLocation.d.ts +44 -0
  168. package/dist-lib/types/sourceRef.d.ts +6 -1
  169. package/dist-lib/types/srgbIcc.d.ts +16 -0
  170. package/dist-lib/types/structure.d.ts +65 -0
  171. package/dist-lib/types/structureBuilder.d.ts +109 -0
  172. package/dist-lib/types/svg.d.ts +23 -1
  173. package/dist-lib/types/svgFilterRaster.d.ts +40 -18
  174. package/dist-lib/types/svgFilterSubregion.d.ts +2 -2
  175. package/dist-lib/types/svgRenderer.d.ts +83 -0
  176. package/dist-lib/types/tableLimits.d.ts +0 -16
  177. package/dist-lib/types/types.d.ts +221 -9
  178. package/dist-lib/types/warichu.d.ts +109 -0
  179. package/dist-lib/types/xmlParse.d.ts +17 -0
  180. package/dist-lib/types/xslfoImport.d.ts +20 -2
  181. package/package.json +8 -4
  182. package/dist-browser/chunks/el-monoton-vcesHl--.js +0 -684
  183. package/dist-browser/chunks/en-gb-DAIgCw5-.js +0 -13027
  184. package/dist-browser/chunks/en-us-BzUSGdOw.js +0 -9109
  185. package/dist-browser/chunks/la-DRKqnbhl.js +0 -548
  186. package/dist-browser/chunks/pixels-BvYSA32R.js +0 -714
  187. package/dist-browser/chunks/ru-C-K8QVC6.js +0 -9694
  188. package/dist-browser/chunks/uk-DsJ1E5t7.js +0 -6134
  189. package/dist-lib/epsInfo-D7b8OFlX.js +0 -565
  190. package/dist-lib/pixels-BvYSA32R.js +0 -714
package/CHANGELOG.en.md CHANGED
@@ -4,6 +4,96 @@
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.6.0 (2026-11-23)
8
+
9
+ - **Typesetting a page built by JavaScript, by turning it into text in the browser window** (new API function `snapshotDocument`, available from `kumiori` and `kumiori/browser`; it works only where there is a DOM and a rendered page (a browser window); the typeset result does not change): Kumiori does not run JavaScript, but a page whose content JavaScript builds (charts, Web Components, CSS-in-JS screens, etc.) can now be typeset by turning the document as JavaScript left it into text. `snapshotDocument(document, options)` waits for the document load, the font loading, the page's own signal (`waitFor`) and rendering to settle (up to `timeoutMs` in all; 10 seconds by default), picks up what `outerHTML` loses, and returns `{ html, options, baseUrl, diagnostics, warnings }`, which can be typeset as is with `typeset(snap.html, { ...snap.options })`. What it picks up: the drawing of canvases (turned into PNG and replaced with `img`), rules added through the CSSOM (`insertRule`; the source text of `<style>` is kept), constructed stylesheets (`adoptedStyleSheets`), Shadow DOM (expanded into the flat tree, with the shadow tree's styles applied only inside it; closed roots only when passed in `shadowRoots`), the current values of forms (written back to attributes; passwords and hidden values are not written), the content of blob: URLs, fonts added by JavaScript (obtained through `fontSources`), relative URLs (made absolute against the document base, with references into the document kept in the `#` form) and the image chosen by `srcset`. `<script>`, event handlers, `javascript:` URLs (including those hidden with spaces or control characters, and SVG animations that change `href` to `javascript:`), document `data:` URLs of `<iframe>`, `<object>` and `<embed>`, `<noscript>` and comments are removed (inside `<template>` too), and `</style` inside the text of a `<style>` is escaped, so that no elements are injected when the copy is parsed again. What could not be taken is reported with new `snapshot/…` diagnostics (9 warnings). The limits are `limits` (`imagePixels`, `fileBytes`, and `snapshotBytes`, which is for snapshots only; 512MB by default). See "Typesetting a page built by JavaScript" in [`docs/en/library.md`](docs/en/library.md)
10
+ - **Page SVG output now has links** (`renderPageToSvg` in the API, `--format svg` in the CLI; **compatibility changes**: the SVG of a document with links gets `a` elements and elements carrying the destination ids; new option `RenderPageSvgOptions.pageHref`; the typeset result, the PDF and PNG output do not change): links on the pages (HTML `a`, XSL-FO `fo:basic-link`) and links inside SVG images (SVG 2 `a` elements) become SVG `a` elements. Links leaving the document are written only when they pass the same link rules as the PDF (`links`, `--link-schemes`, `--link-launch`, `--link-relative`); the others (by default `javascript:`, `data:`, `ftp:` and so on) are not written and a warning is given (`link/action-dropped`). URLs are escaped as XML attributes. A link on a page is a transparent rectangle over the link area, on top of the page content. A destination within the document becomes `#id` on the same page; a link to another page is written as `<URL>#id` in the API only when `pageHref` (a function that takes a page number and returns the URL of that page's SVG) is given (otherwise it is not written), and in the CLI it uses the file name that page is written to (`book-3.svg#id`). The destination id is put on an unpainted rectangle covering that page in its SVG (ids made inside the output avoid the document's ids). When the written SVG is shown with `img`, browsers do not let its links be followed (they can be when it is opened directly or put straight into HTML). Up to 0.5.0, no links were written.
11
+ - **Page SVG and PNG output now also chooses `switch` children in SVG images by `svgLanguages` and draws the content of `foreignObject`** (`renderPageToSvg` and `renderPageToPng` in the API, `--format svg|png` in the CLI; **SVG and PNG output changes** for documents with SVG images that use `switch` or `foreignObject`; the typeset result and the PDF do not change): when SVG images are turned into shapes, `systemLanguage` (SVG 2 §5.6.5) is matched against `svgLanguages` (`--svg-lang`) as in the PDF (a language given where the image is placed wins), and the content of `foreignObject` (SVG 2 §23.2; HTML and MathML) is typeset like the body text and drawn. In 0.5.0 the runtime language was used and only the text of `foreignObject` was approximated (the caveat noted for 0.5.0).
12
+ - **PDF as images** (`<img src="a.pdf">`, `fo:external-graphic`. **Typesetting results change** only for documents that refer to a PDF as an image; before, a "missing image" placeholder was drawn): a page of a PDF is read as an image and embedded in PDF output as a Form XObject, staying vector. The page is chosen with `#page=N` (RFC 8118), the size is the CropBox (clipped to the MediaBox), and `/Rotate` and `UserUnit` are applied. The Antenna House extensions (page ranges, `bbox=`, `page=` in data: URIs) are read only in compatibility mode, and only the first page of a range is placed. Annotations, bookmarks and the structure tree are not carried over (the MCIDs of marked content and the `StructParents` of XObjects are removed, including those of Form XObjects and the like in the resources). Screen, SVG and PNG output draw a placeholder frame (`image/pdf-placeholder`). With PDF/X, PDF/A and PDF/UA-1, each page is checked before it is embedded, and pages that do not meet the requirements (in PDF/A, also pages with optional content) are not placed and are reported (the whole document no longer fails). New limits `pdfImageObjects`, `pdfImagePages`, `pdfImageDepth`, `pdfImageStreamBytes`, `pdfImageLoadMs` (compressed streams, including object streams, cross-reference streams and streams in the resources, are limited in size and time before and while they are decompressed; streams in the resources are copied as the bytes decompressed within the limits, compressed again), and new diagnostics `image/pdf-*`, `pdfx/embedded-pdf`, `pdfa/embedded-pdf`, `pdfua/embedded-pdf` ("PDF images" in [`docs/en/library.md`](docs/en/library.md))
13
+ - **More languages for hyphenation** (HTML and XSL-FO. **Typesetting results change**: only for documents that use hyphenation (`hyphens: auto`, `hyphenate="true"`) in the added languages, and XSL-FO documents with hyphenation whose `language` is an ISO 639-2 three-letter code or whose `country` is an ISO 3166 three-letter or three-digit code): rules (hyph-utf8 patterns, from the hyphen dependency) were added for German (reformed orthography; also the traditional orthography `de-1901` and the Swiss traditional orthography `de-CH-1901`), French, Spanish, Italian, Portuguese, Dutch, Polish, Danish, Swedish, Norwegian (`nb`, `nn`, `no`), Finnish, Hungarian, Slovak, Slovenian, Croatian, Serbian (Latin and Cyrillic script), Bulgarian, Estonian, Lithuanian, Irish, Welsh, Catalan, Galician, Basque, Icelandic and Turkish. The rules are loaded only when a document using the language is opened. Czech, Latvian, Romanian, Indonesian and Macedonian are not hyphenated, because the available rules are under licences that do not fit (GPL or LGPL only) or have no licence statement (the same as a language without resources in CSS Text 3 §5.3). Language tags (BCP 47) are read as language, script, region and variants, and rules are not applied when the script differs from the script of the rules (such as `ru-Latn`). XSL-FO documents whose `language` is a three-letter code (`eng`, `deu`, `rus` and so on; XSL 1.1 allows ISO 639-2) were not hyphenated; this was fixed. Three-letter and three-digit `country` codes (`GBR`, `826` and so on; XSL 1.1 §7.10.1 allows ISO 3166 codes) are also read as the two-letter region (`GB`) (before, `language="en" country="GBR"` was hyphenated with American rules as `en` without a region, and the language in tagged PDF was written as `en-GBR`). For the added languages whose rules are made to leave 3 letters at the end of a word (Portuguese, Slovak, Irish, Welsh and Estonian), 3 letters are left at the end when `hyphenate-limit-chars` does not give the numbers before and after the break. The browser build (`dist-browser/`) puts the rules in a separate file per language and minifies them except for Hungarian (`kumiori.js` does not grow). The copyright and licence notices of each set of rules are at the top of its file and in section 1.4 of `THIRD_PARTY_NOTICES.md` (Hungarian is under the MPL 1.1, Swedish and some others under the LPPL 1.3c, and the others under MIT, BSD and similar permissions)
14
+ - **Structure and reading order of inline absolutely positioned elements in tagged PDF** (HTML; **PDFs change** for tagged PDF (the default) with an absolutely or fixed positioned element inside a paragraph with text or inside an inline element; the page appearance does not change): an inline absolutely positioned element such as `<p>before<span style="position: absolute">abs</span>after</p>` had no structure element, so its text was direct text of the parent paragraph in drawing order (after the paragraph's text). It is now a Span structure element placed among the parent's text where it is written (the reading order is document order; ISO 32000-1 §14.8.2.3), and the paragraph's marked content is split there. A zero-width marker box is placed where the element is written (line break opportunities, line heights and glyph positions do not change; in the Area Tree, the inline area of the text is split there and the marker box is added)
15
+ - **Words across lines when tagged PDF is read in structure order** (HTML and XSL-FO; **PDFs change** for tagged PDF (the default) with lines broken at a space or by hyphenation; the page appearance does not change, and untagged PDF does not change): when the text was read in structure order (read aloud, exported to another format, and so on), the last word of a line and the first word of the next line ran together with no space (`documentation` + `characteristically` → `documentationcharacteristically`), and a hyphen added at the end of a line by hyphenation was read as a hyphen inside the word (`inter-national`). Now a line broken at a space gets the space removed at the end of the line, written as an invisible character after its last character (ISO 32000-1 §14.8.2.5: word breaks are represented by space characters), and a hyphenation hyphen gets a soft hyphen (U+00AD) as the replacement text (`ActualText`, §14.9.4) of its marked content (the marked content of the structure element is split at the hyphen). The characters of the Area Tree (`GlyphArea`) also get `hyphen`, a mark for a character added by hyphenation, and `breakSpace`, the space removed at the end of the line (the Area Tree JSON changes)
16
+ - **PDF/X output intents and output ICC profiles** (output that is not PDF/X does not change; **compatibility changes**: some inputs that produced a PDF before are now errors; **PDFs change**: the PDF/X output intent when only a profile is given): (1) PDF/X-3 now also reports an error (`pdfx/profile-required`) when the printing condition (`pdfx.condition`, `--output-condition`) is not in the ICC registry and no output ICC profile (`pdfx.profile`, `--output-profile`) is given (the same rule as PDF/X-1a; ISO 15930-1 §6.3.2). Before, it wrote an output intent with neither RegistryName nor DestOutputProfile, which does not identify the printing condition. The check after writing applies the same rule to the X-3 output intent. A profile given for X-3 must be CMYK (this was not checked before). (2) When only a profile is given and no printing condition name, the name was JC200103 (the registry name of Japan Color 2001 Coated) and the registry (RegistryName) was written; now the profile's description (the text of its desc tag) is the name (OutputConditionIdentifier, OutputCondition and Info) and RegistryName is not written (so the PDF does not claim a printing condition other than the embedded profile's). For the previous output intent, give `condition: 'JC200103'` or `--output-condition JC200103`. With neither a profile nor a name, it is JC200103 as before. (3) The output ICC profile is now checked up to its header and tag table, not just the color space and device class in the header (ICC.1:2010 §7.2 and §7.3: the profile size in the header, `acsp`, the tag count and the offset and size of each tag's data, and the desc description tag that every profile needs (§8.2)); otherwise it is an error (`pdfx/profile-invalid`). Before, a 144-byte header with only tag signatures was accepted
17
+ - **PDF page labels** (XSL-FO and HTML; **PDFs change** for documents with a non-decimal page number format or renumbered pages; the typeset pages do not change): the page numbers a viewer shows now follow the page numbers on the page (`/PageLabels` in the catalog; ISO 32000-1 §12.4.2). Before, a viewer showed consecutive numbers from 1 even for documents whose front matter is numbered i, ii and whose body starts again at 1. The format comes from the `format` and `initial-page-number` of the XSL-FO `fo:page-sequence`, and from the type of `counter(page, <type>)` in CSS margin boxes and `page` in `counter-reset` and `counter-set`; a new range starts where the format changes or the numbers do not continue. Pages whose numbers PDF cannot write with the same characters as on the page (decimal, Roman numerals and letters), such as kanji numerals, circled numbers, full-width or zero-padded digits, Roman numeral characters, letters that differ from PDF's (ab on page 28, for example) and numbers of 0 or less, are written page by page with the same characters as on the page. The characters around the number (the "-" of "- 1 -") are not included. Documents numbered in decimal from 1 throughout get no page labels. `page` in the area tree gets `pageNumberFormat`, the format of non-decimal pages ([`docs/en/area-tree.md`](docs/en/area-tree.md), "Page numbers")
18
+ - **Nested list content no longer goes one block per page at page ends, leaving runs of nearly empty pages** (HTML and XSL-FO; **typesetting results change** for documents whose nested lists (`ul > li > ul > li`, nested `fo:list-block`) cross a page): when the text and paragraphs (blocks) in a nested list item reached the end of a page, each following page took only one block before moving on to the next, leaving runs of pages with a few lines (this happened in ordinary documents with two levels of nesting; the bug predates 0.4.0 and is not a regression). Lists are laid out as tables with a marker column and a body column, and a nested list becomes a table inside the body of the outer item. When the outer item was split across pages, the height of the continuation of the inner item was taken from what was left on the page holding the outer item, not from the height of the next page. Continuations now fill the height of the next page (XSL 1.1 §6.8 and §4.8, CSS 2.1 §13.3.5). Example: an A5 document that took 5 pages (body lines 33, 1, 3, 1, 3) now takes 2 (33, 8). The random nested documents (nest and fonest from `scripts/gen-stress-docs.mjs`) at size 300 went from 29 to 16 pages and from 30 to 16 pages
19
+ - **The PDF creation and modification dates can be given** (`PdfOptions.date` in the API, the `SOURCE_DATE_EPOCH` environment variable on the command line; without them the PDF does not change): the time given as `date` (a `Date`) to `toPdf`, `typesetToPdf` and the typesetter's `typesetToPdf` is written as the PDF creation and modification dates (`CreationDate` and `ModDate` in Info, and `xmp:CreateDate`, `ModifyDate` and `MetadataDate` in the XMP of PDF/X, PDF/A and PDF/UA) and as the modification date of PDF/A-3 attached files (`ModDate` in `Params`), dropping anything below a second. Before, all of them were the time of typesetting. The command reads the `SOURCE_DATE_EPOCH` environment variable (the reproducible-builds.org specification: an integer number of seconds since 1970-01-01 UTC); a value that does not follow the specification is an error (exit status 1). An invalid `Date` or a time outside the years 0 to 9999 is a `KumioriOptionError` (`option` is `date`)
20
+ - **The same input gives the same PDF bytes** (**PDFs change**: the bytes of the document ID change in every PDF; the appearance and the text do not): the document ID (`ID` in the trailer, and `xmpMM:DocumentID` and `InstanceID` in the XMP of PDF/X, PDF/A and PDF/UA) is made from the SHA-256 of the written PDF instead of random numbers (the same contents give the same ID). `random` in the glyph programs of PostScript fonts (CFF inside EPS) uses random numbers from a fixed seed for each glyph, and PostScript `realtime` is made from the number of interpreter steps instead of the clock. With `date` (`SOURCE_DATE_EPOCH` on the command line), the same version of Kumiori gives the same PDF bytes for the same input, fonts and settings
21
+ - **An option to set characters no font has a glyph for in OS fonts** (API `systemFonts`, command `--system-fonts`; a new option, off by default; typesetting is unchanged without it): characters for which none of the default fonts nor the symbol and emoji fonts has a glyph are looked up in the OS font locations (the font folders on Windows and macOS; on Linux and others, the `<dir>` entries of the fontconfig configuration) and set in the font found (the user agent's system font fallback of CSS Fonts 4 §5.2). In the library, pass `createSystemFonts()` from `kumiori/node` as `systemFonts` (a `createTypesetter` option). Only those characters are set in OS fonts; the fonts and positions of other characters do not change. Characters in a serif (Mincho) context prefer a serif font and those in a sans-serif (Gothic) context a sans-serif one (the kind comes from the OS/2 PANOSE and sFamilyClass and from the name), falling back to fonts of the other kind. Only the kinds of font the document needs are loaded (a sans-serif font is not loaded for characters that appear only in a serif context). Only the tables needed (the character map `cmap` and a few others) are read from each font file to build the index (once per finder), and fonts that cannot be embedded in PDF (OS/2 `fsType`) are not used. A document's `font-family` cannot name an OS font. The OS fonts used are reported after typesetting, with the characters set in each, by the notice `font/system-fallback`, and fonts not used because they cannot be embedded by the warning `font/system-font-not-embeddable`. The number of OS fonts used in one document is capped by the limit `systemFontFaces` (default 16). `dirs` of `createSystemFonts` must be an array of strings (other values are a `TypeError`; relative paths are resolved against the current directory when the finder is created). `systemFonts` is a container option: like the other container options, it is not used when passed in the per-document options of `typesetter.typeset` (`api/setup-option-ignored`). The result depends on the fonts of the machine and the PDF reveals which fonts the machine has, so do not use it for documents written by others (on the command line, combining it with `--no-outside-files` is an error). On the command line, when characters have no glyph and `--system-fonts` is not given, a note that `--system-fonts` can look for them is added after the diagnostics
22
+ - **Placement of floats and absolutely positioned boxes written within lines in HTML** (HTML, in every style; **typesetting results change** for documents with a float written in the middle of a paragraph, an absolutely positioned box without a positioned ancestor whose top or left is auto, or a float inside a flex item): (1) a float written in the middle of a paragraph (`float: left`, `right` and so on, including one inside an inline element) is placed on the line where it is written (CSS 2.1 §9.5.1, rules 6 and 8). Before, it was placed at the start of the paragraph (on the first page for a paragraph that spans pages). A float that does not fit beside the content of that line before it is placed below that line. (2) a float inside an inline element that contains blocks (such as a `div` inside a `span`) is placed on the side where it is written (in the anonymous block, among those the inline element is split into before and after the blocks, that contains the place where the float is written; CSS 2.1 §9.2.1.1). In 0.5.0 it was placed after those blocks (the limitation noted in the 0.5.0 entry). (3) the content-based width (max-content) of a flex item now counts the width of floats inside it (CSS Flexbox 1 §9.2, CSS Sizing 3 §5). Before, it did not, and text that should fit beside the float was pushed to the next line. (4) for an absolutely positioned box (`position: absolute`) without a positioned ancestor, the directions where top and bottom, or left and right, are auto are placed at the static position (where the box would be if it were in the flow; CSS 2.1 §10.3.7, §10.6.4): a box between blocks goes below the preceding block, and a box within a line (including one inside an inline element) goes at the top of the line where it is found and at its position in the line. Before, they were placed at the top and left edges of the page's content area. Only boxes in the body flow of the page (horizontal writing, not multi-column) are placed at the static position; boxes inside multiple columns, in vertical documents and inside table cells, list items and flex items are not placed at the static position (as before, they usually go at the top left of the page's content area). The first line of the text inside the box is indented by the inherited `text-indent` (CSS Text 3 §8.1, as in browsers; this includes the default 1em indent of `p`). When typesetting in the browser (the web page), the browser's positions are used, as before
23
+ - **Laying out only the first N pages** (`maxPages` in the API, `--max-pages <N>` on the command line; without it, typesetting results do not change): to preview the first few pages of a long document, layout can now stop once the first N pages are laid out. When it stops, the result's `truncated` (`TypesetResult`, `TypesetPdfResult`; the layout tree gets `truncated: { maxPages }`) is `true`, and the info diagnostic `layout/max-pages-reached` is reported. Page number references to places after page N (`page-number-citation`, `target-counter()` and so on), the last page number of elements that continue after page N, and the total page count (`counter(pages)`, the total in running heads) cannot be resolved, so they are set as `"?"` (empty with `--style weasyprint`); index lists list only the places within the first N pages, and bookmarks pointing after page N have no destination. One `layout/beyond-max-pages` warning is reported for each kind. The layout of the kept pages is the same as for the whole document as long as their body text has nothing pointing after page N; if it has, the difference in width of those references can change line breaks (a table of contents with leaders rarely changes). Every layout pass stops at page N. Reading the document and the cascade are still done for the whole document, so what gets faster is laying out and writing the PDF. With a container (`createTypesetter`), a stopped document keeps what it remembered but does not advance the generation of the memory. See "Laying out only the first pages" in [`docs/en/library.md`](docs/en/library.md)
24
+ - **Development: before-and-after comparison and area tree fingerprint tests** (typesetting results do not change): added `npm run compare:base -- --base <commit>` (`scripts/compare-base.mjs`), which typesets the same documents with Kumiori at the commit before and after a change and lists the documents and pages whose typesetting changed. It checks out the two commits in temporary locations, builds the command for each, typesets the conformance documents, `examples` and `samples`, plus, when available locally, Antenna House's sample FO collection, the 4th edition of 『CSSページ組版入門』 and the WeasyPrint samples (earlier versions that cannot be given the date are run with the clock and random numbers frozen), and compares the PDF bytes, page counts, the text of each page (words and positions from pdftotext) and the image (pixels from pdftoppm), telling documents with identical bytes from those that only look the same, writing `report.md`, `report.json` and side-by-side images of before, after and the difference for the changed pages. Also, fingerprints (SHA-256) of the area trees of the conformance documents' samples and whole documents, and of the documents in `examples` and `samples/check`, are kept in `test/fingerprints/`, so that `npm test` fails and shows the changed pages when the typesetting changes. When the change is intended, rewrite them with `npm run fingerprints:update` (narrowed with `-t`, only the fingerprints of the documents typeset are rewritten and the others are kept; see "Comparing before and after" and "Area tree fingerprints" in `docs/en/development.md`)
25
+ - **Input limits can be changed with options** (`limits` in the API, `--limit <name>=<value>` and `--list-limits` on the command line; without them the typesetting results do not change): the limits that keep a small input from using up time and memory (image pixels, file sizes, fetch sizes, EPS time and memory, EPUB decompression, draw.io diagrams, table columns, formula glyphs, nesting depths, the work of writing PNG and others; 62 in all) can now be raised for large trusted documents and lowered to tighten a server. Any limit can be lowered; only time and size limits can be raised (nesting-depth limits are lower only; raising one is a `KumioriOptionError`, or an error on the command line). The defaults are unchanged. Raising a limit does not change the limits by file size (code density, decompression ratios). A raised limit is reported with the notice `limit/raised`. `limits` in the `createTypesetter` setup becomes the default for each document, and the typesetter does not reuse what it kept for a document with different limits. The `load` context of plugins gets a read-only `limits`. The names and defaults are in "Input limits" in [`docs/en/library.md`](docs/en/library.md) (the EPUB decompression limits are used only when the browser app reads an EPUB, with the default values there; the API and the command line do not read EPUB, so changing them has no effect). The security policy ([`SECURITY.en.md`](SECURITY.en.md)) treats using more than the set limits (lowered ones included) as a vulnerability, but not using a lot of time or memory within raised limits
26
+ - **Fewer pages and no runs of nearly empty pages in multi-column documents with many footnotes** (XSL-FO and HTML; **typesetting results change** for documents whose multi-column pages have footnotes at the bottom of the page): 0.5.0 changed the re-typesetting that decides the height of the footnote area on multi-column pages (the per-page reservation) to settle pages one by one from the front. In long multi-column documents with many footnotes, the front-to-back passes only got through the first few pages, and the remaining passes piled up reservations, so pages with only a few body lines and no footnotes appeared throughout the document, the page count grew by 40 to 50 percent over 0.4.0, and typesetting took more than twice as long (a regression in 0.5.0; the 0.5.0 change log says this re-typesetting reduced pages with only a few body lines, which was the opposite for such documents). The reservation is now decided during typesetting, at the start of each page: from the positions of the footnote references in the body flow of the previous pass (the amount of body text, independent of where the columns break), the footnotes that fall on the page and the height they need are estimated, and the smallest reservation that holds them is used. A page that starts at the same place keeps the reservation that fit in an earlier pass, and raises it if it did not fit. When the reservation of an earlier page changes and the body shifts, the reservations of later pages follow the shifted body, so typesetting usually settles in 2 to 4 passes. The same change fixes pages where the footnotes are more than fit on a page: the reservation used to swing up and down, settle on the larger value and leave nearly empty pages (present since 0.4.0). On a page with body text, the reservation leaves one and a half lines of body (a line with a footnote call can be taller than the line height; it was one line). In a randomly generated two-column document with many footnotes (3,000 body lines, 238 footnotes; mix3000a.html from `scripts/gen-column-footnotes.mjs`), 288 pages and 52 seconds just before this change (an unreleased version after 0.5.0) became 143 pages and 9 seconds (0.4.0: 204 pages, 26 seconds, and it dropped 56 footnote lines), and footnotes whose first part is on a different page from the reference went from 41 (0.4.0: 44) to 0. The layout of footnotes on multi-column pages (where footnotes split, the space between the body and the footnotes, and the number of pages) changes
27
+ - **A link from the app to the API reference** (app; typesetting results do not change): "API reference" (API の説明書) was added to the bar at the top of the app. It opens the list of the library's functions, types and options (`api/` under the app on GitHub Pages) in a new tab. On narrow screens, it is under "Other" (そのほか) in "Settings" (設定)
28
+ - **Faster re-typesetting of a slightly edited document** (the `createTypesetter()` container in the API; the layout result and the PDF do not change): the container remembers the preparation of `@font-face` font files (decompressing WOFF2, checking the tables) and the line breaking of paragraphs with the same content, style and width from the previous document, and reuses them for the next document. Re-typesetting while editing one paragraph at a time takes about 9 s instead of about 13 s for a 151-page HTML document, and about 3.2 s instead of about 4.1 s for a 103-page XSL-FO document (from the second or third re-typesetting, once the order of the fonts is the same; paragraphs containing inline boxes, images, footnotes or page number references are not reused). It uses memory for what it remembers (one previous document; at most about 400 MB); `createTypesetter({ reuse: false })` turns it off. In documents with many tables, the reuse can make re-typesetting the same document about 20 percent slower than in 0.5.0 (with `reuse: false` the speed is about the same as in 0.5.0)
29
+ - **Per-call message language** (API; typesetting results do not change): `TypesetOptions.lang` is now kept in a per-call context. `typeset` and container `typeset` calls with different `lang` values that run at the same time (without awaiting each other) each write warnings and error messages in their own language (before, the language of the call that started last applied while they overlapped; both in Node and in browsers). A call without `lang` keeps the language that was in effect when it started. Warnings from the result's `renderPage` (Canvas) are also written in the language of the typesetting call, as with `toPdf` (before, the default language at that moment)
30
+ - **A signal to stop typesetting, and progress** (new API options; nothing changes, including speed, unless they are passed; typesetting results do not change): `signal` (an AbortSignal) and `onProgress` for `typeset`, `typesetToPdf` and the container's `typeset` and `typesetToPdf`; `setup.signal` and `setup.onProgress` for `createTypesetter`; `signal` and `onProgress` for the result's `toPdf`; and `signal` for `renderPageToSvg` and `renderPageToPng`. When stopped, the returned Promise rejects with `signal.reason` (an `AbortError` `DOMException` if no reason was given). An already aborted signal fails before anything is read; the signal is checked each time a font or resource is read, and fetches in flight are stopped. `resolveResource` and `loadFont` receive `{ signal }` as a second argument (the fonts a container first loads when a document needs them (math, monospace, symbols and emoji) are shared with the other calls typesetting with the same container at the same time, so `loadFont` gets the timeout only, and a stopped call just stops waiting; the loads of the other calls do not fail). For `typesetToPdf`, the `signal` and `onProgress` of the typesetting options (`options`) apply through writing the PDF, and passing them in the PDF options (the third argument) throws `KumioriOptionError`. It is also checked each time a page is laid out and each time a PDF page is written, and progress reports the font (`fonts`), resource (`resources`), import (`import`), layout (`layout`; pass and page count) and PDF (`pdf`; pages written and total) phases. When they are passed, Kumiori pauses at layout pass, page-sequence and PDF page boundaries (it does not pause in the middle of laying out one page-sequence, so to stop there, stop inside `onProgress`). The container stays usable after a stop, and its cross-document memory does not count the stopped document as a generation. See "Stopping and progress" in [`docs/en/library.md`](docs/en/library.md)
31
+ - **Work and layer counting of PNG output** (PDF, SVG and the PNG of pages that do not reach the limits do not change): the color of a gradient with many color stops (a fine `repeating-linear-gradient` has about 4,000) was found by searching the stops from the start for each pixel; it now uses a binary search (40 such boxes on A4 at 300dpi took 16 seconds, now 1.4 seconds; a two-color gradient takes 0.9 seconds). The work count adds log2 of the number of stops per pixel for gradients with more than 16 stops. The limit on layers held at once (`pngLayerPixels`) now counts the layers of opacity groups and masks by the size they actually grow to, not by the area they may draw into when made (often the whole page; on large pages or at high resolutions, even shallow nesting of small opacity boxes reached the limit and overlaps inside were drawn darker). When growing the layer of an opacity group would exceed the limit, its contents so far are composited before drawing the rest. Fixed the contents of the outermost clip (such as inside an SVG opacity group) not being drawn when the count was near the limit. The note in the 0.5.0 documentation and SECURITY.md that the work of such gradients is not counted has been removed
32
+ - **Faster typesetting of long content inside nested tables and lists** (HTML and XSL-FO; typesetting results do not change): for a table inside a table cell (HTML lists are laid out as tables too), every time an outer level split a row across pages, the layout that measures the inner level's row height was redone, so a table at depth k was laid out k times (1.7 seconds for 4,000 `<p>` elements inside a list nested 16 levels deep). During one typesetting run, the height of each one-row layout is now remembered, and the measuring layout is skipped for rows that will be split across pages; the same document typesets in 0.6 seconds. A row that could not be split is no longer split again under the same conditions (in some places the number of attempts doubled at each nesting level). Rows whose layout leaves traces outside the table (markers, absolutely positioned boxes) are measured as before
33
+ - **Faster typesetting of documents with many subsequent-sibling combinator (`A ~ B`) rules** (HTML and SVG `<style>`; typesetting results do not change): matching walked back over every previous sibling of each element to find one that matches the left part of `~`, so the work grew as rules × elements × siblings (about 40 seconds for 4,500 `.cN ~ *` rules and 400 sibling `<p>` elements). During one cascade, the position of the first child matching each left part, and how far the children have been matched, are now remembered per parent, and the same document typesets in 1.4 seconds (about the same as the same number of next-sibling combinator `+` rules; Selectors 4 §16.4)
34
+ - **Diagnostics for CSS declarations with invalid values, XSL-FO import notes and reached limits** (HTML and XSL-FO; typesetting results and the PDF do not change; **compatibility changes**: diagnostics and exit codes. They are added to `warnings` and `diagnostics`, and the exit code with `--fail-on warning` (and with `--fail-on error` for `fo/master-reference-not-found`) on the command line changes): (1) Declarations of known CSS properties with invalid values (such as `display: foo`, `color: notacolor` or `margin: foo`, which CSS 2.1 §4.2 ignores as a whole) are reported with the new diagnostic `css/invalid-value` (a warning; args `property` and `value`). Before, they were dropped without a warning. Only declarations in author style sheets and `style` attributes are counted, one per "property: value". Values with `var()` or `attr()`, prefixed values (such as `-webkit-box`) and declarations with a readable declaration of the same property in the same rule (or `style` attribute; fallback values for browsers) are not counted. Values that are valid CSS but that Kumiori does not read (system font names such as `font: caption`, and `font-size: math`) are reported as `css/unsupported`, and extension values written on an unprefixed property that are read only with the compatibility option `--style ah` (such as `border-style: dot-dash`) are reported as `css/unsupported` ("a value read only with --style ah") when that option is not given. They are also shown in the app's conversion report. (2) XSL-FO import notes (approximations and defaults used instead: a too-large number of columns was capped, no region matches `flow-name` so the content was flowed into the body region, `axf:document-info name="title"`, which is not in the Antenna House documentation, and so on) were shown only in the app's conversion report. They are now also reported on the command line and in the API's `diagnostics` as the new diagnostic `fo/note` (a warning). When no page master matches the `master-reference` of an `fo:page-sequence`, typesetting ended with 0 pages and no message; it is now reported with the new diagnostic `fo/master-reference-not-found` (an error, since the content of that `page-sequence` is missing from the output; args `name`). (3) When the input limits (`limits`, `--limit`) are lowered, the places that cut the input without a diagnostic (grid track lists `gridTracks`, leaders of repeated characters `leaderRepeats`, selectors expanded from nested rules `nestedSelectors`, collected stylesheet and font references `styleRefs`, the depth of `@import` `importDepth`, `tableColumns` lowered below the HTML limit of 1,000 for the `span` of `col` and `colspan`, and `pdfImage*` for PDF images that were not drawn) now report the new diagnostic `limit/reached` (a warning; args `limit` and `value`), once per limit name per typesetting (limits reached during `toPdf`, `renderPageToSvg` and `renderPageToPng` of a result are added to its `warnings` and `diagnostics` afterwards). With the default limits, ordinary documents do not get it. (4) The warnings for an `fo:block-container` with `overflow="condense"` (`layout/condense-overflow`, `layout/condense-capped`, `layout/condense-height-unknown`) were not reported when the container was inside an inline box (`fo:inline-container`) or a footnote body (`fo:footnote-body`), because the layout that measures the content did not report warnings. They are now reported once each, as elsewhere. (5) The `args` of a diagnostic code are now the same wherever it is reported: `font/file-unreadable` always has `file` (the name of the file that could not be read), and also the font name `font` for `@font-face` (before, `@font-face` had only `font`). Font fetch errors (`KumioriFontError`, `font/load-failed`) always have `font`. `png/image-not-drawn` and `png/image-limit` have, for images inside SVG, the `src` of the SVG image that contains them (before, they had no `src`)
35
+ - **Empty values and `--watch` in the command** (command; typesetting results do not change. **Compatibility changes**: how empty values are treated): (1) an empty value (`''`; for comma-separated lists, also a value with no items) for an option that takes a file, directory or plugin path (`--font-dir`, `--font-cache`, `--font`, `--css`, `--base`, `--spot-colors`, `--output-profile`, `--drawio-stencils`, `--plugin`) or a name (`--ignore-warning`, `--output-condition`) is now an invalid value (exit code 1). Before, it was accepted and taken as the current directory (`--font-dir ''` read fonts from the current directory, `--base ''` resolved against the current directory) or as not given (`--css ''`, `--ignore-warning ''`) (`-o ''` became an error in 0.5.0). (2) `--watch` stopped re-typesetting from the second save made by writing a new file and renaming it over the old one, as editors do (Node's recursive `fs.watch` on Linux does not watch the file after the rename); this is fixed. On Linux, the input directory and each directory below it are now watched (including directories created later). (3) The warning for an unknown name given to `--ignore-warning` (`api/unknown-diagnostic-code`) now names `--ignore-warning`, not the API option (`diagnostics.ignore`). (4) The exit status section of the command guide now says that even with `--watch`, a plugin that cannot be loaded ends the run with exit code 1 without watching (before, it only said that `--watch` does not change the exit code)
36
+ - **Checked to run on Deno and Bun** (documentation and a development tool; layout results unchanged): the library (`kumiori`, `kumiori/node`, `kumiori/browser`) and the command were checked to run on Deno 2.9 and Bun 1.4, and what was checked is written in the README and in "Package entry points and requirements" of the guide. It also notes that the single browser file is the one to use where there is neither the Node API nor a DOM, such as Cloudflare Workers (not tried on Workers itself). Added `node scripts/check-runtimes.mjs`, which loads the packed package on Node, Deno and Bun.
37
+ - **A promise on API stability** (documentation; typesetting results do not change): the public API is divided into what is kept across versions (the entry functions, `TypesetResult`, the main options, error types and names, `kumiori/node`, the functions that walk the Area Tree) and what may change (the layout result, details of Area Tree fields, message wording, the internal structure of the output, new and experimental options), written with how they relate to `PLUGIN_API_VERSION` and `AREA_TREE_SCHEMA_VERSION` in "API stability" of the library guide. While the version is 0.x, even the stable parts may break compatibility in a minor version, and such changes are marked "**compatibility changes**" in the changelog.
38
+
39
+ ## 0.5.0 (2026-11-22)
40
+
41
+ - **Image warnings inside inline boxes and footnote bodies** (HTML and XSL-FO; typesetting results and PDF output do not change; **compatibility changes**: diagnostics and exit codes): 0.4.0 reported nothing for missing images (`image/not-found`, severity error), images that cannot be drawn (`image/unsupported`), images that can be drawn only in part (`image/partial`) and missing references inside SVG (`image/reference-not-found`) inside `inline-block`, `fo:inline-container` and footnote bodies (HTML `float: footnote`, `fo:footnote-body`), because the layouts that measure their content did not report warnings. They are now reported once each, as elsewhere. They are added to `warnings` and `diagnostics`, and the exit codes of `--fail-on error` (missing images) and `--fail-on warning` on the command line change
42
+ - **Fixes to PDF/X and PDF/A output** (the PDF does not change when they are not requested; **compatibility changes**: unknown PDF/X versions, PDF/X-1a printing conditions not in the registry, the kinds of profiles, and the check of PDF/X-4 after writing (an error when it does not conform); **the PDF changes**: actions and output intents in PDF/X, and missing glyphs and XMP in PDF/X-4): (1) when the written PDF/X was read back and checked, characters in the glyph data of font files (TrueType streams without the `Length1` length entry) that look like operators (`PS`, `rg` and so on) were taken as operators, so documents using some characters of the default fonts (such as 戀 in bold Mincho and 赥 in Gothic) could not be written with `--pdfx x1a`, `x3` or `x4`. Only the content streams of pages, Form XObjects, patterns, Type3 glyphs and annotation appearances are now checked, and the PDF/A check does the same. The glyphs of Type3 fonts written directly in resources and the streams of annotation appearances (`/AP`) are now checked too, for both PDF/X and PDF/A. (2) The `--pdfx x4` check took structure elements of type `JavaScript` (XSL-FO `role="JavaScript"`) for JavaScript actions and refused to write the PDF; this is fixed. (3) An unknown value for `pdfx.version` in the API (such as `'x4'`; case-sensitive) silently produced PDF/X-3; it is now an option error (`KumioriOptionError` with `option` set to `pdfx.version`), as with `pdfa.version` (leaving it out still means PDF/X-3). (4) Keywords consisting only of separators (XSL-FO `axf:document-info name="keywords" value=","`) wrote an empty `Keywords` entry, and the PDF/A and PDF/X-4 checks stopped with "Keywords in Info differs from XMP"; empty keywords are no longer written. (5) On the command line, the list of places that do not meet the PDF/X or PDF/A rules was printed on one line with `\x0a` in place of the line breaks; each item is now printed on its own line. (6) PDF/X-1a:2001 and PDF/X-4 output, and the check after writing, now follow the text of ISO 15930-1 and ISO 15930-7. PDF/X (X-1a, X-3 and X-4) no longer writes actions (bookmarks keep only their titles and destinations within the document, and destinations pointing outside are dropped; annotations with actions (links to outside, submit and reset buttons) are not written either; the count is given in a `pdfx/actions-dropped` notice, which is not shown by default but appears with `--verbose` or `--diagnostics json` on the command line and in `diagnostics` in the API). The `RegistryName` of the output intent is written only when the printing condition is in the ICC registry (0.4.0 always wrote `http://www.color.org`). For PDF/X-1a, a printing condition that is not in the registry without a profile (`pdfx.profile`, `--output-profile`) is an error (`pdfx/profile-required`). The profile must have an AtoB1 table (A2B1) for PDF/X-1a and be an output device profile (device class `prtr`) for PDF/X-4; otherwise it is an error (`pdfx/profile-invalid`). PDF/X-4 no longer draws characters that have no glyph in the font (.notdef), as with PDF/A and PDF/UA. PDF/X-4 output is now also read back and checked after writing. (7) The XMP packet (PDF/X-4, PDF/A, PDF/UA) now contains about 2,000 bytes of white space so that it can be rewritten later (XMP Specification Part 1 §7.3.2; **the PDF changes**: compared with 0.4.0, only PDF/X-4 changes; PDF/A and PDF/UA are new in 0.5.0)
43
+ - **README and documentation reorganized** (typesetting results do not change): the README is now an entry point with highlights, getting started, features and a guide to the documentation. The details moved to new documents: the library guide ([`docs/en/library.md`](docs/en/library.md)), using the web app ([`docs/en/app.md`](docs/en/app.md)), the feature list ([`docs/en/features.md`](docs/en/features.md)), fonts ([`docs/en/fonts.md`](docs/en/fonts.md)), architecture ([`docs/en/architecture.md`](docs/en/architecture.md)) and development and testing ([`docs/en/development.md`](docs/en/development.md)). The Japanese versions are in `docs/`
44
+ - **Command reference** (typesetting results do not change): added [`docs/en/cli.md`](docs/en/cli.md) (Japanese: [`docs/cli.md`](docs/cli.md)), which organizes the options of the Node CLI into tables by category (argument, default, description), with common examples, detailed examples with output, environment variables and exit codes; the "Node CLI" section of the README was removed, and the README now has only a one-line example in "Getting started" and a pointer to this reference. The `--help` descriptions of `--lang` and `--font-cache` now match the actual behavior (the locale is looked up in `LC_ALL`, `LC_MESSAGES`, `LANG`, and the Linux cache also honors `$XDG_CACHE_HOME`)
45
+ - **CLI `-o` ending with `/`** (typesetting results do not change; **compatibility changes**: an `-o` naming a missing directory with a trailing `/` and an empty `-o` become errors): with a single input, passing a missing directory ending with `/` to `-o` (`-o out/`) wrote a PDF without an extension under the name with the trailing `/` dropped (`out`) and exited with 0. An `-o` ending with `/` (also `\` on Windows) is now taken as a directory: if it does not exist, this is an error (exit code 1); if it exists, `<input name>.pdf` (`.svg` or `.png` with `--format svg` or `png`) is written inside it. The behavior with several inputs (`-o` is the output directory, created if missing) and when an existing directory is given without `/` does not change. With standard input (`-`), an `-o` ending with `/` or naming an existing directory, which used to stop with a write error, is now an error asking for a file name in `-o` (exit code 1). With a single input, an `-o` ending with `/` that names an existing file is an error saying it is not a directory; with several inputs, an `-o` naming an existing file, which printed a stack trace, is now an error message (exit code 1). When `-o` ends with `/` or is an existing directory, the output format is not taken from the `-o` extension (a PDF is written even inside a directory named `d.svg`). An empty `-o` (`-o ''`), which wrote next to the input as if `-o` were not given, is now an invalid-value error (exit code 1)
46
+ - **CLI outputs no longer overwrite files the conversion reads, or outputs of other inputs** (typesetting results do not change; **compatibility changes**: an `-o` that writes to a file the conversion reads or to the output of another input becomes an error, and colliding output names change): if an output is a file the conversion reads (the input (including the file behind standard input, when redirected with `< a.fo`), the images, CSS and fonts the document uses, the fonts read from `--font-dir` and `--font-cache`, the files of `--css`, `--font`, `--spot-colors`, `--output-profile`, `--drawio-stencils` and `--plugin`, and the files under a directory given to `--drawio-stencils`; a hard-linked alias counts as the same file) or an output written from another input in the same run, nothing is written and it is an error (exit 1). When the same input is given more than once (`a.html a.html`), it is typeset only once, with a note (previously it was written again as `a-2.pdf`; when several inputs were given, `-o` stays the output directory after they are merged, except that with `-o -` the merged input is written to standard output). When the output is the same as standard output (a file or a pipe), as in `-o /dev/stdout > out.pdf` or `-o /dev/stdout | cat > out.pdf`, the conversion report goes to standard error (previously the report line overwrote the start of the PDF, or was appended to its end, and broke it). On machines whose file systems ignore case (macOS, Windows), the output names of `A.html` and `a.fo` are also treated as colliding. Previously, typesetting `fig.html` with `<img src="fig.svg">` as `--format svg` overwrote the image `fig.svg` with the page SVG (exit 0), and giving `-o` the same name as the input (`-o one.html`) overwrote the input with the PDF (since 0.4.0). When output names collide (`a.html` and `a.fo` in the same directory, for example), later ones now keep the input name with its extension (`a.fo.svg`; if that still collides, `a.html.2.svg`) instead of getting `-2`, `-3` (previously, typesetting a 3-page `a.html` together with `a.fo` as `--format svg` wrote the output of `a.fo` as `a-2.svg`, erasing page 2 of `a.html`; the names of PDF outputs change the same way). `--watch` with `--format svg` or `png` no longer re-typesets a multi-page document over and over (only `a.svg` was excluded from watching, while the files actually written, `a-1.svg` …, triggered re-typesetting). An image whose relative reference contains `%2F` (`<img src="a%2Fb.png">`) no longer stops the command with exit 1 without a PDF; it is warned about as an unreadable image and the document is typeset
47
+ - **SVG and PNG output of the same document can be run again** (typesetting results do not change): the "images the document uses" that outputs must not overwrite are now the images the typesetting actually looked up, not every image whose content the library read. Previously, typesetting `a.html` with `<img src="img/a.svg">`, or `b.html` whose text mentions `b.png`, twice with `--format svg` or `png` took the earlier output (matched only by the end of its name, or merely named in the text) as a file the conversion read, and the second run failed (exit 1; with `--watch`, every time). Inputs are now merged only when they are the same name in the same directory (a symbolic link or a hard-linked alias in another directory is a separate input, written next to itself). The files inside a directory given to `--drawio-stencils` and the `--plugin` files are no longer overwritten by outputs either
48
+ - **Checks of CLI arguments and library options** (**typesetting results change**: an `.xml` input with `--xhtml` is read as XHTML, not XSL-FO; nothing else changes; **compatibility changes**: the arguments and options below become errors, and the error type of `createFontLoader` changes): if the value of a CLI option that takes a value is the name of another option (`-o --print`), it is taken as a missing value and is an error (exit 1; previously a PDF named `--print` was written). Control characters (such as ESC) in argument error messages are written in a visible form, as in warnings. `--xhtml` now takes effect for `.xml` inputs too (previously `.xml` was read as XSL-FO; since 0.4.0). Numbers for `--image-max-dpi` are now written as for `--dpi` (digits and a decimal point; previously `0x10` and `1e3` were accepted too). Diagnostics for XSL-FO attributes that were not read and for values not in the list of allowed values (`fo/unsupported`) now carry the location (line and column) of the element. Values of the library options `documentLang`, `tagged`, `print`, `pdfua`, `name` and `unreferencedCss` outside their types, and `options`, `setup` or `pdf` that are not objects (such as `null`), are now option errors (`KumioriOptionError`) (previously `documentLang: 123` returned an unreadable PDF without an error, and a `null` `options` gave a raw `TypeError`). When `createFontLoader` of `kumiori/node` cannot fetch a font, the error is now a `KumioriFontError` (`code: font/load-failed`) like the other font errors (previously an `Error` without a `code`). The API reference and [`docs/en/library.md`](docs/en/library.md) now note that when calls with different `TypesetOptions.lang` values run at the same time, the language of the call that started last applies while they overlap
49
+ - **Security and robustness against crafted input** (protection of time and memory when typesetting documents written by others on a server; the typesetting results of documents that do not reach a limit do not change (**compatibility changes** and **typesetting results change**: on the command line, documents that refer to files whose names start with `.` under the input directory; see the item on attachment annotations below), and neither do their PDFs except in the items marked **the PDF changes**; limits and their grounds are in the source comments; when a limit is reached, the document is typeset as far as possible and a diagnostic is reported):
50
+ - In tagged PDF tables, the total number of empty cells (`TD`) added to even out the rows is limited to the number of cells in the document or 10,000, whichever is larger (a single cell spanning 1000 columns added 999 empty cells to every other row, and a 4KB document produced a 12.8MB PDF). In a table beyond the limit, each row gets a single empty cell whose column span (`ColSpan`) evens out the columns (diagnostic `limit/table-structure-cells`). Counting the row widths now takes time proportional to the number of cells rather than the number of columns
51
+ - The descriptions (`Contents`) of the annotations of links that span lines or pages in a tagged PDF: the full text of the link was rebuilt and written for every annotation; it is now built once per link, reused, and cut at 2,000 characters (counted after collapsing white space) (diagnostic `limit/link-description`). Long links made the PDF and memory grow as "number of lines × number of characters", and with `--pdfa 3b` the strings exceeded the PDF/A length limit so no PDF/A could be written
52
+ - The actions of the annotations of links that span lines or pages (also in untagged PDF): the full URL was written for every annotation; annotations with the same target now refer to one action (the PDF grew as the number of per-line annotations × the URL length; a link with a 200KB URL and 6,000 words (235KB) took 9.9 seconds and 473MB, now 2.5 seconds and 287MB. Since 0.4.0. **The PDF changes**: in documents with external links (URLs), even short ones, the annotation's action (`A`) is written as a reference to an indirect object instead of a dictionary written directly in the annotation. How the PDF looks and behaves when opened does not change)
53
+ - XSL-FO warichu (`kumiori:warichu="auto"`): whether an `fo:inline` can be a warichu and whether it is inside one are remembered per element and decided from the results of its children and parent (it took time proportional to the square of the number of warichu times the nesting depth; a 27KB document took 19 seconds)
54
+ - Internal entities in the XSL-FO DOCTYPE: the expansion of each entity is built once and reused (referring many times to nested entities that expand to nothing took time growing exponentially with the depth while the length stayed the same; a 1KB document took more than 200 seconds). The limits on the nesting depth (8 levels) and on the expanded length stay as before
55
+ - Re-breaking the last lines of `text-wrap: pretty` paragraphs of more than 100 lines when set one line at a time: at most 200 line lengths are tried per group (for lines very long compared with the font size, such as 1pt text in a 16000pt line, the number of tries grew with the line length and the time with its square; a 49KB document took 57 seconds. In paragraphs whose line length exceeds 200 times the font size (1pt when the font size is smaller than 1pt), the tried lengths are spaced more widely). Also, the length of exactly 3/4 was sometimes not tried because of rounding errors; this is fixed
56
+ - Locations of diagnostics for unsupported and unknown CSS: the text search is done only for the diagnostics that are kept (200 per code; none for codes that are not reported), and lines are looked up in a table of line starts (each item searched the whole CSS and document; a 549KB document with 40,000 unknown CSS properties took 34 seconds)
57
+ - In the lines of the command-line option `--diagnostics json`, DEL and C1 control characters (U+007F to U+009F, including U+0085), U+2028, U+2029, bidirectional marks and controls (U+061C, U+200E, U+200F, U+202A to U+202E, U+2066 to U+2069) and the BOM (U+FEFF) from the document are written like `\u2028` (readers that treat them as line breaks split one entry into two lines, and the 8-bit CSI U+009B starts a terminal control sequence). The text output also shows these in a visible form. Line breaks and control characters in input file names are also shown in a visible form in the conversion report and in the error line of an input that could not be typeset (a line break in a name used to start a new line, which could look like a fake line starting with `{`)
58
+ - Table and note structure in tagged PDFs: to decide the scope of header cells (`th`), whether a row has a `td` is checked once per row (a 100KB document with 10,000 `th` in a row took 14 seconds). When numbers are added to IDs of notes (Note) with the same id, the next number is remembered per value (20,000 notes took 18 seconds). When the rows (TR) of tables split by `ends-row` and `starts-row` without `fo:table-row` are built, the list of children of the parent is rebuilt only once at the end. The structure tree and the PDF do not change
59
+ - File attachment annotations (XSL-FO `axf:annotation-file-attachment`): annotations that attach the same file point to a single embedded file (a 14KB document attaching a 1MB file 100 times produced a 100MB PDF. **The PDF changes**: only for documents that attach the same file more than once; the appearance and the attached contents do not change)
60
+ - Custom structure types in XSL-FO (`role`, `axf:pdftag`): types such as `role="JavaScript"` were taken for actions by the PDF/A check, so no PDF could be written with `--pdfa`; this is fixed. Type names with non-ASCII characters (`axf:pdftag="名前タグ"`) are written as PDF names in UTF-8 bytes (characters up to U+00FF were written as one Latin-1 byte and later characters as 4-digit hexadecimal character codes, so readers read them as different names. **The PDF changes**: only for documents that use custom type names with non-ASCII characters)
61
+ - The 127-byte limit on custom structure type names in XSL-FO (ISO 32000-1 Annex C) is counted in UTF-8 bytes instead of characters (Japanese names of 43 to 127 characters were used as they were, and with `--pdfa 3b` the error "a name longer than 127 bytes" stopped the PDF/A output; such names now give a standard type instead of a custom one. **The PDF changes**: only in documents using custom type names of 128 bytes or more in UTF-8 (from about 43 Japanese characters); those elements get a standard structure type. How the PDF looks when opened does not change)
62
+ - References made of `url(` and a long run of spaces (HTML image `src`, and XSL-FO `external-destination`, form submit targets and `axf:annotation-file-attachment`): the regular expression that extracted the content made the leading and trailing spaces and the content compete for the same spaces, taking 8 seconds for a 2 KB value (`<img src="url(`, 2,000 spaces and `x">`) and over 200 seconds for 6,000 spaces. The surrounding parts are now removed before the content is examined (time proportional to the length; the extracted content is the same as before)
63
+ - The columns of an HTML table (the sum of the `span`s of `<col>` and `<colgroup>`) are now limited to 1,000 per table, as in XSL-FO (previously only a single `span` was limited to 1,000, so 1,000 `<col span="1000">` made a million columns and took 3.6 seconds, and 2,500 took 19 seconds and 1.3 GB). The excess columns are dropped, and a new diagnostic `limit/table-columns` (warning) is reported once per table
64
+ - XSL-FO form submit targets (`external-destination` of `axf:form`): absolute paths (`/…`) and UNC paths (`\\host\…`) were written as-is as `SubmitForm` targets. As with the link policy, they are now written only with `links.launch` (`--link-launch`); otherwise they are left out and reported
65
+ - File attachment annotations (XSL-FO `axf:annotation-file-attachment`): matching a file by the end of its name alone is now limited to files passed with a name without a directory, and references pointing outside the document's location (`file:`, absolute paths, `..`) are never matched by name, and are reported as pointing outside the document's location (a path that goes up and back into the input directory, such as `url('../doc/note.txt')`, also counts as outside; variations such as `./` and `//` in paths are normalized on both sides) (previously it matched any file under the input directory by the end of its name, so `url(../../x/.env)` could attach another `.env`; since 0.4.0). The command no longer passes files under the input directory whose names start with `.` (such as `.env`) as the document's files, as with directories starting with `.` (**compatibility changes** and **typesetting results change**: 0.4.0 skipped only directories starting with `.`. An image whose name starts with `.` (`<img src=".dot.svg">`) becomes a missing image (`image/not-found`), and a style sheet (`<link href=".s.css">`) silently does not apply. To use such a file, name its path with `--css`, or give it a name that does not start with `.`)
66
+ - Deep nesting: values with `calc(` nested 5,000 levels deep (CSS, XSL-FO, SVG) and XHTML nested 4,000 levels deep exhausted the call stack (`RangeError`), so the whole document could not be typeset. Parentheses and functions inside `calc()` are now limited to 64 levels (deeper values are ignored as invalid), and rewriting XHTML no longer uses the call stack to walk the nesting
67
+ - **Long footnotes on multi-column pages** (XSL-FO and HTML; **typesetting results change** for documents whose multi-column pages reference a footnote that does not fit below the referencing line, and for documents where the rest of a long footnote carries over to the next page): in a multi-column document (`column-count` in HTML, `column-count` on `fo:region-body` in XSL-FO) with footnotes placed at the bottom of the page (the area spanning all columns), a footnote longer than the space left below the referencing line (but short enough to fit on a page) was reserved whole, shrinking the columns to a few lines. The referencing line then kept moving to the next page, page after page held only two lines per column, and on a later page the footnote was drawn over the body lines. Such a footnote now starts on the page of the reference, and the rest is split by lines and continued at the top of the footnote area of the following pages (XSL 1.1 §6.12.3, CSS GCPM 3 §2; as on single-column pages). The footnote area never overlaps the body lines. A footnote inside a before-float (the entry below) is split in the same way (the reference position is taken at the float's anchor in the column; the float stays at the top of its page and the rest of a footnote that does not fit continues on the next page, rather than moving the float and the footnote together to the next page). When the continuation of a footnote from the previous page is carried over again to the next page, the footnotes referenced on the page still start on the page of the reference (before, once one continuation was carried over, all the footnotes of the page were carried over too, so footnotes referenced while a long footnote was continuing moved away from the page of the reference; with a height limit on the footnote area (`max-height` in `@footnote`) they are still carried over in order, as before). On the pages added after the end of the body, continuations that cannot be split (such as one-line footnotes) were stacked whole, so the footnote area grew taller than the body area and its top lines went off the page and disappeared without a warning; such a continuation now goes to the next page when the page already has footnotes, and one that does not fit on a page with nothing else is placed with the overflow warning. The relayout that decides the height of the footnote area (the reservation for each page) now settles the pages from the front (before, the reservations only grew, so a reservation made for footnotes in the first layout stayed after the body moved, leaving pages with a few body lines and no footnotes, adding pages and "a line does not fit on the page" errors). However, in a multi-column document with more footnote text than fits on a page, the relayout of the reservations can swing between raising and lowering and settle on the larger one, leaving an almost blank page (0.4.0 does the same). On a page with body text, the reservation leaves the height of one body line. The limit on relayouts is raised from 6 to 16 (a long multi-column document with many footnotes can take about twice as long to typeset)
68
+ - **Floats and absolutely positioned boxes inside HTML inline elements** (HTML, in every style; **typesetting results change** only for documents with a float or an absolutely positioned box inside an inline element): (1) floats (`float: left`, `right` and so on) inside inline elements (`em`, `span`, warichu and so on) are now laid out (CSS 2.1 §9.5). Before, they disappeared with their content and without a warning. They are placed in the enclosing block, and one written inside a paragraph is placed at the height of the start of that paragraph (as when it is written directly in the paragraph). A float inside an inline element that contains blocks (such as a `div` inside a `span`) is, for now, placed after those blocks (not at the height where the float is written). Floats inside a footnote body (`float: footnote`), an element moved to a running header (`position: running()`) and flex and grid items (including items of `inline-flex` and `inline-grid`) are laid out inside it (in the footnote area, the margin box or the item; a float written directly in a footnote was already laid out in the footnote area). (2) absolutely positioned boxes (`position: absolute`, `fixed`) and floats inside inline elements now inherit the font size and other inherited properties from their parent inline element in the document tree (CSS 2.1 §6.2; before, they inherited from the enclosing block). For example, the text of an absolutely positioned box inside a `span` with `font-size: 6pt` changes from 12pt to 6pt, and its position changes with the text size
69
+ - **Pages can be written as PNG** (new feature; typesetting results and PDF output do not change): the API's `result.renderPageToPng(page, { dpi, guides })` and the command's `--format png` (can be omitted when `-o` ends with `.png`), `--dpi <value>` (96 by default) and `--pages` turn typeset pages into PNG (8-bit RGB on white paper; up to 40 million pixels per image, beyond which a `RangeError` is thrown). It works in the browser and in Node and rasterizes by itself with no added dependencies (each shape is computed only over its own area, with anti-aliasing). Glyphs come from the font outlines, SVG images are the same shapes as in the PDF, and color glyphs are drawn too. Apart from how the edges of glyphs and lines are anti-aliased, it matches the same page's PDF rendered with pdftocairo. A text-heavy A4 page at 150dpi takes about 0.5 seconds. CMYK JPEG and interlaced PNG images are not drawn and a warning is given. Decoded images are kept up to 100 million pixels in total per typeset result and reused across pages (an image used as the background of many pages is not decoded again for each page; large images that together exceed the 100-million-pixel memo may be decoded again for each page when placed alternately, still within the per-page limit), and images decoded for one page may total up to 400 million pixels (reducing a kept original-size image to another size counts its original pixels too; images after that are not drawn, with a `png/image-limit` warning; this is counted separately from the work limit below, so decoding 400 million pixels of images can take about 50 seconds for JPEG: four 100-million-pixel JPEG images on one page take about 48 seconds for A4 at 96dpi). The work of rasterizing one page (the sum of the pixels in the bounding box of each shape, the edges crossed on each scanline, the work of sorting them and so on) is limited to 128 times the number of pixels in the page plus 64 million (beyond that, the rest is not drawn, with a `png/raster-budget` warning; SVG images that could not be finished are drawn as placeholder boxes). Opacity groups and mask contents are drawn on layers only as large as their contents (the layers held at once are limited to 8 times the number of pixels in the page (but not less than 16 million pixels) and to 64 million pixels (1GB); deeper nested opacity groups beyond that are drawn without a layer, applying the opacity to each shape inside (overlaps inside get darker), and masks and color glyph compositing beyond that are not drawn, with a `png/layer-limit` warning; the limit is checked before a layer is allocated, so a small HTML file with deeply nested opacity boxes no longer uses several GB); the coverage of the intersection of nested clips counts toward the same limit (at 4 bytes per pixel, as a quarter of a layer pixel; no array is made when the new clip fully covers the area of the outer clip), and a deeper clip beyond it is drawn with the outer clip only when it encloses the outer clip (its own edge is not applied), and otherwise its contents are not drawn, with a `png/clip-limit` warning (before, a 1.6KB HTML file with 60 nested full-page boxes with `overflow: hidden; border-radius: 1px` used 2.4GB at 300dpi), and a pattern tile with the same content is drawn once per page (tiles kept up to 16 million pixels in total). Strokes outside the area being drawn are skipped without building their outlines (an SVG with 200 fine dashed lines outside the area being drawn took about 5 seconds before, and about 0.03 seconds now). Decoded images are identified by their content (data: images inside SVG are reused across pages too). Links, annotations and form fields are not drawn. The work count does not include that the work per pixel of a gradient with many color stops (such as a fine `repeating-linear-gradient`) grows with the number of stops, so when rasterizing documents written by others, put a time limit on it from outside ([`docs/en/cli.md`](docs/en/cli.md), "Limits and memory"). The languages matched against SVG `systemLanguage` (`--svg-lang`) and the content of SVG `foreignObject` have no effect on PNG and SVG output (`switch` chooses by the language of the runtime, and `foreignObject` content is not drawn; the PDF draws them)
70
+ - **Pages can be written as SVG** (new feature; typesetting results and PDF output do not change): the API's `result.renderPageToSvg(page, { guides, idPrefix })` and the command's `--format svg` (can be omitted when `-o` ends with `.svg`) and `--pages 1-3,5,7-` turn typeset pages into SVG. It works in the browser and in Node with no added dependencies. Glyphs become outline paths (each glyph is written once in `defs` and placed with `use`: a page of 2,700 Japanese characters (290 kinds) is 0.5MB instead of 2.2MB with an outline per character) and images are embedded in the SVG, so it draws the same picture as the PDF without the font and image files (SVG images become the same shapes as in the PDF, and color glyphs become shapes, gradients and images; color glyphs from the OpenType SVG table are drawn in color in Node and in Web Workers too, without calling `toPdf()` first (also in PNG)). Coordinates are written with 3 decimal places and matrix and scale factors with 7 significant digits (rounding a small scale factor to 3 decimal places drew an SVG with a large `viewBox` placed small about 6% too large). `vector-effect` `non-scaling-stroke` and `non-scaling-size` become shapes whose width, dashes and size are divided by the scale at which the SVG is placed, as in the PDF (also in PNG; the scale of a CSS `transform` is not applied). Very large numbers (such as `1e308`) are clamped to the largest 32-bit floating-point value (about 3.4e38) (before, `Infinity` was written). When the document has several pages, the command writes each page to a name with `-<number>` added (even when only one page is chosen with `--pages`). A `--format` that does not match the `-o` extension (`.pdf`, `.svg` or `.png`), and a `--pages` that names a page the document does not have, are errors, and nothing is written. The same image is embedded once per placed size (up to 8 sizes per image; further sizes stretch one copy) and referenced with `use` where it is placed (placing the same image many times no longer makes the output grow with the number of placements. However, because the content is embedded once per size, placing one image in many sizes (the tile sizes of repeated backgrounds count too) makes the output up to about 9 times the image's embedded data (base64, about 4/3 of the original file): a page placing a 1.2MB JPEG in 9 sizes and as a repeated background gives 14MB. The content is embedded per size because referencing one embedded copy stretched changes pixels slightly in Chromium). Links, annotations and form fields are not written (nor are links inside SVG images). `idPrefix` must be an XML name without `:` (anything else is a `RangeError`)
71
+ - **Negative, zero and sub-1pt page sizes** (HTML and XSL-FO; **typesetting results change**, only for documents that give a negative or zero page size or one smaller than 1pt): negative and zero lengths in the HTML `@page` `size` (invalid by CSS Paged Media 3 §7.1) are not read (when this is visible from the value itself, the `size` of an earlier rule stays; when a `calc()` comes out negative or zero, the default page size is used). Lengths smaller than 1pt (such as `1e-320pt`) cannot make a page either, so they are not read and the default page size is used (before, the numbers of the PDF MediaBox were broken, like "0.000…finity"). The command's `--page-size` and the API's `pageSize` also reject lengths smaller than 1pt. In XSL-FO, a `page-width` or `page-height` smaller than 1pt falls back to the default size and is reported. Before, the page was laid out with the negative size, and SVG and PNG output had a negative size (the PDF had the size with its sign flipped). PDF numbers whose absolute value is smaller than the smallest normalized PDF real number (about 1.175e-38; ISO 32000-1 Annex C) are written as 0, and non-finite numbers (NaN as 0, infinity as the largest value, about 3.403e38) and numbers beyond the largest value are clamped (PDF real numbers have no exponent; ISO 32000-2 §7.3.3; before, an SVG with a 1e300 viewBox placed with scale(1e10) wrote "Infinity" into the content stream and readers reported a syntax error). The numbers of text matrices (`Tm`) are clamped in the same way and written without an exponent (before, `@page { size: 1e25px 1e25px }` wrote `7.5e+24 Tm`)
72
+ - **API reference** (typesetting results do not change): a list of pages of the functions, types and options of the public API (`kumiori`, `kumiori/node`), generated from the comments in the type declarations (`npm run docs:api`; TypeDoc; in Japanese). It is placed below the web app on GitHub Pages (<https://n-lights-co.github.io/kumiori/api/>). Along with it, the types referenced by the public types but not usable by name (`PdfXOptions`, `PdfAOptions`, `FoCompat`, `MessageLang`, `LinkPolicy`, `DocumentInfo`, `AreaStructure`, `StructNode`, and the types of Area Tree fields such as `BorderSide` and `Edges`) are now exported from `kumiori`, and `PdfOptions` is now a documented type instead of a type picked from the internal type of the PDF writer (the fields are the same)
73
+ - **XSL-FO `axf:document-info name="document-title"` is read as the document title** (XSL-FO; typesetting results do not change, but the PDF now gets the document title): in the list of `name` values of `axf:document-info` in the Antenna House documentation, the document title is `document-title`, but Kumiori read only `title`, which is not in that list, so PDFs of documents that set their title with `document-title` had no title (Info Title, XMP `dc:title`). `document-title` is now read as the title (in every mode). `title` is still read as the title (the conversion report of the app shows a note to rewrite it as `document-title`; the command's diagnostics and the API's `diagnostics` do not show it yet); when both are given, `document-title` is used. With `--pdfua`, such documents no longer fail the PDF/UA-1 rule for a missing title (7.1-9)
74
+ - **Tagged PDF by default** (**the default output changes**): the command line, the API and the browser app now write tagged PDF by default (document structure, reading order, alternate text for figures, language; see the item below). The page appearance (positions of text, lines and images) does not change, but the PDF contents change and the file grows by about 10 to 20% (for example, the HTML Conformance Guide 1,348KB → 1,542KB, the XSL-FO Conformance Guide 790KB → 958KB, CSS-Print 4,432KB → 4,608KB), and typesetting takes slightly longer. To get the same PDF as before, use `--no-tagged` on the command line, `tagged: false` in the API, or turn off "Tagged PDF" in the settings of the browser app (the choice is remembered in the browser). PDF/X-1a and X-3, whose transparency is flattened, cannot be tagged, so they are written without tags by default (the same PDF as before; an explicit `--tagged` or `tagged: true` is still an error). `--pdfua` cannot be combined with `--no-tagged`
75
+ - **Warichu (inline cutting notes)** (HTML and XSL-FO; new feature; documents that do not use warichu are typeset as before): typesets a note in two lines of characters smaller than the main text inside a line (JLREQ §3.4). Neither standard CSS and XSL-FO nor the extensions of other formatters have a way to write it, so it is written with Kumiori extensions: `-kumiori-warichu: auto` on an inline element in CSS (the initial value is `none`), and `kumiori:warichu="auto"` on `fo:inline` in XSL-FO (namespace `https://github.com/n-lights-co/kumiori/ns`; the declaration `xmlns:kumiori` is required, and a document without it is an XML error whose message explains how to declare it). The size of the warichu characters is the font size of that element. The brackets around it are set with `-kumiori-warichu-brackets` and `kumiori:warichu-brackets` (`auto` = full-width parentheses, `none`, or two strings), at twice the size of the warichu characters, with no space between a bracket and the adjacent character. The two lines are divided at the line-break opportunity nearest to the middle of the content, and the second line is not made longer than the first (when the line-breaking rules prevent a division near the middle, the second line is made one character longer or starts with a character that must not start a line, so that the line of the main text does not overflow). There is no hyphenation inside a warichu. The center of the two lines is aligned with the center of the main text characters, and the line height does not change (also in HTML quirks mode (documents without a DOCTYPE), a warichu counts in the line height as a box containing characters, so lines with only a warichu are not set closer). A warichu that does not fit on one line of the main text is divided at the end of the line and continued on the next line or page, and the part on each line is divided into two lines separately (brackets only at the first and last parts). The opening bracket is not put at the end of a line, nor the closing bracket at the start of a line. Vertical writing (the first line on the right) is also supported. In a right-to-left paragraph (`dir="rtl"` and so on), when the brackets are at a right-to-left level (the surrounding text runs right to left), the opening bracket is put on the right and the closing bracket on the left (with mirrored glyphs; UAX #9 L4), and the outer side of each bracket (the right of the opening one, the left of the closing one) is trimmed (before, the brackets faced outward and the closing bracket overlapped the adjacent character; this is for horizontal writing only, and warichu in right-to-left paragraphs in vertical writing are as before). Ruby inside a warichu is set at the size of the warichu characters, and only when there is ruby over the base characters of the second line (or ruby under the first line), a gap of the ruby's size is left between the two lines (the warichu may then extend above and below the line of the main text by that much). Boxes that are not characters, such as images and inline-blocks, are not typeset inside a warichu, and a warning is reported. For a warichu inside a warichu, the inner one is not made a warichu, and a warning is reported. A warichu whose content is only white space is not made a warichu. `-kumiori-warichu: auto` has no effect on elements that are not inline elements (`display: inline`), and a warning is reported. The border, padding, margin and background of the warichu element are put outside the warichu including its brackets, as for other inline elements, and vertical padding and borders are not counted in the line height. A warichu that spans lines follows `box-decoration-break` (slice puts none on the divided side; clone puts them on each line). In tagged PDF it becomes a Warichu structure element (content WT, brackets WP; ISO 32000-1 §14.8.4.4). See section 9.2 of the HTML and CSS volume and section 4.6 of the XSL-FO 1.1 volume of the Conformance Guide
76
+ - **Tagged PDF** (HTML and XSL-FO; new option; typesetting results do not change): `--tagged` on the command line and `tagged` in the API put the document structure and reading order into the PDF (ISO 32000-1 §14.7, §14.8). Headings, paragraphs, lists (labels and bodies), figures (`img`, `svg` and `object` shown as an image; alternate text, Alt), captions, links (the annotation goes into the Link structure element with an alternate description, Contents), `section`, `article`, `div` and so on, tables (Table, Caption, THead, TBody, TFoot, TR, TH, TD, with the direction of header cells (Scope), RowSpan and ColSpan of merged cells, and Headers from the `headers` attribute) and footnotes (`float: footnote`; the reference mark in the text becomes Reference, and the body becomes the Note that follows it, with an ID and its number as Lbl) become PDF standard structure types, ordered in document order (the reading order stays the document order even when multi-column layout or floats change the drawing order; a footnote body is read at its reference). Structure types are decided by the element and `role`, not by CSS `display`. The document language and the language of elements that differ from their parent are written to Lang. Backgrounds, borders, decorative images (`alt=""`) and the contents of `aria-hidden` become artifacts, and running heads, page numbers and table headers and footers repeated from the second page on become pagination artifacts. Tags are added by default (see the item above). XSL-FO input also gets structure from its elements (paragraphs, lists, tables, footnotes, figures, links), `role` and the Antenna House extensions (`axf:pdftag`, `axf:alttext`, `axf:expansion-text`), with fo:static-content as pagination artifacts and fo:leader as an artifact. Annotations other than links go into Annot structure elements, and links without text (in running heads and so on) get their destination as the alternate description. Table rows with missing cells are padded with empty TD elements so that all rows have the same number of columns. Ruby becomes Ruby (base text RB, annotation RT), and emphasis marks are artifacts. Top and bottom margin boxes and fo:region-before and fo:region-after become Header and Footer pagination artifacts. Annotations other than links go into Annot and form fields into Form structure elements, with a description (TU) on the field. The contents of boxes with opacity (transparency group Form XObjects) are also marked per structure element. `--pdfua` on the command line and `pdfua` in the API write PDF/UA-1 (ISO 14289-1): XMP `pdfuaid:part` and `dc:title`, `DisplayDocTitle`, no .notdef glyphs, and warnings for what is missing (title, language, alternate text for figures and formulas, heading levels). `--document-lang` and `documentLang` give the document language when the input has none. In addition, in the area tree (`AreaTree`), the areas of tables with collapsing borders (`border-collapse: collapse`) and tables whose column widths are sized to their content (and their rows and cells), table captions (`caption`), footnote bodies and the elements in them, and leaders (CSS `leader()`, fo:leader) now carry the input node number (`sourceRef`), which was missing (leaders become artifacts). It cannot be combined with `--pdfx x1a` or `x3`. The structure types (H2, P and so on) and reading order of absolutely positioned elements (`position: absolute`), spanning headings (`column-span: all`) and boxes in an orthogonal writing mode (such as a vertical paragraph in horizontal text) are kept (they used to lose their types and become text directly under the document, and absolutely positioned elements were read at the end of the document). Ruby inside `aria-hidden` becomes an artifact, base text and annotation alike (it used to get marked-content numbers (MCID) that were not in the structure tree)
77
+ - **PDF/A-2b and PDF/A-3b output for long-term archiving** (new feature; PDFs written without it do not change): `--pdfa 2b|3b` on the command line, `toPdf({ pdfa: { version: 'A-2b' | 'A-3b', warnings } })` in the API (and `typesetToPdf`). Writes the markers of PDF/A (ISO 19005-2 and -3) at the level that preserves the appearance (b): an output intent (S is `GTS_PDFA1`), `pdfaid:part` and `pdfaid:conformance` in the XMP metadata, and matching Info and XMP values. The output intent profile is an sRGB ICC profile (version 2.1) that Kumiori builds on the fly (no third-party file is bundled). Transparency is written as is (PDF/A-2 and later allow it). An sRGB output intent does not allow CMYK, so CMYK colors (`cmyk()`, `device-cmyk()` and so on) and spot color alternates are converted to RGB with the same formula as the screen preview, with a warning (CMYK JPEGs cannot be converted, so the output stops with an error that says why). The following are not written, with a warning: Launch actions (even with `--link-launch`), form fields (their drawn frames remain), and characters with no glyph in the font (.notdef). Annotations get the Print flag, lose hiding flags, and get an appearance. Attachments are embedded in PDF/A-3b with a MIME type, a modification date and `AFRelationship`, referenced from `AF` in the catalog; PDF/A-2b does not embed them (only PDF/A files may be embedded) and writes text annotations instead. TrueType font files get their decoded length (`Length1`; ISO 32000-1 §9.9; pdf-lib does not write it). It can be combined with `--pdfx`: this needs `--output-profile` (CMYK), writes two output intents (`GTS_PDFX` and `GTS_PDFA1`) that refer to the same profile, and writes the PDF/X version marker with its extension schema in the XMP (colors are converted to CMYK as for PDF/X). The written PDF is read back and checked against the PDF/A requirements (file header, encryption, output intent, device color spaces, graphics state, images, font embedding, annotations, forms, actions, metadata, embedded files, name and string lengths, `q` nesting depth); if it does not meet them, the output stops with an error. Output was checked with the PDF/A validator veraPDF 1.28.2 against the PDF/A-2b and 3b rules, and passed: the HTML and XSL-FO conformance documents, CSS-Print (spot colors), the Antenna House sample FO collection, and documents with annotations, attachments, tagged PDF and PDF/X combinations. However, it has not been checked against the text of the PDF/A standards (section numbers come from the table of contents and public descriptions), so conformance is not guaranteed. PDF/A-1b (which does not allow transparency) and the a level (which needs tagged PDF) cannot be written yet
78
+ - **Order of SVG `filter` and `clip-path`, `mask` and `opacity`** (**typesetting results change**: only SVG with a `filter` and a `clip-path`, `mask` or `opacity` on the same element or an ancestor, when drawn on Node; browsers rasterize the whole SVG and were already right): `filter` was applied to the shapes after clipping, masking and opacity; it now follows the specified order (filter → clipping → masking → opacity; Filter Effects 1 §5, CSS Masking 1 §2), on the shape-approximation path, the pixel path and the transparency-flattening path of PDF/X-1a and X-3 alike. Examples: a red rectangle clipped by a circle of radius 10 and dilated by 5 with `feMorphology` was a circle of radius 15 → a circle of radius 10 (as in Chromium). A rectangle with `opacity="0.4"` and `feFuncA type="discrete" tableValues="0 1"` drew nothing → an opaque rectangle drawn at 0.4. With `opacity=".5"` and `feDropShadow`, the shadow showed through the shape → the shadow and the shape are made translucent together. Also, a masked image (an image with transparency, such as a filter result computed in pixels) is put in a transparency group before the mask is applied (the image's SMask replaced the soft mask of the graphics state, so the mask had no effect; ISO 32000-2 §11.6.5.3). The limitation describing this difference was removed from the conformance documents.
79
+ - **Footnotes inside before-floats on multi-column pages** (XSL-FO and HTML; **typesetting results change**): in a multi-column document (`column-count` on `fo:region-body` in XSL-FO, `column-count` in HTML) with footnotes placed at the bottom of the page (the area spanning all columns), a footnote inside a before-float (`fo:float float="before"`, `float: top` with `--style ah`, and so on) was placed nowhere, with no warning. A page-number reference (`fo:page-number-citation`) to an `id` inside the float also came out as "?". Footnotes inside the float now go in the footnote area of the page the float is placed on, in document order (XSL 1.1 §6.12.3 and §6.12.2, CSS GCPM 3 §2.2). Single-column documents, and footnotes placed per column (`axf:footnote-position="column"`), already placed them
80
+ - **Speed, memory and PDF size of documents that place the same SVG many times** (typesetting results do not change): each time an SVG image (`<img>`, `fo:external-graphic`, background images, draw.io diagrams) was placed, all of its drawing operators were written to the page again. Now they are written once into a Form XObject per SVG and placed size, and later placements draw that Form (ISO 32000-2 §8.10). The pattern and gradient matrices inside the Form are made from the Form's coordinates (§8.7.3.1), and masks, opacity, fonts and spot colors are looked up in the same resource dictionary as the page. Links from SVG `a` elements are still made at each placement. An HTML file placing a 9.5-million-character SVG with `<img>` went from 41.9 s, 2.8 GB and a 27.5 MB PDF to 13.6 s, 1.2 GB and 9.1 MB for 3 placements; 5 placements ran out of memory and now take 13.5 s and 1.6 GB; 31 placements take 12.8 s, 1.2 GB and 9.1 MB. An HTML file placing a draw.io diagram of 3,000 shapes 30 times went from 11.5 s, 1.2 GB and 15.8 MB to 3.3 s, 0.45 GB and 0.54 MB. Positions and shapes do not change (in some viewers, gradient colors can differ by one to a few pixel levels, from the rounding of the transformation from the Form's coordinates). SVGs whose transparency is flattened for PDF/X-1a and X-3 are still drawn at each placement, as are SVGs whose root `overflow` is `visible` (not clipped) in Antenna House compatibility
81
+ - **Speed of documents with many rules whose rightmost part is `*`** (HTML, and `<style>` in SVG written directly in HTML and in SVG images; which declarations apply to which elements does not change): rules whose rightmost compound is a bare `*` with a descendant or child combinator on its left (`*:nth-child(3n+3) *`, `g > *` and so on) cannot be narrowed by the rule index (the rightmost id, class or element name), and were matched for each element by walking its ancestors, so the work grew as the number of rules × the number of elements × the depth of ancestors (25 seconds for 1000 such rules and 20,000 shapes split into 200 `g` elements, in SVG written directly in HTML). The answer for such a rule depends only on the element's parent and is the same for siblings, so it is now matched once per parent and reused for the siblings (3 seconds for the same document, about the same as typesetting it without the rules). For rules with an element name and so on in the rightmost part, the answer for the part left of the rightmost compound (the part that walks the ancestors) is likewise reused for siblings with the same parent (1000 rules of `*:nth-child(kn+k) span` and 20,000 `span` elements: 24 seconds → 8 seconds). In `<style>` in SVG images, such rules ending in `*` no longer reach the limit on the number of matches (500,000), so the image is drawn instead of a placeholder box
82
+ - **Typesetting in a Web Worker** (the single-file browser build `kumiori/browser`; typesetting results on the main thread do not change): typesetting, `renderPage`, `toPdf` and `typesetToPdf` can now be used in a worker, so that the page does not freeze while a large document is typeset. (1) A worker has no DOMParser, so HTML and SVG are parsed with linkedom (the same parsing as in Node). Previously linkedom was imported by its bare name, and `createTypesetter()` already failed (`Failed to resolve module specifier 'linkedom'`). linkedom and htmlparser2 are loaded from separate files (`chunks/`) only the first time a document is typeset in a worker (never on the main thread). (2) `renderPage` accepts an `OffscreenCanvas` (previously it failed trying to set the canvas's `style`). The default `devicePixelRatio` is 1 in a worker, which has no `window`. (3) A worker has no browser images (`<img>`), so SVG images are drawn as shapes in the PDF, as in Node, and `renderPage` draws the shapes as pixels (at the resolution of the current scale). The canvas and the PDF in a worker draw SVG through the same shape path as Node, so they may look different from the SVG the browser draws on the page (`renderPage` only approximates the text in `foreignObject`; a filter of `feGaussianBlur` alone is drawn without the blur; an SVG image inside an SVG is a placeholder box). Fonts from an SVG's `@font-face` are loaded when the document is typeset, so they are used even when `renderPage` is called before `toPdf`. Images inside an SVG in forms the pixel reader of the typesetter cannot read (CMYK JPEG, interlaced PNG) are read with `createImageBitmap` when the document is typeset, and broken images the browser cannot read either are left out on their own, as in the PDF (they are read with up to 4 million pixels each, scaling larger images down, and up to 32 million pixels in total per typeset result; images beyond that, the later ones in loading order, are not drawn by `renderPage`, without a warning; an image whose header gives a larger size is scaled down while it is read; the PDF is not affected). The work of rasterizing an SVG image in `renderPage` (number of shapes × number of pixels) is limited: an image with many shapes placed large is drawn at a lower resolution, and images after the total for one drawing is used up are drawn as placeholder boxes with a `canvas/svg-not-drawn` warning. See "[Typesetting in a Web Worker](docs/en/library.md#typesetting-in-a-web-worker)" in the library guide for an example and for where the result may differ from typesetting on the main thread.
83
+ - **Radial gradients where transparency is flattened in PDF/X-1a and X-3, and inside SVG filters computed as pixels** (**typesetting results change**): SVG `radialGradient` and CSS `radial-gradient()` and `repeating-radial-gradient()` (which the typesetter draws as SVG radial gradients) change only in these places. (1) Areas turned into images to flatten transparency in PDF/X-1a and X-3: radial gradients with translucent stops, radial gradients inside a box with `opacity`, and radial gradients under a translucent object. (2) Radial gradients inside a filter of an SVG image that cannot be approximated with shapes and is computed as pixels (`feColorMatrix`, `feMorphology` and so on), in PDFs made in Node, which has no screen (the PDF and `renderPage` in a Web Worker, available from this version, draw them the same way; PDFs typeset on the browser's main thread do not change, as the browser rasterizes the SVG). (2) applies to ordinary PDFs and PDF/X-4 as well. Radial gradients elsewhere than (1) and (2) (the shadings in ordinary PDFs and PDF/X-4, and those in PDF/X-1a and X-3 where transparency is not flattened) stay PDF shadings (Type 3) and do not change. 0.4.0 took the wrong root of the quadratic that finds the circle giving a point its color, and painted an ordinary radial gradient with the focal point inside the outer circle (every CSS radial gradient, and SVG ones without `fx` and `fy`, for example) in the single color of the first stop. Now the color comes from the circle through the point (with radius ≥ 0) with the largest t, as in SVG 2 §14.2.3.2 and the PDF Type 3 shading (ISO 32000-1 §8.7.4.5.4), and the color changes from the center to the edge, as in ordinary PDFs and in browsers. When the focal circle lies outside the outer circle, the area outside the cone touching both circles is not painted (0.4.0 painted it in the color of the first stop).
84
+ - **White space around comments between text, and non-white-space characters directly in flex and grid containers** (HTML, any style. **Typesetting results change**: only documents written as below): (1) at a comment, processing instruction or `display: none` element between text, the white space on both sides was not collapsed and two spaces remained (`<p>x <!--c--> y</p>` gave "x y"). Comments are treated as absent and the run of white space collapses to one space (CSS Display 3 §1, CSS Text 3 §4.1.1; `white-space: pre` and `pre-wrap` still do not collapse). (2) In an element with `text-transform: full-width`, the space at a comment became two ideographic spaces; white space is now collapsed before the characters are transformed (CSS Text 3 §2.1). (3) A run of text directly inside a `display: flex` or `grid` container that consists only of `&nbsp;` or ideographic spaces now becomes an item (it was treated as white space and dropped; only runs of spaces, tabs and line breaks are not rendered. CSS Flexbox 1 §4)
85
+ - **Repetition of `@page` backgrounds, and the order of longhands and the shorthand** (**typesetting results change**: only HTML documents written as below): (1) `background-repeat: repeat-x` and `repeat-y` and the two-value form (`repeat no-repeat` etc.) are read for page background images (only `no-repeat` was read and everything else was tiled in both directions. CSS Backgrounds 3 §2.4). (2) A shorthand written after a longhand, as in `background-attachment: scroll; background: url(a.png) fixed`, now wins as the later declaration (the shorthand resets earlier longhands to their initial values. CSS Backgrounds 3 §2.10; the longhand was read first, giving scroll). The same applies across separate `@page` rules and to the declarations of margin boxes (`@top-center` etc.)
86
+ - **Position of collapsed-border tables aligned by `text-align` on `fo:table-and-caption`** (XSL-FO. **Typesetting results change**: only tables with collapsed borders (`border-collapse="collapse"`, the initial value) that have their own borders, inside an `fo:table-and-caption` with `text-align` `center` or `end`): the box between the outer grid lines (the centers of the borders) is aligned (CSS 2.1 §17.6.2; the same box as a table with `auto` margins). The table was shifted toward the start by half of its border that lies outside (a centered table with a 3pt outer border was 1.5pt to the left). The outer border of the table in `axf-justify-rowspan-height-1` from Antenna House's sample FO collection is now at the same position as in the sample
87
+ - **Patterns inside SVG masks, and color-changing filters on images** (**typesetting results change**: only SVG written as below, which was drawn as a placeholder box): (1) elements filled with a `pattern` inside a group with `mask` are drawn (the outer mask was carried into the pattern contents and the SVG failed with "pattern content"; pattern contents do not inherit the clipping and masks of the element they fill. SVG 2 §14.3). (2) Images and pattern fills with a color-changing filter (`feColorMatrix`, `feComponentTransfer`) are computed in pixels (graying an image with `feColorMatrix type="saturate" values="0"`, recoloring an icon inside a mask, etc.; the colors were changed as shapes and failed with "filter color". Filter Effects 1 §9.6, §9.7)
88
+ - **Shapes painted with patterns or gradients and shifted by SVG `feOffset`** (**typesetting results change**: only SVG where a shape filled with a `pattern` or a gradient (or stroked with a gradient) has a filter that shifts it with `feOffset` and is approximated with shapes (`feOffset` alone, `feOffset` with `feGaussianBlur` and so on). When drawing in Node): the shifted copy dropped the pattern or gradient, so a pattern became a flat fallback gray (128, 128, 128) and a gradient a flat area of its last color. The pattern or gradient is now shifted together with the shape (as in Chromium; Filter Effects 1 §9.19). The same holds for PDF, for flattening transparency in PDF/X-1a and X-3, and for PNG output. For pattern-filled shapes that are also blurred, the strokes that widen the shape to approximate the blur are no longer drawn (a pattern cannot be used for strokes, so they made a gray edge)
89
+ - **Overlapping children of an SVG element with a `mask`** (**typesetting results change**: only SVG with two or more overlapping shapes inside an element with a `mask` (`g` and so on), SVG with a `mask` on a single shape with both fill and stroke, SVG with shapes whose stroke width does not scale (`vector-effect="non-scaling-stroke"`) inside a `mask` (masks inside groups and groups inside masks too; PDF), SVG with nested `mask`s (PNG), and SVG with a shadow `filter` (`feDropShadow` and so on) around an element with a `mask`, when drawn in Node; PDF and PNG): (1) the mask was applied to each child shape (and separately to the fill and the stroke of a single shape with both), so where the mask was faint, the color under an overlapping child showed through (the lower child was faintly visible under the upper one). The mask is now applied once to a transparency group of the children (CSS Masking 1 §7.1: a mask applies to the rendered element; as in Chromium). When the children include shapes whose stroke width or size does not scale (`vector-effect`), the mask is applied to each child as before. (2) In PDF, strokes whose width does not scale inside a mask (including masks inside groups and groups inside masks) were drawn without dividing by the scale at which the SVG is placed. (3) In PNG, the outer mask of nested masks was applied twice and came out fainter. (4) Shadows approximated with shapes (copies shifted by `feDropShadow` and so on) were cut by the masks and clip paths at the original position. Shadows now move together with the masks and clip paths of the descendants (Filter Effects 1 §9.19; as in Chromium), and a group with a mask is copied as a group with the mask applied once, in the shadow copies too
90
+ - **Order of relayouts in the app** (app; typesetting results do not change): when a new load started while the previous one was waiting for fonts, hyphenation patterns or images (for example after changing settings in quick succession), the result of the previous load could finish later and be shown over the new one. Loads now carry a generation mark, and the result of an older load that finishes after a newer one has started is not shown. Earlier bugs are fixed as well: adding a font while an HTML document was shown went back to the XSL-FO opened before, opening only MathML re-laid out the previous XSL-FO, and changing settings or adding images, fonts or shape libraries while a document was being opened went back to the previous document. The document now shown is re-laid out (a document being opened is laid out with the settings at the time its loading starts)
91
+ - **Balancing the last page of page columns** (HTML; typesetting results do not change except for the heights of the column boxes): with `column-count` on `body` or the like, short content with no more lines on the last page than columns (a one-line paragraph, for example) was typeset in full but warned "a line does not fit on the page". When finding the column height for the last page of columns that span pages, a height at which lines overflow the columns was taken as fitting, and the column height was lowered to nearly 0. Now a height at which more lines or boxes overflow an empty column is not taken as fitting (CSS Multi-column 1 §7.1). Lines and glyphs stay where they were, and the column boxes become as tall as the lines (since before 0.4.0)
92
+ - **SVG with `isolation: isolate` and children with blend modes in PDF/X-1a and X-3** (**typesetting results change**: only such SVG in PDF/X-1a and X-3): when flattening transparency, groups with opacity 1 are opened and their children are drawn directly, but isolated groups (`isolation: isolate` and so on) with `mix-blend-mode` children were opened too, so the children were also blended with what lies under the group and their colors changed (a `multiply` blue inside the group on green became nearly black, for example). Now groups with children that have blend modes are not opened, and the whole group is turned into an image (Compositing and Blending 1 §3.3, §5.3). Groups without such children are opened and drawn as before (no transparency group is written)
93
+ - **Checking the content fetched from draw.io's distribution** (`fetchStencils`, `--fetch-drawio-stencils`; typesetting results do not change): the shape libraries (`js/stencils.min.js`) and images fetched from the default source (the URL of the v24.7.5 tag in draw.io's public repository) are checked against the SHA-256 list for v24.7.5 that Kumiori holds, and files that do not match or are not in the list are not used, with a warning (a tag can be moved). Nothing is checked when you choose the source yourself (`stencilsUrl`, `--drawio-stencils-url`). See "Checking fetched shape libraries and images" in [`docs/en/drawio.md`](docs/en/drawio.md)
94
+ - **Line wrapping style `text-wrap-style`, `text-wrap-mode` and the `text-wrap` shorthand** (HTML; new feature; documents that do not use them are typeset as before): CSS Text 4 §5.1, §5.4 and §5.5 (W3C Working Draft 2026-08-14) are now read (they were reported as unsupported properties and ignored). `balance` evens out the remaining space of the lines without changing the number of lines (the lines are cut again at the shortest length that keeps the number of lines; separately for each group divided by forced line breaks; a group of more than 10 lines is the same as `auto`). `pretty` and `avoid-short-last-line` choose the lines looking at the whole paragraph (the Knuth–Plass method: the breaks with the smallest total badness of squeezing and spacing; breaks that leave the last line shorter than 1/4 of the line length are avoided; a paragraph never gets more lines than when set one line at a time (only the number of lines is compared, so a paragraph can become slightly taller when more of its lines hold larger characters); in a paragraph of more than 100 lines when set one line at a time, only the last 4 lines are cut again when the last line is short). Setting such a paragraph takes about 2 to 3 times as long. `stable` is the same as `auto`. With every value, the rules for line-breaking prohibitions (kinsoku), squeezing, hanging punctuation and hyphenation stay the same (a line cut again at a shorter length keeps its line-end punctuation inside the line instead of hanging it when it fits in the line length, and the last line of a paragraph is not justified). `text-wrap-mode: nowrap` and `text-wrap: nowrap` stop wrapping (`white-space: nowrap` and `pre` also set `text-wrap-mode` to `nowrap`: §3). They are also read in page-margin boxes (`@top-center` and the like). A paragraph with lines beside a float and a paragraph with `::first-line` are set as `auto`. Added section 6.14 to the HTML and CSS volume of the conformance manual and removed the properties from the list in chapter 16. The text of that volume (except inside the examples) is now set with `text-wrap: pretty` (the page counts of both languages do not change). An element with only `white-space-collapse` now inherits the parent's no-wrap setting (it used to replace `white-space` and wrap). Invalid values of shorthands (`text-wrap`, `text-decoration`, `font` and so on) are discarded without a warning, like invalid values of other properties (they used to be reported as unknown CSS properties)
95
+ - **Diagnostics (kinds and severities of warnings) and error types** (API; typesetting results, PDF output and the texts and order of `warnings` do not change (except for the image warnings inside measured layouts; see the item on them); **compatibility changes**: the form of the warning lines the command writes to standard error, the `name` of errors (option errors change from `TypeError` to `KumioriOptionError`), and the type and text of XML errors in XSL-FO and XHTML (from xmldom's `ParseError` to `KumioriInputError`)): typesetting results now have `diagnostics` (the results of `typeset` and `typesetToPdf`, and Area Trees with diagnostics). They hold the same events as `warnings`, with a code (`code`, such as `css/unknown-property`; not changed across versions), a severity (`severity`: `error`, `warning`, `info`), the text, the embedded values (`args`) and the number of identical occurrences (`count`). Unsupported and unknown CSS and XSL-FO and characters with no glyph are one diagnostic per item. Up to 200 diagnostics are kept per code, and the rest are gathered into one diagnostic, "n more warnings of the same kind (m distinct) were omitted" (`args.omitted` and `args.omittedKinds`). Errors thrown by Kumiori are now `KumioriError` and its subclasses (`KumioriInputError`, `KumioriLimitError`, `KumioriFontError`, `KumioriPdfError`), which carry a code `code`, and invalid options throw `KumioriOptionError`, which extends `TypeError` (`isKumioriError` tells them apart; `AreaTreeFormatError` is a subclass of `KumioriInputError`). Error messages are unchanged, and `name` is now the name of the type (XML errors in XSL-FO and XHTML such as unclosed elements, which used to throw xmldom's `ParseError` as is, now throw a `KumioriInputError` with "XML parse error: …", like other parse errors). The codes are listed in `docs/en/diagnostics.md`. A diagnostic has its location in the input `source` when known (file, line, column, element, the Area Tree `sourceRef`, the PDF page): the line and column of the element for XSL-FO, the line and column of the element inside Node and Web Workers for HTML, and the first place written for unsupported and unknown CSS properties (the browser app now reads XSL-FO with @xmldom/xmldom, the same as the library). The command prints one line per diagnostic as "warning [code] file:line:column (element): text" (error, warning or info by severity; this replaces the former "warning: text", and unsupported and unknown specifications get one line per item), and prints notices (`info`) only with `--verbose`. `--diagnostics json` prints one JSON object per line (an error that stops typesetting an input is also printed as one line, with `name`, `code` and `severity: "fatal"`). Frequent diagnostics are condensed in the text output: characters with no glyph go on one line listing the 20 most frequent, and other codes are printed up to 20 lines each followed by one "n more … (m distinct)" line (JSON keeps one line per diagnostic). Diagnostics can be suppressed by code (`diagnostics: { ignore }` in the API, `--ignore-warning` on the command line), and the command's `--fail-on error|warning` exits with code 2 when there is a matching diagnostic. The warnings column of the browser app shows the severity mark, code, element and page, and clicking a line with a page moves to that page. The warnings column of the browser app also shows diagnostics about limits hit while reading (`limit/table-structure-cells` for table structure in tagged PDF). The command-line options `--format svg` and `png` do not build the structure tree (so diagnostics that only concern tagged PDF are not reported)
96
+
7
97
  ## 0.4.0 (2026-11-19)
8
98
 
9
99
  - **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)
@@ -43,40 +133,40 @@ Version numbers follow [Semantic Versioning](https://semver.org/). During 0.x, i
43
133
  - 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
134
  - 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
135
  - `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)
136
+ - **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 §2.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
137
  - **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
138
  - **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
139
  - **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
140
  - **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
141
  - **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
142
+ - **HTML default style** (typesetting results change 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)
143
+ - **vertical-align of inline boxes** (typesetting results change 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
144
+ - **@page padding** (typesetting results change 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
145
+ - **Targets of target-counter()** (typesetting results change 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)
146
+ - **Percentages of top and bottom for relative positioning** (typesetting results change 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
147
+ - **WeasyPrint behaviour** (typesetting results change 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
148
+ - **Reading declarations of margin boxes and @footnote** (typesetting results change 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
149
+ - **Properties of the page context, margin boxes and @footnote** (typesetting results change 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)
150
+ - **Initial width of borders of margin boxes and the footnote separator** (typesetting results change 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.3). 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
151
+ - **Nested named pages** (typesetting results change 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
152
+ - **Page number style of target-counter()** (typesetting results change 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
153
+ - **Page number reference text on pages reused in re-layouts** (typesetting results change 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)
154
+ - **Border widths in WeasyPrint behaviour** (typesetting results change 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
155
  - **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)
156
+ - **Effort limit for large documents** (typesetting results change 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
157
+ - **break-inside: avoid rows taller than a page** (typesetting results change 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
158
+ - **Formats of footnote calls and markers** (typesetting results change 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
159
+ - **Column balancing and lines taller than a column** (typesetting results change 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)
160
+ - **Position of background images of @page and margin boxes** (typesetting results change 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`
161
+ - **Footnote number formats per footnote** (typesetting results change 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
162
+ - **Continuation pages for footnotes and floats** (typesetting results change 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)
163
+ - **Border widths of the default style** (typesetting results change 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)
164
+ - **hsl() and hsla() in XSL-FO** (typesetting results change 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
165
+ - **The lh unit in XSL-FO** (typesetting results change 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
166
  - **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):
167
+ - **Condensing in XSL-FO (overflow="condense")** (typesetting results change 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
168
+ - **Breaks and span="all" in XSL-FO multi-column containers** (**typesetting results change** 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
169
+ - **keep-together and the spaces at the start and end of columns in XSL-FO multi-column containers** (**typesetting results change** 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
170
  - 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
171
  - `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
172
  - 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)
@@ -86,14 +176,14 @@ Version numbers follow [Semantic Versioning](https://semver.org/). During 0.x, i
86
176
  - 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
177
  - 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
178
  - 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)
179
+ - **XSL-FO drop caps (`axf:initial-letters`)** (new feature; **typesetting results change** 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)
180
+ - **initial-letter and floats at the head of a column** (typesetting results change 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)
181
+ - **Absolutely positioned boxes in multi-column layouts** (**typesetting results change** 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
182
  - **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
183
  - **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)
184
+ - **Translucent text colors in HTML** (typesetting results change 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)
185
+ - **Transparent text color** (typesetting results change 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)
186
+ - **Paint-only effects of fixed-position boxes and margin boxes** (typesetting results change 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
187
  - **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
188
  - **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
189
  - **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
@@ -149,7 +239,7 @@ A release that adds draw.io diagrams, plugins that add image formats, PDF/X-4 an
149
239
  - SVG with a clipPath of many points applied to many shapes (such as maps) is drawn as shapes. Previously the clip outline was written again for each shape, exceeded the segment budget, and a placeholder frame was drawn. The same clip shared by consecutive shapes is now written once (ISO 32000-2 §8.4.2, §8.5.4)
150
240
  - `svgLanguages` in the API and `--svg-lang` in the CLI: the languages to match SVG `systemLanguage` against (when the place of the SVG has no language)
151
241
  - **Fonts**: When the document contains emoji not found in the symbol font (Noto Sans Symbols 2) either (faces such as 😀, flags, skin tone modifiers, etc.), the emoji font Noto Emoji (monochrome outline emoji; SIL Open Font License 1.1; about 870KB) is loaded. Previously no default font had emoji, so those characters were set as the missing-glyph box and the warning "no loaded font has a glyph for these characters" was given. **Typesetting results change** only for documents with such emoji (characters the symbol font has, such as ✈ and ❤, are set in the symbol font as before). For colour emoji, pass a font such as Noto Color Emoji, as before. `emoji` was added to `DEFAULT_FONTS`
152
- - **`.minimum` and `.maximum` of XSL-FO `word-spacing`** (spec mode only): now read (they used to be reported as unsupported). In justified lines, word spaces are shrunk down to `.minimum` to fit a character or word, and are widened only up to `.maximum` (XSL 1.1 §7.17.8: “The minimum and maximum values specify the limits of the adjustment.”; the `<space>` datatype in §5.11). Compatibility mode still does not read them and reports a warning
242
+ - **`.minimum` and `.maximum` of XSL-FO `word-spacing`** (spec mode only): now read (they used to be reported as unsupported). In justified lines, word spaces are shrunk down to `.minimum` to fit a character or word, and are widened only up to `.maximum` (XSL 1.1 §7.17.8: `.minimum` and `.maximum` are the two ends of the range within which spacing may be adjusted; the `<space>` datatype in §5.11). Compatibility mode still does not read them and reports a warning
153
243
  - **Warnings raised while writing the PDF**: notices about glyphs that cannot be drawn, the limits for color glyphs, glyphs in the SVG table, form fields that cannot be made and so on are added to `result.warnings` after `result.toPdf()` (previously they only went to the console, or came after `warnings` was built). The notice for glyphs that cannot be drawn is given once per font. The warnings follow the `lang` used for typesetting. The web app lists them with the other warnings
154
244
  - **Warnings**: warnings that stayed in Japanese with `lang: 'en'` (`--lang en` on the command line) are now written in English: three image warnings (a placeholder frame is drawn, part of the image cannot be drawn, the image is not found or cannot be read) and the reasons for placeholder frames of unreadable images; in the notices of unsupported CSS and XSL-FO, the reasons attached to items (`a value read only with --style ah`, `unit xx (length …)` and so on) and the separators of the list; the PDF/X warnings on transparency and the ICC profile; the overflow warnings of the layout (lines, boxes, floats, footnotes, table rows and so on that do not fit on the page); the separators of the list of characters without glyphs; the errors when reading EPUB; the error for too deeply nested transforms; the notes inside image formats (elements of CGM, WMF and EMF that cannot be drawn and their limits, and names of EPS features that cannot be drawn); the errors when reading Area Tree JSON (`parseAreaTree`); and errors in the content of fonts and images (CFF, WebP, PNG)
155
245
  - **Reporting vulnerabilities**: added the procedure for reporting vulnerabilities privately (`SECURITY.md`, `SECURITY.en.md`), linked from the "Reporting vulnerabilities" section of the README
@@ -245,15 +335,15 @@ A release that adds flex features, WOFF/WOFF2, an API for loading referenced fil
245
335
  - Transparent and translucent border colors (HTML). **The rendered result changes**: a border with `border-color: transparent` used to be drawn as a black line and is no longer drawn (it still takes up its width). A border with a translucent color (`rgba()` and so on) is blended over the background beneath it with that opacity, instead of being drawn in an opaque color mixed with white (PDF output uses a transparency group; PDF/X-3 issues a warning)
246
336
  - CSS gradient backgrounds (`linear-gradient()`, `radial-gradient()` and their `repeating-` forms) are now also drawn on screen (Canvas: `renderPage` and the app view). **Previously they were drawn only in the PDF and were missing on screen** (the PDF output is unchanged)
247
337
  - Line decorations (underlines etc.) and atomic inlines (CSS Text Decoration 3 §2). **The rendered result changes**: a link with `display: inline-block` used to get two underlines (one under its text and one at the bottom of the box); it now gets only the one under its text. Images and inline-block boxes inside an underlined element are themselves no longer decorated (the line under an image inside a link disappears), and the lines of ancestors are not propagated to the contents of inline-blocks and inline-tables (the text before and after is still decorated, as in browsers). XSL-FO output is unchanged
248
- - The width of a box sized to its contents (`inline-block`, floats, absolutely positioned boxes, etc.) that inherits an indent (`text-indent`) now includes the indent (CSS Text 3 §8.1). **The layout result changes**: previously the box was too narrow by the indent, so its first line wrapped or its text stuck out of the box (the default style indents paragraphs by one character, so an `inline-block` inside a paragraph was affected). Now the box is wider by the indent and the contents fit on one line. To avoid indenting inside the box, specify `text-indent: 0` on it
249
- - `margin` on inline images (`img`; all four sides; CSS 2.1 §8.3 and §10.8). **The layout result changes**: previously the `margin` of an inline image was not read, so the image sat tight against the neighbouring text or images (the `margin` of block and floated images already worked). Now the left and right margins add space before and after, and the top and bottom margins count toward the line height (the `hspace` and `vspace` attributes too). For an inline image with a border, padding or background color, only the left and right margins apply (top and bottom are reported in a warning)
250
- - List items, table rows and forced breaks inside them (CSS Fragmentation 3 §2.1, §3.1 and §4.3). **The layout result changes**: `break-before` and `break-after` (`page` and so on) now take effect on blocks inside an `li`, on the `li` of a nested list, and on blocks inside a table cell (the item or row is split at that point; previously they were ignored). `left`, `right`, `recto` and `verso` on an `li` in the middle of a list or a `tr` in the middle of a table insert a blank page until the parity matches (previously they only started a new page). `column` on such an `li` or `tr` inside a multi-column context takes effect. `page` on such an `li` or `tr` in a document whose pages are set in columns starts a new page, not the next column. `break-before: column` and `break-after: column` outside a multi-column context have no effect (previously they started a new page even where there were no columns). In XSL-FO too, `break-before` and `break-after` on a block inside a table cell or a list item body split the row at that point (XSL 1.1 §4.8; previously ignored)
251
- - Containing blocks of absolutely positioned boxes (CSS 2.1 §10.1, CSS Position 3 §2.1). **The layout result changes**: a `position: absolute` box inside a table, table cell, list item or vertical-writing box with `position: relative` (or `transform`) is placed relative to the padding box of that box. When a table or list item lies between the box and its reference block, that block is still the reference (previously the body region of the page was used in all these cases, and the position was far off). The `position: relative` offset of a block in vertical writing is now applied in physical directions (`left` horizontally, `top` vertically). An element within a line (`span`, `inline-block`) with `position: relative` is also a reference (the rectangle around its padding boxes). A `position: absolute` box inside an inline element is no longer dropped. An absolutely positioned box in the middle of the text of a paragraph no longer splits the line. The `position: relative` offset (`top`, `left` and so on) of elements within a line (`span`, `inline-block`, `img`) now takes effect (CSS 2.1 §9.4.3; previously ignored)
252
- - Percentages for `top`, `bottom` and `height` of absolutely positioned boxes (CSS 2.1 §10.5, CSS Position 3 §3.1). **The layout result changes**: `top: 50%`, `top: 100%` (the drop-down pattern), `bottom: 10%`, `inset: 10%` and `height: 50%` are read as fractions of the height of the padding box of the containing block (when the height of that box depends on its content, the height after layout; with no positioned ancestor, and for `position: fixed`, the height of the page content area; also for absolutely positioned `::before` and `::after`). Before, percentages for `top` and `bottom` were treated as absent (the box appeared at the top of the reference box or where it was found), and percentages for `height` were taken from the content height of the parent
253
- - Positions of absolutely positioned boxes. **The layout result changes**: an absolutely positioned box in the middle of a line of a paragraph whose `left` and `right` (and `top` and `bottom`) are `auto` is placed where it was found in the line (the static position; CSS 2.1 §10.3.7, §10.6.4). Before, it was placed at the start of the first line of the paragraph and overlapped the preceding text. Boxes found inside table cells are handled the same way. An absolutely positioned box inside a flex or grid container (horizontal writing) with `position: relative` (or `transform`) is placed relative to the padding box of the container (CSS Flexbox 1 §4.1, CSS Grid 1 §9.1; before, the body region was the reference). A `position: static` flex or grid container whose height depends on its content lets the reference pass through to an outer containing box. The `position: relative` offsets (`left`, `top`, etc.) of list items (`li`) and table cells (`td`, `th`) now take effect (CSS 2.1 §9.4.3; a list item moves together with its marker, and row heights and the positions of other cells do not change; before, they had no effect)
254
- - Tables with `writing-mode` (CSS Writing Modes 3 §2.1, CSS 2.1 §17). **The layout result changes**: a table (`table`, `display: table`) with `writing-mode: vertical-rl` or `vertical-lr` in a horizontal document is laid out vertically (rows run from right to left and the cells in a row from top to bottom; previously the `writing-mode` of the table was ignored and it was laid out horizontally). The same applies to a `horizontal-tb` table in a vertical document. The size of a table with separated borders (`border-spacing`) whose writing mode differs from its parent now includes the cell spacing
255
- - Anonymous table rows and cells (CSS 2.1 §17.2.1). **The layout result changes**: content that is not a table part (text or other elements) directly inside a table (`display: table`, `inline-table`) or a row (`table-row`) is wrapped in an anonymous row and an anonymous cell (previously it was dropped, for example the text of `<span style="display: inline-table">text</span>`)
256
- - `text-indent` on tables (CSS Text 3 §8.1 and the HTML default style sheet). **The layout result changes**: `text-indent` specified on a table now applies to the lines in its cells (previously ignored). `text-indent` from outside a table (`body`, `div` and so on) does not enter the table (`table { text-indent: initial }`; previously the outer indent applied to the lines in cells; this matches browsers)
338
+ - The width of a box sized to its contents (`inline-block`, floats, absolutely positioned boxes, etc.) that inherits an indent (`text-indent`) now includes the indent (CSS Text 3 §8.1). **Typesetting results change**: previously the box was too narrow by the indent, so its first line wrapped or its text stuck out of the box (the default style indents paragraphs by one character, so an `inline-block` inside a paragraph was affected). Now the box is wider by the indent and the contents fit on one line. To avoid indenting inside the box, specify `text-indent: 0` on it
339
+ - `margin` on inline images (`img`; all four sides; CSS 2.1 §8.3 and §10.8). **Typesetting results change**: previously the `margin` of an inline image was not read, so the image sat tight against the neighbouring text or images (the `margin` of block and floated images already worked). Now the left and right margins add space before and after, and the top and bottom margins count toward the line height (the `hspace` and `vspace` attributes too). For an inline image with a border, padding or background color, only the left and right margins apply (top and bottom are reported in a warning)
340
+ - List items, table rows and forced breaks inside them (CSS Fragmentation 3 §2.1, §3.1 and §4.3). **Typesetting results change**: `break-before` and `break-after` (`page` and so on) now take effect on blocks inside an `li`, on the `li` of a nested list, and on blocks inside a table cell (the item or row is split at that point; previously they were ignored). `left`, `right`, `recto` and `verso` on an `li` in the middle of a list or a `tr` in the middle of a table insert a blank page until the parity matches (previously they only started a new page). `column` on such an `li` or `tr` inside a multi-column context takes effect. `page` on such an `li` or `tr` in a document whose pages are set in columns starts a new page, not the next column. `break-before: column` and `break-after: column` outside a multi-column context have no effect (previously they started a new page even where there were no columns). In XSL-FO too, `break-before` and `break-after` on a block inside a table cell or a list item body split the row at that point (XSL 1.1 §4.8; previously ignored)
341
+ - Containing blocks of absolutely positioned boxes (CSS 2.1 §10.1, CSS Position 3 §2.1). **Typesetting results change**: a `position: absolute` box inside a table, table cell, list item or vertical-writing box with `position: relative` (or `transform`) is placed relative to the padding box of that box. When a table or list item lies between the box and its reference block, that block is still the reference (previously the body region of the page was used in all these cases, and the position was far off). The `position: relative` offset of a block in vertical writing is now applied in physical directions (`left` horizontally, `top` vertically). An element within a line (`span`, `inline-block`) with `position: relative` is also a reference (the rectangle around its padding boxes). A `position: absolute` box inside an inline element is no longer dropped. An absolutely positioned box in the middle of the text of a paragraph no longer splits the line. The `position: relative` offset (`top`, `left` and so on) of elements within a line (`span`, `inline-block`, `img`) now takes effect (CSS 2.1 §9.4.3; previously ignored)
342
+ - Percentages for `top`, `bottom` and `height` of absolutely positioned boxes (CSS 2.1 §10.5, CSS Position 3 §3.1). **Typesetting results change**: `top: 50%`, `top: 100%` (the drop-down pattern), `bottom: 10%`, `inset: 10%` and `height: 50%` are read as fractions of the height of the padding box of the containing block (when the height of that box depends on its content, the height after layout; with no positioned ancestor, and for `position: fixed`, the height of the page content area; also for absolutely positioned `::before` and `::after`). Before, percentages for `top` and `bottom` were treated as absent (the box appeared at the top of the reference box or where it was found), and percentages for `height` were taken from the content height of the parent
343
+ - Positions of absolutely positioned boxes. **Typesetting results change**: an absolutely positioned box in the middle of a line of a paragraph whose `left` and `right` (and `top` and `bottom`) are `auto` is placed where it was found in the line (the static position; CSS 2.1 §10.3.7, §10.6.4). Before, it was placed at the start of the first line of the paragraph and overlapped the preceding text. Boxes found inside table cells are handled the same way. An absolutely positioned box inside a flex or grid container (horizontal writing) with `position: relative` (or `transform`) is placed relative to the padding box of the container (CSS Flexbox 1 §4.1, CSS Grid 1 §9.1; before, the body region was the reference). A `position: static` flex or grid container whose height depends on its content lets the reference pass through to an outer containing box. The `position: relative` offsets (`left`, `top`, etc.) of list items (`li`) and table cells (`td`, `th`) now take effect (CSS 2.1 §9.4.3; a list item moves together with its marker, and row heights and the positions of other cells do not change; before, they had no effect)
344
+ - Tables with `writing-mode` (CSS Writing Modes 3 §2.1, CSS 2.1 §17). **Typesetting results change**: a table (`table`, `display: table`) with `writing-mode: vertical-rl` or `vertical-lr` in a horizontal document is laid out vertically (rows run from right to left and the cells in a row from top to bottom; previously the `writing-mode` of the table was ignored and it was laid out horizontally). The same applies to a `horizontal-tb` table in a vertical document. The size of a table with separated borders (`border-spacing`) whose writing mode differs from its parent now includes the cell spacing
345
+ - Anonymous table rows and cells (CSS 2.1 §17.2.1). **Typesetting results change**: content that is not a table part (text or other elements) directly inside a table (`display: table`, `inline-table`) or a row (`table-row`) is wrapped in an anonymous row and an anonymous cell (previously it was dropped, for example the text of `<span style="display: inline-table">text</span>`)
346
+ - `text-indent` on tables (CSS Text 3 §8.1 and the HTML default style sheet). **Typesetting results change**: `text-indent` specified on a table now applies to the lines in its cells (previously ignored). `text-indent` from outside a table (`body`, `div` and so on) does not enter the table (`table { text-indent: initial }`; previously the outer indent applied to the lines in cells; this matches browsers)
257
347
  - Outlines (`outline`, `outline-width`, `outline-style`, `outline-color`, `outline-offset`; CSS UI 4 §3) are supported. A line that takes up no space is drawn outside the border box (rounded on boxes with rounded corners; an inline element that breaks across lines and a block that breaks across pages are enclosed fragment by fragment). They were previously reported as unsupported CSS
258
348
  - The clipping rectangle (`clip: rect(…)`; CSS 2.1 §11.1.2) is supported. **Results change for absolutely positioned boxes with `clip`**: the background, border and content of the box are drawn clipped to the rectangle. A box with the screen-reader-only idiom (`clip: rect(0 0 0 0)`) is not drawn. Previously `clip` was reported as unsupported CSS and the box was drawn without clipping
259
349
  - Tab size (`tab-size`; CSS Text 3 §4.2) is supported. **Results change for tab characters inside `pre` and the like**: a tab character (U+0009) inside `white-space: pre`, `pre-wrap` or `break-spaces` now advances to the next tab stop (every 8 spaces from the content edge of the block; changeable with `tab-size`) (CSS Text 3 §4.1.2). Previously the tab character was drawn as the missing-glyph mark (□)
@@ -367,11 +457,11 @@ A release that adds flex features, WOFF/WOFF2, an API for loading referenced fil
367
457
  - CLI: files referenced by relative references of the document or the CSS that point outside the input's directory (`url(../fx/a.ttf)` of an `@font-face` in `sub/a.html` etc.) were not read, and the default font was used without a warning. They are now read, like `file:` URLs (as when a browser opens a local HTML file; RFC 3986 §5.2). Relative references in CSS files that point above the input's directory also resolve to the right file. When none of the files in the `src` of an `@font-face` is found, the warning "font file of @font-face not found" is reported (CSS Fonts 4 §4.3; the CLI and the API)
368
458
  - Line layout (results change): words of joining scripts such as Arabic are now broken between letters with `word-break: break-all`, and inside a word longer than the line with `overflow-wrap: anywhere` or `break-word` (in XSL-FO, on a line with no other break opportunity) (CSS Text 3 §5.1, §5.5). They used to be kept whole, so in a narrow box a word longer than the line overflowed far to the end side (left) of the right-to-left line and disappeared off the page. The letters at the break keep the joined forms (initial, medial, final) they have when the word is not broken (the note in §5.1; the pieces are passed to the font with a zero width joiner on the joining side; the lam-alef ligature is not split)
369
459
  - Layout (results change): the fragments (column rows) of a multi-column container that spans pages now also get the background image, rounded corners, shadow (`box-shadow`) and diagonal borders (previously only the background color, borders and padding, so no fragment had the background image, rounded corners or shadow). For boxes split across pages or columns, with `box-decoration-break: slice` (the default) the corners on the side of the break are no longer rounded (CSS Fragmentation 3 §5.4: as if drawn unbroken and then sliced; previously all four corners of each fragment were rounded). With `clone`, each fragment is still rounded
370
- - Line layout (results change): the background of an inline box with a background color (`span`, `fo:inline` and so on, without borders or padding) is now also painted where it contains an `inline-block` or an image (CSS 2.1 §9.2.2, §14.2, CSS Backgrounds 3 §3.7; the painted height is the content area of the enclosing box). Previously only the text was painted, leaving a gap at the `inline-block`
460
+ - Line layout (results change): the background of an inline box with a background color (`span`, `fo:inline` and so on, without borders or padding) is now also painted where it contains an `inline-block` or an image (CSS 2.1 §9.2.2, §14.2, CSS Backgrounds 3 §2.7; the painted height is the content area of the enclosing box). Previously only the text was painted, leaving a gap at the `inline-block`
371
461
  - CSS: `bleed: auto` (the initial value) in `@page` is 6pt when `marks` includes `crop`, and 0 otherwise (CSS Paged Media 3 §7.3). Previously `auto` was dropped, so the bleed was 0 and the BleedBox of a PDF with `marks: crop` equaled the TrimBox. **Documents that set `marks: crop` in `@page` without `bleed` now get a 6pt bleed** (when `@page` has neither `bleed` nor `marks`, the bleed set by options such as `--print` is used, as before)
372
462
  - CSS: `trim-all` of `text-spacing-trim` (brackets, middle dots, full stops and commas set half width regardless of position) and `space-first` (full width at the start of the first line of a paragraph and of lines after a forced break, half width at the start of other lines) are typeset as in CSS Text 4 §8.5 (they used to be the same as `normal`). Combinations of keywords that set the start of the line, adjacent punctuation and the end of the line separately (`trim-start trim-end`, `space-start trim-adjacent` and so on; the grammar of the Editor's Draft; omitted positions take `trim-start trim-adjacent allow-end`) are read, also inside the `text-spacing` shorthand. `-ah-punctuation-trim: all` also sets them half width
373
463
  - CSS: the color function `light-dark()` (CSS Color 5 §7) is read. It takes the second color when the color scheme of the element (`color-scheme`, or else `<meta name="color-scheme">`) supports only dark, and the first color otherwise (as this is print, the user preference is taken to be light; CSS Color Adjust 1 §2.3). `none` components in the modern syntax of `rgb()` and `hsl()` (CSS Color 4 §4.4; 0 when the color is used, a missing component inside `color-mix()`) are also read. Previously, declarations with these were dropped as unreadable
374
- - CSS: specifications that were dropped without notice are now reported in the unsupported-CSS warning: `page-orientation` in `@page` (CSS Paged Media 3 §7.1.2), `@page :nth()` (CSS GCPM 3 §3), `target-counters()` (CSS Content 3 §6.2; also in the `content` of margin boxes), `@namespace` (CSS Namespaces 3 §2), `last` of `hanging-punctuation` (CSS Text 3 §8.2.1), and `shape-outside`, `shape-margin` and `shape-image-threshold` (CSS Shapes 1 §6; previously reported as unknown properties). The typeset result does not change
464
+ - CSS: specifications that were dropped without notice are now reported in the unsupported-CSS warning: `page-orientation` in `@page` (CSS Paged Media 3 §7.1.2), `@page :nth()` (CSS GCPM 3 §3), `target-counters()` (CSS Content 3 §6.2; also in the `content` of margin boxes), `@namespace` (CSS Namespaces 3 §2), `last` of `hanging-punctuation` (CSS Text 3 §8.2.1), and `shape-outside`, `shape-margin` and `shape-image-threshold` (CSS Shapes 1 §6; previously reported as unknown properties). The typesetting results do not change
375
465
  - **Distribution**:
376
466
  - `require('kumiori')` and `require('kumiori/node')` work (the `exports` condition is now `default`; without a flag this needs Node 20.19.0 or later, or 22.12.0 or later)
377
467
  - The type declarations work for consumers whose `moduleResolution` is `NodeNext` or `Node16` (relative specifiers in the declarations now end in `.js`; they used to cause errors or silently fall back to any)
@@ -415,7 +505,7 @@ A release that adds flex features, WOFF/WOFF2, an API for loading referenced fil
415
505
  - `font-variant="small-caps"` and `word-spacing` (a length added to inter-word spaces) are now read (XSL 1.1 §7.9.8, §7.17.8)
416
506
  - `auto`, `0deg` (all glyphs upright) and `90deg` (all glyphs rotated sideways) of `glyph-orientation-vertical` are now read (XSL 1.1 §7.29.3). 180 and 270 degrees, and values other than 0 degrees of `glyph-orientation-horizontal`, are not read and are reported
417
507
  - `relative-position="relative"` (an `fo:block` in horizontal writing is drawn shifted), `hidden` and `collapse` of `visibility` (the space is kept but nothing is drawn) and a negative `z-index` on an absolutely positioned `fo:block-container` (drawn behind the body text) are now read (XSL 1.1 §7.13.5, §7.30.17, §7.30.18)
418
- - The kinds of `break-before` and `break-after` (`odd-page`, `even-page`, `page`, `column`) on `fo:table-row` and `fo:list-item` are kept, as for `fo:block` (XSL 1.1 §7.20.1, §7.20.2). **The layout result changes**: `odd-page` and `even-page` on a row or item start it on an odd or even page, inserting a blank page when needed (before, every kind only moved it to the next column or page). In a multi-column region, `page` moves to the next page instead of the next column
508
+ - The kinds of `break-before` and `break-after` (`odd-page`, `even-page`, `page`, `column`) on `fo:table-row` and `fo:list-item` are kept, as for `fo:block` (XSL 1.1 §7.20.1, §7.20.2). **Typesetting results change**: `odd-page` and `even-page` on a row or item start it on an odd or even page, inserting a blank page when needed (before, every kind only moved it to the next column or page). In a multi-column region, `page` moves to the next page instead of the next column
419
509
  - Digit grouping of page numbers (`grouping-separator` and `grouping-size` on `fo:page-sequence`) is read (XSL 1.1 §7.26.2, §7.26.3; "1,234"). The values of `letter-value` are accepted (§7.26.4)
420
510
  - Table-of-contents lines: `last-line-end-indent` is read (XSL 1.1 §7.16.3), so wrapped lines can stop short of `end-indent` while only the last line, with the page number, runs to the edge (`text-align-last="justify"` + `end-indent` + a negative `last-line-end-indent`). `reference-area` and `page` of `leader-alignment` are read (§7.22.1): the cycles of a dotted leader are aligned to a grid from the edge of the body region (column, table cell) or of the page
421
511
  - `fo:initial-property-set` is read (XSL 1.1 §6.6.4): the font properties, `color`, `letter-spacing`, `word-spacing`, `text-decoration` and `background-color` are applied to the first line of an `fo:block` only. `text-transform`, `font-variant`, `line-height`, borders, `padding` and the like are not read and are reported
@@ -455,7 +545,7 @@ A release that adds flex features, WOFF/WOFF2, an API for loading referenced fil
455
545
  - **font-synthesis** (HTML): `font-synthesis` (shorthand) and `font-synthesis-weight`, `-style`, `-small-caps` and `-position` (CSS Fonts 4 §2.8; inherited) are now read. With `none`, fonts without bold are not emboldened, fonts without italic are not slanted, and capitals are not shrunk in place of small capitals for fonts without small-cap glyphs. `font-synthesis-style: oblique-only` slants only for `font-style: oblique`. `-position` is only read (superscript and subscript glyphs were never synthesized). Until now they were reported as unsupported and synthesis always happened. **Results change**: glyph shapes in documents that set these to `none`
456
546
  - **Content width with negative text-indent** (HTML and XSL-FO): when a box's width comes from its contents (shrink-to-fit for inline blocks, floats, table columns and so on), a negative indent is now subtracted from the line length (CSS Text 3 §8.1: the indent is treated as a margin on the start edge of the line box; the same as Chromium). Until now only positive indents were counted, so boxes with a negative indent were wider by the indent. **Results change**: widths of inline blocks and the like with a negative indent
457
547
  - **Margins of inline svg and object** (HTML): inline `<svg>` elements written in the document and image `<object>` elements now get margins on all four sides, and borders, padding and background color, the same as `<img>` (CSS 2.1 §8.3, §10.8). Until now they were not read. **Results change**: positions of inline svg and object elements with margins and the like
458
- - **Rounded corners and shadows of inline blocks** (HTML and XSL-FO): `border-radius` (and AH Formatter's `axf:border-radius` and so on) and `box-shadow` are now applied to inline-block boxes such as `display: inline-block` (`fo:inline-container` in XSL-FO) (CSS Backgrounds 3 §5.3, §7). Until now they were not applied to inline-block boxes: the background, border, background images and gradients were drawn square and shadows were not drawn (block boxes already had rounded corners and shadows). **Results change**: the appearance of inline blocks with rounded corners or shadows. Also, in XSL-FO compatibility mode, the unprefixed `border-radius` (not in XSL 1.1; an AH Formatter extension spelling) is read the same as `axf:border-radius` (the radio buttons in the axf-form-field-1 sample become round; spec mode still reports it as unsupported)
548
+ - **Rounded corners and shadows of inline blocks** (HTML and XSL-FO): `border-radius` (and AH Formatter's `axf:border-radius` and so on) and `box-shadow` are now applied to inline-block boxes such as `display: inline-block` (`fo:inline-container` in XSL-FO) (CSS Backgrounds 3 §4.3, §6). Until now they were not applied to inline-block boxes: the background, border, background images and gradients were drawn square and shadows were not drawn (block boxes already had rounded corners and shadows). **Results change**: the appearance of inline blocks with rounded corners or shadows. Also, in XSL-FO compatibility mode, the unprefixed `border-radius` (not in XSL 1.1; an AH Formatter extension spelling) is read the same as `axf:border-radius` (the radio buttons in the axf-form-field-1 sample become round; spec mode still reports it as unsupported)
459
549
  - **conic-gradient** (HTML): `conic-gradient()` and `repeating-conic-gradient()` (CSS Images 4 §3.3; `from <angle>`, `at <position>`, angle and percentage stops) are now drawn as backgrounds. Until now they were not drawn and no warning was shown. Both PDF and the web app draw them as thin wedges (1° or less) from the center (SVG and PDF have no conic gradient)
460
550
  - **Inline images with borders, padding or background** (HTML): the border, padding and vertical margins of `img { border: …; padding: … }` now count toward the line height (CSS 2.1 §10.8: the inline box of a replaced element is as tall as its margin box). Until now the border and padding did not count and overlapped the neighboring lines, and vertical margins were ignored as unsupported. **Results change**: line heights and vertical positions of inline images with borders, padding or vertical margins
461
551
  - **CSS applied by the command** (HTML): without `--css`, only the CSS in the input directory that the HTML references (`<link>`, `@import`) is used. Unreferenced CSS is not applied, and a warning says so. CSS named with `--css` is still added as a user stylesheet even if unreferenced. The API gains `unreferencedCss` (`'user-stylesheet'` (default) or `'ignore'`; the web app and the API default do not change). **Behavior changes**: until now the command also applied CSS meant for other documents in the same directory