kumiori 0.3.0 → 0.5.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 (121) hide show
  1. package/CHANGELOG.en.md +176 -14
  2. package/CHANGELOG.md +165 -3
  3. package/README.en.md +59 -302
  4. package/README.md +59 -302
  5. package/THIRD_PARTY_NOTICES.md +362 -6
  6. package/dist-browser/THIRD_PARTY_NOTICES.md +362 -6
  7. package/dist-browser/chunks/{UTIF-D5qoainF.js → UTIF-KG0m1IdM.js} +4 -4
  8. package/dist-browser/chunks/{ccitt-7WmwG6OA.js → ccitt-VTTPFdAq.js} +5 -5
  9. package/dist-browser/chunks/{cgm-DUIP-hbA.js → cgm-ConNL6R-.js} +5 -5
  10. package/dist-browser/chunks/{el-monoton-BVsCvfmZ.js → el-monoton-RX3dXQyi.js} +4 -4
  11. package/dist-browser/chunks/{en-gb-Cjtf0A6r.js → en-gb-CWSEx_aY.js} +4 -4
  12. package/dist-browser/chunks/{en-us-B_UiZPbu.js → en-us-DAXlLA12.js} +4 -4
  13. package/dist-browser/chunks/{eps-_CPowVcQ.js → eps-Dngej5a8.js} +6 -6
  14. package/dist-browser/chunks/{epsInfo-BUAZ97F-.js → epsInfo-DpkWEFcD.js} +3 -3
  15. package/dist-browser/chunks/esm-Bur2GgqP.js +1537 -0
  16. package/dist-browser/chunks/esm-BwQHdGL5.js +11959 -0
  17. package/dist-browser/chunks/{export-contract-OHP-GNO0.js → export-contract-Dizj1UsO.js} +3 -3
  18. package/dist-browser/chunks/{la-7qtmi2aU.js → la-I5rV_oNf.js} +4 -4
  19. package/dist-browser/chunks/{load-BRpJTflg.js → load-Cb6TEIjm.js} +2724 -2698
  20. package/dist-browser/chunks/{matrix-BcBTRcOc.js → matrix-C-5rhIt0.js} +2 -2
  21. package/dist-browser/chunks/{metafile-BikFmcYd.js → metafile-CnBftNGE.js} +4 -4
  22. package/dist-browser/chunks/{pako-Dl02IHsa.js → pako-uucVXsP5.js} +3 -3
  23. package/{dist-lib/pixels-ByXzkjlj.js → dist-browser/chunks/pixels-CmBhR0Gf.js} +2 -2
  24. package/dist-browser/chunks/{rolldown-runtime-Bra2mvh4.js → rolldown-runtime-DMd8KBjB.js} +20 -6
  25. package/dist-browser/chunks/{ru-BMiVc5Ts.js → ru-DZuNnLHw.js} +4 -4
  26. package/dist-browser/chunks/{sniff-B_ueafAB.js → sniff-CYNZW-f9.js} +1608 -1573
  27. package/dist-browser/chunks/{strokeOutline-DA-aSg5C.js → strokeOutline-DSM8B9ds.js} +4 -4
  28. package/dist-browser/chunks/{uk-ChOFgYc8.js → uk-Dy8Pyatw.js} +4 -4
  29. package/dist-browser/kumiori.js +67359 -56612
  30. package/dist-cli/THIRD_PARTY_NOTICES.md +362 -6
  31. package/dist-cli/assets/{cgm-CVN2h83E.js → cgm-KDeQnQKd.js} +4 -3
  32. package/dist-cli/assets/drawioPin--INN4wXl.js +2026 -0
  33. package/dist-cli/assets/{drawioStencil-Bzai2moR.js → drawioStencil-BfKkpoEe.js} +28 -11
  34. package/dist-cli/assets/{eps-BK1bEizE.js → eps-OJOdWnxf.js} +4 -3
  35. package/dist-cli/assets/{load-BwlOZ5Bc.js → load-DKJw5pc8.js} +26 -11
  36. package/dist-cli/assets/{metafile-DmYDB8sR.js → metafile-0xNymmpL.js} +4 -3
  37. package/dist-cli/assets/pixels-KdRNvKJI.js +1286 -0
  38. package/dist-cli/cli.js +52885 -36886
  39. package/dist-lib/THIRD_PARTY_NOTICES.md +362 -6
  40. package/dist-lib/{api-DB-5PKHp.js → api-BCRMQoJy.js} +42967 -32176
  41. package/dist-lib/{cgm-CkwJobkQ.js → cgm-GzRHYfjQ.js} +19 -19
  42. package/dist-lib/{eps-D9WVND82.js → eps-wXi2WEGi.js} +158 -158
  43. package/dist-lib/{epsInfo-BUAZ97F-.js → epsInfo-DpkWEFcD.js} +3 -3
  44. package/dist-lib/index.js +11 -11
  45. package/dist-lib/{load-plWCtVUv.js → load-Dkw362LJ.js} +2699 -2673
  46. package/dist-lib/{metafile-BOfMQbwN.js → metafile-21bqsyGl.js} +8 -8
  47. package/dist-lib/node.js +53 -48
  48. package/{dist-browser/chunks/pixels-ByXzkjlj.js → dist-lib/pixels-CmBhR0Gf.js} +2 -2
  49. package/dist-lib/types/api.d.ts +149 -18
  50. package/dist-lib/types/areaResources.d.ts +9 -1
  51. package/dist-lib/types/areaTree.d.ts +5 -2
  52. package/dist-lib/types/assets.d.ts +37 -1
  53. package/dist-lib/types/canvasRenderer.d.ts +35 -1
  54. package/dist-lib/types/color.d.ts +4 -1
  55. package/dist-lib/types/colorGlyph.d.ts +4 -4
  56. package/dist-lib/types/colorGlyphCanvas.d.ts +2 -1
  57. package/dist-lib/types/colorGlyphPdf.d.ts +11 -4
  58. package/dist-lib/types/colorGlyphSvg.d.ts +8 -0
  59. package/dist-lib/types/compat.d.ts +12 -0
  60. package/dist-lib/types/cssCascade.d.ts +40 -3
  61. package/dist-lib/types/cssSelector.d.ts +67 -3
  62. package/dist-lib/types/cssText.d.ts +23 -0
  63. package/dist-lib/types/diagnostics.d.ts +83 -0
  64. package/dist-lib/types/drawio/drawioHashes.d.ts +9 -0
  65. package/dist-lib/types/drawio/drawioPin.d.ts +11 -0
  66. package/dist-lib/types/drawio/drawioStencil.d.ts +22 -5
  67. package/dist-lib/types/drawio/options.d.ts +6 -1
  68. package/dist-lib/types/errors.d.ts +57 -0
  69. package/dist-lib/types/foContext.d.ts +19 -0
  70. package/dist-lib/types/foDom.d.ts +7 -0
  71. package/dist-lib/types/foExpr.d.ts +7 -0
  72. package/dist-lib/types/foPageMaster.d.ts +2 -0
  73. package/dist-lib/types/fontLoader.d.ts +3 -1
  74. package/dist-lib/types/fontManager.d.ts +6 -5
  75. package/dist-lib/types/fontkitShaping.d.ts +9 -9
  76. package/dist-lib/types/footnotes.d.ts +21 -2
  77. package/dist-lib/types/geometry.d.ts +5 -0
  78. package/dist-lib/types/gridTracks.d.ts +51 -0
  79. package/dist-lib/types/htmlImport.d.ts +71 -17
  80. package/dist-lib/types/htmlPaged.d.ts +12 -1
  81. package/dist-lib/types/htmlParserStack.d.ts +0 -13
  82. package/dist-lib/types/htmlPrepare.d.ts +10 -2
  83. package/dist-lib/types/iccRegistry.d.ts +16 -0
  84. package/dist-lib/types/imageFormats.d.ts +5 -1
  85. package/dist-lib/types/index.d.ts +29 -8
  86. package/dist-lib/types/indexCitation.d.ts +4 -6
  87. package/dist-lib/types/inlineFlatten.d.ts +1 -1
  88. package/dist-lib/types/inlineLayout.d.ts +60 -13
  89. package/dist-lib/types/layoutEngine.d.ts +170 -8
  90. package/dist-lib/types/linkPolicy.d.ts +6 -2
  91. package/dist-lib/types/linkedomModules.d.ts +4 -0
  92. package/dist-lib/types/lnode.d.ts +28 -0
  93. package/dist-lib/types/node.d.ts +10 -6
  94. package/dist-lib/types/nodeFonts.d.ts +4 -1
  95. package/dist-lib/types/pageFlow.d.ts +34 -0
  96. package/dist-lib/types/pageRaster.d.ts +153 -0
  97. package/dist-lib/types/paint.d.ts +21 -3
  98. package/dist-lib/types/pdfContentStreams.d.ts +9 -0
  99. package/dist-lib/types/pdfFlatten.d.ts +169 -0
  100. package/dist-lib/types/pdfLibPatches.d.ts +44 -4
  101. package/dist-lib/types/pdfRenderer.d.ts +110 -14
  102. package/dist-lib/types/pdfStandard.d.ts +75 -14
  103. package/dist-lib/types/pdfTags.d.ts +106 -0
  104. package/dist-lib/types/pdfaVerify.d.ts +2 -0
  105. package/dist-lib/types/pdfxVerify.d.ts +56 -0
  106. package/dist-lib/types/resourceUse.d.ts +16 -0
  107. package/dist-lib/types/resources.d.ts +9 -0
  108. package/dist-lib/types/sourceLocation.d.ts +44 -0
  109. package/dist-lib/types/sourceRef.d.ts +26 -2
  110. package/dist-lib/types/srgbIcc.d.ts +16 -0
  111. package/dist-lib/types/structure.d.ts +65 -0
  112. package/dist-lib/types/structureBuilder.d.ts +109 -0
  113. package/dist-lib/types/svg.d.ts +8 -1
  114. package/dist-lib/types/svgFilterRaster.d.ts +89 -1
  115. package/dist-lib/types/svgFilterSubregion.d.ts +2 -2
  116. package/dist-lib/types/svgRenderer.d.ts +47 -0
  117. package/dist-lib/types/types.d.ts +451 -15
  118. package/dist-lib/types/warichu.d.ts +109 -0
  119. package/dist-lib/types/xmlParse.d.ts +10 -0
  120. package/dist-lib/types/xslfoImport.d.ts +12 -2
  121. package/package.json +2 -1
package/CHANGELOG.en.md CHANGED
@@ -4,6 +4,168 @@
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.5.0 (2026-11-22)
8
+
9
+ - **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
10
+ - **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)
11
+ - **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/`
12
+ - **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`)
13
+ - **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)
14
+ - **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
15
+ - **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
16
+ - **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
17
+ - **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):
18
+ - 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
19
+ - 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
20
+ - 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)
21
+ - 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)
22
+ - 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
23
+ - 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
24
+ - 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)
25
+ - 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 `{`)
26
+ - 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
27
+ - 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)
28
+ - 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)
29
+ - 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)
30
+ - 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)
31
+ - 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
32
+ - 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
33
+ - 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 `.`)
34
+ - 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
35
+ - **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)
36
+ - **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
37
+ - **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)
38
+ - **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`)
39
+ - **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`)
40
+ - **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)
41
+ - **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)
42
+ - **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`
43
+ - **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
44
+ - **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)
45
+ - **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
46
+ - **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.
47
+ - **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
48
+ - **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
49
+ - **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
50
+ - **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.
51
+ - **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).
52
+ - **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)
53
+ - **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.)
54
+ - **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
55
+ - **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)
56
+ - **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)
57
+ - **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
58
+ - **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)
59
+ - **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)
60
+ - **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)
61
+ - **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)
62
+ - **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)
63
+ - **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)
64
+
65
+ ## 0.4.0 (2026-11-19)
66
+
67
+ - **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)
68
+ - **The base of percentages** (HTML, every style. **Typesetting results change**): percentages in `width`, `max-width`, `min-width`, `padding`, `margin` and `text-indent` (and `calc()` with percentages) were made lengths from the estimate of the containing block width at import time (which takes off only what normal-flow blocks take), so inside floats, inline-blocks, absolutely positioned boxes, flex and grid items, columns of a multi-column box and table cells the width of the outer box was the base, and boxes overflowed (a `width: 50%` box in a column of `columns: 2` took the full column width; `width: 50%` in a 100pt grid column was 150pt). For an element that names a page with `page` (`@page body { margin: … }`), the base was also the page area of the unnamed `@page`. They are now resolved at layout time against the actual containing block where the box is placed (CSS 2.1 §10.2, §8.3, §8.4, §10.4, CSS Paged Media 3 §10.1; in vertical text the base of `padding` and `margin` is the height of the containing block, CSS Writing Modes 4 §7.2; inside a page-margin box the base is the margin box). When measuring the content width, percentage widths count as `auto`, `padding`, `margin` and minimums as 0, and maximums as none (CSS Sizing 3 §5.2.1). Also: (1) percentages in `width` and `max-width` of images are resolved against the width of the box that sets the line (the default style's `img { max-width: 100% }` now works inside grid columns and columns of a multi-column box; it was resolved against the body width and the image overflowed the column) (2) a table or image with `width="100%"` in a cell of an auto-layout table does not widen the outer table (it widened the column of that cell nearly to the page width; as in browsers) (3) the column count from `column-width` and percentages in `column-gap` are decided by the width at layout time too (`columns: 40pt` in a cell about 110pt wide: 3 columns → 2) (4) percentages of normal-flow blocks in the body are the same as before
69
+ - **Pages with different margins, and fixed boxes** (HTML, every style. **Typesetting results change**: only documents with pages whose margins or sizes differ by `:first`, `:left`, `:right` or named pages): percentage widths and margins, and the position and size of fixed boxes (`position: fixed`), were decided on the page area of the unnamed `@page`, so on a `:first` page with wider margins a `width: 100%` box and fixed boxes overflowed the body area. They are now decided on the page area of the page where the box is placed, and a box that runs over pages is resolved for each fragment with the width of its page (CSS Paged Media 3 §3, CSS Fragmentation 3 §5.1; fixed boxes are placed again on each page)
70
+ - **Content widths (min-content and max-content)** (HTML, every style. **Typesetting results change**): boxes sized by their content (columns of auto-layout tables, floats, inline-blocks, `width: max-content` and so on) counted the following wrongly. (1) A block whose width is given as a length inside a cell of an auto-layout table was counted by the length of its lines, not by the width of the box (the box overflowed the cell). The outer width of the box (width and margins) is now counted. Percentage widths count as `auto`, and `max-width` and `min-width` given as lengths limit the content width (CSS Sizing 3 §5.1, §5.2.1) (2) the max-content width of a list (`ul`, `ol`, elements with `display: list-item`) in a cell was counted as the full length of the measuring line (the whole table width), so the other columns shrank to their minimum width. The indent plus the content width of the items is now counted (the same with or without markers) (3) the width of an inline-block is decided by shrink-to-fit, as for floats (a list inside took the full page width) (4) the content width of a grid container is decided by its length columns and the content widths of its `fr` and `auto` columns (a grid inside a float took the full page width) (5) the content width of a paragraph with `text-align-last: justify` or `text-align: justify-all` does not count the length added by justification (a cell with a heading spread by justification took the whole table width) (6) a vertical inline-block with `auto` height is as long as its content (it was longer than its content). Column widths of XSL-FO tables do not change
71
+ - **Propagation of breaks (`break-before`, `break-after`, `break-inside`)** (HTML, every style. **Typesetting results change**: only documents with breaks): as in CSS Fragmentation 3 §3.1.1, they now propagate out of tables, rows of flex and grid containers, and multi-column boxes. (1) Tables: `break-before` on the first child and `break-after` on the last child of a cell become the break before and after the row (they were not read; as in Chrome), and the break before the first row and after the last row becomes the break before and after the table. Breaks on `tr` and on `thead`, `tbody` and `tfoot`, and `break-inside: avoid` on them, are read too (`break-before` on the first row or the first `tbody`, `break-after` on the last row, and breaks between `tbody` elements did not work). In a table with a `thead`, a forced break at the first body row (on `tr`, `tbody` or the first child of a cell) starts the table, header included, on the next page (`tr` and `tbody` did not break, and the first child of a cell left only the header on the previous page) (2) flex and grid: `break-before` and `break-after` on an item break before and after the row of that item (`break-before` on a grid item sent only that item to the next page, and `break-after` on a flex item did not work). `break-inside: avoid` on an item and `break-after: avoid` on the last item work too (3) multi-column boxes: `page`, `left` and `right` in `break-before` and `break-after` inside go to the first column of the next page (before, `page` went to the next column on the same page, and `left` and `right` went to the next page without a blank page (landing on the wrong side) when the current page was already on the requested side, and to the next column on the same page otherwise). A break on the first child becomes the break before the multi-column box. In a balanced multi-column box, the column height stays within the rest of the page even when an unbreakable block falls on the boundary between columns (the first column overflowed the bottom of the page) (4) `left` and `right` at the same break point take the value of the later element, once (CSS Fragmentation 3 §4.3; both used to apply and an extra blank page went in: `break-after: left` with `break-before: right` gave 4 pages, now 3)
72
+ - **Named pages (`page`) and renumbering pages** (HTML, every style. **Typesetting results change**: only documents written as below): (1) `page` on `body` and `html` is read, and the document starts on that page (CSS Paged Media 3 §8.1; it was not read) (2) `page` on list items (`li`) switches the page too (3) `page` where the page cannot be switched (table rows, flex and grid items, boxes inside multi-column boxes and table cells, and so on) is reported in the warnings as unsupported CSS instead of being ignored silently (4) `counter-reset: page` on `body` and `html` gives the number of the first page (it was not read) (5) where pages of the same name follow each other, a box whose `page` names the same page and that has a forced page break and `counter-reset: page` renumbers the pages too (it did not; `counter-reset: page` on a box without `page`, inside unnamed pages, still does not renumber) (6) also in documents without `page`, when the first content of `body` was text not wrapped in an element, the next block was sent to the second page (it is now set on one page) (7) in HTML, no blank page is inserted for renumbering pages (the page counter of CSS Paged Media 3 §6.1 has no rule that inserts blank pages; blank pages come only from `left`, `right`, `recto` and `verso` of `break-before` and `break-after`: CSS Fragmentation 3 §3.1), and left and right pages (the choice of `@page :left` and `:right`, the blank pages of `left`, `right`, `recto` and `verso` breaks, and `inside` and `outside` of `float` and `text-align`) are decided not by the parity of the page number but by the order of the pages from the start of the document (which sheet it is; a blank page counts as one) (CSS Paged Media 3 §3.3: left and right pages alternate, and the first page is a right page; in a vertical (`vertical-rl`) document it is a left page; right-to-left horizontal (`direction: rtl`) documents also start on a right page, while in §3.3 they start on a left page). Renumbering the pages does not change the left and right of the spreads. When 0.3.0 switched to a page of another name and renumbered the pages, it inserted a blank page at the end of the previous pages to match the parity of the new number (making the page after page 1 page 5 gave "1 | blank | 5", now "1 | 5"; page 5 is the second sheet, so it is a left page), and it decided left and right by the parity of the page number. **Typesetting results change**: documents that renumber pages no longer get blank pages for the renumbering, and the `:left` and `:right` of the pages after the renumbering and the blank pages of `left` and `right` breaks change (usually there are fewer pages, but there can be more; `break-before: right` that renumbers to 4 gave "1 | blank | blank | 5", now "1 | blank | 4"). In documents whose first page number is even (`counter-reset: page 2` on the first element, and so on), the left and right of every page are swapped (the first page is set as a right page instead of a left page, and the pages alternate from there). A `break-before: right` at the start of the document gets no blank page before it, and the blank pages of later `left` and `right` breaks move (a document with `counter-reset: page 2` on the first element and a later `break-before: right` goes from 2 pages to 3). Documents that do not renumber pages do not change. The compatibility styles (`--style ah`, `weasyprint`, `vivliostyle`) and XSL-FO are as before (they insert the blank page before renumbering, and decide left and right by the parity of the page number)
73
+ - **Grid columns (`grid-template-columns`)** (HTML, every style. **Typesetting results change**: only documents with grids. How column widths are decided is detailed in section 13.2 of the HTML and CSS volume of the Conformance Guide):
74
+ - `em`, `rem` and `calc()` in column sizes, and relative lengths inside `minmax()`, are made absolute in the computed value (such a column was treated as `1fr` and shared equally: with 10pt text, `5em 1fr` 300pt wide went from 150 + 150pt to 50 + 250pt; CSS Values 4 §6)
75
+ - `0fr` is no longer made `1fr`, and when the `fr` factors add up to less than 1, only that share of the remaining space is divided (`0.2fr 0.3fr` 300pt wide went from 120 + 180pt to 60 + 90pt; CSS Grid 1 §12.7.1)
76
+ - the number of repetitions of `repeat(auto-fill, minmax(100px, 1fr))` is counted from the container width (300pt wide: 3 columns of 100pt → 4 columns of 75pt; CSS Grid 1 §7.2.3.2)
77
+ - line names (such as `[a]`) are not counted as columns (they were counted as `1fr` columns: the two items of `[a] 100pt [b] 1fr` 300pt wide went from 50pt and 100pt to 100pt and 200pt). `minmax()` with a function holding commas, such as `minmax(min(100%, 200px), 1fr)`, is read too (CSS Grid 1 §7.2)
78
+ - a `minmax()` column whose maximum is a length is grown up to that length first, and the rest goes to the other columns (`minmax(100px, 200px) 1fr` 400pt wide went from 200 + 200pt to 150 + 250pt; CSS Grid 1 §12.6). The factor of `minmax(0, 2fr)` is 2 (it was 1: `minmax(0, 2fr) 1fr` 300pt wide went from 150 + 150pt to 200 + 100pt)
79
+ - invalid track lists (negative lengths, nested `repeat()`, `minmax()` with an `fr` minimum, `auto-fill` with `fr`, and so on) drop the whole declaration, and the previous declaration stays (CSS Grid 1 §7.2, CSS 2.1 §4.2; a negative column was read as 0: `-10px 1fr` after `100pt 100pt` went from a 0pt column and a column with the rest to 100 + 100pt)
80
+ - a column whose math function (`min()`, `calc()` and so on) gives a negative result becomes a 0 column, without dropping the declaration (CSS Values 4 §10.12; `min(10px, -5px) 1fr` 300pt wide was not read and the previous declaration (`100pt 100pt`) stayed → 0 + 300pt)
81
+ - very large `fr` factors and percentages (`1e307fr`, `1e400%` and so on) are clamped to values that can be handled (the column widths became Infinity or NaN; CSS Values 4 §10.9)
82
+ - the column widths are decided from the actual content width of the container at layout time (they were decided from the width estimated while importing (the body width and so on), so inside flex items, table cells and grid items the columns overflowed the container: `1fr 1fr` in a `flex: 1` item next to a 250pt sibling in a 400pt flex container went from 200 + 200pt to 75 + 75pt)
83
+ - the width of a grid inside a box sized by its content, such as a float or an inline-block, is decided from the content widths (max-content) of the items of all the rows (it took the full body width: `1fr 1fr` with one letter in each item inside a float went from 240.9 + 240.9pt to 5 + 5pt; items spanning columns with `grid-column: span 2` are counted too; CSS Grid 1 §12.7.1)
84
+ - `fr` and `auto` columns are not made narrower than the automatic minimum size of their items (the narrowest width of the content, such as a long word or a table) (they were shared equally and the word ran into the next column: in `1fr 1fr` 150pt wide, the column of a long word went from 75pt (the word overflowing by 78.3pt) to 153.3pt; when the minimums add up to more than the container, the grid overflows; CSS Grid 1 §6.6, §12.7.1). Children of an item with `width: 100%` and images with the default `img { max-width: 100% }` do not widen the column
85
+ - the column of an item with `min-width` or a length `width` is not made narrower than that width (the columns were shared equally and the item ran into the next column: in `1fr 1fr` 300pt wide, the column of an item with `width: 200pt` went from 150pt to 200pt, and the next column is 100pt; CSS Grid 1 §6.6)
86
+ - a `minmax(auto, 80px)` column grows up to its maximum of 80px, and the minimum measured from the content is limited to 80px too (it was treated as `1fr` and shared equally: `minmax(auto, 80px) 1fr` 300pt wide went from 150 + 150pt to 60 + 240pt; the column of an item with `min-width: 150px` is 112.5pt, the minimum not being limited; CSS Grid 1 §6.6, §12.5)
87
+ - `auto` columns are still counted as `1fr` and shared, so an image that is itself an item in an `auto` column (with the default `max-width: 100%`) shrinks to the shared column width (a 600×400px image in `auto 1fr` 300pt wide went from 300pt (running into the next column) to 150pt; Chrome widens the `auto` column to the image, 295pt)
88
+ - known limitation: the number of repetitions of `repeat(auto-fill, …)` and `repeat(auto-fit, …)` is still decided from the width estimated while importing, so where the container is narrower than the estimate, the columns may overflow the container (`repeat(auto-fill, minmax(100px, 1fr))` in a `flex: 0 0 110pt` item has 6 columns of 75pt, counted from the 481.9pt body width)
89
+ - large grids take longer to set (a 4-column grid of 3,200 items takes about 1.7 times as long as in 0.3.0; the content widths of the items are measured at layout time to decide the column widths)
90
+ - **Image sizes** (HTML, every style. **Typesetting results change**: only images written as below. How the sizes are decided is detailed in sections 3.5 and 13.1 of the HTML and CSS volume of the Conformance Guide):
91
+ - the `width` and `height` attributes of `img` and `object` are read as presentational hints (HTML §15.4.3), and the author's CSS `width` and `height` take priority over the attributes (an image with 600×400 attributes and `style="height: 100pt"` in a 200pt wide place went from 200×44.4pt to 200×100pt with the default style `kumiori`)
92
+ - an image with attributes whose width is shrunk by the default style's (`kumiori`) `img { max-width: 100% }` shrinks its height by the aspect ratio too, as in 0.3.0 (an image with 600×400 attributes in a 200pt wide place is 200×133.3pt; also inside grid items, multi-column boxes and table cells; CSS 2.1 §10.4)
93
+ - an image with attributes whose width is shrunk by the author's `max-width` (also `max-inline-size`) keeps the height of the attribute (as in browsers: with the author's `img { max-width: 100% }`, an image with 600×400 attributes in a 200pt wide place went from 200×133.3pt to 200×300pt; with `height: auto` in CSS it shrinks by the aspect ratio as before; CSS 2.1 §10.4)
94
+ - flex containers shrink image items (they did not, and the image ran into the next item). The height of the shrunk image stays the height of the attribute (as in Chrome; CSS Flexbox 1 §9.7): in a 200pt wide container, an image with 600×400 attributes and `min-width: 0` next to a 150pt item went from 200×133.3pt to 50×300pt. An image with `flex: 0 0 100pt; min-width: 0` (also `flex-basis: 50%`) went from 200×133.3pt to 100×300pt
95
+ - flex also shrinks images with `overflow: hidden`, images with a length `min-width` (`min-width: 40pt` in the example above gives 50×300pt), and, even without a next item, images with `min-width: 0` whose own padding, border and margin make the item wider than the container (160×300pt with 10pt padding, a 5pt border and a 5pt margin)
96
+ - an image item with a width (also by attributes) in a flex container is placed without shrinking below its automatic minimum size (only the item width was shrunk and the image ran into the next item: in a 200pt wide container, an image with `width: 150pt` next to a 150pt item makes the next item shrink to 50pt; CSS Flexbox 1 §4.5)
97
+ - the automatic minimum size of an image that is itself a flex item is limited by a length `max-width` (it was not, for images whose size is not known while importing, such as `data:` SVG: a 300×200px image with `flex: 0 0 30%; max-width: 50px` went from 225pt (running into the next item) to 37.5pt; as in browsers; CSS Flexbox 1 §4.5)
98
+ - an image with `flex: 1` grows, and its height stays the height of the attribute (it did not grow: in a 200pt wide container, an image with 20×10 attributes went from 15×7.5pt to 200×7.5pt; as in Chrome; CSS Flexbox 1 §9.7)
99
+ - an image with attributes widened by `min-width` or `min-height` keeps the other size of the attribute (it was widened by the aspect ratio: an image with 100×50 attributes and `min-width: 150pt` went from 150×75pt to 150×37.5pt, and with `min-height: 100pt` from 200×100pt to 75×100pt; as in browsers; CSS 2.1 §10.4)
100
+ - an image with attributes for which the author writes only `max-height` has only its height limited (it was shrunk by the aspect ratio: an image with 600×400 attributes and `max-height: 100pt` in a 500pt wide place went from 150×100pt to 450×100pt; as in browsers). When the default style's (`kumiori`) `max-width` shrinks the width too, the aspect ratio is kept as before (150×100pt in a 200pt wide place)
101
+ - 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)
102
+ - 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)
103
+ - `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)
104
+ - **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)
105
+ - **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)
106
+ - **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)
107
+ - **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
108
+ - **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)
109
+ - **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)
110
+ - **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)
111
+ - **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
112
+ - **@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
113
+ - **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)
114
+ - **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
115
+ - **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
116
+ - **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
117
+ - **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)
118
+ - **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
119
+ - **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
120
+ - **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
121
+ - **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)
122
+ - **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
123
+ - **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)
124
+ - **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
125
+ - **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
126
+ - **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
127
+ - **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)
128
+ - **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`
129
+ - **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
130
+ - **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)
131
+ - **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)
132
+ - **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
133
+ - **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)
134
+ - **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
135
+ - **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
136
+ - **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
137
+ - **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):
138
+ - 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
139
+ - `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
140
+ - 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)
141
+ - a `discard` `space-before` of a multi-column container moved to the head of the next page because little room is left on the page is discarded (before, it was kept at the head of the next page: a container with `space-before="10pt"` moves up by 10pt; XSL 1.1 §4.3.1)
142
+ - when checking whether the line at the head of a column of a multi-column container fits, the space discarded there is not counted (before, balancing made the columns taller by that space: a container with three lines and a three-line block with `space-before="20pt"` went from 56pt to 36pt high). This also fixes the last row of a table split across two columns sometimes disappearing (a four-row table in compatibility mode, with `space-before` on the blocks in cells with borders, went from 2 + 1 rows and a warning to 2 + 2 rows)
143
+ - HTML multi-column layout (`columns`; every style): a block or table with `break-inside: avoid` / `avoid-column` is not split across two columns by balancing if it fits in a single column (before, it was split: a four-line block with `break-inside: avoid` went from 2 + 2 lines to 4 lines in the first column; CSS Fragmentation 3 §3.3). Content that does not fit in a single column is still split as before
144
+ - 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)
145
+ - 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)
146
+ - 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)
147
+ - **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)
148
+ - **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)
149
+ - **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)
150
+ - **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
151
+ - **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
152
+ - **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)
153
+ - **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)
154
+ - **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)
155
+ - **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)
156
+ - **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
157
+ - **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
158
+ - **Grey-only images in PDF/X** (only for PDF/X-1a, X-3 and X-4 output of documents with grey-only images): images whose pixels are all R = G = B (RGB and RGBA PNGs, 16-bit and 1-bit grey PNGs, grey + alpha PNGs, RGB JPEGs) are embedded as DeviceGray images instead of DeviceRGB (the same tones; ISO 32000-2 §8.6.4.2). They used to be written as DeviceRGB (a bug since 0.3.0), leaving RGB images in PDF/X
159
+ - **Development** (typesetting results do not change): when run from npm, `npm run ci:local` runs the npm main script (`npm_execpath`) directly with the Node that runs the script, without a shell. On Windows too, `npm.cmd` is not run and the arguments are passed as they are, so the deprecation warning from Node 24 about passing an argument list to a shell does not appear. In the node-min job, npm also runs on the same Node when the lowest supported Node is put first in PATH. When run directly as `node scripts/ci-local.mjs`, the `npm` in PATH is called as before
160
+ - **Security and robustness against crafted input** (protection of time and memory when typesetting documents written by others on a server; typesetting results of valid documents do not change; limits and their grounds are in the source comments):
161
+ - Regular expressions that took time quadratic in the input length now read the text once from the front: `width` and `height` in the start tag of SVG images (long runs of spaces), grid `repeat()` (a `repeat(` without a comma and long runs of spaces), and runs of unclosed `url(` (computed lengths of `filter`, `box-shadow` and the like, `background` of `@page`, `background-position`, and XSL-FO `axf:printer-marks`; an unclosed `url(` ends at the end of the value: CSS Syntax 3 §4.3.6)
162
+ - Deeply nested math functions such as `calc()` (in computed values of `filter`, `box-shadow`, `grid-template-columns` and others) took time proportional to depth × length and overflowed the stack, so the whole document could not be typeset
163
+ - The selector before `::footnote-call` and `::footnote-marker` is matched with the same matcher as the cascade (short selectors over deep nesting or many siblings took exponential time). The memo for matching selectors that mix combinator kinds has a total budget per cascade; once it is spent, such selectors are not applied and a warning is given (valid documents do not reach it)
164
+ - Paragraphs with many line breaks around comments, tables with many `rowspan="0"` cells, documents with many named pages and track lists with large `repeat()` counts are typeset in time proportional to their size
165
+ - Documents with many `span="all"` blocks deep inside nested blocks of a multi-column container (XSL-FO `axf:column-count`): the number of fragments made to lift the spans out is limited; spans beyond the limit are set within the columns and reported by the importer
166
+ - When an SVG filter is approximated with shapes, the number of clipping rectangles for primitive subregions and the number of layers no longer grow exponentially with stacked `feComposite` and `feMerge` (with too many layers, the approximation is dropped and the filter is computed in pixels)
167
+ - When flattening transparency for PDF/X-1a and X-3: the 72 ppi floor of the rasterization resolution is gone, and the pixel limit of one image is always kept (very large pages made images of billions of pixels. **Typesetting results change** only for large pages where rasterizing the whole page exceeds the limit: the resolution goes below 72 ppi, and the lowered resolution is reported in the warning. An area beyond the limit even at 1 ppi is an error, since it cannot be rasterized). The objects under a translucent object are looked up through a grid index of the page (each translucent glyph walked all objects drawn on the page)
168
+
7
169
  ## 0.3.0 (2026-11-16)
8
170
 
9
171
  A release that adds draw.io diagrams, plugins that add image formats, PDF/X-4 and more, and widens what SVG can draw. While in 0.x, it is a minor release because it includes fixes that change typesetting results.
@@ -45,7 +207,7 @@ A release that adds draw.io diagrams, plugins that add image formats, PDF/X-4 an
45
207
  - 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)
46
208
  - `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)
47
209
  - **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`
48
- - **`.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
210
+ - **`.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
49
211
  - **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
50
212
  - **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)
51
213
  - **Reporting vulnerabilities**: added the procedure for reporting vulnerabilities privately (`SECURITY.md`, `SECURITY.en.md`), linked from the "Reporting vulnerabilities" section of the README
@@ -141,15 +303,15 @@ A release that adds flex features, WOFF/WOFF2, an API for loading referenced fil
141
303
  - 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)
142
304
  - 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)
143
305
  - 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
144
- - 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
145
- - `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)
146
- - 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)
147
- - 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)
148
- - 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
149
- - 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)
150
- - 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
151
- - 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>`)
152
- - `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)
306
+ - 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
307
+ - `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)
308
+ - 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)
309
+ - 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)
310
+ - 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
311
+ - 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)
312
+ - 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
313
+ - 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>`)
314
+ - `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)
153
315
  - 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
154
316
  - 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
155
317
  - 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 (□)
@@ -263,11 +425,11 @@ A release that adds flex features, WOFF/WOFF2, an API for loading referenced fil
263
425
  - 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)
264
426
  - 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)
265
427
  - 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
266
- - 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`
428
+ - 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`
267
429
  - 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)
268
430
  - 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
269
431
  - 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
270
- - 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
432
+ - 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
271
433
  - **Distribution**:
272
434
  - `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)
273
435
  - 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)
@@ -311,7 +473,7 @@ A release that adds flex features, WOFF/WOFF2, an API for loading referenced fil
311
473
  - `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)
312
474
  - `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
313
475
  - `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)
314
- - 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
476
+ - 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
315
477
  - 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)
316
478
  - 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
317
479
  - `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
@@ -351,7 +513,7 @@ A release that adds flex features, WOFF/WOFF2, an API for loading referenced fil
351
513
  - **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`
352
514
  - **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
353
515
  - **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
354
- - **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)
516
+ - **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)
355
517
  - **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)
356
518
  - **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
357
519
  - **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