pulpweaver4 0.0.0-stage → 0.0.91
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.
- package/dist/ast/djot.d.ts +124 -0
- package/dist/ast/djot.js +464 -0
- package/dist/ast/djot.js.map +1 -0
- package/dist/ast/index.d.ts +10 -0
- package/dist/ast/index.js +11 -0
- package/dist/ast/index.js.map +1 -0
- package/dist/ast/locator.d.ts +27 -0
- package/dist/ast/locator.js +77 -0
- package/dist/ast/locator.js.map +1 -0
- package/dist/ast/nodes.d.ts +543 -0
- package/dist/ast/nodes.js +56 -0
- package/dist/ast/nodes.js.map +1 -0
- package/dist/ast/position.d.ts +88 -0
- package/dist/ast/position.js +98 -0
- package/dist/ast/position.js.map +1 -0
- package/dist/ast/traverse.d.ts +12 -0
- package/dist/ast/traverse.js +37 -0
- package/dist/ast/traverse.js.map +1 -0
- package/dist/bibliography/biblatex.d.ts +13 -0
- package/dist/bibliography/biblatex.js +849 -0
- package/dist/bibliography/biblatex.js.map +1 -0
- package/dist/bibliography/bibtex.d.ts +39 -0
- package/dist/bibliography/bibtex.js +259 -0
- package/dist/bibliography/bibtex.js.map +1 -0
- package/dist/bibliography/csl.d.ts +9 -0
- package/dist/bibliography/csl.js +241 -0
- package/dist/bibliography/csl.js.map +1 -0
- package/dist/bibliography/dates.d.ts +33 -0
- package/dist/bibliography/dates.js +223 -0
- package/dist/bibliography/dates.js.map +1 -0
- package/dist/bibliography/index.d.ts +8 -0
- package/dist/bibliography/index.js +9 -0
- package/dist/bibliography/index.js.map +1 -0
- package/dist/bibliography/item.d.ts +142 -0
- package/dist/bibliography/item.js +181 -0
- package/dist/bibliography/item.js.map +1 -0
- package/dist/bibliography/latex.d.ts +21 -0
- package/dist/bibliography/latex.js +586 -0
- package/dist/bibliography/latex.js.map +1 -0
- package/dist/bibliography/names.d.ts +23 -0
- package/dist/bibliography/names.js +244 -0
- package/dist/bibliography/names.js.map +1 -0
- package/dist/bibliography/read.d.ts +24 -0
- package/dist/bibliography/read.js +50 -0
- package/dist/bibliography/read.js.map +1 -0
- package/dist/citations/book.d.ts +93 -0
- package/dist/citations/book.js +217 -0
- package/dist/citations/book.js.map +1 -0
- package/dist/citations/collect.d.ts +56 -0
- package/dist/citations/collect.js +129 -0
- package/dist/citations/collect.js.map +1 -0
- package/dist/citations/hast.d.ts +12 -0
- package/dist/citations/hast.js +49 -0
- package/dist/citations/hast.js.map +1 -0
- package/dist/citations/index.d.ts +14 -0
- package/dist/citations/index.js +15 -0
- package/dist/citations/index.js.map +1 -0
- package/dist/citations/lint.d.ts +70 -0
- package/dist/citations/lint.js +92 -0
- package/dist/citations/lint.js.map +1 -0
- package/dist/citations/notes.d.ts +11 -0
- package/dist/citations/notes.js +163 -0
- package/dist/citations/notes.js.map +1 -0
- package/dist/citations/positions.d.ts +34 -0
- package/dist/citations/positions.js +90 -0
- package/dist/citations/positions.js.map +1 -0
- package/dist/citations/project.d.ts +7 -0
- package/dist/citations/project.js +24 -0
- package/dist/citations/project.js.map +1 -0
- package/dist/colour/cmyk.d.ts +71 -0
- package/dist/colour/cmyk.js +210 -0
- package/dist/colour/cmyk.js.map +1 -0
- package/dist/colour/images.d.ts +36 -0
- package/dist/colour/images.js +106 -0
- package/dist/colour/images.js.map +1 -0
- package/dist/colour/index.d.ts +7 -0
- package/dist/colour/index.js +8 -0
- package/dist/colour/index.js.map +1 -0
- package/dist/colour/ink-limit.d.ts +68 -0
- package/dist/colour/ink-limit.js +109 -0
- package/dist/colour/ink-limit.js.map +1 -0
- package/dist/colour/intents.d.ts +145 -0
- package/dist/colour/intents.js +193 -0
- package/dist/colour/intents.js.map +1 -0
- package/dist/colour/lcms.d.ts +79 -0
- package/dist/colour/lcms.js +229 -0
- package/dist/colour/lcms.js.map +1 -0
- package/dist/colour/previews.d.ts +49 -0
- package/dist/colour/previews.js +116 -0
- package/dist/colour/previews.js.map +1 -0
- package/dist/colour/wasm/LICENSE-lcms2 +22 -0
- package/dist/colour/wasm/lcms2.wasm +0 -0
- package/dist/config/config.d.ts +114 -0
- package/dist/config/config.js +309 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/page.d.ts +42 -0
- package/dist/config/page.js +95 -0
- package/dist/config/page.js.map +1 -0
- package/dist/config/project-schema.d.ts +23 -0
- package/dist/config/project-schema.js +223 -0
- package/dist/config/project-schema.js.map +1 -0
- package/dist/config/schema.d.ts +68 -0
- package/dist/config/schema.js +333 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/toml.d.ts +54 -0
- package/dist/config/toml.js +238 -0
- package/dist/config/toml.js.map +1 -0
- package/dist/contents/index.d.ts +8 -0
- package/dist/contents/index.js +9 -0
- package/dist/contents/index.js.map +1 -0
- package/dist/contents/transform.d.ts +64 -0
- package/dist/contents/transform.js +149 -0
- package/dist/contents/transform.js.map +1 -0
- package/dist/csl/affix.d.ts +16 -0
- package/dist/csl/affix.js +74 -0
- package/dist/csl/affix.js.map +1 -0
- package/dist/csl/data/chicago-author-date.d.ts +2 -0
- package/dist/csl/data/chicago-author-date.js +3 -0
- package/dist/csl/data/chicago-author-date.js.map +1 -0
- package/dist/csl/data/chicago-notes-bibliography.d.ts +2 -0
- package/dist/csl/data/chicago-notes-bibliography.js +3 -0
- package/dist/csl/data/chicago-notes-bibliography.js.map +1 -0
- package/dist/csl/data/locales-en-GB.d.ts +2 -0
- package/dist/csl/data/locales-en-GB.js +3 -0
- package/dist/csl/data/locales-en-GB.js.map +1 -0
- package/dist/csl/data/locales-en-US.d.ts +2 -0
- package/dist/csl/data/locales-en-US.js +3 -0
- package/dist/csl/data/locales-en-US.js.map +1 -0
- package/dist/csl/dates.d.ts +30 -0
- package/dist/csl/dates.js +223 -0
- package/dist/csl/dates.js.map +1 -0
- package/dist/csl/format.d.ts +29 -0
- package/dist/csl/format.js +157 -0
- package/dist/csl/format.js.map +1 -0
- package/dist/csl/index.d.ts +26 -0
- package/dist/csl/index.js +16 -0
- package/dist/csl/index.js.map +1 -0
- package/dist/csl/ir.d.ts +103 -0
- package/dist/csl/ir.js +549 -0
- package/dist/csl/ir.js.map +1 -0
- package/dist/csl/load.d.ts +98 -0
- package/dist/csl/load.js +163 -0
- package/dist/csl/load.js.map +1 -0
- package/dist/csl/locale.d.ts +90 -0
- package/dist/csl/locale.js +251 -0
- package/dist/csl/locale.js.map +1 -0
- package/dist/csl/names.d.ts +41 -0
- package/dist/csl/names.js +203 -0
- package/dist/csl/names.js.map +1 -0
- package/dist/csl/numbers.d.ts +48 -0
- package/dist/csl/numbers.js +170 -0
- package/dist/csl/numbers.js.map +1 -0
- package/dist/csl/processor.d.ts +179 -0
- package/dist/csl/processor.js +765 -0
- package/dist/csl/processor.js.map +1 -0
- package/dist/csl/project.d.ts +21 -0
- package/dist/csl/project.js +85 -0
- package/dist/csl/project.js.map +1 -0
- package/dist/csl/render.d.ts +130 -0
- package/dist/csl/render.js +748 -0
- package/dist/csl/render.js.map +1 -0
- package/dist/csl/style.d.ts +168 -0
- package/dist/csl/style.js +262 -0
- package/dist/csl/style.js.map +1 -0
- package/dist/csl/xml.d.ts +28 -0
- package/dist/csl/xml.js +162 -0
- package/dist/csl/xml.js.map +1 -0
- package/dist/djot/djot.js/LICENSE +20 -0
- package/dist/djot/djot.js/src/ast.d.ts +327 -0
- package/dist/djot/djot.js/src/ast.js +68 -0
- package/dist/djot/djot.js/src/ast.js.map +1 -0
- package/dist/djot/djot.js/src/attributes.d.ts +31 -0
- package/dist/djot/djot.js/src/attributes.js +300 -0
- package/dist/djot/djot.js/src/attributes.js.map +1 -0
- package/dist/djot/djot.js/src/block.d.ts +87 -0
- package/dist/djot/djot.js/src/block.js +1201 -0
- package/dist/djot/djot.js/src/block.js.map +1 -0
- package/dist/djot/djot.js/src/djot-renderer.d.ts +8 -0
- package/dist/djot/djot.js/src/djot-renderer.js +755 -0
- package/dist/djot/djot.js/src/djot-renderer.js.map +1 -0
- package/dist/djot/djot.js/src/event.d.ts +6 -0
- package/dist/djot/djot.js/src/event.js +2 -0
- package/dist/djot/djot.js/src/event.js.map +1 -0
- package/dist/djot/djot.js/src/filter.d.ts +13 -0
- package/dist/djot/djot.js/src/filter.js +159 -0
- package/dist/djot/djot.js/src/filter.js.map +1 -0
- package/dist/djot/djot.js/src/find.d.ts +7 -0
- package/dist/djot/djot.js/src/find.js +33 -0
- package/dist/djot/djot.js/src/find.js.map +1 -0
- package/dist/djot/djot.js/src/html.d.ts +40 -0
- package/dist/djot/djot.js/src/html.js +657 -0
- package/dist/djot/djot.js/src/html.js.map +1 -0
- package/dist/djot/djot.js/src/index.d.ts +9 -0
- package/dist/djot/djot.js/src/index.js +9 -0
- package/dist/djot/djot.js/src/index.js.map +1 -0
- package/dist/djot/djot.js/src/inline.d.ts +62 -0
- package/dist/djot/djot.js/src/inline.js +1032 -0
- package/dist/djot/djot.js/src/inline.js.map +1 -0
- package/dist/djot/djot.js/src/options.d.ts +13 -0
- package/dist/djot/djot.js/src/options.js +27 -0
- package/dist/djot/djot.js/src/options.js.map +1 -0
- package/dist/djot/djot.js/src/pandoc.d.ts +20 -0
- package/dist/djot/djot.js/src/pandoc.js +1110 -0
- package/dist/djot/djot.js/src/pandoc.js.map +1 -0
- package/dist/djot/djot.js/src/parse.d.ts +19 -0
- package/dist/djot/djot.js/src/parse.js +1445 -0
- package/dist/djot/djot.js/src/parse.js.map +1 -0
- package/dist/djot/djot.js/src/version.d.ts +1 -0
- package/dist/djot/djot.js/src/version.js +2 -0
- package/dist/djot/djot.js/src/version.js.map +1 -0
- package/dist/djot/index.d.ts +5 -0
- package/dist/djot/index.js +6 -0
- package/dist/djot/index.js.map +1 -0
- package/dist/djot/read.d.ts +57 -0
- package/dist/djot/read.js +146 -0
- package/dist/djot/read.js.map +1 -0
- package/dist/fonts/css.d.ts +82 -0
- package/dist/fonts/css.js +329 -0
- package/dist/fonts/css.js.map +1 -0
- package/dist/fonts/faces.d.ts +101 -0
- package/dist/fonts/faces.js +226 -0
- package/dist/fonts/faces.js.map +1 -0
- package/dist/fonts/index.d.ts +12 -0
- package/dist/fonts/index.js +13 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/fonts/lint.d.ts +58 -0
- package/dist/fonts/lint.js +209 -0
- package/dist/fonts/lint.js.map +1 -0
- package/dist/fonts/match.d.ts +36 -0
- package/dist/fonts/match.js +104 -0
- package/dist/fonts/match.js.map +1 -0
- package/dist/fonts/names.d.ts +9 -0
- package/dist/fonts/names.js +50 -0
- package/dist/fonts/names.js.map +1 -0
- package/dist/fonts/subset.d.ts +72 -0
- package/dist/fonts/subset.js +169 -0
- package/dist/fonts/subset.js.map +1 -0
- package/dist/fonts/walk.d.ts +33 -0
- package/dist/fonts/walk.js +120 -0
- package/dist/fonts/walk.js.map +1 -0
- package/dist/fonts/wasm/LICENSE-harfbuzzjs +19 -0
- package/dist/fonts/wasm/harfbuzz-subset.wasm +0 -0
- package/dist/html/check.d.ts +62 -0
- package/dist/html/check.js +186 -0
- package/dist/html/check.js.map +1 -0
- package/dist/html/counters.d.ts +32 -0
- package/dist/html/counters.js +72 -0
- package/dist/html/counters.js.map +1 -0
- package/dist/html/css.d.ts +33 -0
- package/dist/html/css.js +72 -0
- package/dist/html/css.js.map +1 -0
- package/dist/html/dom.d.ts +28 -0
- package/dist/html/dom.js +162 -0
- package/dist/html/dom.js.map +1 -0
- package/dist/html/editions.d.ts +26 -0
- package/dist/html/editions.js +57 -0
- package/dist/html/editions.js.map +1 -0
- package/dist/html/images.d.ts +13 -0
- package/dist/html/images.js +62 -0
- package/dist/html/images.js.map +1 -0
- package/dist/html/index.d.ts +14 -0
- package/dist/html/index.js +15 -0
- package/dist/html/index.js.map +1 -0
- package/dist/html/registry.d.ts +120 -0
- package/dist/html/registry.js +48 -0
- package/dist/html/registry.js.map +1 -0
- package/dist/html/render.d.ts +99 -0
- package/dist/html/render.js +694 -0
- package/dist/html/render.js.map +1 -0
- package/dist/hyphenation/NOTICE +429 -0
- package/dist/hyphenation/exceptions.d.ts +60 -0
- package/dist/hyphenation/exceptions.js +79 -0
- package/dist/hyphenation/exceptions.js.map +1 -0
- package/dist/hyphenation/hyphenator.d.ts +66 -0
- package/dist/hyphenation/hyphenator.js +245 -0
- package/dist/hyphenation/hyphenator.js.map +1 -0
- package/dist/hyphenation/index.d.ts +4 -0
- package/dist/hyphenation/index.js +5 -0
- package/dist/hyphenation/index.js.map +1 -0
- package/dist/hyphenation/languages.d.ts +20 -0
- package/dist/hyphenation/languages.js +75 -0
- package/dist/hyphenation/languages.js.map +1 -0
- package/dist/hyphenation/patterns/af.wasm +0 -0
- package/dist/hyphenation/patterns/as.wasm +0 -0
- package/dist/hyphenation/patterns/be.wasm +0 -0
- package/dist/hyphenation/patterns/bg.wasm +0 -0
- package/dist/hyphenation/patterns/bn.wasm +0 -0
- package/dist/hyphenation/patterns/ca.wasm +0 -0
- package/dist/hyphenation/patterns/cy.wasm +0 -0
- package/dist/hyphenation/patterns/da.wasm +0 -0
- package/dist/hyphenation/patterns/de.wasm +0 -0
- package/dist/hyphenation/patterns/el-monoton.wasm +0 -0
- package/dist/hyphenation/patterns/el-polyton.wasm +0 -0
- package/dist/hyphenation/patterns/en-gb.wasm +0 -0
- package/dist/hyphenation/patterns/en-us.wasm +0 -0
- package/dist/hyphenation/patterns/eo.wasm +0 -0
- package/dist/hyphenation/patterns/es.wasm +0 -0
- package/dist/hyphenation/patterns/et.wasm +0 -0
- package/dist/hyphenation/patterns/eu.wasm +0 -0
- package/dist/hyphenation/patterns/fi-x-school.wasm +0 -0
- package/dist/hyphenation/patterns/fr.wasm +0 -0
- package/dist/hyphenation/patterns/fur.wasm +0 -0
- package/dist/hyphenation/patterns/ga.wasm +0 -0
- package/dist/hyphenation/patterns/gl.wasm +0 -0
- package/dist/hyphenation/patterns/gu.wasm +0 -0
- package/dist/hyphenation/patterns/hi.wasm +0 -0
- package/dist/hyphenation/patterns/hr.wasm +0 -0
- package/dist/hyphenation/patterns/hsb.wasm +0 -0
- package/dist/hyphenation/patterns/ia.wasm +0 -0
- package/dist/hyphenation/patterns/is.wasm +0 -0
- package/dist/hyphenation/patterns/it.wasm +0 -0
- package/dist/hyphenation/patterns/ka.wasm +0 -0
- package/dist/hyphenation/patterns/kmr.wasm +0 -0
- package/dist/hyphenation/patterns/kn.wasm +0 -0
- package/dist/hyphenation/patterns/la.wasm +0 -0
- package/dist/hyphenation/patterns/lt.wasm +0 -0
- package/dist/hyphenation/patterns/ml.wasm +0 -0
- package/dist/hyphenation/patterns/mn-cyrl.wasm +0 -0
- package/dist/hyphenation/patterns/mr.wasm +0 -0
- package/dist/hyphenation/patterns/nb.wasm +0 -0
- package/dist/hyphenation/patterns/nl.wasm +0 -0
- package/dist/hyphenation/patterns/nn.wasm +0 -0
- package/dist/hyphenation/patterns/no.wasm +0 -0
- package/dist/hyphenation/patterns/oc.wasm +0 -0
- package/dist/hyphenation/patterns/or.wasm +0 -0
- package/dist/hyphenation/patterns/pa.wasm +0 -0
- package/dist/hyphenation/patterns/pi.wasm +0 -0
- package/dist/hyphenation/patterns/pl.wasm +0 -0
- package/dist/hyphenation/patterns/pms.wasm +0 -0
- package/dist/hyphenation/patterns/pt.wasm +0 -0
- package/dist/hyphenation/patterns/rm.wasm +0 -0
- package/dist/hyphenation/patterns/ru.wasm +0 -0
- package/dist/hyphenation/patterns/sh-cyrl.wasm +0 -0
- package/dist/hyphenation/patterns/sh-latn.wasm +0 -0
- package/dist/hyphenation/patterns/sk.wasm +0 -0
- package/dist/hyphenation/patterns/sl.wasm +0 -0
- package/dist/hyphenation/patterns/sq.wasm +0 -0
- package/dist/hyphenation/patterns/sv.wasm +0 -0
- package/dist/hyphenation/patterns/ta.wasm +0 -0
- package/dist/hyphenation/patterns/te.wasm +0 -0
- package/dist/hyphenation/patterns/th.wasm +0 -0
- package/dist/hyphenation/patterns/tk.wasm +0 -0
- package/dist/hyphenation/patterns/tr.wasm +0 -0
- package/dist/hyphenation/patterns/uk.wasm +0 -0
- package/dist/hyphenation/patterns/zh-latn-pinyin.wasm +0 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/indexes/index.d.ts +10 -0
- package/dist/indexes/index.js +11 -0
- package/dist/indexes/index.js.map +1 -0
- package/dist/indexes/layout.d.ts +30 -0
- package/dist/indexes/layout.js +83 -0
- package/dist/indexes/layout.js.map +1 -0
- package/dist/indexes/locators.d.ts +33 -0
- package/dist/indexes/locators.js +51 -0
- package/dist/indexes/locators.js.map +1 -0
- package/dist/indexes/terms.d.ts +97 -0
- package/dist/indexes/terms.js +211 -0
- package/dist/indexes/terms.js.map +1 -0
- package/dist/indexes/transform.d.ts +90 -0
- package/dist/indexes/transform.js +154 -0
- package/dist/indexes/transform.js.map +1 -0
- package/dist/layout/calibrate.d.ts +12 -0
- package/dist/layout/calibrate.js +50 -0
- package/dist/layout/calibrate.js.map +1 -0
- package/dist/layout/converge.d.ts +31 -0
- package/dist/layout/converge.js +84 -0
- package/dist/layout/converge.js.map +1 -0
- package/dist/layout/counters.d.ts +16 -0
- package/dist/layout/counters.js +62 -0
- package/dist/layout/counters.js.map +1 -0
- package/dist/layout/first-letter.d.ts +34 -0
- package/dist/layout/first-letter.js +183 -0
- package/dist/layout/first-letter.js.map +1 -0
- package/dist/layout/fonts.d.ts +67 -0
- package/dist/layout/fonts.js +110 -0
- package/dist/layout/fonts.js.map +1 -0
- package/dist/layout/generated.d.ts +9 -0
- package/dist/layout/generated.js +83 -0
- package/dist/layout/generated.js.map +1 -0
- package/dist/layout/glue.d.ts +18 -0
- package/dist/layout/glue.js +48 -0
- package/dist/layout/glue.js.map +1 -0
- package/dist/layout/index.d.ts +17 -0
- package/dist/layout/index.js +18 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/lists.d.ts +91 -0
- package/dist/layout/lists.js +1068 -0
- package/dist/layout/lists.js.map +1 -0
- package/dist/layout/margin-boxes.d.ts +114 -0
- package/dist/layout/margin-boxes.js +429 -0
- package/dist/layout/margin-boxes.js.map +1 -0
- package/dist/layout/minipage.d.ts +85 -0
- package/dist/layout/minipage.js +83 -0
- package/dist/layout/minipage.js.map +1 -0
- package/dist/layout/page-box.d.ts +34 -0
- package/dist/layout/page-box.js +112 -0
- package/dist/layout/page-box.js.map +1 -0
- package/dist/layout/page-rules.d.ts +49 -0
- package/dist/layout/page-rules.js +205 -0
- package/dist/layout/page-rules.js.map +1 -0
- package/dist/layout/page.d.ts +51 -0
- package/dist/layout/page.js +133 -0
- package/dist/layout/page.js.map +1 -0
- package/dist/layout/pagebuilder.d.ts +243 -0
- package/dist/layout/pagebuilder.js +591 -0
- package/dist/layout/pagebuilder.js.map +1 -0
- package/dist/layout/pages.d.ts +77 -0
- package/dist/layout/pages.js +772 -0
- package/dist/layout/pages.js.map +1 -0
- package/dist/layout/paragraph.d.ts +194 -0
- package/dist/layout/paragraph.js +1148 -0
- package/dist/layout/paragraph.js.map +1 -0
- package/dist/layout/pre.d.ts +8 -0
- package/dist/layout/pre.js +151 -0
- package/dist/layout/pre.js.map +1 -0
- package/dist/layout/region.d.ts +66 -0
- package/dist/layout/region.js +200 -0
- package/dist/layout/region.js.map +1 -0
- package/dist/layout/vlist.d.ts +218 -0
- package/dist/layout/vlist.js +72 -0
- package/dist/layout/vlist.js.map +1 -0
- package/dist/linebreak/items.d.ts +69 -0
- package/dist/linebreak/items.js +44 -0
- package/dist/linebreak/items.js.map +1 -0
- package/dist/linebreak/knuth-plass.d.ts +149 -0
- package/dist/linebreak/knuth-plass.js +461 -0
- package/dist/linebreak/knuth-plass.js.map +1 -0
- package/dist/lint/config.d.ts +48 -0
- package/dist/lint/config.js +185 -0
- package/dist/lint/config.js.map +1 -0
- package/dist/lint/context.d.ts +64 -0
- package/dist/lint/context.js +37 -0
- package/dist/lint/context.js.map +1 -0
- package/dist/lint/fix.d.ts +40 -0
- package/dist/lint/fix.js +86 -0
- package/dist/lint/fix.js.map +1 -0
- package/dist/lint/index.d.ts +14 -0
- package/dist/lint/index.js +15 -0
- package/dist/lint/index.js.map +1 -0
- package/dist/lint/linter.d.ts +59 -0
- package/dist/lint/linter.js +239 -0
- package/dist/lint/linter.js.map +1 -0
- package/dist/lint/presets.d.ts +20 -0
- package/dist/lint/presets.js +65 -0
- package/dist/lint/presets.js.map +1 -0
- package/dist/lint/project.d.ts +31 -0
- package/dist/lint/project.js +100 -0
- package/dist/lint/project.js.map +1 -0
- package/dist/lint/rules/html.d.ts +30 -0
- package/dist/lint/rules/html.js +163 -0
- package/dist/lint/rules/html.js.map +1 -0
- package/dist/lint/rules/layout.d.ts +42 -0
- package/dist/lint/rules/layout.js +428 -0
- package/dist/lint/rules/layout.js.map +1 -0
- package/dist/lint/rules/source.d.ts +67 -0
- package/dist/lint/rules/source.js +339 -0
- package/dist/lint/rules/source.js.map +1 -0
- package/dist/lint/testing.d.ts +7 -0
- package/dist/lint/testing.js +77 -0
- package/dist/lint/testing.js.map +1 -0
- package/dist/math/hast.d.ts +46 -0
- package/dist/math/hast.js +297 -0
- package/dist/math/hast.js.map +1 -0
- package/dist/math/index.d.ts +9 -0
- package/dist/math/index.js +10 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/mathjax/LICENSE-mathjax +202 -0
- package/dist/math/mathjax/LICENSE-speech-rule-engine +177 -0
- package/dist/math/mathjax/sre/af.json +146 -0
- package/dist/math/mathjax/sre/base.json +140 -0
- package/dist/math/mathjax/sre/ca.json +140 -0
- package/dist/math/mathjax/sre/da.json +140 -0
- package/dist/math/mathjax/sre/de.json +146 -0
- package/dist/math/mathjax/sre/en.json +158 -0
- package/dist/math/mathjax/sre/es.json +140 -0
- package/dist/math/mathjax/sre/euro.json +32 -0
- package/dist/math/mathjax/sre/fr.json +146 -0
- package/dist/math/mathjax/sre/hi.json +146 -0
- package/dist/math/mathjax/sre/it.json +146 -0
- package/dist/math/mathjax/sre/ko.json +146 -0
- package/dist/math/mathjax/sre/nb.json +146 -0
- package/dist/math/mathjax/sre/nemeth.json +125 -0
- package/dist/math/mathjax/sre/nn.json +146 -0
- package/dist/math/mathjax/sre/sv.json +146 -0
- package/dist/math/mathjax/svg/PUA.json +1 -0
- package/dist/math/mathjax/svg/accents-b-i.json +1 -0
- package/dist/math/mathjax/svg/accents.json +1 -0
- package/dist/math/mathjax/svg/arabic.json +1 -0
- package/dist/math/mathjax/svg/arrows.json +1 -0
- package/dist/math/mathjax/svg/braille-d.json +1 -0
- package/dist/math/mathjax/svg/braille.json +1 -0
- package/dist/math/mathjax/svg/calligraphic.json +1 -0
- package/dist/math/mathjax/svg/cherokee.json +1 -0
- package/dist/math/mathjax/svg/cyrillic-ss.json +1 -0
- package/dist/math/mathjax/svg/cyrillic.json +1 -0
- package/dist/math/mathjax/svg/devanagari.json +1 -0
- package/dist/math/mathjax/svg/double-struck.json +1 -0
- package/dist/math/mathjax/svg/fraktur.json +1 -0
- package/dist/math/mathjax/svg/greek-ss.json +1 -0
- package/dist/math/mathjax/svg/greek.json +1 -0
- package/dist/math/mathjax/svg/hebrew.json +1 -0
- package/dist/math/mathjax/svg/latin-b.json +1 -0
- package/dist/math/mathjax/svg/latin-bi.json +1 -0
- package/dist/math/mathjax/svg/latin-i.json +1 -0
- package/dist/math/mathjax/svg/latin.json +1 -0
- package/dist/math/mathjax/svg/marrows.json +1 -0
- package/dist/math/mathjax/svg/math.json +1 -0
- package/dist/math/mathjax/svg/monospace-ex.json +1 -0
- package/dist/math/mathjax/svg/monospace-l.json +1 -0
- package/dist/math/mathjax/svg/monospace.json +1 -0
- package/dist/math/mathjax/svg/mshapes.json +1 -0
- package/dist/math/mathjax/svg/phonetics-ss.json +1 -0
- package/dist/math/mathjax/svg/phonetics.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-b.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-bi.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-ex.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-i.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-r.json +1 -0
- package/dist/math/mathjax/svg/sans-serif.json +1 -0
- package/dist/math/mathjax/svg/script.json +1 -0
- package/dist/math/mathjax/svg/shapes.json +1 -0
- package/dist/math/mathjax/svg/symbols-b-i.json +1 -0
- package/dist/math/mathjax/svg/symbols.json +1 -0
- package/dist/math/mathjax/svg/variants.json +1 -0
- package/dist/math/mathjax.d.ts +67 -0
- package/dist/math/mathjax.js +162 -0
- package/dist/math/mathjax.js.map +1 -0
- package/dist/math/speech.d.ts +27 -0
- package/dist/math/speech.js +87 -0
- package/dist/math/speech.js.map +1 -0
- package/dist/math/typeset.d.ts +75 -0
- package/dist/math/typeset.js +108 -0
- package/dist/math/typeset.js.map +1 -0
- package/dist/measure/css.d.ts +44 -0
- package/dist/measure/css.js +158 -0
- package/dist/measure/css.js.map +1 -0
- package/dist/measure/index.d.ts +3 -0
- package/dist/measure/index.js +4 -0
- package/dist/measure/index.js.map +1 -0
- package/dist/measure/measurer.d.ts +159 -0
- package/dist/measure/measurer.js +300 -0
- package/dist/measure/measurer.js.map +1 -0
- package/dist/measure/model.d.ts +46 -0
- package/dist/measure/model.js +47 -0
- package/dist/measure/model.js.map +1 -0
- package/dist/output/assets.d.ts +10 -0
- package/dist/output/assets.js +65 -0
- package/dist/output/assets.js.map +1 -0
- package/dist/output/index.d.ts +4 -0
- package/dist/output/index.js +5 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/output.d.ts +103 -0
- package/dist/output/output.js +86 -0
- package/dist/output/output.js.map +1 -0
- package/dist/output/stylesheets.d.ts +45 -0
- package/dist/output/stylesheets.js +50 -0
- package/dist/output/stylesheets.js.map +1 -0
- package/dist/paint/backgrounds.d.ts +56 -0
- package/dist/paint/backgrounds.js +261 -0
- package/dist/paint/backgrounds.js.map +1 -0
- package/dist/paint/blend.d.ts +61 -0
- package/dist/paint/blend.js +157 -0
- package/dist/paint/blend.js.map +1 -0
- package/dist/paint/border-image.d.ts +13 -0
- package/dist/paint/border-image.js +149 -0
- package/dist/paint/border-image.js.map +1 -0
- package/dist/paint/borders.d.ts +47 -0
- package/dist/paint/borders.js +329 -0
- package/dist/paint/borders.js.map +1 -0
- package/dist/paint/canvas.d.ts +52 -0
- package/dist/paint/canvas.js +274 -0
- package/dist/paint/canvas.js.map +1 -0
- package/dist/paint/colours.d.ts +55 -0
- package/dist/paint/colours.js +380 -0
- package/dist/paint/colours.js.map +1 -0
- package/dist/paint/columns.d.ts +11 -0
- package/dist/paint/columns.js +42 -0
- package/dist/paint/columns.js.map +1 -0
- package/dist/paint/context.d.ts +47 -0
- package/dist/paint/context.js +2 -0
- package/dist/paint/context.js.map +1 -0
- package/dist/paint/decoration.d.ts +97 -0
- package/dist/paint/decoration.js +280 -0
- package/dist/paint/decoration.js.map +1 -0
- package/dist/paint/effects.d.ts +64 -0
- package/dist/paint/effects.js +342 -0
- package/dist/paint/effects.js.map +1 -0
- package/dist/paint/emphasis.d.ts +13 -0
- package/dist/paint/emphasis.js +95 -0
- package/dist/paint/emphasis.js.map +1 -0
- package/dist/paint/flatten.d.ts +33 -0
- package/dist/paint/flatten.js +968 -0
- package/dist/paint/flatten.js.map +1 -0
- package/dist/paint/geometry.d.ts +62 -0
- package/dist/paint/geometry.js +170 -0
- package/dist/paint/geometry.js.map +1 -0
- package/dist/paint/gradients.d.ts +31 -0
- package/dist/paint/gradients.js +394 -0
- package/dist/paint/gradients.js.map +1 -0
- package/dist/paint/images.d.ts +17 -0
- package/dist/paint/images.js +80 -0
- package/dist/paint/images.js.map +1 -0
- package/dist/paint/lint.d.ts +46 -0
- package/dist/paint/lint.js +105 -0
- package/dist/paint/lint.js.map +1 -0
- package/dist/paint/overprint.d.ts +13 -0
- package/dist/paint/overprint.js +12 -0
- package/dist/paint/overprint.js.map +1 -0
- package/dist/paint/painter.d.ts +92 -0
- package/dist/paint/painter.js +281 -0
- package/dist/paint/painter.js.map +1 -0
- package/dist/paint/path.d.ts +9 -0
- package/dist/paint/path.js +173 -0
- package/dist/paint/path.js.map +1 -0
- package/dist/paint/raster.d.ts +32 -0
- package/dist/paint/raster.js +180 -0
- package/dist/paint/raster.js.map +1 -0
- package/dist/paint/shadows.d.ts +28 -0
- package/dist/paint/shadows.js +104 -0
- package/dist/paint/shadows.js.map +1 -0
- package/dist/paint/sources.d.ts +13 -0
- package/dist/paint/sources.js +17 -0
- package/dist/paint/sources.js.map +1 -0
- package/dist/paint/stacking.d.ts +75 -0
- package/dist/paint/stacking.js +327 -0
- package/dist/paint/stacking.js.map +1 -0
- package/dist/paint/svg-lint.d.ts +57 -0
- package/dist/paint/svg-lint.js +119 -0
- package/dist/paint/svg-lint.js.map +1 -0
- package/dist/paint/svg.d.ts +95 -0
- package/dist/paint/svg.js +728 -0
- package/dist/paint/svg.js.map +1 -0
- package/dist/paint/tables.d.ts +18 -0
- package/dist/paint/tables.js +178 -0
- package/dist/paint/tables.js.map +1 -0
- package/dist/paint/text-shadow.d.ts +26 -0
- package/dist/paint/text-shadow.js +187 -0
- package/dist/paint/text-shadow.js.map +1 -0
- package/dist/paint/text.d.ts +144 -0
- package/dist/paint/text.js +713 -0
- package/dist/paint/text.js.map +1 -0
- package/dist/paint/values.d.ts +24 -0
- package/dist/paint/values.js +160 -0
- package/dist/paint/values.js.map +1 -0
- package/dist/paint/vertical.d.ts +19 -0
- package/dist/paint/vertical.js +236 -0
- package/dist/paint/vertical.js.map +1 -0
- package/dist/pdf/index.d.ts +6 -0
- package/dist/pdf/index.js +7 -0
- package/dist/pdf/index.js.map +1 -0
- package/dist/pdf/pdfx.d.ts +30 -0
- package/dist/pdf/pdfx.js +18 -0
- package/dist/pdf/pdfx.js.map +1 -0
- package/dist/pdf/structure/index.d.ts +53 -0
- package/dist/pdf/structure/index.js +52 -0
- package/dist/pdf/structure/index.js.map +1 -0
- package/dist/pdf/structure/labels.d.ts +16 -0
- package/dist/pdf/structure/labels.js +45 -0
- package/dist/pdf/structure/labels.js.map +1 -0
- package/dist/pdf/structure/links.d.ts +49 -0
- package/dist/pdf/structure/links.js +136 -0
- package/dist/pdf/structure/links.js.map +1 -0
- package/dist/pdf/structure/tags.d.ts +79 -0
- package/dist/pdf/structure/tags.js +314 -0
- package/dist/pdf/structure/tags.js.map +1 -0
- package/dist/pdf/types.d.ts +551 -0
- package/dist/pdf/types.js +16 -0
- package/dist/pdf/types.js.map +1 -0
- package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +41 -0
- package/dist/pdf/wasm/pulpweaver4_pdf.js +286 -0
- package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
- package/dist/pdf/writer.d.ts +41 -0
- package/dist/pdf/writer.js +78 -0
- package/dist/pdf/writer.js.map +1 -0
- package/dist/plugin/attributes.d.ts +10 -0
- package/dist/plugin/attributes.js +63 -0
- package/dist/plugin/attributes.js.map +1 -0
- package/dist/plugin/define.d.ts +425 -0
- package/dist/plugin/define.js +311 -0
- package/dist/plugin/define.js.map +1 -0
- package/dist/plugin/failure.d.ts +80 -0
- package/dist/plugin/failure.js +97 -0
- package/dist/plugin/failure.js.map +1 -0
- package/dist/plugin/index.d.ts +11 -0
- package/dist/plugin/index.js +12 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/load.d.ts +105 -0
- package/dist/plugin/load.js +197 -0
- package/dist/plugin/load.js.map +1 -0
- package/dist/plugin/register.d.ts +166 -0
- package/dist/plugin/register.js +306 -0
- package/dist/plugin/register.js.map +1 -0
- package/dist/plugin/render.d.ts +4 -0
- package/dist/plugin/render.js +28 -0
- package/dist/plugin/render.js.map +1 -0
- package/dist/preflight/index.d.ts +3 -0
- package/dist/preflight/index.js +4 -0
- package/dist/preflight/index.js.map +1 -0
- package/dist/preflight/pdfx.d.ts +440 -0
- package/dist/preflight/pdfx.js +1781 -0
- package/dist/preflight/pdfx.js.map +1 -0
- package/dist/preflight/reader.d.ts +126 -0
- package/dist/preflight/reader.js +832 -0
- package/dist/preflight/reader.js.map +1 -0
- package/dist/preflight/xmp.d.ts +30 -0
- package/dist/preflight/xmp.js +145 -0
- package/dist/preflight/xmp.js.map +1 -0
- package/dist/print/index.d.ts +2 -0
- package/dist/print/index.js +3 -0
- package/dist/print/index.js.map +1 -0
- package/dist/print/output.d.ts +5 -0
- package/dist/print/output.js +215 -0
- package/dist/print/output.js.map +1 -0
- package/dist/problem.d.ts +142 -0
- package/dist/problem.js +234 -0
- package/dist/problem.js.map +1 -0
- package/dist/profile/index.d.ts +10 -0
- package/dist/profile/index.js +11 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/profile/lint.d.ts +69 -0
- package/dist/profile/lint.js +282 -0
- package/dist/profile/lint.js.map +1 -0
- package/dist/profile/metadata.d.ts +27 -0
- package/dist/profile/metadata.js +38 -0
- package/dist/profile/metadata.js.map +1 -0
- package/dist/profile/profile.d.ts +92 -0
- package/dist/profile/profile.js +282 -0
- package/dist/profile/profile.js.map +1 -0
- package/dist/project.d.ts +56 -0
- package/dist/project.js +137 -0
- package/dist/project.js.map +1 -0
- package/dist/reproducible/clock.d.ts +46 -0
- package/dist/reproducible/clock.js +173 -0
- package/dist/reproducible/clock.js.map +1 -0
- package/dist/reproducible/date.d.ts +42 -0
- package/dist/reproducible/date.js +82 -0
- package/dist/reproducible/date.js.map +1 -0
- package/dist/reproducible/index.d.ts +8 -0
- package/dist/reproducible/index.js +9 -0
- package/dist/reproducible/index.js.map +1 -0
- package/dist/spike/spike-page.chromium.json +330 -0
- package/dist/spike/spike.d.ts +75 -0
- package/dist/spike/spike.js +106 -0
- package/dist/spike/spike.js.map +1 -0
- package/dist/style/borders.d.ts +25 -0
- package/dist/style/borders.js +177 -0
- package/dist/style/borders.js.map +1 -0
- package/dist/style/colours.d.ts +34 -0
- package/dist/style/colours.js +138 -0
- package/dist/style/colours.js.map +1 -0
- package/dist/style/compile.d.ts +79 -0
- package/dist/style/compile.js +325 -0
- package/dist/style/compile.js.map +1 -0
- package/dist/style/defaults.d.ts +20 -0
- package/dist/style/defaults.js +45 -0
- package/dist/style/defaults.js.map +1 -0
- package/dist/style/gcpm.d.ts +22 -0
- package/dist/style/gcpm.js +86 -0
- package/dist/style/gcpm.js.map +1 -0
- package/dist/style/index.d.ts +4 -0
- package/dist/style/index.js +5 -0
- package/dist/style/index.js.map +1 -0
- package/dist/style/media.d.ts +22 -0
- package/dist/style/media.js +342 -0
- package/dist/style/media.js.map +1 -0
- package/dist/style/properties.d.ts +44 -0
- package/dist/style/properties.js +497 -0
- package/dist/style/properties.js.map +1 -0
- package/dist/style/scope.d.ts +6 -0
- package/dist/style/scope.js +134 -0
- package/dist/style/scope.js.map +1 -0
- package/dist/style/values.d.ts +45 -0
- package/dist/style/values.js +106 -0
- package/dist/style/values.js.map +1 -0
- package/dist/test/book.d.ts +180 -0
- package/dist/test/book.js +314 -0
- package/dist/test/book.js.map +1 -0
- package/dist/test/build.d.ts +58 -0
- package/dist/test/build.js +222 -0
- package/dist/test/build.js.map +1 -0
- package/dist/test/environment.d.ts +63 -0
- package/dist/test/environment.js +46 -0
- package/dist/test/environment.js.map +1 -0
- package/dist/test/index.d.ts +17 -0
- package/dist/test/index.js +18 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/indexes.d.ts +4 -0
- package/dist/test/indexes.js +48 -0
- package/dist/test/indexes.js.map +1 -0
- package/dist/test/layout.d.ts +8 -0
- package/dist/test/layout.js +121 -0
- package/dist/test/layout.js.map +1 -0
- package/dist/test/matchers.d.ts +80 -0
- package/dist/test/matchers.js +177 -0
- package/dist/test/matchers.js.map +1 -0
- package/dist/test/pipeline.d.ts +231 -0
- package/dist/test/pipeline.js +75 -0
- package/dist/test/pipeline.js.map +1 -0
- package/dist/test/plugins.d.ts +13 -0
- package/dist/test/plugins.js +22 -0
- package/dist/test/plugins.js.map +1 -0
- package/dist/test/render.d.ts +46 -0
- package/dist/test/render.js +149 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/runner.d.ts +61 -0
- package/dist/test/runner.js +256 -0
- package/dist/test/runner.js.map +1 -0
- package/dist/test/select.d.ts +54 -0
- package/dist/test/select.js +193 -0
- package/dist/test/select.js.map +1 -0
- package/dist/test/snapshot.d.ts +52 -0
- package/dist/test/snapshot.js +175 -0
- package/dist/test/snapshot.js.map +1 -0
- package/dist/test/text.d.ts +7 -0
- package/dist/test/text.js +46 -0
- package/dist/test/text.js.map +1 -0
- package/dist/test/vitest.d.ts +3 -0
- package/dist/test/vitest.js +39 -0
- package/dist/test/vitest.js.map +1 -0
- package/dist/text/index.d.ts +5 -0
- package/dist/text/index.js +6 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/output.d.ts +5 -0
- package/dist/text/output.js +39 -0
- package/dist/text/output.js.map +1 -0
- package/dist/text/render.d.ts +82 -0
- package/dist/text/render.js +583 -0
- package/dist/text/render.js.map +1 -0
- package/dist/text/width.d.ts +16 -0
- package/dist/text/width.js +90 -0
- package/dist/text/width.js.map +1 -0
- package/dist/text/wrap.d.ts +19 -0
- package/dist/text/wrap.js +151 -0
- package/dist/text/wrap.js.map +1 -0
- package/dist/transform/core.d.ts +19 -0
- package/dist/transform/core.js +22 -0
- package/dist/transform/core.js.map +1 -0
- package/dist/transform/index.d.ts +10 -0
- package/dist/transform/index.js +11 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/numbering.d.ts +47 -0
- package/dist/transform/numbering.js +142 -0
- package/dist/transform/numbering.js.map +1 -0
- package/dist/transform/references.d.ts +38 -0
- package/dist/transform/references.js +182 -0
- package/dist/transform/references.js.map +1 -0
- package/dist/transform/run.d.ts +32 -0
- package/dist/transform/run.js +210 -0
- package/dist/transform/run.js.map +1 -0
- package/dist/transform/store.d.ts +111 -0
- package/dist/transform/store.js +331 -0
- package/dist/transform/store.js.map +1 -0
- package/dist/transform/testing.d.ts +31 -0
- package/dist/transform/testing.js +76 -0
- package/dist/transform/testing.js.map +1 -0
- package/dist/transform/transform.d.ts +104 -0
- package/dist/transform/transform.js +89 -0
- package/dist/transform/transform.js.map +1 -0
- package/dist/vfs/fsa.d.ts +14 -0
- package/dist/vfs/fsa.js +123 -0
- package/dist/vfs/fsa.js.map +1 -0
- package/dist/vfs/index.d.ts +7 -0
- package/dist/vfs/index.js +8 -0
- package/dist/vfs/index.js.map +1 -0
- package/dist/vfs/memory.d.ts +15 -0
- package/dist/vfs/memory.js +101 -0
- package/dist/vfs/memory.js.map +1 -0
- package/dist/vfs/path.d.ts +30 -0
- package/dist/vfs/path.js +67 -0
- package/dist/vfs/path.js.map +1 -0
- package/dist/vfs/vfs.d.ts +66 -0
- package/dist/vfs/vfs.js +68 -0
- package/dist/vfs/vfs.js.map +1 -0
- package/dist/vfs/zip.d.ts +27 -0
- package/dist/vfs/zip.js +67 -0
- package/dist/vfs/zip.js.map +1 -0
- package/dist/web/css.d.ts +15 -0
- package/dist/web/css.js +80 -0
- package/dist/web/css.js.map +1 -0
- package/dist/web/hast.d.ts +44 -0
- package/dist/web/hast.js +175 -0
- package/dist/web/hast.js.map +1 -0
- package/dist/web/index.d.ts +11 -0
- package/dist/web/index.js +12 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/justify-main.d.ts +1 -0
- package/dist/web/justify-main.js +38 -0
- package/dist/web/justify-main.js.map +1 -0
- package/dist/web/justify.d.ts +46 -0
- package/dist/web/justify.js +147 -0
- package/dist/web/justify.js.map +1 -0
- package/dist/web/output.d.ts +28 -0
- package/dist/web/output.js +251 -0
- package/dist/web/output.js.map +1 -0
- package/dist/web/runtime/LICENSE-harfbuzzjs.txt +19 -0
- package/dist/web/runtime/NOTICE-patterns.txt +429 -0
- package/dist/web/runtime/harfbuzz.wasm +0 -0
- package/dist/web/runtime/justify.js.txt +2 -0
- package/dist/web/site.d.ts +53 -0
- package/dist/web/site.js +219 -0
- package/dist/web/site.js.map +1 -0
- package/docs/README.md +16 -0
- package/docs/reference/css-properties/index.md +94 -0
- package/docs/reference/css-properties/pw-adj-demerits.md +22 -0
- package/docs/reference/css-properties/pw-border-bottom-width.md +24 -0
- package/docs/reference/css-properties/pw-border-left-width.md +24 -0
- package/docs/reference/css-properties/pw-border-right-width.md +24 -0
- package/docs/reference/css-properties/pw-border-top-width.md +24 -0
- package/docs/reference/css-properties/pw-box.md +28 -0
- package/docs/reference/css-properties/pw-broken-penalty.md +22 -0
- package/docs/reference/css-properties/pw-club-penalty.md +24 -0
- package/docs/reference/css-properties/pw-column-rule-width.md +23 -0
- package/docs/reference/css-properties/pw-content-after.md +31 -0
- package/docs/reference/css-properties/pw-content-before.md +31 -0
- package/docs/reference/css-properties/pw-double-hyphen-demerits.md +23 -0
- package/docs/reference/css-properties/pw-emergency-stretch.md +28 -0
- package/docs/reference/css-properties/pw-ex-hyphen-penalty.md +22 -0
- package/docs/reference/css-properties/pw-final-hyphen-demerits.md +22 -0
- package/docs/reference/css-properties/pw-float-skip.md +22 -0
- package/docs/reference/css-properties/pw-float.md +33 -0
- package/docs/reference/css-properties/pw-footnote-max-height.md +22 -0
- package/docs/reference/css-properties/pw-footnote-skip.md +23 -0
- package/docs/reference/css-properties/pw-hyphen-penalty.md +24 -0
- package/docs/reference/css-properties/pw-inter-line-penalty.md +24 -0
- package/docs/reference/css-properties/pw-leader-space.md +22 -0
- package/docs/reference/css-properties/pw-leader.md +29 -0
- package/docs/reference/css-properties/pw-left-hyphen-min.md +23 -0
- package/docs/reference/css-properties/pw-line-breaking.md +29 -0
- package/docs/reference/css-properties/pw-line-penalty.md +23 -0
- package/docs/reference/css-properties/pw-list-indent.md +18 -0
- package/docs/reference/css-properties/pw-looseness.md +30 -0
- package/docs/reference/css-properties/pw-max-depth.md +22 -0
- package/docs/reference/css-properties/pw-minipage-footnotes.md +23 -0
- package/docs/reference/css-properties/pw-orphans.md +24 -0
- package/docs/reference/css-properties/pw-outline-width.md +23 -0
- package/docs/reference/css-properties/pw-overprint.md +26 -0
- package/docs/reference/css-properties/pw-padding-bottom.md +22 -0
- package/docs/reference/css-properties/pw-padding-left.md +22 -0
- package/docs/reference/css-properties/pw-padding-right.md +22 -0
- package/docs/reference/css-properties/pw-padding-top.md +22 -0
- package/docs/reference/css-properties/pw-page-prefix.md +28 -0
- package/docs/reference/css-properties/pw-page.md +32 -0
- package/docs/reference/css-properties/pw-penalty-after.md +23 -0
- package/docs/reference/css-properties/pw-penalty-before.md +30 -0
- package/docs/reference/css-properties/pw-pretolerance.md +23 -0
- package/docs/reference/css-properties/pw-right-hyphen-min.md +22 -0
- package/docs/reference/css-properties/pw-running.md +23 -0
- package/docs/reference/css-properties/pw-site-background.md +21 -0
- package/docs/reference/css-properties/pw-site-link.md +17 -0
- package/docs/reference/css-properties/pw-site-measure.md +17 -0
- package/docs/reference/css-properties/pw-site-muted.md +21 -0
- package/docs/reference/css-properties/pw-site-rule.md +17 -0
- package/docs/reference/css-properties/pw-site-text.md +22 -0
- package/docs/reference/css-properties/pw-space-after.md +23 -0
- package/docs/reference/css-properties/pw-space-before.md +29 -0
- package/docs/reference/css-properties/pw-string-set.md +32 -0
- package/docs/reference/css-properties/pw-tolerance.md +33 -0
- package/docs/reference/css-properties/pw-top-skip.md +22 -0
- package/docs/reference/css-properties/pw-widow-penalty.md +32 -0
- package/docs/reference/css-properties/pw-widows.md +24 -0
- package/docs/reference/css-properties/pw-word-space.md +22 -0
- package/docs/reference/css-properties/pw-xspace.md +22 -0
- package/docs/reference/index.md +17 -0
- package/docs/reference/lint-rules/black-text.md +31 -0
- package/docs/reference/lint-rules/blank-page.md +35 -0
- package/docs/reference/lint-rules/chapter-verso.md +34 -0
- package/docs/reference/lint-rules/citation-in-heading.md +24 -0
- package/docs/reference/lint-rules/consecutive-hyphens.md +34 -0
- package/docs/reference/lint-rules/empty-link.md +32 -0
- package/docs/reference/lint-rules/figure-distance.md +34 -0
- package/docs/reference/lint-rules/fonts.md +24 -0
- package/docs/reference/lint-rules/generated-text.md +24 -0
- package/docs/reference/lint-rules/heading-levels.md +30 -0
- package/docs/reference/lint-rules/ibid-across-page.md +30 -0
- package/docs/reference/lint-rules/image-alt.md +30 -0
- package/docs/reference/lint-rules/image-resolution.md +34 -0
- package/docs/reference/lint-rules/index.md +120 -0
- package/docs/reference/lint-rules/ink-limit.md +30 -0
- package/docs/reference/lint-rules/missing-field.md +37 -0
- package/docs/reference/lint-rules/orphan.md +34 -0
- package/docs/reference/lint-rules/overfull-line.md +28 -0
- package/docs/reference/lint-rules/profile.md +24 -0
- package/docs/reference/lint-rules/raw-html.md +30 -0
- package/docs/reference/lint-rules/signature.md +34 -0
- package/docs/reference/lint-rules/straight-quotes.md +33 -0
- package/docs/reference/lint-rules/svg-use-css.md +24 -0
- package/docs/reference/lint-rules/underfull-line.md +35 -0
- package/docs/reference/lint-rules/unknown-citation.md +30 -0
- package/docs/reference/lint-rules/unknown-label.md +31 -0
- package/docs/reference/lint-rules/unpaintable.md +24 -0
- package/docs/reference/lint-rules/unplaced-index.md +31 -0
- package/docs/reference/lint-rules/unused-entry.md +38 -0
- package/docs/reference/lint-rules/widow.md +34 -0
- package/docs/reference/plugin-api/assert-no-errors.md +18 -0
- package/docs/reference/plugin-api/asset-processor.md +28 -0
- package/docs/reference/plugin-api/attribute-problem.md +26 -0
- package/docs/reference/plugin-api/attribute-type.md +18 -0
- package/docs/reference/plugin-api/capabilities.md +18 -0
- package/docs/reference/plugin-api/capability.md +22 -0
- package/docs/reference/plugin-api/check-attributes.md +18 -0
- package/docs/reference/plugin-api/claim-kind.md +20 -0
- package/docs/reference/plugin-api/combine-penalties.md +17 -0
- package/docs/reference/plugin-api/command-context.md +30 -0
- package/docs/reference/plugin-api/command-definition.md +34 -0
- package/docs/reference/plugin-api/core-claims.md +18 -0
- package/docs/reference/plugin-api/define-plugin.md +20 -0
- package/docs/reference/plugin-api/define-rule.md +19 -0
- package/docs/reference/plugin-api/describe-error.md +14 -0
- package/docs/reference/plugin-api/describe-node.md +14 -0
- package/docs/reference/plugin-api/empty-registry.md +18 -0
- package/docs/reference/plugin-api/failed-on.md +32 -0
- package/docs/reference/plugin-api/fails-as.md +18 -0
- package/docs/reference/plugin-api/import-plugins.md +20 -0
- package/docs/reference/plugin-api/import-text.md +14 -0
- package/docs/reference/plugin-api/index.md +123 -0
- package/docs/reference/plugin-api/layout-definition.md +42 -0
- package/docs/reference/plugin-api/layout-slot.md +28 -0
- package/docs/reference/plugin-api/line-breaker.md +18 -0
- package/docs/reference/plugin-api/lint-context.md +48 -0
- package/docs/reference/plugin-api/lint-definition.md +32 -0
- package/docs/reference/plugin-api/lint-edition.md +38 -0
- package/docs/reference/plugin-api/lint-fix.md +36 -0
- package/docs/reference/plugin-api/lint-level.md +20 -0
- package/docs/reference/plugin-api/lint-preset.md +30 -0
- package/docs/reference/plugin-api/lint-rule.md +42 -0
- package/docs/reference/plugin-api/load-failure.md +32 -0
- package/docs/reference/plugin-api/load-plugins-options.md +32 -0
- package/docs/reference/plugin-api/load-plugins.md +20 -0
- package/docs/reference/plugin-api/loaded-plugin.md +32 -0
- package/docs/reference/plugin-api/node-claim.md +34 -0
- package/docs/reference/plugin-api/output-definition.md +28 -0
- package/docs/reference/plugin-api/owned.md +28 -0
- package/docs/reference/plugin-api/page-builder-hook.md +18 -0
- package/docs/reference/plugin-api/penalty-rule.md +34 -0
- package/docs/reference/plugin-api/plugin-api.md +18 -0
- package/docs/reference/plugin-api/plugin-definition.md +66 -0
- package/docs/reference/plugin-api/plugin-error.md +22 -0
- package/docs/reference/plugin-api/plugin-failure.md +30 -0
- package/docs/reference/plugin-api/plugin-importer.md +34 -0
- package/docs/reference/plugin-api/plugin-problem.md +30 -0
- package/docs/reference/plugin-api/plugin-registry.md +83 -0
- package/docs/reference/plugin-api/plugin-scope.md +15 -0
- package/docs/reference/plugin-api/plugin-stage.md +18 -0
- package/docs/reference/plugin-api/plugin-threw-problem.md +34 -0
- package/docs/reference/plugin-api/plugin-threw.md +21 -0
- package/docs/reference/plugin-api/plugin.md +69 -0
- package/docs/reference/plugin-api/project-with-plugins.md +36 -0
- package/docs/reference/plugin-api/read-context.md +30 -0
- package/docs/reference/plugin-api/read-failure.md +18 -0
- package/docs/reference/plugin-api/read-plugin-styles.md +22 -0
- package/docs/reference/plugin-api/reader.md +22 -0
- package/docs/reference/plugin-api/register-options.md +28 -0
- package/docs/reference/plugin-api/register-plugins.md +20 -0
- package/docs/reference/plugin-api/render-format.md +18 -0
- package/docs/reference/plugin-api/render-formats.md +18 -0
- package/docs/reference/plugin-api/renderer-registry.md +18 -0
- package/docs/reference/plugin-api/renderer-set.md +34 -0
- package/docs/reference/plugin-api/renderers.md +34 -0
- package/docs/reference/plugin-api/specifier-kind.md +14 -0
- package/docs/reference/plugin-api/style-source.md +18 -0
- package/docs/reference/plugin-api/text-context.md +28 -0
- package/docs/reference/plugin-api/text-edit.md +28 -0
- package/docs/reference/plugin-api/text-renderer.md +24 -0
- package/docs/reference/plugin-api/try-plugin-async.md +18 -0
- package/docs/reference/plugin-api/try-plugin.md +20 -0
- package/docs/reference/pulpweaver4-toml/editions.md +208 -0
- package/docs/reference/pulpweaver4-toml/index.md +195 -0
- package/docs/reference/pulpweaver4-toml/inks.md +50 -0
- package/docs/reference/pulpweaver4-toml/lint.md +36 -0
- package/docs/reference/test-matchers/index.md +33 -0
- package/docs/reference/test-matchers/to-be-recto.md +20 -0
- package/docs/reference/test-matchers/to-cite.md +22 -0
- package/docs/reference/test-matchers/to-fit-on-one-page.md +20 -0
- package/docs/reference/test-matchers/to-have-no-overfull-lines.md +20 -0
- package/docs/reference/test-matchers/to-match-html-snapshot.md +20 -0
- package/docs/reference/test-matchers/to-match-page-snapshot.md +20 -0
- package/docs/reference/test-matchers/to-match-text-snapshot.md +21 -0
- package/docs/reference/test-matchers/to-start-page.md +20 -0
- package/package.json +75 -4
- package/README.md +0 -3
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS's font properties, as HarfBuzz takes them. The engine reads computed
|
|
3
|
+
* styles and shapes text with HarfBuzz, so every property that changes which
|
|
4
|
+
* glyphs a browser picks, or where it puts them, must map to the same
|
|
5
|
+
* HarfBuzz features and variations, in the cascade's order of precedence
|
|
6
|
+
* (CSS Fonts 4, “Font feature and variation resolution”).
|
|
7
|
+
*/
|
|
8
|
+
/** Reads the font properties of a computed style. */
|
|
9
|
+
export function fontStyleFromComputed(cs, lang = '') {
|
|
10
|
+
const get = (p) => cs.getPropertyValue(p).trim();
|
|
11
|
+
const sizePx = parsePx(get('font-size')) ?? 16;
|
|
12
|
+
const features = {};
|
|
13
|
+
const variations = {};
|
|
14
|
+
// Lowest precedence first: the font's defaults that CSS changes.
|
|
15
|
+
if (get('font-kerning') === 'none')
|
|
16
|
+
features.kern = 0;
|
|
17
|
+
const letterSpacingPx = parseSpacing(get('letter-spacing'), sizePx);
|
|
18
|
+
if (letterSpacingPx !== 0) {
|
|
19
|
+
// CSS Text: a non-zero letter-spacing turns off optional ligatures.
|
|
20
|
+
for (const tag of ['liga', 'clig', 'dlig', 'hlig', 'calt'])
|
|
21
|
+
features[tag] = 0;
|
|
22
|
+
}
|
|
23
|
+
// font-variant-*
|
|
24
|
+
for (const word of get('font-variant-ligatures').split(/\s+/)) {
|
|
25
|
+
const set = LIGATURES[word];
|
|
26
|
+
if (set)
|
|
27
|
+
Object.assign(features, set);
|
|
28
|
+
}
|
|
29
|
+
for (const word of get('font-variant-caps').split(/\s+/)) {
|
|
30
|
+
for (const tag of CAPS[word] ?? [])
|
|
31
|
+
features[tag] = 1;
|
|
32
|
+
}
|
|
33
|
+
for (const word of get('font-variant-numeric').split(/\s+/)) {
|
|
34
|
+
const tag = NUMERIC[word];
|
|
35
|
+
if (tag)
|
|
36
|
+
features[tag] = 1;
|
|
37
|
+
}
|
|
38
|
+
for (const word of get('font-variant-east-asian').split(/\s+/)) {
|
|
39
|
+
const tag = EAST_ASIAN[word];
|
|
40
|
+
if (tag)
|
|
41
|
+
features[tag] = 1;
|
|
42
|
+
}
|
|
43
|
+
const position = POSITION[get('font-variant-position')];
|
|
44
|
+
if (position)
|
|
45
|
+
features[position] = 1;
|
|
46
|
+
if (/\bhistorical-forms\b/.test(get('font-variant-alternates')))
|
|
47
|
+
features.hist = 1;
|
|
48
|
+
// Variations from font-weight, font-stretch and font-style.
|
|
49
|
+
const weight = Number.parseFloat(get('font-weight'));
|
|
50
|
+
variations.wght = Number.isFinite(weight) ? weight : 400;
|
|
51
|
+
const stretch = get('font-stretch');
|
|
52
|
+
variations.wdth = stretch.endsWith('%') ? Number.parseFloat(stretch) : (STRETCH[stretch] ?? 100);
|
|
53
|
+
const style = get('font-style');
|
|
54
|
+
if (style === 'italic')
|
|
55
|
+
variations.ital = 1;
|
|
56
|
+
const oblique = /^oblique\s+(-?[\d.]+)deg$/.exec(style);
|
|
57
|
+
if (oblique)
|
|
58
|
+
variations.slnt = -Number.parseFloat(oblique[1]);
|
|
59
|
+
else if (style === 'oblique')
|
|
60
|
+
variations.slnt = -14;
|
|
61
|
+
// Highest precedence: the low-level settings.
|
|
62
|
+
Object.assign(variations, parseTagged(get('font-variation-settings'), 'variation'));
|
|
63
|
+
Object.assign(features, parseTagged(get('font-feature-settings'), 'feature'));
|
|
64
|
+
return {
|
|
65
|
+
sizePx,
|
|
66
|
+
features,
|
|
67
|
+
variations,
|
|
68
|
+
opticalSizing: get('font-optical-sizing') !== 'none',
|
|
69
|
+
letterSpacingPx,
|
|
70
|
+
wordSpacingPx: parseSpacing(get('word-spacing'), sizePx),
|
|
71
|
+
lang: lang || '',
|
|
72
|
+
direction: get('direction') === 'rtl' ? 'rtl' : 'ltr',
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const LIGATURES = {
|
|
76
|
+
none: { liga: 0, clig: 0, dlig: 0, hlig: 0, calt: 0 },
|
|
77
|
+
'common-ligatures': { liga: 1, clig: 1 },
|
|
78
|
+
'no-common-ligatures': { liga: 0, clig: 0 },
|
|
79
|
+
'discretionary-ligatures': { dlig: 1 },
|
|
80
|
+
'no-discretionary-ligatures': { dlig: 0 },
|
|
81
|
+
'historical-ligatures': { hlig: 1 },
|
|
82
|
+
'no-historical-ligatures': { hlig: 0 },
|
|
83
|
+
contextual: { calt: 1 },
|
|
84
|
+
'no-contextual': { calt: 0 },
|
|
85
|
+
};
|
|
86
|
+
const CAPS = {
|
|
87
|
+
'small-caps': ['smcp'],
|
|
88
|
+
'all-small-caps': ['smcp', 'c2sc'],
|
|
89
|
+
'petite-caps': ['pcap'],
|
|
90
|
+
'all-petite-caps': ['pcap', 'c2pc'],
|
|
91
|
+
unicase: ['unic'],
|
|
92
|
+
'titling-caps': ['titl'],
|
|
93
|
+
};
|
|
94
|
+
const NUMERIC = {
|
|
95
|
+
'lining-nums': 'lnum',
|
|
96
|
+
'oldstyle-nums': 'onum',
|
|
97
|
+
'proportional-nums': 'pnum',
|
|
98
|
+
'tabular-nums': 'tnum',
|
|
99
|
+
'diagonal-fractions': 'frac',
|
|
100
|
+
'stacked-fractions': 'afrc',
|
|
101
|
+
ordinal: 'ordn',
|
|
102
|
+
'slashed-zero': 'zero',
|
|
103
|
+
};
|
|
104
|
+
const EAST_ASIAN = {
|
|
105
|
+
jis78: 'jp78',
|
|
106
|
+
jis83: 'jp83',
|
|
107
|
+
jis90: 'jp90',
|
|
108
|
+
jis04: 'jp04',
|
|
109
|
+
simplified: 'smpl',
|
|
110
|
+
traditional: 'trad',
|
|
111
|
+
'full-width': 'fwid',
|
|
112
|
+
'proportional-width': 'pwid',
|
|
113
|
+
ruby: 'ruby',
|
|
114
|
+
};
|
|
115
|
+
const POSITION = { sub: 'subs', super: 'sups' };
|
|
116
|
+
const STRETCH = {
|
|
117
|
+
'ultra-condensed': 50,
|
|
118
|
+
'extra-condensed': 62.5,
|
|
119
|
+
condensed: 75,
|
|
120
|
+
'semi-condensed': 87.5,
|
|
121
|
+
normal: 100,
|
|
122
|
+
'semi-expanded': 112.5,
|
|
123
|
+
expanded: 125,
|
|
124
|
+
'extra-expanded': 150,
|
|
125
|
+
'ultra-expanded': 200,
|
|
126
|
+
};
|
|
127
|
+
function parsePx(value) {
|
|
128
|
+
const m = /^(-?[\d.]+(?:e-?\d+)?)px$/.exec(value);
|
|
129
|
+
return m ? Number.parseFloat(m[1]) : undefined;
|
|
130
|
+
}
|
|
131
|
+
/** A computed letter- or word-spacing: `normal`, or a length in px. */
|
|
132
|
+
function parseSpacing(value, sizePx) {
|
|
133
|
+
if (value === '' || value === 'normal')
|
|
134
|
+
return 0;
|
|
135
|
+
const px = parsePx(value);
|
|
136
|
+
if (px !== undefined)
|
|
137
|
+
return px;
|
|
138
|
+
const em = /^(-?[\d.]+)em$/.exec(value);
|
|
139
|
+
return em ? Number.parseFloat(em[1]) * sizePx : 0;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Parses `font-feature-settings` or `font-variation-settings`: `normal`, or
|
|
143
|
+
* a list of a quoted tag and an optional value (`on`, `off`, a number).
|
|
144
|
+
*/
|
|
145
|
+
export function parseTagged(value, kind) {
|
|
146
|
+
const out = {};
|
|
147
|
+
if (!value || value === 'normal')
|
|
148
|
+
return out;
|
|
149
|
+
for (const part of value.split(',')) {
|
|
150
|
+
const m = /^\s*["']([\x20-\x7e]{4})["']\s*(on|off|-?[\d.]+)?\s*$/.exec(part);
|
|
151
|
+
if (!m)
|
|
152
|
+
continue;
|
|
153
|
+
const v = m[2];
|
|
154
|
+
out[m[1]] = v === undefined ? (kind === 'feature' ? 1 : 0) : v === 'on' ? 1 : v === 'off' ? 0 : Number.parseFloat(v);
|
|
155
|
+
}
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/measure/css.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkCH,qDAAqD;AACrD,MAAM,UAAU,qBAAqB,CAAC,EAAqB,EAAE,IAAI,GAAG,EAAE;IACpE,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IACxD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAA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C,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;IACvH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { type ComputedStyleLike, type FontStyle, fontStyleFromComputed, parseTagged } from './css.js';
|
|
2
|
+
export { type FontMetrics, MeasuredFont, Measurer, type ShapeOptions, type ShapedGlyph, type ShapedRun } from './measurer.js';
|
|
3
|
+
export { type Engine, type LayoutModel, MODELS, appliedSpacing, currentModel, detectEngine, setSize } from './model.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/measure/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,qBAAqB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACrG,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAuD,MAAM,eAAe,CAAA;AAC7H,OAAO,EAAiC,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text measurement with HarfBuzz, over the same font files the page loads
|
|
3
|
+
* (https://plans.inkylabs.com/pulpweaver#measuring-text). Browsers shape with
|
|
4
|
+
* HarfBuzz too, so with the browser's size, `opsz` and rounding modelled
|
|
5
|
+
* (model.ts), the widths agree to the browser's layout unit, and the engine's
|
|
6
|
+
* lines end where it computed them.
|
|
7
|
+
*/
|
|
8
|
+
import type { FontStyle } from './css.js';
|
|
9
|
+
import { type LayoutModel } from './model.js';
|
|
10
|
+
type HarfBuzz = typeof import('harfbuzzjs');
|
|
11
|
+
/** A font file, parsed once, that runs are shaped with. */
|
|
12
|
+
export declare class MeasuredFont {
|
|
13
|
+
readonly data: Uint8Array;
|
|
14
|
+
readonly index: number;
|
|
15
|
+
/** Units per em. */
|
|
16
|
+
readonly upem: number;
|
|
17
|
+
/** Whether its outlines are CFF (Firefox doesn't round CFF sizes). */
|
|
18
|
+
readonly cff: boolean;
|
|
19
|
+
/** Its variation axes, by tag. */
|
|
20
|
+
readonly axes: Readonly<Record<string, {
|
|
21
|
+
min: number;
|
|
22
|
+
default: number;
|
|
23
|
+
max: number;
|
|
24
|
+
}>>;
|
|
25
|
+
/** @internal */
|
|
26
|
+
readonly face: InstanceType<HarfBuzz['Face']>;
|
|
27
|
+
/** @internal */
|
|
28
|
+
constructor(hb: HarfBuzz, data: Uint8Array, index: number);
|
|
29
|
+
private cmap;
|
|
30
|
+
/** The characters its `cmap` maps to glyphs, as code points. */
|
|
31
|
+
codepoints(): ReadonlySet<number>;
|
|
32
|
+
private readonly instances;
|
|
33
|
+
private readonly outlines;
|
|
34
|
+
/**
|
|
35
|
+
* @internal A glyph's outline at these axis values, flattened to line
|
|
36
|
+
* segments `[x0, y0, x1, y1]` in em, y up from the baseline.
|
|
37
|
+
*/
|
|
38
|
+
outline(hb: HarfBuzz, variations: Readonly<Record<string, number>>, glyph: number): readonly Segment[];
|
|
39
|
+
/**
|
|
40
|
+
* @internal A HarfBuzz font at these axis values, scaled to 64 units per
|
|
41
|
+
* font unit (sub-unit precision; runs scale it to their size themselves).
|
|
42
|
+
*/
|
|
43
|
+
instance(hb: HarfBuzz, variations: Readonly<Record<string, number>>): InstanceType<HarfBuzz['Font']>;
|
|
44
|
+
}
|
|
45
|
+
/** A line segment of a glyph's outline: `[x0, y0, x1, y1]`. */
|
|
46
|
+
type Segment = [number, number, number, number];
|
|
47
|
+
/**
|
|
48
|
+
* A font's metrics at an instance, in em, y up from the baseline: from its
|
|
49
|
+
* `hhea`, `OS/2` and `post` tables, and `MVAR` for a variable font.
|
|
50
|
+
*/
|
|
51
|
+
export interface FontMetrics {
|
|
52
|
+
ascender: number;
|
|
53
|
+
/** Negative: below the baseline. */
|
|
54
|
+
descender: number;
|
|
55
|
+
/** The top of the underline (`post`'s `underlinePosition`): negative, below the baseline. */
|
|
56
|
+
underlineOffset: number;
|
|
57
|
+
underlineThickness: number;
|
|
58
|
+
/** The top of the strikeout stroke (`OS/2`'s `yStrikeoutPosition`). */
|
|
59
|
+
strikeoutOffset: number;
|
|
60
|
+
strikeoutThickness: number;
|
|
61
|
+
}
|
|
62
|
+
/** One glyph of a shaped run, in px. */
|
|
63
|
+
export interface ShapedGlyph {
|
|
64
|
+
/** The glyph ID in the font. */
|
|
65
|
+
id: number;
|
|
66
|
+
/** The UTF-16 offset in the text of the first character the glyph shows. */
|
|
67
|
+
cluster: number;
|
|
68
|
+
/**
|
|
69
|
+
* Advance, rounded as the browser rounds it; letter- and word-spacing not
|
|
70
|
+
* included. Shaped top to bottom (`ttb`), the advance down the page.
|
|
71
|
+
*/
|
|
72
|
+
advance: number;
|
|
73
|
+
/** Offset from the pen, y up; top to bottom, from the glyph's vertical origin. */
|
|
74
|
+
offsetX: number;
|
|
75
|
+
offsetY: number;
|
|
76
|
+
}
|
|
77
|
+
/** A run of text shaped in one font and style. */
|
|
78
|
+
export interface ShapedRun {
|
|
79
|
+
/** The text the offsets refer to: the whole context the run was shaped in. */
|
|
80
|
+
readonly text: string;
|
|
81
|
+
/** The run's part of it, in UTF-16 offsets. */
|
|
82
|
+
readonly start: number;
|
|
83
|
+
readonly end: number;
|
|
84
|
+
/** Glyphs in visual order, as HarfBuzz gives them. */
|
|
85
|
+
readonly glyphs: readonly ShapedGlyph[];
|
|
86
|
+
/** The size text is set at, in px, after the model's rounding. */
|
|
87
|
+
readonly setSize: number;
|
|
88
|
+
/** The axis values it was shaped with, `opsz` included. */
|
|
89
|
+
readonly variations: Readonly<Record<string, number>>;
|
|
90
|
+
/** The letter- and word-spacing the browser applies, in px. */
|
|
91
|
+
readonly letterSpacing: number;
|
|
92
|
+
readonly wordSpacing: number;
|
|
93
|
+
/** The width of the whole run, spacing included. */
|
|
94
|
+
readonly width: number;
|
|
95
|
+
/** The width of the run's text in [start, end), spacing included. */
|
|
96
|
+
widthBetween(start: number, end: number): number;
|
|
97
|
+
}
|
|
98
|
+
export interface ShapeOptions {
|
|
99
|
+
/**
|
|
100
|
+
* The run's part of `text`, in UTF-16 offsets; the rest is context, as a
|
|
101
|
+
* paragraph shaped in runs has it, so shaping across a run's edge (Arabic
|
|
102
|
+
* joining, kerning) is as the browser does it.
|
|
103
|
+
*/
|
|
104
|
+
start?: number;
|
|
105
|
+
end?: number;
|
|
106
|
+
/**
|
|
107
|
+
* The direction to shape in: a bidi run's, which the browser has resolved
|
|
108
|
+
* (so neutral characters and mirroring follow it), or `ttb` for upright
|
|
109
|
+
* vertical text. Guessed from the text if absent.
|
|
110
|
+
*/
|
|
111
|
+
direction?: 'ltr' | 'rtl' | 'ttb';
|
|
112
|
+
}
|
|
113
|
+
/** Shapes and measures text, as the browser it runs in lays it out. */
|
|
114
|
+
export declare class Measurer {
|
|
115
|
+
private readonly hb;
|
|
116
|
+
readonly model: LayoutModel;
|
|
117
|
+
private constructor();
|
|
118
|
+
/** Loads HarfBuzz; the model defaults to that of the browser it runs in. */
|
|
119
|
+
static create(model?: LayoutModel): Promise<Measurer>;
|
|
120
|
+
/** Parses a font file (a face of a collection with `index`). */
|
|
121
|
+
loadFont(data: ArrayBuffer | Uint8Array, index?: number): MeasuredFont;
|
|
122
|
+
/** A font's metrics at an instance (the axis values a run was shaped with). */
|
|
123
|
+
metrics(font: MeasuredFont, variations: Readonly<Record<string, number>>): FontMetrics;
|
|
124
|
+
/**
|
|
125
|
+
* How far a glyph's vertical origin is above its baseline, in em, as Blink
|
|
126
|
+
* finds it for upright vertical text: the `VORG` table's (CFF fonts), else
|
|
127
|
+
* the glyph's top plus its `vmtx` top side bearing, else the ascender.
|
|
128
|
+
* Also returns the ascender, which HarfBuzz's own offsets assume here.
|
|
129
|
+
*/
|
|
130
|
+
verticalOrigin(font: MeasuredFont, variations: Readonly<Record<string, number>>, glyph: number): {
|
|
131
|
+
origin: number;
|
|
132
|
+
ascender: number;
|
|
133
|
+
};
|
|
134
|
+
/** A glyph's bounding box at an instance, as `[xMin, yMin, xMax, yMax]` in em, y up; undefined if it has no ink. */
|
|
135
|
+
glyphBounds(font: MeasuredFont, variations: Readonly<Record<string, number>>, glyph: number): [number, number, number, number] | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* How far a glyph's ink reaches across the band from `y0` to `y1` (em, y up
|
|
138
|
+
* from the baseline): its leftmost and rightmost x there, in em, or
|
|
139
|
+
* undefined if it doesn't reach the band.
|
|
140
|
+
*/
|
|
141
|
+
inkBetween(font: MeasuredFont, variations: Readonly<Record<string, number>>, glyph: number, y0: number, y1: number): [
|
|
142
|
+
number,
|
|
143
|
+
number
|
|
144
|
+
] | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* A glyph's outline at a variable font's instance, in ems from its origin,
|
|
147
|
+
* y up, as SVG path commands (`M`, `L`, `Q`, `C`, `Z`).
|
|
148
|
+
*/
|
|
149
|
+
outline(font: MeasuredFont, variations: Readonly<Record<string, number>>, glyph: number): {
|
|
150
|
+
type: string;
|
|
151
|
+
values: number[];
|
|
152
|
+
}[];
|
|
153
|
+
/**
|
|
154
|
+
* Shapes `text` (or its [start, end) part, in the context of the rest) in
|
|
155
|
+
* one font and style.
|
|
156
|
+
*/
|
|
157
|
+
shape(font: MeasuredFont, text: string, style: FontStyle, opts?: ShapeOptions): ShapedRun;
|
|
158
|
+
}
|
|
159
|
+
export {};
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { appliedSpacing, currentModel, setSize } from './model.js';
|
|
2
|
+
let harfbuzz;
|
|
3
|
+
/** HarfBuzz, loaded once, when first needed (its WebAssembly is 400 kB). */
|
|
4
|
+
function loadHarfBuzz() {
|
|
5
|
+
harfbuzz ??= import('harfbuzzjs');
|
|
6
|
+
return harfbuzz;
|
|
7
|
+
}
|
|
8
|
+
/** A font file, parsed once, that runs are shaped with. */
|
|
9
|
+
export class MeasuredFont {
|
|
10
|
+
data;
|
|
11
|
+
index;
|
|
12
|
+
/** Units per em. */
|
|
13
|
+
upem;
|
|
14
|
+
/** Whether its outlines are CFF (Firefox doesn't round CFF sizes). */
|
|
15
|
+
cff;
|
|
16
|
+
/** Its variation axes, by tag. */
|
|
17
|
+
axes;
|
|
18
|
+
/** @internal */
|
|
19
|
+
face;
|
|
20
|
+
/** @internal */
|
|
21
|
+
constructor(hb, data, index) {
|
|
22
|
+
this.data = data;
|
|
23
|
+
this.index = index;
|
|
24
|
+
this.face = new hb.Face(new hb.Blob(data), index);
|
|
25
|
+
this.upem = this.face.upem;
|
|
26
|
+
this.cff = this.face.referenceTable('CFF ') !== undefined || this.face.referenceTable('CFF2') !== undefined;
|
|
27
|
+
const axes = {};
|
|
28
|
+
for (const [tag, a] of Object.entries(this.face.getAxisInfos())) {
|
|
29
|
+
axes[tag] = { min: a.min, default: a.default, max: a.max };
|
|
30
|
+
}
|
|
31
|
+
this.axes = axes;
|
|
32
|
+
}
|
|
33
|
+
cmap;
|
|
34
|
+
/** The characters its `cmap` maps to glyphs, as code points. */
|
|
35
|
+
codepoints() {
|
|
36
|
+
this.cmap ??= new Set(this.face.collectUnicodes());
|
|
37
|
+
return this.cmap;
|
|
38
|
+
}
|
|
39
|
+
instances = new Map();
|
|
40
|
+
outlines = new Map();
|
|
41
|
+
/**
|
|
42
|
+
* @internal A glyph's outline at these axis values, flattened to line
|
|
43
|
+
* segments `[x0, y0, x1, y1]` in em, y up from the baseline.
|
|
44
|
+
*/
|
|
45
|
+
outline(hb, variations, glyph) {
|
|
46
|
+
const key = `${glyph}|${Object.entries(variations).sort(([a], [b]) => (a < b ? -1 : 1)).join(',')}`;
|
|
47
|
+
let segments = this.outlines.get(key);
|
|
48
|
+
if (!segments) {
|
|
49
|
+
const unit = this.upem * 64;
|
|
50
|
+
const out = [];
|
|
51
|
+
let x = 0;
|
|
52
|
+
let y = 0;
|
|
53
|
+
let sx = 0;
|
|
54
|
+
let sy = 0;
|
|
55
|
+
const to = (nx, ny) => {
|
|
56
|
+
out.push([x / unit, y / unit, nx / unit, ny / unit]);
|
|
57
|
+
x = nx;
|
|
58
|
+
y = ny;
|
|
59
|
+
};
|
|
60
|
+
// Curves as 8 chords each: enough to find where ink crosses a line.
|
|
61
|
+
for (const { type, values: v } of this.instance(hb, variations).glyphToJson(glyph)) {
|
|
62
|
+
if (type === 'M')
|
|
63
|
+
[x, y, sx, sy] = [v[0], v[1], v[0], v[1]];
|
|
64
|
+
else if (type === 'L')
|
|
65
|
+
to(v[0], v[1]);
|
|
66
|
+
else if (type === 'Q' || type === 'C') {
|
|
67
|
+
const [x0, y0] = [x, y];
|
|
68
|
+
for (let i = 1; i <= 8; i++) {
|
|
69
|
+
const t = i / 8;
|
|
70
|
+
const u = 1 - t;
|
|
71
|
+
if (type === 'Q')
|
|
72
|
+
to(u * u * x0 + 2 * u * t * v[0] + t * t * v[2], u * u * y0 + 2 * u * t * v[1] + t * t * v[3]);
|
|
73
|
+
else {
|
|
74
|
+
to(u ** 3 * x0 + 3 * u * u * t * v[0] + 3 * u * t * t * v[2] + t ** 3 * v[4], u ** 3 * y0 + 3 * u * u * t * v[1] + 3 * u * t * t * v[3] + t ** 3 * v[5]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else if (type === 'Z')
|
|
79
|
+
to(sx, sy);
|
|
80
|
+
}
|
|
81
|
+
segments = out;
|
|
82
|
+
this.outlines.set(key, segments);
|
|
83
|
+
}
|
|
84
|
+
return segments;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @internal A HarfBuzz font at these axis values, scaled to 64 units per
|
|
88
|
+
* font unit (sub-unit precision; runs scale it to their size themselves).
|
|
89
|
+
*/
|
|
90
|
+
instance(hb, variations) {
|
|
91
|
+
const entries = Object.entries(variations).sort(([a], [b]) => (a < b ? -1 : 1));
|
|
92
|
+
const key = entries.map(([t, v]) => `${t}=${v}`).join(',');
|
|
93
|
+
let font = this.instances.get(key);
|
|
94
|
+
if (!font) {
|
|
95
|
+
font = new hb.Font(this.face);
|
|
96
|
+
font.setScale(this.upem * 64, this.upem * 64);
|
|
97
|
+
if (entries.length)
|
|
98
|
+
font.setVariations(entries.map(([tag, v]) => new hb.Variation(tag, v)));
|
|
99
|
+
this.instances.set(key, font);
|
|
100
|
+
}
|
|
101
|
+
return font;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** Shapes and measures text, as the browser it runs in lays it out. */
|
|
105
|
+
export class Measurer {
|
|
106
|
+
hb;
|
|
107
|
+
model;
|
|
108
|
+
constructor(hb, model) {
|
|
109
|
+
this.hb = hb;
|
|
110
|
+
this.model = model;
|
|
111
|
+
}
|
|
112
|
+
/** Loads HarfBuzz; the model defaults to that of the browser it runs in. */
|
|
113
|
+
static async create(model = currentModel()) {
|
|
114
|
+
return new Measurer(await loadHarfBuzz(), model);
|
|
115
|
+
}
|
|
116
|
+
/** Parses a font file (a face of a collection with `index`). */
|
|
117
|
+
loadFont(data, index = 0) {
|
|
118
|
+
return new MeasuredFont(this.hb, data instanceof Uint8Array ? data : new Uint8Array(data), index);
|
|
119
|
+
}
|
|
120
|
+
/** A font's metrics at an instance (the axis values a run was shaped with). */
|
|
121
|
+
metrics(font, variations) {
|
|
122
|
+
const hbFont = font.instance(this.hb, variations);
|
|
123
|
+
const unit = font.upem * 64;
|
|
124
|
+
const tag = this.hb.MetricsTag;
|
|
125
|
+
const get = (t) => hbFont.getMetricPositionWithFallback(t) / unit;
|
|
126
|
+
return {
|
|
127
|
+
ascender: get(tag.HORIZONTAL_ASCENDER),
|
|
128
|
+
descender: get(tag.HORIZONTAL_DESCENDER),
|
|
129
|
+
underlineOffset: get(tag.UNDERLINE_OFFSET),
|
|
130
|
+
underlineThickness: get(tag.UNDERLINE_SIZE),
|
|
131
|
+
strikeoutOffset: get(tag.STRIKEOUT_OFFSET),
|
|
132
|
+
strikeoutThickness: get(tag.STRIKEOUT_SIZE),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* How far a glyph's vertical origin is above its baseline, in em, as Blink
|
|
137
|
+
* finds it for upright vertical text: the `VORG` table's (CFF fonts), else
|
|
138
|
+
* the glyph's top plus its `vmtx` top side bearing, else the ascender.
|
|
139
|
+
* Also returns the ascender, which HarfBuzz's own offsets assume here.
|
|
140
|
+
*/
|
|
141
|
+
verticalOrigin(font, variations, glyph) {
|
|
142
|
+
const hbFont = font.instance(this.hb, variations);
|
|
143
|
+
const unit = font.upem * 64;
|
|
144
|
+
const ascender = hbFont.hExtents().ascender / unit;
|
|
145
|
+
const vorg = font.face.referenceTable('VORG');
|
|
146
|
+
if (vorg && vorg.length >= 8) {
|
|
147
|
+
const v = new DataView(vorg.buffer, vorg.byteOffset, vorg.byteLength);
|
|
148
|
+
const n = v.getUint16(6);
|
|
149
|
+
// Entries are sorted by glyph: a binary search.
|
|
150
|
+
let lo = 0;
|
|
151
|
+
let hi = n - 1;
|
|
152
|
+
while (lo <= hi) {
|
|
153
|
+
const mid = (lo + hi) >> 1;
|
|
154
|
+
const g = v.getUint16(8 + mid * 4);
|
|
155
|
+
if (g === glyph)
|
|
156
|
+
return { origin: v.getInt16(10 + mid * 4) / font.upem, ascender };
|
|
157
|
+
if (g < glyph)
|
|
158
|
+
lo = mid + 1;
|
|
159
|
+
else
|
|
160
|
+
hi = mid - 1;
|
|
161
|
+
}
|
|
162
|
+
return { origin: v.getInt16(4) / font.upem, ascender };
|
|
163
|
+
}
|
|
164
|
+
const vhea = font.face.referenceTable('vhea');
|
|
165
|
+
const vmtx = font.face.referenceTable('vmtx');
|
|
166
|
+
const extents = hbFont.glyphExtents(glyph);
|
|
167
|
+
if (vhea && vmtx && extents) {
|
|
168
|
+
const long = new DataView(vhea.buffer, vhea.byteOffset, vhea.byteLength).getUint16(34);
|
|
169
|
+
const m = new DataView(vmtx.buffer, vmtx.byteOffset, vmtx.byteLength);
|
|
170
|
+
const at = glyph < long ? glyph * 4 + 2 : long * 4 + (glyph - long) * 2;
|
|
171
|
+
if (at + 2 <= vmtx.byteLength)
|
|
172
|
+
return { origin: (m.getInt16(at) / font.upem) + extents.yBearing / unit, ascender };
|
|
173
|
+
}
|
|
174
|
+
return { origin: ascender, ascender };
|
|
175
|
+
}
|
|
176
|
+
/** A glyph's bounding box at an instance, as `[xMin, yMin, xMax, yMax]` in em, y up; undefined if it has no ink. */
|
|
177
|
+
glyphBounds(font, variations, glyph) {
|
|
178
|
+
const e = font.instance(this.hb, variations).glyphExtents(glyph);
|
|
179
|
+
if (!e || (!e.width && !e.height))
|
|
180
|
+
return undefined;
|
|
181
|
+
const unit = font.upem * 64;
|
|
182
|
+
return [e.xBearing / unit, (e.yBearing + e.height) / unit, (e.xBearing + e.width) / unit, e.yBearing / unit];
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* How far a glyph's ink reaches across the band from `y0` to `y1` (em, y up
|
|
186
|
+
* from the baseline): its leftmost and rightmost x there, in em, or
|
|
187
|
+
* undefined if it doesn't reach the band.
|
|
188
|
+
*/
|
|
189
|
+
inkBetween(font, variations, glyph, y0, y1) {
|
|
190
|
+
let min = Number.POSITIVE_INFINITY;
|
|
191
|
+
let max = Number.NEGATIVE_INFINITY;
|
|
192
|
+
for (const [ax, ay, bx, by] of font.outline(this.hb, variations, glyph)) {
|
|
193
|
+
// The segment's part within the band.
|
|
194
|
+
const lo = Math.max(Math.min(ay, by), y0);
|
|
195
|
+
const hi = Math.min(Math.max(ay, by), y1);
|
|
196
|
+
if (lo > hi)
|
|
197
|
+
continue;
|
|
198
|
+
const xs = ay === by ? [ax, bx] : [lo, hi].map((y) => ax + ((bx - ax) * (y - ay)) / (by - ay));
|
|
199
|
+
for (const x of xs) {
|
|
200
|
+
min = Math.min(min, x);
|
|
201
|
+
max = Math.max(max, x);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return min <= max ? [min, max] : undefined;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* A glyph's outline at a variable font's instance, in ems from its origin,
|
|
208
|
+
* y up, as SVG path commands (`M`, `L`, `Q`, `C`, `Z`).
|
|
209
|
+
*/
|
|
210
|
+
outline(font, variations, glyph) {
|
|
211
|
+
const k = font.upem * 64;
|
|
212
|
+
return font.instance(this.hb, variations).glyphToJson(glyph).map((c) => ({ type: c.type, values: c.values.map((v) => v / k) }));
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Shapes `text` (or its [start, end) part, in the context of the rest) in
|
|
216
|
+
* one font and style.
|
|
217
|
+
*/
|
|
218
|
+
shape(font, text, style, opts = {}) {
|
|
219
|
+
const { hb, model } = this;
|
|
220
|
+
const start = opts.start ?? 0;
|
|
221
|
+
const end = opts.end ?? text.length;
|
|
222
|
+
const size = style.setSizePx ?? setSize(model, style.sizePx, font.cff);
|
|
223
|
+
const variations = {};
|
|
224
|
+
for (const [tag, value] of Object.entries(style.variations))
|
|
225
|
+
if (tag in font.axes)
|
|
226
|
+
variations[tag] = value;
|
|
227
|
+
if (style.opticalSizing && 'opsz' in font.axes && !('opsz' in style.variations)) {
|
|
228
|
+
if (model.opticalSize === 'css-size')
|
|
229
|
+
variations.opsz = style.sizePx;
|
|
230
|
+
else if (model.opticalSize === 'set-size')
|
|
231
|
+
variations.opsz = size;
|
|
232
|
+
}
|
|
233
|
+
const scale = font.upem * 64;
|
|
234
|
+
const hbFont = font.instance(hb, variations);
|
|
235
|
+
const buf = new hb.Buffer();
|
|
236
|
+
// The whole text goes in, so HarfBuzz sees the context either side.
|
|
237
|
+
buf.addText(text, start, end - start);
|
|
238
|
+
// Direction and script come from the text, as a bidi run has them.
|
|
239
|
+
buf.guessSegmentProperties();
|
|
240
|
+
if (opts.direction)
|
|
241
|
+
buf.setDirection(hb.Direction[opts.direction === 'ltr' ? 'LTR' : opts.direction === 'rtl' ? 'RTL' : 'TTB']);
|
|
242
|
+
if (style.lang)
|
|
243
|
+
buf.setLanguage(style.lang);
|
|
244
|
+
const features = Object.entries(style.features).map(([tag, v]) => new hb.Feature(tag, v));
|
|
245
|
+
hb.shape(hbFont, buf, features);
|
|
246
|
+
const k = size / scale;
|
|
247
|
+
const unit = model.advanceUnit;
|
|
248
|
+
const round = (v) => (unit ? Math.round(v / unit) * unit : v);
|
|
249
|
+
const ttb = opts.direction === 'ttb';
|
|
250
|
+
const positions = buf.getGlyphPositions();
|
|
251
|
+
const glyphs = buf.getGlyphInfos().map((g, i) => {
|
|
252
|
+
const p = positions[i];
|
|
253
|
+
return { id: g.codepoint, cluster: g.cluster, advance: round((ttb ? -p.yAdvance : p.xAdvance) * k), offsetX: p.xOffset * k, offsetY: p.yOffset * k };
|
|
254
|
+
});
|
|
255
|
+
return new Run(text, start, end, glyphs, size, variations, appliedSpacing(model, style.letterSpacingPx), appliedSpacing(model, style.wordSpacingPx));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
const graphemes = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
|
|
259
|
+
/** Word-separator characters that take word-spacing (CSS Text 3). */
|
|
260
|
+
const WORD_SEPARATORS = /[ ፡\u{10100}\u{10101}\u{1039f}\u{1091f}]/u;
|
|
261
|
+
class Run {
|
|
262
|
+
text;
|
|
263
|
+
start;
|
|
264
|
+
end;
|
|
265
|
+
glyphs;
|
|
266
|
+
setSize;
|
|
267
|
+
variations;
|
|
268
|
+
letterSpacing;
|
|
269
|
+
wordSpacing;
|
|
270
|
+
width;
|
|
271
|
+
constructor(text, start, end, glyphs, setSize, variations, letterSpacing, wordSpacing) {
|
|
272
|
+
this.text = text;
|
|
273
|
+
this.start = start;
|
|
274
|
+
this.end = end;
|
|
275
|
+
this.glyphs = glyphs;
|
|
276
|
+
this.setSize = setSize;
|
|
277
|
+
this.variations = variations;
|
|
278
|
+
this.letterSpacing = letterSpacing;
|
|
279
|
+
this.wordSpacing = wordSpacing;
|
|
280
|
+
this.width = this.widthBetween(start, end);
|
|
281
|
+
}
|
|
282
|
+
widthBetween(from, to) {
|
|
283
|
+
let w = 0;
|
|
284
|
+
for (const g of this.glyphs)
|
|
285
|
+
if (g.cluster >= from && g.cluster < to)
|
|
286
|
+
w += g.advance;
|
|
287
|
+
if (this.letterSpacing || this.wordSpacing) {
|
|
288
|
+
for (const { segment, index } of graphemes.segment(this.text.slice(from, to))) {
|
|
289
|
+
void index;
|
|
290
|
+
// Letter-spacing follows every grapheme in browsers; word-spacing
|
|
291
|
+
// every word separator.
|
|
292
|
+
w += this.letterSpacing;
|
|
293
|
+
if (WORD_SEPARATORS.test(segment))
|
|
294
|
+
w += this.wordSpacing;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return w;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=measurer.js.map
|