postext 1.63.3 → 1.63.4

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 (792) hide show
  1. package/dist/bundle/codec/files.d.ts +20 -0
  2. package/dist/bundle/codec/files.d.ts.map +1 -0
  3. package/dist/bundle/codec/files.js +92 -0
  4. package/dist/bundle/codec/files.js.map +1 -0
  5. package/dist/bundle/codec/plan.d.ts +114 -0
  6. package/dist/bundle/codec/plan.d.ts.map +1 -0
  7. package/dist/bundle/codec/plan.js +367 -0
  8. package/dist/bundle/codec/plan.js.map +1 -0
  9. package/dist/bundle/codec/read.d.ts +92 -0
  10. package/dist/bundle/codec/read.d.ts.map +1 -0
  11. package/dist/bundle/codec/read.js +249 -0
  12. package/dist/bundle/codec/read.js.map +1 -0
  13. package/dist/bundle/codec.d.ts +6 -218
  14. package/dist/bundle/codec.d.ts.map +1 -1
  15. package/dist/bundle/codec.js +3 -699
  16. package/dist/bundle/codec.js.map +1 -1
  17. package/dist/bundle/manifest/entries.d.ts +25 -0
  18. package/dist/bundle/manifest/entries.d.ts.map +1 -0
  19. package/dist/bundle/manifest/entries.js +108 -0
  20. package/dist/bundle/manifest/entries.js.map +1 -0
  21. package/dist/bundle/manifest/fileNames.d.ts +38 -0
  22. package/dist/bundle/manifest/fileNames.d.ts.map +1 -0
  23. package/dist/bundle/manifest/fileNames.js +143 -0
  24. package/dist/bundle/manifest/fileNames.js.map +1 -0
  25. package/dist/bundle/manifest/locale.d.ts +61 -0
  26. package/dist/bundle/manifest/locale.d.ts.map +1 -0
  27. package/dist/bundle/manifest/locale.js +216 -0
  28. package/dist/bundle/manifest/locale.js.map +1 -0
  29. package/dist/bundle/manifest/sizes.d.ts +18 -0
  30. package/dist/bundle/manifest/sizes.d.ts.map +1 -0
  31. package/dist/bundle/manifest/sizes.js +257 -0
  32. package/dist/bundle/manifest/sizes.js.map +1 -0
  33. package/dist/bundle/manifest/validation.d.ts +10 -0
  34. package/dist/bundle/manifest/validation.d.ts.map +1 -0
  35. package/dist/bundle/manifest/validation.js +114 -0
  36. package/dist/bundle/manifest/validation.js.map +1 -0
  37. package/dist/bundle/manifest.d.ts +7 -139
  38. package/dist/bundle/manifest.d.ts.map +1 -1
  39. package/dist/bundle/manifest.js +5 -829
  40. package/dist/bundle/manifest.js.map +1 -1
  41. package/dist/canvas-backend/blockRender/block.d.ts +5 -0
  42. package/dist/canvas-backend/blockRender/block.d.ts.map +1 -0
  43. package/dist/canvas-backend/blockRender/block.js +240 -0
  44. package/dist/canvas-backend/blockRender/block.js.map +1 -0
  45. package/dist/canvas-backend/blockRender/lines.d.ts +16 -0
  46. package/dist/canvas-backend/blockRender/lines.d.ts.map +1 -0
  47. package/dist/canvas-backend/blockRender/lines.js +192 -0
  48. package/dist/canvas-backend/blockRender/lines.js.map +1 -0
  49. package/dist/canvas-backend/blockRender/segments.d.ts +54 -0
  50. package/dist/canvas-backend/blockRender/segments.d.ts.map +1 -0
  51. package/dist/canvas-backend/blockRender/segments.js +311 -0
  52. package/dist/canvas-backend/blockRender/segments.js.map +1 -0
  53. package/dist/canvas-backend/blockRender.d.ts +2 -7
  54. package/dist/canvas-backend/blockRender.d.ts.map +1 -1
  55. package/dist/canvas-backend/blockRender.js +3 -727
  56. package/dist/canvas-backend/blockRender.js.map +1 -1
  57. package/dist/canvas-backend/renderResourceBlock/block.d.ts +9 -0
  58. package/dist/canvas-backend/renderResourceBlock/block.d.ts.map +1 -0
  59. package/dist/canvas-backend/renderResourceBlock/block.js +185 -0
  60. package/dist/canvas-backend/renderResourceBlock/block.js.map +1 -0
  61. package/dist/canvas-backend/renderResourceBlock/images.d.ts +67 -0
  62. package/dist/canvas-backend/renderResourceBlock/images.d.ts.map +1 -0
  63. package/dist/canvas-backend/renderResourceBlock/images.js +224 -0
  64. package/dist/canvas-backend/renderResourceBlock/images.js.map +1 -0
  65. package/dist/canvas-backend/renderResourceBlock/overlays.d.ts +10 -0
  66. package/dist/canvas-backend/renderResourceBlock/overlays.d.ts.map +1 -0
  67. package/dist/canvas-backend/renderResourceBlock/overlays.js +107 -0
  68. package/dist/canvas-backend/renderResourceBlock/overlays.js.map +1 -0
  69. package/dist/canvas-backend/renderResourceBlock/table.d.ts +3 -0
  70. package/dist/canvas-backend/renderResourceBlock/table.d.ts.map +1 -0
  71. package/dist/canvas-backend/renderResourceBlock/table.js +143 -0
  72. package/dist/canvas-backend/renderResourceBlock/table.js.map +1 -0
  73. package/dist/canvas-backend/renderResourceBlock/text.d.ts +11 -0
  74. package/dist/canvas-backend/renderResourceBlock/text.d.ts.map +1 -0
  75. package/dist/canvas-backend/renderResourceBlock/text.js +141 -0
  76. package/dist/canvas-backend/renderResourceBlock/text.js.map +1 -0
  77. package/dist/canvas-backend/renderResourceBlock.d.ts +4 -81
  78. package/dist/canvas-backend/renderResourceBlock.d.ts.map +1 -1
  79. package/dist/canvas-backend/renderResourceBlock.js +3 -777
  80. package/dist/canvas-backend/renderResourceBlock.js.map +1 -1
  81. package/dist/canvas-backend/verticalText/alternates.d.ts +47 -0
  82. package/dist/canvas-backend/verticalText/alternates.d.ts.map +1 -0
  83. package/dist/canvas-backend/verticalText/alternates.js +240 -0
  84. package/dist/canvas-backend/verticalText/alternates.js.map +1 -0
  85. package/dist/canvas-backend/verticalText/painter.d.ts +58 -0
  86. package/dist/canvas-backend/verticalText/painter.d.ts.map +1 -0
  87. package/dist/canvas-backend/verticalText/painter.js +329 -0
  88. package/dist/canvas-backend/verticalText/painter.js.map +1 -0
  89. package/dist/canvas-backend/verticalText.d.ts +4 -101
  90. package/dist/canvas-backend/verticalText.d.ts.map +1 -1
  91. package/dist/canvas-backend/verticalText.js +2 -562
  92. package/dist/canvas-backend/verticalText.js.map +1 -1
  93. package/dist/checks/contrast/colours.d.ts +64 -0
  94. package/dist/checks/contrast/colours.d.ts.map +1 -0
  95. package/dist/checks/contrast/colours.js +101 -0
  96. package/dist/checks/contrast/colours.js.map +1 -0
  97. package/dist/checks/contrast/document.d.ts +17 -0
  98. package/dist/checks/contrast/document.d.ts.map +1 -0
  99. package/dist/checks/contrast/document.js +132 -0
  100. package/dist/checks/contrast/document.js.map +1 -0
  101. package/dist/checks/contrast/pairs.d.ts +10 -0
  102. package/dist/checks/contrast/pairs.d.ts.map +1 -0
  103. package/dist/checks/contrast/pairs.js +462 -0
  104. package/dist/checks/contrast/pairs.js.map +1 -0
  105. package/dist/checks/contrast/types.d.ts +114 -0
  106. package/dist/checks/contrast/types.d.ts.map +1 -0
  107. package/dist/checks/contrast/types.js +2 -0
  108. package/dist/checks/contrast/types.js.map +1 -0
  109. package/dist/checks/contrast.d.ts +5 -170
  110. package/dist/checks/contrast.d.ts.map +1 -1
  111. package/dist/checks/contrast.js +3 -686
  112. package/dist/checks/contrast.js.map +1 -1
  113. package/dist/comics/layoutPage/letterPanels.d.ts +38 -0
  114. package/dist/comics/layoutPage/letterPanels.d.ts.map +1 -0
  115. package/dist/comics/layoutPage/letterPanels.js +146 -0
  116. package/dist/comics/layoutPage/letterPanels.js.map +1 -0
  117. package/dist/comics/layoutPage/letteringStyle.d.ts +31 -0
  118. package/dist/comics/layoutPage/letteringStyle.d.ts.map +1 -0
  119. package/dist/comics/layoutPage/letteringStyle.js +88 -0
  120. package/dist/comics/layoutPage/letteringStyle.js.map +1 -0
  121. package/dist/comics/layoutPage/records.d.ts +25 -0
  122. package/dist/comics/layoutPage/records.d.ts.map +1 -0
  123. package/dist/comics/layoutPage/records.js +36 -0
  124. package/dist/comics/layoutPage/records.js.map +1 -0
  125. package/dist/comics/layoutPage/settings.d.ts +64 -0
  126. package/dist/comics/layoutPage/settings.d.ts.map +1 -0
  127. package/dist/comics/layoutPage/settings.js +168 -0
  128. package/dist/comics/layoutPage/settings.js.map +1 -0
  129. package/dist/comics/layoutPage/zones.d.ts +79 -0
  130. package/dist/comics/layoutPage/zones.d.ts.map +1 -0
  131. package/dist/comics/layoutPage/zones.js +179 -0
  132. package/dist/comics/layoutPage/zones.js.map +1 -0
  133. package/dist/comics/layoutPage.d.ts +8 -113
  134. package/dist/comics/layoutPage.d.ts.map +1 -1
  135. package/dist/comics/layoutPage.js +12 -603
  136. package/dist/comics/layoutPage.js.map +1 -1
  137. package/dist/comics/lettering/letter/variants.d.ts +28 -0
  138. package/dist/comics/lettering/letter/variants.d.ts.map +1 -0
  139. package/dist/comics/lettering/letter/variants.js +269 -0
  140. package/dist/comics/lettering/letter/variants.js.map +1 -0
  141. package/dist/comics/lettering/letter.d.ts +32 -1
  142. package/dist/comics/lettering/letter.d.ts.map +1 -1
  143. package/dist/comics/lettering/letter.js +8 -270
  144. package/dist/comics/lettering/letter.js.map +1 -1
  145. package/dist/comics/lettering/shape-text/breaks.d.ts +53 -0
  146. package/dist/comics/lettering/shape-text/breaks.d.ts.map +1 -0
  147. package/dist/comics/lettering/shape-text/breaks.js +217 -0
  148. package/dist/comics/lettering/shape-text/breaks.js.map +1 -0
  149. package/dist/comics/lettering/shape-text/measure.d.ts +20 -0
  150. package/dist/comics/lettering/shape-text/measure.d.ts.map +1 -0
  151. package/dist/comics/lettering/shape-text/measure.js +160 -0
  152. package/dist/comics/lettering/shape-text/measure.js.map +1 -0
  153. package/dist/comics/lettering/shape-text/ruby.d.ts +28 -0
  154. package/dist/comics/lettering/shape-text/ruby.d.ts.map +1 -0
  155. package/dist/comics/lettering/shape-text/ruby.js +173 -0
  156. package/dist/comics/lettering/shape-text/ruby.js.map +1 -0
  157. package/dist/comics/lettering/shape-text.d.ts +7 -6
  158. package/dist/comics/lettering/shape-text.d.ts.map +1 -1
  159. package/dist/comics/lettering/shape-text.js +10 -536
  160. package/dist/comics/lettering/shape-text.js.map +1 -1
  161. package/dist/composed/overlap/ink.d.ts +48 -0
  162. package/dist/composed/overlap/ink.d.ts.map +1 -0
  163. package/dist/composed/overlap/ink.js +180 -0
  164. package/dist/composed/overlap/ink.js.map +1 -0
  165. package/dist/composed/overlap/moves.d.ts +97 -0
  166. package/dist/composed/overlap/moves.d.ts.map +1 -0
  167. package/dist/composed/overlap/moves.js +191 -0
  168. package/dist/composed/overlap/moves.js.map +1 -0
  169. package/dist/composed/overlap.d.ts +2 -2
  170. package/dist/composed/overlap.d.ts.map +1 -1
  171. package/dist/composed/overlap.js +3 -367
  172. package/dist/composed/overlap.js.map +1 -1
  173. package/dist/composed/sourceMap/chains.d.ts +27 -0
  174. package/dist/composed/sourceMap/chains.d.ts.map +1 -0
  175. package/dist/composed/sourceMap/chains.js +176 -0
  176. package/dist/composed/sourceMap/chains.js.map +1 -0
  177. package/dist/composed/sourceMap/frames.d.ts +19 -0
  178. package/dist/composed/sourceMap/frames.d.ts.map +1 -0
  179. package/dist/composed/sourceMap/frames.js +143 -0
  180. package/dist/composed/sourceMap/frames.js.map +1 -0
  181. package/dist/composed/sourceMap/text.d.ts +52 -0
  182. package/dist/composed/sourceMap/text.d.ts.map +1 -0
  183. package/dist/composed/sourceMap/text.js +200 -0
  184. package/dist/composed/sourceMap/text.js.map +1 -0
  185. package/dist/composed/sourceMap.d.ts +22 -1
  186. package/dist/composed/sourceMap.d.ts.map +1 -1
  187. package/dist/composed/sourceMap.js +7 -511
  188. package/dist/composed/sourceMap.js.map +1 -1
  189. package/dist/composed/types/frames.d.ts +290 -0
  190. package/dist/composed/types/frames.d.ts.map +1 -0
  191. package/dist/composed/types/frames.js +2 -0
  192. package/dist/composed/types/frames.js.map +1 -0
  193. package/dist/composed/types/resolved.d.ts +207 -0
  194. package/dist/composed/types/resolved.d.ts.map +1 -0
  195. package/dist/composed/types/resolved.js +2 -0
  196. package/dist/composed/types/resolved.js.map +1 -0
  197. package/dist/composed/types/templates.d.ts +152 -0
  198. package/dist/composed/types/templates.d.ts.map +1 -0
  199. package/dist/composed/types/templates.js +2 -0
  200. package/dist/composed/types/templates.js.map +1 -0
  201. package/dist/composed/types.d.ts +3 -641
  202. package/dist/composed/types.d.ts.map +1 -1
  203. package/dist/composed/types.js +8 -0
  204. package/dist/composed/types.js.map +1 -1
  205. package/dist/defaults/boxes/calloutStyles/inherit.d.ts +15 -0
  206. package/dist/defaults/boxes/calloutStyles/inherit.d.ts.map +1 -0
  207. package/dist/defaults/boxes/calloutStyles/inherit.js +64 -0
  208. package/dist/defaults/boxes/calloutStyles/inherit.js.map +1 -0
  209. package/dist/defaults/boxes/calloutStyles/resolve.d.ts +7 -0
  210. package/dist/defaults/boxes/calloutStyles/resolve.d.ts.map +1 -0
  211. package/dist/defaults/boxes/calloutStyles/resolve.js +223 -0
  212. package/dist/defaults/boxes/calloutStyles/resolve.js.map +1 -0
  213. package/dist/defaults/boxes/calloutStyles/statics.d.ts +136 -0
  214. package/dist/defaults/boxes/calloutStyles/statics.d.ts.map +1 -0
  215. package/dist/defaults/boxes/calloutStyles/statics.js +140 -0
  216. package/dist/defaults/boxes/calloutStyles/statics.js.map +1 -0
  217. package/dist/defaults/boxes/calloutStyles/strip.d.ts +10 -0
  218. package/dist/defaults/boxes/calloutStyles/strip.d.ts.map +1 -0
  219. package/dist/defaults/boxes/calloutStyles/strip.js +336 -0
  220. package/dist/defaults/boxes/calloutStyles/strip.js.map +1 -0
  221. package/dist/defaults/boxes/calloutStyles.d.ts +4 -148
  222. package/dist/defaults/boxes/calloutStyles.d.ts.map +1 -1
  223. package/dist/defaults/boxes/calloutStyles.js +4 -749
  224. package/dist/defaults/boxes/calloutStyles.js.map +1 -1
  225. package/dist/defaults/structure/headerFooter/defaults.d.ts +34 -0
  226. package/dist/defaults/structure/headerFooter/defaults.d.ts.map +1 -0
  227. package/dist/defaults/structure/headerFooter/defaults.js +162 -0
  228. package/dist/defaults/structure/headerFooter/defaults.js.map +1 -0
  229. package/dist/defaults/structure/headerFooter/legacy.d.ts +8 -0
  230. package/dist/defaults/structure/headerFooter/legacy.d.ts.map +1 -0
  231. package/dist/defaults/structure/headerFooter/legacy.js +124 -0
  232. package/dist/defaults/structure/headerFooter/legacy.js.map +1 -0
  233. package/dist/defaults/structure/headerFooter/resolve.d.ts +29 -0
  234. package/dist/defaults/structure/headerFooter/resolve.d.ts.map +1 -0
  235. package/dist/defaults/structure/headerFooter/resolve.js +231 -0
  236. package/dist/defaults/structure/headerFooter/resolve.js.map +1 -0
  237. package/dist/defaults/structure/headerFooter.d.ts +6 -58
  238. package/dist/defaults/structure/headerFooter.d.ts.map +1 -1
  239. package/dist/defaults/structure/headerFooter.js +5 -510
  240. package/dist/defaults/structure/headerFooter.js.map +1 -1
  241. package/dist/defaults/structure/headings/defaults.d.ts +46 -0
  242. package/dist/defaults/structure/headings/defaults.d.ts.map +1 -0
  243. package/dist/defaults/structure/headings/defaults.js +100 -0
  244. package/dist/defaults/structure/headings/defaults.js.map +1 -0
  245. package/dist/defaults/structure/headings/resolve.d.ts +17 -0
  246. package/dist/defaults/structure/headings/resolve.d.ts.map +1 -0
  247. package/dist/defaults/structure/headings/resolve.js +179 -0
  248. package/dist/defaults/structure/headings/resolve.js.map +1 -0
  249. package/dist/defaults/structure/headings/strip.d.ts +9 -0
  250. package/dist/defaults/structure/headings/strip.d.ts.map +1 -0
  251. package/dist/defaults/structure/headings/strip.js +323 -0
  252. package/dist/defaults/structure/headings/strip.js.map +1 -0
  253. package/dist/defaults/structure/headings.d.ts +3 -62
  254. package/dist/defaults/structure/headings.d.ts.map +1 -1
  255. package/dist/defaults/structure/headings.js +3 -594
  256. package/dist/defaults/structure/headings.js.map +1 -1
  257. package/dist/defaults/text/bodyText/arabic.d.ts +35 -0
  258. package/dist/defaults/text/bodyText/arabic.d.ts.map +1 -0
  259. package/dist/defaults/text/bodyText/arabic.js +85 -0
  260. package/dist/defaults/text/bodyText/arabic.js.map +1 -0
  261. package/dist/defaults/text/bodyText/defaults.d.ts +31 -0
  262. package/dist/defaults/text/bodyText/defaults.d.ts.map +1 -0
  263. package/dist/defaults/text/bodyText/defaults.js +128 -0
  264. package/dist/defaults/text/bodyText/defaults.js.map +1 -0
  265. package/dist/defaults/text/bodyText/resolve.d.ts +12 -0
  266. package/dist/defaults/text/bodyText/resolve.d.ts.map +1 -0
  267. package/dist/defaults/text/bodyText/resolve.js +171 -0
  268. package/dist/defaults/text/bodyText/resolve.js.map +1 -0
  269. package/dist/defaults/text/bodyText/strip.d.ts +12 -0
  270. package/dist/defaults/text/bodyText/strip.d.ts.map +1 -0
  271. package/dist/defaults/text/bodyText/strip.js +305 -0
  272. package/dist/defaults/text/bodyText/strip.js.map +1 -0
  273. package/dist/defaults/text/bodyText.d.ts +4 -70
  274. package/dist/defaults/text/bodyText.d.ts.map +1 -1
  275. package/dist/defaults/text/bodyText.js +4 -673
  276. package/dist/defaults/text/bodyText.js.map +1 -1
  277. package/dist/design/richText/ellipsis.d.ts +26 -0
  278. package/dist/design/richText/ellipsis.d.ts.map +1 -0
  279. package/dist/design/richText/ellipsis.js +173 -0
  280. package/dist/design/richText/ellipsis.js.map +1 -0
  281. package/dist/design/richText/measure.d.ts +51 -0
  282. package/dist/design/richText/measure.d.ts.map +1 -0
  283. package/dist/design/richText/measure.js +176 -0
  284. package/dist/design/richText/measure.js.map +1 -0
  285. package/dist/design/richText/parse.d.ts +120 -0
  286. package/dist/design/richText/parse.d.ts.map +1 -0
  287. package/dist/design/richText/parse.js +190 -0
  288. package/dist/design/richText/parse.js.map +1 -0
  289. package/dist/design/richText/wrap.d.ts +13 -0
  290. package/dist/design/richText/wrap.d.ts.map +1 -0
  291. package/dist/design/richText/wrap.js +176 -0
  292. package/dist/design/richText/wrap.js.map +1 -0
  293. package/dist/design/richText.d.ts +6 -199
  294. package/dist/design/richText.d.ts.map +1 -1
  295. package/dist/design/richText.js +4 -698
  296. package/dist/design/richText.js.map +1 -1
  297. package/dist/exercises/grids/arithmetic.d.ts +3 -0
  298. package/dist/exercises/grids/arithmetic.d.ts.map +1 -0
  299. package/dist/exercises/grids/arithmetic.js +214 -0
  300. package/dist/exercises/grids/arithmetic.js.map +1 -0
  301. package/dist/exercises/grids/common.d.ts +8 -0
  302. package/dist/exercises/grids/common.d.ts.map +1 -0
  303. package/dist/exercises/grids/common.js +9 -0
  304. package/dist/exercises/grids/common.js.map +1 -0
  305. package/dist/exercises/grids/crossword.d.ts +3 -0
  306. package/dist/exercises/grids/crossword.d.ts.map +1 -0
  307. package/dist/exercises/grids/crossword.js +191 -0
  308. package/dist/exercises/grids/crossword.js.map +1 -0
  309. package/dist/exercises/grids/match.d.ts +3 -0
  310. package/dist/exercises/grids/match.d.ts.map +1 -0
  311. package/dist/exercises/grids/match.js +58 -0
  312. package/dist/exercises/grids/match.js.map +1 -0
  313. package/dist/exercises/grids/wordSearch.d.ts +5 -0
  314. package/dist/exercises/grids/wordSearch.d.ts.map +1 -0
  315. package/dist/exercises/grids/wordSearch.js +122 -0
  316. package/dist/exercises/grids/wordSearch.js.map +1 -0
  317. package/dist/exercises/grids.d.ts +2 -2
  318. package/dist/exercises/grids.d.ts.map +1 -1
  319. package/dist/exercises/grids.js +4 -575
  320. package/dist/exercises/grids.js.map +1 -1
  321. package/dist/knuthPlass/breakpoints/adjust.d.ts +22 -0
  322. package/dist/knuthPlass/breakpoints/adjust.d.ts.map +1 -0
  323. package/dist/knuthPlass/breakpoints/adjust.js +39 -0
  324. package/dist/knuthPlass/breakpoints/adjust.js.map +1 -0
  325. package/dist/knuthPlass/breakpoints/search.d.ts +10 -0
  326. package/dist/knuthPlass/breakpoints/search.d.ts.map +1 -0
  327. package/dist/knuthPlass/breakpoints/search.js +439 -0
  328. package/dist/knuthPlass/breakpoints/search.js.map +1 -0
  329. package/dist/knuthPlass/breakpoints.d.ts +2 -21
  330. package/dist/knuthPlass/breakpoints.d.ts.map +1 -1
  331. package/dist/knuthPlass/breakpoints.js +2 -472
  332. package/dist/knuthPlass/breakpoints.js.map +1 -1
  333. package/dist/marks/cjkMarks/geometry.d.ts +58 -0
  334. package/dist/marks/cjkMarks/geometry.d.ts.map +1 -0
  335. package/dist/marks/cjkMarks/geometry.js +131 -0
  336. package/dist/marks/cjkMarks/geometry.js.map +1 -0
  337. package/dist/marks/cjkMarks/lineMarks.d.ts +7 -0
  338. package/dist/marks/cjkMarks/lineMarks.d.ts.map +1 -0
  339. package/dist/marks/cjkMarks/lineMarks.js +183 -0
  340. package/dist/marks/cjkMarks/lineMarks.js.map +1 -0
  341. package/dist/marks/cjkMarks/reach.d.ts +28 -0
  342. package/dist/marks/cjkMarks/reach.d.ts.map +1 -0
  343. package/dist/marks/cjkMarks/reach.js +130 -0
  344. package/dist/marks/cjkMarks/reach.js.map +1 -0
  345. package/dist/marks/cjkMarks/resources.d.ts +31 -0
  346. package/dist/marks/cjkMarks/resources.d.ts.map +1 -0
  347. package/dist/marks/cjkMarks/resources.js +46 -0
  348. package/dist/marks/cjkMarks/resources.js.map +1 -0
  349. package/dist/marks/cjkMarks.d.ts +4 -27
  350. package/dist/marks/cjkMarks.d.ts.map +1 -1
  351. package/dist/marks/cjkMarks.js +6 -479
  352. package/dist/marks/cjkMarks.js.map +1 -1
  353. package/dist/measure/canvas/ink.d.ts +67 -0
  354. package/dist/measure/canvas/ink.d.ts.map +1 -0
  355. package/dist/measure/canvas/ink.js +215 -0
  356. package/dist/measure/canvas/ink.js.map +1 -0
  357. package/dist/measure/canvas/state.d.ts +91 -0
  358. package/dist/measure/canvas/state.d.ts.map +1 -0
  359. package/dist/measure/canvas/state.js +306 -0
  360. package/dist/measure/canvas/state.js.map +1 -0
  361. package/dist/measure/canvas/widths.d.ts +27 -0
  362. package/dist/measure/canvas/widths.d.ts.map +1 -0
  363. package/dist/measure/canvas/widths.js +137 -0
  364. package/dist/measure/canvas/widths.js.map +1 -0
  365. package/dist/measure/canvas.d.ts +4 -154
  366. package/dist/measure/canvas.d.ts.map +1 -1
  367. package/dist/measure/canvas.js +4 -646
  368. package/dist/measure/canvas.js.map +1 -1
  369. package/dist/measure/cjk/cjkPunctuation/box.d.ts +71 -0
  370. package/dist/measure/cjk/cjkPunctuation/box.d.ts.map +1 -0
  371. package/dist/measure/cjk/cjkPunctuation/box.js +114 -0
  372. package/dist/measure/cjk/cjkPunctuation/box.js.map +1 -0
  373. package/dist/measure/cjk/cjkPunctuation/composition.d.ts +128 -0
  374. package/dist/measure/cjk/cjkPunctuation/composition.d.ts.map +1 -0
  375. package/dist/measure/cjk/cjkPunctuation/composition.js +157 -0
  376. package/dist/measure/cjk/cjkPunctuation/composition.js.map +1 -0
  377. package/dist/measure/cjk/cjkPunctuation/lineEdges.d.ts +63 -0
  378. package/dist/measure/cjk/cjkPunctuation/lineEdges.d.ts.map +1 -0
  379. package/dist/measure/cjk/cjkPunctuation/lineEdges.js +183 -0
  380. package/dist/measure/cjk/cjkPunctuation/lineEdges.js.map +1 -0
  381. package/dist/measure/cjk/cjkPunctuation.d.ts +8 -247
  382. package/dist/measure/cjk/cjkPunctuation.d.ts.map +1 -1
  383. package/dist/measure/cjk/cjkPunctuation.js +6 -447
  384. package/dist/measure/cjk/cjkPunctuation.js.map +1 -1
  385. package/dist/measure/plain/overwide.d.ts +70 -0
  386. package/dist/measure/plain/overwide.d.ts.map +1 -0
  387. package/dist/measure/plain/overwide.js +150 -0
  388. package/dist/measure/plain/overwide.js.map +1 -0
  389. package/dist/measure/plain/segments.d.ts +53 -0
  390. package/dist/measure/plain/segments.d.ts.map +1 -0
  391. package/dist/measure/plain/segments.js +153 -0
  392. package/dist/measure/plain/segments.js.map +1 -0
  393. package/dist/measure/plain.d.ts +2 -15
  394. package/dist/measure/plain.d.ts.map +1 -1
  395. package/dist/measure/plain.js +12 -300
  396. package/dist/measure/plain.js.map +1 -1
  397. package/dist/migrate/pageDesign/pictures.d.ts +16 -0
  398. package/dist/migrate/pageDesign/pictures.d.ts.map +1 -0
  399. package/dist/migrate/pageDesign/pictures.js +101 -0
  400. package/dist/migrate/pageDesign/pictures.js.map +1 -0
  401. package/dist/migrate/pageDesign/text.d.ts +48 -0
  402. package/dist/migrate/pageDesign/text.d.ts.map +1 -0
  403. package/dist/migrate/pageDesign/text.js +196 -0
  404. package/dist/migrate/pageDesign/text.js.map +1 -0
  405. package/dist/migrate/pageDesign/types.d.ts +137 -0
  406. package/dist/migrate/pageDesign/types.d.ts.map +1 -0
  407. package/dist/migrate/pageDesign/types.js +2 -0
  408. package/dist/migrate/pageDesign/types.js.map +1 -0
  409. package/dist/migrate/pageDesign.d.ts +4 -154
  410. package/dist/migrate/pageDesign.d.ts.map +1 -1
  411. package/dist/migrate/pageDesign.js +4 -294
  412. package/dist/migrate/pageDesign.js.map +1 -1
  413. package/dist/numerals/numbering/counters.d.ts +49 -0
  414. package/dist/numerals/numbering/counters.d.ts.map +1 -0
  415. package/dist/numerals/numbering/counters.js +311 -0
  416. package/dist/numerals/numbering/counters.js.map +1 -0
  417. package/dist/numerals/numbering/formats.d.ts +30 -0
  418. package/dist/numerals/numbering/formats.d.ts.map +1 -0
  419. package/dist/numerals/numbering/formats.js +116 -0
  420. package/dist/numerals/numbering/formats.js.map +1 -0
  421. package/dist/numerals/numbering/headings.d.ts +40 -0
  422. package/dist/numerals/numbering/headings.d.ts.map +1 -0
  423. package/dist/numerals/numbering/headings.js +64 -0
  424. package/dist/numerals/numbering/headings.js.map +1 -0
  425. package/dist/numerals/numbering/pageLabels.d.ts +43 -0
  426. package/dist/numerals/numbering/pageLabels.d.ts.map +1 -0
  427. package/dist/numerals/numbering/pageLabels.js +75 -0
  428. package/dist/numerals/numbering/pageLabels.js.map +1 -0
  429. package/dist/numerals/numbering/styles.d.ts +52 -0
  430. package/dist/numerals/numbering/styles.d.ts.map +1 -0
  431. package/dist/numerals/numbering/styles.js +43 -0
  432. package/dist/numerals/numbering/styles.js.map +1 -0
  433. package/dist/numerals/numbering.d.ts +9 -201
  434. package/dist/numerals/numbering.d.ts.map +1 -1
  435. package/dist/numerals/numbering.js +5 -595
  436. package/dist/numerals/numbering.js.map +1 -1
  437. package/dist/parse/annotations/apply.d.ts +32 -0
  438. package/dist/parse/annotations/apply.d.ts.map +1 -0
  439. package/dist/parse/annotations/apply.js +293 -0
  440. package/dist/parse/annotations/apply.js.map +1 -0
  441. package/dist/parse/annotations/scan.d.ts +55 -0
  442. package/dist/parse/annotations/scan.d.ts.map +1 -0
  443. package/dist/parse/annotations/scan.js +232 -0
  444. package/dist/parse/annotations/scan.js.map +1 -0
  445. package/dist/parse/annotations/source.d.ts +31 -0
  446. package/dist/parse/annotations/source.d.ts.map +1 -0
  447. package/dist/parse/annotations/source.js +128 -0
  448. package/dist/parse/annotations/source.js.map +1 -0
  449. package/dist/parse/annotations.d.ts +5 -86
  450. package/dist/parse/annotations.d.ts.map +1 -1
  451. package/dist/parse/annotations.js +3 -648
  452. package/dist/parse/annotations.js.map +1 -1
  453. package/dist/pipeline/blocks/measureContentBlock/helpers.d.ts +31 -0
  454. package/dist/pipeline/blocks/measureContentBlock/helpers.d.ts.map +1 -0
  455. package/dist/pipeline/blocks/measureContentBlock/helpers.js +74 -0
  456. package/dist/pipeline/blocks/measureContentBlock/helpers.js.map +1 -0
  457. package/dist/pipeline/blocks/measureContentBlock/inlineSpans.d.ts +12 -0
  458. package/dist/pipeline/blocks/measureContentBlock/inlineSpans.d.ts.map +1 -0
  459. package/dist/pipeline/blocks/measureContentBlock/inlineSpans.js +107 -0
  460. package/dist/pipeline/blocks/measureContentBlock/inlineSpans.js.map +1 -0
  461. package/dist/pipeline/blocks/measureContentBlock/measureOptions.d.ts +68 -0
  462. package/dist/pipeline/blocks/measureContentBlock/measureOptions.d.ts.map +1 -0
  463. package/dist/pipeline/blocks/measureContentBlock/measureOptions.js +90 -0
  464. package/dist/pipeline/blocks/measureContentBlock/measureOptions.js.map +1 -0
  465. package/dist/pipeline/blocks/measureContentBlock/types.d.ts +165 -0
  466. package/dist/pipeline/blocks/measureContentBlock/types.d.ts.map +1 -0
  467. package/dist/pipeline/blocks/measureContentBlock/types.js +2 -0
  468. package/dist/pipeline/blocks/measureContentBlock/types.js.map +1 -0
  469. package/dist/pipeline/blocks/measureContentBlock.d.ts +8 -172
  470. package/dist/pipeline/blocks/measureContentBlock.d.ts.map +1 -1
  471. package/dist/pipeline/blocks/measureContentBlock.js +16 -257
  472. package/dist/pipeline/blocks/measureContentBlock.js.map +1 -1
  473. package/dist/pipeline/blocks/placement/bands.d.ts +61 -0
  474. package/dist/pipeline/blocks/placement/bands.d.ts.map +1 -0
  475. package/dist/pipeline/blocks/placement/bands.js +188 -0
  476. package/dist/pipeline/blocks/placement/bands.js.map +1 -0
  477. package/dist/pipeline/blocks/placement.d.ts +2 -59
  478. package/dist/pipeline/blocks/placement.d.ts.map +1 -1
  479. package/dist/pipeline/blocks/placement.js +3 -184
  480. package/dist/pipeline/blocks/placement.js.map +1 -1
  481. package/dist/pipeline/build/pass/composed/comicText.d.ts +27 -0
  482. package/dist/pipeline/build/pass/composed/comicText.d.ts.map +1 -0
  483. package/dist/pipeline/build/pass/composed/comicText.js +89 -0
  484. package/dist/pipeline/build/pass/composed/comicText.js.map +1 -0
  485. package/dist/pipeline/build/pass/composed/jumps.d.ts +29 -0
  486. package/dist/pipeline/build/pass/composed/jumps.d.ts.map +1 -0
  487. package/dist/pipeline/build/pass/composed/jumps.js +91 -0
  488. package/dist/pipeline/build/pass/composed/jumps.js.map +1 -0
  489. package/dist/pipeline/build/pass/composed/placePage.d.ts +60 -0
  490. package/dist/pipeline/build/pass/composed/placePage.d.ts.map +1 -0
  491. package/dist/pipeline/build/pass/composed/placePage.js +368 -0
  492. package/dist/pipeline/build/pass/composed/placePage.js.map +1 -0
  493. package/dist/pipeline/build/pass/composed.d.ts +6 -7
  494. package/dist/pipeline/build/pass/composed.d.ts.map +1 -1
  495. package/dist/pipeline/build/pass/composed.js +20 -524
  496. package/dist/pipeline/build/pass/composed.js.map +1 -1
  497. package/dist/pipeline/build/pass/setup/contentSetup.d.ts +89 -0
  498. package/dist/pipeline/build/pass/setup/contentSetup.d.ts.map +1 -0
  499. package/dist/pipeline/build/pass/setup/contentSetup.js +314 -0
  500. package/dist/pipeline/build/pass/setup/contentSetup.js.map +1 -0
  501. package/dist/pipeline/build/pass/setup/pageSetup.d.ts +32 -0
  502. package/dist/pipeline/build/pass/setup/pageSetup.d.ts.map +1 -0
  503. package/dist/pipeline/build/pass/setup/pageSetup.js +147 -0
  504. package/dist/pipeline/build/pass/setup/pageSetup.js.map +1 -0
  505. package/dist/pipeline/build/pass/setup/passFinish.d.ts +95 -0
  506. package/dist/pipeline/build/pass/setup/passFinish.d.ts.map +1 -0
  507. package/dist/pipeline/build/pass/setup/passFinish.js +201 -0
  508. package/dist/pipeline/build/pass/setup/passFinish.js.map +1 -0
  509. package/dist/pipeline/build/pass/setupState.d.ts +8 -0
  510. package/dist/pipeline/build/pass/setupState.d.ts.map +1 -0
  511. package/dist/pipeline/build/pass/setupState.js +2 -0
  512. package/dist/pipeline/build/pass/setupState.js.map +1 -0
  513. package/dist/pipeline/build/pass.d.ts.map +1 -1
  514. package/dist/pipeline/build/pass.js +60 -654
  515. package/dist/pipeline/build/pass.js.map +1 -1
  516. package/dist/pipeline/callouts/calloutLayout/boxDecoration.d.ts +49 -0
  517. package/dist/pipeline/callouts/calloutLayout/boxDecoration.d.ts.map +1 -0
  518. package/dist/pipeline/callouts/calloutLayout/boxDecoration.js +110 -0
  519. package/dist/pipeline/callouts/calloutLayout/boxDecoration.js.map +1 -0
  520. package/dist/pipeline/callouts/calloutLayout/labelTab.d.ts +31 -0
  521. package/dist/pipeline/callouts/calloutLayout/labelTab.d.ts.map +1 -0
  522. package/dist/pipeline/callouts/calloutLayout/labelTab.js +202 -0
  523. package/dist/pipeline/callouts/calloutLayout/labelTab.js.map +1 -0
  524. package/dist/pipeline/callouts/calloutLayout/layoutCallout.d.ts.map +1 -1
  525. package/dist/pipeline/callouts/calloutLayout/layoutCallout.js +23 -355
  526. package/dist/pipeline/callouts/calloutLayout/layoutCallout.js.map +1 -1
  527. package/dist/pipeline/callouts/calloutLayout/layoutCalloutState.d.ts +14 -0
  528. package/dist/pipeline/callouts/calloutLayout/layoutCalloutState.d.ts.map +1 -0
  529. package/dist/pipeline/callouts/calloutLayout/layoutCalloutState.js +2 -0
  530. package/dist/pipeline/callouts/calloutLayout/layoutCalloutState.js.map +1 -0
  531. package/dist/pipeline/callouts/calloutLayout/markerColumn.d.ts +31 -0
  532. package/dist/pipeline/callouts/calloutLayout/markerColumn.d.ts.map +1 -0
  533. package/dist/pipeline/callouts/calloutLayout/markerColumn.js +75 -0
  534. package/dist/pipeline/callouts/calloutLayout/markerColumn.js.map +1 -0
  535. package/dist/pipeline/composedPages/composedLayout/composePage/run/fill.d.ts +68 -0
  536. package/dist/pipeline/composedPages/composedLayout/composePage/run/fill.d.ts.map +1 -0
  537. package/dist/pipeline/composedPages/composedLayout/composePage/run/fill.js +249 -0
  538. package/dist/pipeline/composedPages/composedLayout/composePage/run/fill.js.map +1 -0
  539. package/dist/pipeline/composedPages/composedLayout/composePage/run/measure.d.ts +50 -0
  540. package/dist/pipeline/composedPages/composedLayout/composePage/run/measure.d.ts.map +1 -0
  541. package/dist/pipeline/composedPages/composedLayout/composePage/run/measure.js +195 -0
  542. package/dist/pipeline/composedPages/composedLayout/composePage/run/measure.js.map +1 -0
  543. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeGrid.d.ts +30 -0
  544. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeGrid.d.ts.map +1 -0
  545. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeGrid.js +174 -0
  546. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeGrid.js.map +1 -0
  547. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeGroup.d.ts +35 -0
  548. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeGroup.d.ts.map +1 -0
  549. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeGroup.js +158 -0
  550. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeGroup.js.map +1 -0
  551. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeModules.d.ts +37 -0
  552. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeModules.d.ts.map +1 -0
  553. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeModules.js +303 -0
  554. package/dist/pipeline/composedPages/composedLayout/composePage/run/placeModules.js.map +1 -0
  555. package/dist/pipeline/composedPages/composedLayout/composePage/run/state.d.ts +11 -0
  556. package/dist/pipeline/composedPages/composedLayout/composePage/run/state.d.ts.map +1 -0
  557. package/dist/pipeline/composedPages/composedLayout/composePage/run/state.js +3 -0
  558. package/dist/pipeline/composedPages/composedLayout/composePage/run/state.js.map +1 -0
  559. package/dist/pipeline/composedPages/composedLayout/composePage/run/types.d.ts +14 -0
  560. package/dist/pipeline/composedPages/composedLayout/composePage/run/types.d.ts.map +1 -0
  561. package/dist/pipeline/composedPages/composedLayout/composePage/run/types.js +2 -0
  562. package/dist/pipeline/composedPages/composedLayout/composePage/run/types.js.map +1 -0
  563. package/dist/pipeline/composedPages/composedLayout/composePage/run.d.ts +59 -0
  564. package/dist/pipeline/composedPages/composedLayout/composePage/run.d.ts.map +1 -0
  565. package/dist/pipeline/composedPages/composedLayout/composePage/run.js +171 -0
  566. package/dist/pipeline/composedPages/composedLayout/composePage/run.js.map +1 -0
  567. package/dist/pipeline/composedPages/composedLayout/composePage/state.d.ts +7 -0
  568. package/dist/pipeline/composedPages/composedLayout/composePage/state.d.ts.map +1 -0
  569. package/dist/pipeline/composedPages/composedLayout/composePage/state.js +2 -0
  570. package/dist/pipeline/composedPages/composedLayout/composePage/state.js.map +1 -0
  571. package/dist/pipeline/composedPages/composedLayout/composePage.d.ts.map +1 -1
  572. package/dist/pipeline/composedPages/composedLayout/composePage.js +24 -1165
  573. package/dist/pipeline/composedPages/composedLayout/composePage.js.map +1 -1
  574. package/dist/pipeline/contents/indexDirective/blocks.d.ts +9 -0
  575. package/dist/pipeline/contents/indexDirective/blocks.d.ts.map +1 -0
  576. package/dist/pipeline/contents/indexDirective/blocks.js +256 -0
  577. package/dist/pipeline/contents/indexDirective/blocks.js.map +1 -0
  578. package/dist/pipeline/contents/indexDirective/tree.d.ts +71 -0
  579. package/dist/pipeline/contents/indexDirective/tree.d.ts.map +1 -0
  580. package/dist/pipeline/contents/indexDirective/tree.js +224 -0
  581. package/dist/pipeline/contents/indexDirective/tree.js.map +1 -0
  582. package/dist/pipeline/contents/indexDirective.d.ts +2 -8
  583. package/dist/pipeline/contents/indexDirective.d.ts.map +1 -1
  584. package/dist/pipeline/contents/indexDirective.js +3 -472
  585. package/dist/pipeline/contents/indexDirective.js.map +1 -1
  586. package/dist/pipeline/pages/placeholders/chapterValues.d.ts +117 -0
  587. package/dist/pipeline/pages/placeholders/chapterValues.d.ts.map +1 -0
  588. package/dist/pipeline/pages/placeholders/chapterValues.js +236 -0
  589. package/dist/pipeline/pages/placeholders/chapterValues.js.map +1 -0
  590. package/dist/pipeline/pages/placeholders/lineText.d.ts +66 -0
  591. package/dist/pipeline/pages/placeholders/lineText.d.ts.map +1 -0
  592. package/dist/pipeline/pages/placeholders/lineText.js +173 -0
  593. package/dist/pipeline/pages/placeholders/lineText.js.map +1 -0
  594. package/dist/pipeline/pages/placeholders.d.ts +6 -179
  595. package/dist/pipeline/pages/placeholders.d.ts.map +1 -1
  596. package/dist/pipeline/pages/placeholders.js +4 -398
  597. package/dist/pipeline/pages/placeholders.js.map +1 -1
  598. package/dist/pipeline/references/citations/markers.d.ts +14 -0
  599. package/dist/pipeline/references/citations/markers.d.ts.map +1 -0
  600. package/dist/pipeline/references/citations/markers.js +106 -0
  601. package/dist/pipeline/references/citations/markers.js.map +1 -0
  602. package/dist/pipeline/references/citations/process.d.ts +56 -0
  603. package/dist/pipeline/references/citations/process.d.ts.map +1 -0
  604. package/dist/pipeline/references/citations/process.js +213 -0
  605. package/dist/pipeline/references/citations/process.js.map +1 -0
  606. package/dist/pipeline/references/citations/spans.d.ts +33 -0
  607. package/dist/pipeline/references/citations/spans.d.ts.map +1 -0
  608. package/dist/pipeline/references/citations/spans.js +127 -0
  609. package/dist/pipeline/references/citations/spans.js.map +1 -0
  610. package/dist/pipeline/references/citations.d.ts +4 -51
  611. package/dist/pipeline/references/citations.d.ts.map +1 -1
  612. package/dist/pipeline/references/citations.js +5 -438
  613. package/dist/pipeline/references/citations.js.map +1 -1
  614. package/dist/pipeline/resources/resourceLayout/resourceBlock/captionNotes.d.ts +63 -0
  615. package/dist/pipeline/resources/resourceLayout/resourceBlock/captionNotes.d.ts.map +1 -0
  616. package/dist/pipeline/resources/resourceLayout/resourceBlock/captionNotes.js +88 -0
  617. package/dist/pipeline/resources/resourceLayout/resourceBlock/captionNotes.js.map +1 -0
  618. package/dist/pipeline/resources/resourceLayout/resourceBlock/state.d.ts +9 -0
  619. package/dist/pipeline/resources/resourceLayout/resourceBlock/state.d.ts.map +1 -0
  620. package/dist/pipeline/resources/resourceLayout/resourceBlock/state.js +2 -0
  621. package/dist/pipeline/resources/resourceLayout/resourceBlock/state.js.map +1 -0
  622. package/dist/pipeline/resources/resourceLayout/resourceBlock/upright.d.ts +26 -0
  623. package/dist/pipeline/resources/resourceLayout/resourceBlock/upright.d.ts.map +1 -0
  624. package/dist/pipeline/resources/resourceLayout/resourceBlock/upright.js +90 -0
  625. package/dist/pipeline/resources/resourceLayout/resourceBlock/upright.js.map +1 -0
  626. package/dist/pipeline/resources/resourceLayout/resourceBlock.d.ts +1 -3
  627. package/dist/pipeline/resources/resourceLayout/resourceBlock.d.ts.map +1 -1
  628. package/dist/pipeline/resources/resourceLayout/resourceBlock.js +13 -159
  629. package/dist/pipeline/resources/resourceLayout/resourceBlock.js.map +1 -1
  630. package/dist/pipeline/sections/partPalette/colorKinds.d.ts +53 -0
  631. package/dist/pipeline/sections/partPalette/colorKinds.d.ts.map +1 -0
  632. package/dist/pipeline/sections/partPalette/colorKinds.js +181 -0
  633. package/dist/pipeline/sections/partPalette/colorKinds.js.map +1 -0
  634. package/dist/pipeline/sections/partPalette/flowColors.d.ts +16 -0
  635. package/dist/pipeline/sections/partPalette/flowColors.d.ts.map +1 -0
  636. package/dist/pipeline/sections/partPalette/flowColors.js +78 -0
  637. package/dist/pipeline/sections/partPalette/flowColors.js.map +1 -0
  638. package/dist/pipeline/sections/partPalette/recolor.d.ts +18 -0
  639. package/dist/pipeline/sections/partPalette/recolor.d.ts.map +1 -0
  640. package/dist/pipeline/sections/partPalette/recolor.js +188 -0
  641. package/dist/pipeline/sections/partPalette/recolor.js.map +1 -0
  642. package/dist/pipeline/sections/partPalette.d.ts +4 -49
  643. package/dist/pipeline/sections/partPalette.d.ts.map +1 -1
  644. package/dist/pipeline/sections/partPalette.js +3 -442
  645. package/dist/pipeline/sections/partPalette.js.map +1 -1
  646. package/dist/pipeline/text/lists/orderedRuns.d.ts +49 -0
  647. package/dist/pipeline/text/lists/orderedRuns.d.ts.map +1 -0
  648. package/dist/pipeline/text/lists/orderedRuns.js +256 -0
  649. package/dist/pipeline/text/lists/orderedRuns.js.map +1 -0
  650. package/dist/pipeline/text/lists.d.ts +16 -46
  651. package/dist/pipeline/text/lists.d.ts.map +1 -1
  652. package/dist/pipeline/text/lists.js +5 -255
  653. package/dist/pipeline/text/lists.js.map +1 -1
  654. package/dist/svg/fonts/inline.d.ts +30 -0
  655. package/dist/svg/fonts/inline.d.ts.map +1 -0
  656. package/dist/svg/fonts/inline.js +298 -0
  657. package/dist/svg/fonts/inline.js.map +1 -0
  658. package/dist/svg/fonts/scan.d.ts +27 -0
  659. package/dist/svg/fonts/scan.d.ts.map +1 -0
  660. package/dist/svg/fonts/scan.js +353 -0
  661. package/dist/svg/fonts/scan.js.map +1 -0
  662. package/dist/svg/fonts/types.d.ts +106 -0
  663. package/dist/svg/fonts/types.d.ts.map +1 -0
  664. package/dist/svg/fonts/types.js +4 -0
  665. package/dist/svg/fonts/types.js.map +1 -0
  666. package/dist/svg/fonts.d.ts +4 -150
  667. package/dist/svg/fonts.d.ts.map +1 -1
  668. package/dist/svg/fonts.js +3 -647
  669. package/dist/svg/fonts.js.map +1 -1
  670. package/dist/types/text/bodyText/config.d.ts +465 -0
  671. package/dist/types/text/bodyText/config.d.ts.map +1 -0
  672. package/dist/types/text/bodyText/config.js +2 -0
  673. package/dist/types/text/bodyText/config.js.map +1 -0
  674. package/dist/types/text/bodyText/options.d.ts +73 -0
  675. package/dist/types/text/bodyText/options.d.ts.map +1 -0
  676. package/dist/types/text/bodyText/options.js +2 -0
  677. package/dist/types/text/bodyText/options.js.map +1 -0
  678. package/dist/types/text/bodyText/resolved.d.ts +95 -0
  679. package/dist/types/text/bodyText/resolved.d.ts.map +1 -0
  680. package/dist/types/text/bodyText/resolved.js +2 -0
  681. package/dist/types/text/bodyText/resolved.js.map +1 -0
  682. package/dist/types/text/bodyText.d.ts +3 -623
  683. package/dist/types/text/bodyText.d.ts.map +1 -1
  684. package/dist/vdt/contentWarnings/comic.d.ts +95 -0
  685. package/dist/vdt/contentWarnings/comic.d.ts.map +1 -0
  686. package/dist/vdt/contentWarnings/comic.js +3 -0
  687. package/dist/vdt/contentWarnings/comic.js.map +1 -0
  688. package/dist/vdt/contentWarnings/composed.d.ts +126 -0
  689. package/dist/vdt/contentWarnings/composed.d.ts.map +1 -0
  690. package/dist/vdt/contentWarnings/composed.js +2 -0
  691. package/dist/vdt/contentWarnings/composed.js.map +1 -0
  692. package/dist/vdt/contentWarnings/layout.d.ts +247 -0
  693. package/dist/vdt/contentWarnings/layout.d.ts.map +1 -0
  694. package/dist/vdt/contentWarnings/layout.js +2 -0
  695. package/dist/vdt/contentWarnings/layout.js.map +1 -0
  696. package/dist/vdt/contentWarnings/markup.d.ts +211 -0
  697. package/dist/vdt/contentWarnings/markup.d.ts.map +1 -0
  698. package/dist/vdt/contentWarnings/markup.js +4 -0
  699. package/dist/vdt/contentWarnings/markup.js.map +1 -0
  700. package/dist/vdt/contentWarnings/source.d.ts +216 -0
  701. package/dist/vdt/contentWarnings/source.d.ts.map +1 -0
  702. package/dist/vdt/contentWarnings/source.js +4 -0
  703. package/dist/vdt/contentWarnings/source.js.map +1 -0
  704. package/dist/vdt/contentWarnings/text.d.ts +139 -0
  705. package/dist/vdt/contentWarnings/text.d.ts.map +1 -0
  706. package/dist/vdt/contentWarnings/text.js +4 -0
  707. package/dist/vdt/contentWarnings/text.js.map +1 -0
  708. package/dist/vdt/contentWarnings.d.ts +7 -1017
  709. package/dist/vdt/contentWarnings.d.ts.map +1 -1
  710. package/dist/vdt/pages/comic.d.ts +200 -0
  711. package/dist/vdt/pages/comic.d.ts.map +1 -0
  712. package/dist/vdt/pages/comic.js +2 -0
  713. package/dist/vdt/pages/comic.js.map +1 -0
  714. package/dist/vdt/pages/composed.d.ts +282 -0
  715. package/dist/vdt/pages/composed.d.ts.map +1 -0
  716. package/dist/vdt/pages/composed.js +2 -0
  717. package/dist/vdt/pages/composed.js.map +1 -0
  718. package/dist/vdt/pages.d.ts +6 -476
  719. package/dist/vdt/pages.d.ts.map +1 -1
  720. package/dist/word/docxRead/body.d.ts +17 -0
  721. package/dist/word/docxRead/body.d.ts.map +1 -0
  722. package/dist/word/docxRead/body.js +372 -0
  723. package/dist/word/docxRead/body.js.map +1 -0
  724. package/dist/word/docxRead/parts.d.ts +27 -0
  725. package/dist/word/docxRead/parts.d.ts.map +1 -0
  726. package/dist/word/docxRead/parts.js +160 -0
  727. package/dist/word/docxRead/parts.js.map +1 -0
  728. package/dist/word/docxRead.d.ts +1 -5
  729. package/dist/word/docxRead.d.ts.map +1 -1
  730. package/dist/word/docxRead.js +5 -526
  731. package/dist/word/docxRead.js.map +1 -1
  732. package/dist/word/inline/parse.d.ts +16 -0
  733. package/dist/word/inline/parse.d.ts.map +1 -0
  734. package/dist/word/inline/parse.js +367 -0
  735. package/dist/word/inline/parse.js.map +1 -0
  736. package/dist/word/inline/render.d.ts +44 -0
  737. package/dist/word/inline/render.d.ts.map +1 -0
  738. package/dist/word/inline/render.js +296 -0
  739. package/dist/word/inline/render.js.map +1 -0
  740. package/dist/word/inline.d.ts +4 -52
  741. package/dist/word/inline.d.ts.map +1 -1
  742. package/dist/word/inline.js +2 -657
  743. package/dist/word/inline.js.map +1 -1
  744. package/dist/word/toDocx/parse.d.ts +46 -0
  745. package/dist/word/toDocx/parse.d.ts.map +1 -0
  746. package/dist/word/toDocx/parse.js +313 -0
  747. package/dist/word/toDocx/parse.js.map +1 -0
  748. package/dist/word/toDocx/styles.d.ts +63 -0
  749. package/dist/word/toDocx/styles.d.ts.map +1 -0
  750. package/dist/word/toDocx/styles.js +239 -0
  751. package/dist/word/toDocx/styles.js.map +1 -0
  752. package/dist/word/toDocx/wordml.d.ts +24 -0
  753. package/dist/word/toDocx/wordml.d.ts.map +1 -0
  754. package/dist/word/toDocx/wordml.js +114 -0
  755. package/dist/word/toDocx/wordml.js.map +1 -0
  756. package/dist/word/toDocx.d.ts +3 -25
  757. package/dist/word/toDocx.d.ts.map +1 -1
  758. package/dist/word/toDocx.js +8 -661
  759. package/dist/word/toDocx.js.map +1 -1
  760. package/dist/word/toMarkdown/converter.d.ts +57 -0
  761. package/dist/word/toMarkdown/converter.d.ts.map +1 -0
  762. package/dist/word/toMarkdown/converter.js +600 -0
  763. package/dist/word/toMarkdown/converter.js.map +1 -0
  764. package/dist/word/toMarkdown/helpers.d.ts +98 -0
  765. package/dist/word/toMarkdown/helpers.d.ts.map +1 -0
  766. package/dist/word/toMarkdown/helpers.js +153 -0
  767. package/dist/word/toMarkdown/helpers.js.map +1 -0
  768. package/dist/word/toMarkdown.d.ts +4 -64
  769. package/dist/word/toMarkdown.d.ts.map +1 -1
  770. package/dist/word/toMarkdown.js +2 -749
  771. package/dist/word/toMarkdown.js.map +1 -1
  772. package/dist/writing/bidi/chars.d.ts +61 -0
  773. package/dist/writing/bidi/chars.d.ts.map +1 -0
  774. package/dist/writing/bidi/chars.js +145 -0
  775. package/dist/writing/bidi/chars.js.map +1 -0
  776. package/dist/writing/bidi/joining.d.ts +27 -0
  777. package/dist/writing/bidi/joining.d.ts.map +1 -0
  778. package/dist/writing/bidi/joining.js +70 -0
  779. package/dist/writing/bidi/joining.js.map +1 -0
  780. package/dist/writing/bidi/paragraph.d.ts +72 -0
  781. package/dist/writing/bidi/paragraph.d.ts.map +1 -0
  782. package/dist/writing/bidi/paragraph.js +119 -0
  783. package/dist/writing/bidi/paragraph.js.map +1 -0
  784. package/dist/writing/bidi/resolve.d.ts +14 -0
  785. package/dist/writing/bidi/resolve.d.ts.map +1 -0
  786. package/dist/writing/bidi/resolve.js +413 -0
  787. package/dist/writing/bidi/resolve.js.map +1 -0
  788. package/dist/writing/bidi.d.ts +8 -147
  789. package/dist/writing/bidi.d.ts.map +1 -1
  790. package/dist/writing/bidi.js +6 -733
  791. package/dist/writing/bidi.js.map +1 -1
  792. package/package.json +1 -1
@@ -0,0 +1,306 @@
1
+ // The canvas measurers and the measuring state: the language measured in,
2
+ // the width caches per language, and their clearing and eviction.
3
+ import { fontStringFamily } from '../fontString.js';
4
+ // The language text is measured in (#764).
5
+ //
6
+ // A 2D context has a language (`ctx.lang`, Chrome 136 and later), which the
7
+ // shaper hands the font: Noto Serif SC sets `1` 47.1 px wide at 100 px in
8
+ // Chinese and 55 px in any language it has no forms for, Fira Sans sets
9
+ // `l·l` 62.5 px wide in Catalan and 81.6 px otherwise. Left alone
10
+ // (`inherit`) a context made on a page takes the language of the page that
11
+ // hosts the layout, and one made in a worker none, so one document had a
12
+ // layout per host. The engine sets the language itself, on every context
13
+ // it measures with: the document's, a block's or a run's own.
14
+ //
15
+ // Measured on Chrome 154: any string is taken; a tag the browser or the
16
+ // font knows nothing of (`''`, `und`, `xx`, `en` in a face with no English
17
+ // forms) gives the forms of no language, the ones a worker's `inherit`
18
+ // gives; setting the attribute to the value it has costs nothing that can
19
+ // be measured (40 000 measures in 6 ms either way), and so does reading it.
20
+ // A browser without the attribute measures as it did.
21
+ /** The value a context is given for "the host's language", what it has
22
+ * until someone sets another. */
23
+ const HOST_LANGUAGE = 'inherit';
24
+ /** The language set by {@link setMeasureLanguage}; undefined: the host's. */
25
+ export let _language;
26
+ /** Give `ctx` the language measured in, where the context has one. */
27
+ export function applyLanguage(ctx, language) {
28
+ if ('lang' in ctx)
29
+ ctx.lang = language ?? HOST_LANGUAGE;
30
+ }
31
+ // A width that does not depend on what was measured before (#770).
32
+ //
33
+ // Chrome's canvas keeps the words it shaped, by context, font and
34
+ // language, under the word's text alone: a word is what stands between
35
+ // two spaces in one bidi run, cut before a Han character. The key says
36
+ // nothing of how the word was shaped, and there are two ways. A string of
37
+ // Latin-1 characters reaches the shaper one byte a character and is all
38
+ // Latin script to it. A string with any character past U+00FF, and a long
39
+ // slice of such a text (13 characters or more are a view of their parent
40
+ // in V8, still two bytes each), is cut into script runs word by word, and
41
+ // a word with no letter (`2026`, `(1)`, `.`, `"`) has no script there:
42
+ // the font draws it by its default rules, not its Latin ones. Noto Serif
43
+ // SC sets `2026` 22 px wide at 10 px in English the first way and
44
+ // 22.31 px the second, Amiri a full stop 2.02 px and 3.17 px. The first
45
+ // shape to enter the cache answers for both from then on: `2026` after
46
+ // `2026 — 2027`, the stop of `كتاب.` (a run of its own in a left-to-right
47
+ // context) after `.` was measured alone. So a width depended on the
48
+ // strings measured before it on the page: on the chapter laid out first,
49
+ // on the document the worker had before this one.
50
+ //
51
+ // A document shaped in its own language is measured on two contexts: one
52
+ // that only ever takes strings of Latin-1 characters, each rebuilt
53
+ // character by character so that it is one byte a character whatever text
54
+ // it was cut from, and one that only takes strings with a wider character.
55
+ // On each of them a word has one shape, so a string has one width: the one
56
+ // a context that never measured anything gives it. Measured in Chrome 154,
57
+ // on a page and in a worker: 182 strings in six orders, twelve pairs of
58
+ // face and language, no width moves (30 to 37 of them move on one context
59
+ // in Noto Serif SC and Amiri).
60
+ //
61
+ // A document in its host's language (`_language` undefined) is measured on
62
+ // one context, as up to postext 1.29: its widths are the ones it had.
63
+ /** A character past Latin-1: a string that holds one is two bytes a
64
+ * character to the browser. */
65
+ export const WIDE_RE = /[^\u0000-\u00FF]/;
66
+ /** The one context of a document measured in its host's language. */
67
+ let _host = null;
68
+ /** The contexts of a document measured in its own: Latin-1 strings on one,
69
+ * strings with a wider character on the other. */
70
+ let _narrow = null;
71
+ let _wide = null;
72
+ function newMeasurer() {
73
+ const ctx = typeof OffscreenCanvas !== 'undefined'
74
+ ? new OffscreenCanvas(1, 1).getContext('2d')
75
+ : document.createElement('canvas').getContext('2d');
76
+ return { ctx, font: '', language: HOST_LANGUAGE };
77
+ }
78
+ /** `text` as a string of one byte a character (V8 keeps a string built
79
+ * from single Latin-1 characters that way; a slice of a text with a wider
80
+ * character is two bytes a character, and Chrome shapes it otherwise).
81
+ * For a text of Latin-1 characters only. */
82
+ function oneByte(text) {
83
+ let out = '';
84
+ for (let i = 0; i < text.length; i++)
85
+ out += text[i];
86
+ return out;
87
+ }
88
+ /** `text` as the measurer hands it to the canvas in a document shaped in
89
+ * its own language: a Latin-1 text one byte a character, any other as it
90
+ * is. A painter that hands its strings the same way has them shaped as
91
+ * they were measured. */
92
+ export function canvasText(text) {
93
+ return _language === undefined || WIDE_RE.test(text) ? text : oneByte(text);
94
+ }
95
+ /** The metrics of `text` in `font`, in the language measured in: on the
96
+ * context its kind of string is measured on (see above). `rtl`: in a
97
+ * context set right to left, as a right-to-left word is painted (its
98
+ * brackets mirrored). */
99
+ export function metricsOf(text, font, rtl = false, spacingPx = 0) {
100
+ let measurer;
101
+ let handed = text;
102
+ if (_language === undefined) {
103
+ measurer = _host ??= newMeasurer();
104
+ }
105
+ else if (WIDE_RE.test(text)) {
106
+ measurer = _wide ??= newMeasurer();
107
+ }
108
+ else {
109
+ measurer = _narrow ??= newMeasurer();
110
+ handed = oneByte(text);
111
+ }
112
+ const ctx = measurer.ctx;
113
+ const wanted = _language ?? HOST_LANGUAGE;
114
+ if (wanted !== measurer.language) {
115
+ applyLanguage(ctx, _language);
116
+ measurer.language = wanted;
117
+ }
118
+ if (font !== measurer.font) {
119
+ ctx.font = font;
120
+ measurer.font = font;
121
+ }
122
+ if (spacingPx !== 0) {
123
+ // Only {@link measureSpacedWidth} asks, of a context that has the
124
+ // attribute: it goes back to no spacing, what every other measure is
125
+ // taken at.
126
+ ctx.letterSpacing = `${spacingPx}px`;
127
+ const metrics = ctx.measureText(handed);
128
+ ctx.letterSpacing = '0px';
129
+ return metrics;
130
+ }
131
+ if (!rtl || !('direction' in ctx))
132
+ return ctx.measureText(handed);
133
+ const direction = ctx.direction;
134
+ ctx.direction = 'rtl';
135
+ const metrics = ctx.measureText(handed);
136
+ ctx.direction = direction;
137
+ return metrics;
138
+ }
139
+ /**
140
+ * The width of `text` in `font` under a letter-spacing of `spacingPx`
141
+ * (`ctx.letterSpacing`: the spacing after every letter counted in), in
142
+ * the language measured in and on the context its kind of string is
143
+ * measured on, kept nowhere. Undefined where the canvas has no
144
+ * letter-spacing. For what asks how the browser shapes a tracked text
145
+ * (`measure/trackedLigatures.ts`): under a letter-spacing it sets no
146
+ * optional ligature.
147
+ */
148
+ export function measureSpacedWidth(text, font, spacingPx) {
149
+ const probe = _language === undefined ? (_host ??= newMeasurer()) : WIDE_RE.test(text) ? (_wide ??= newMeasurer()) : (_narrow ??= newMeasurer());
150
+ if (!('letterSpacing' in probe.ctx))
151
+ return undefined;
152
+ return metricsOf(text, font, false, spacingPx).width;
153
+ }
154
+ /**
155
+ * The width of `text` in `font` as the canvas gives it, in the language
156
+ * measured in, kept nowhere: for a caller with a cache of its own (the
157
+ * text library's segments, `measure/pretextLanguage.ts`).
158
+ */
159
+ export function measureUncachedWidth(text, font) {
160
+ return metricsOf(text, font).width;
161
+ }
162
+ const newCaches = () => ({ width: new Map(), widthEntries: 0, run: new Map(), runEntries: 0, marked: new Map(), markedEntries: 0, sensitive: new Map() });
163
+ /** The caches of each language measured in (`''` under the key of the
164
+ * host's language is never mixed with the explicit empty tag: the host's
165
+ * is kept under {@link HOST_LANGUAGE}). */
166
+ let _cachesByLanguage = new Map();
167
+ /** The caches of the language measured in now. */
168
+ export let C = newCaches();
169
+ _cachesByLanguage.set(HOST_LANGUAGE, C);
170
+ /**
171
+ * Measure in `language` from now on: a BCP 47 tag (`zh-Hans`, `ca`), the
172
+ * empty string for no language at all, or undefined for the host's (what
173
+ * a context has when nobody sets one: the page's on a page, none in a
174
+ * worker; a configuration with `bodyText.shapingLanguage: 'host'`). The
175
+ * build sets the document's and puts back what it found; a block and a run
176
+ * that name their own set it for their text ({@link withMeasureLanguage}).
177
+ * Each language keeps its own widths, so going from one to another drops
178
+ * nothing measured; a cache kept elsewhere of what was measured in a font
179
+ * holds the language in its key ({@link measureLanguageKey}).
180
+ */
181
+ export function setMeasureLanguage(language) {
182
+ if (language === _language)
183
+ return;
184
+ _language = language;
185
+ const key = language ?? HOST_LANGUAGE;
186
+ let caches = _cachesByLanguage.get(key);
187
+ if (!caches) {
188
+ caches = newCaches();
189
+ _cachesByLanguage.set(key, caches);
190
+ }
191
+ C = caches;
192
+ }
193
+ /** The language set by {@link setMeasureLanguage}. */
194
+ export function getMeasureLanguage() {
195
+ return _language;
196
+ }
197
+ /** Run `fn` measuring in `language`, then measure again in the language
198
+ * in force before, also when `fn` throws. */
199
+ export function withMeasureLanguage(language, fn) {
200
+ const previous = _language;
201
+ if (language === previous)
202
+ return fn();
203
+ setMeasureLanguage(language);
204
+ try {
205
+ return fn();
206
+ }
207
+ finally {
208
+ setMeasureLanguage(previous);
209
+ }
210
+ }
211
+ /** The part of a measurement cache key the language decides: empty for
212
+ * the host's, so those keys are unchanged. */
213
+ export function measureLanguageKey() {
214
+ return _language === undefined ? '' : `lg${_language}\x00`;
215
+ }
216
+ /** Drop all cached text widths. Must be called whenever font faces are
217
+ * (un)registered: widths measured against fallback glyphs are stale. */
218
+ export function clearTextWidthCache() {
219
+ evictTextWidths(null);
220
+ }
221
+ // The measurement generation (#629): bumped whenever widths are dropped, so
222
+ // caches filled under another generation (a host's `MeasurementCache`) know
223
+ // to drop what was measured with the faces that changed. The log says which
224
+ // families each bump concerned (null: all of them).
225
+ let _generation = 0;
226
+ const _evictions = [];
227
+ const MAX_EVICTIONS = 64;
228
+ /** The current measurement generation: a counter bumped by every
229
+ * {@link evictTextWidths} (and so by `clearMeasurementCache` and the
230
+ * per-family eviction when faces arrive). */
231
+ export function measurementGeneration() {
232
+ return _generation;
233
+ }
234
+ /** What changed since `generation`: every family (`all`), or the
235
+ * families named by the evictions after it (lower case). */
236
+ export function evictionsSince(generation) {
237
+ const families = new Set();
238
+ if (generation >= _generation)
239
+ return { all: false, families };
240
+ const oldest = _evictions[0];
241
+ if (!oldest || oldest.generation > generation + 1)
242
+ return { all: true, families };
243
+ for (const e of _evictions) {
244
+ if (e.generation <= generation)
245
+ continue;
246
+ if (e.families === null)
247
+ return { all: true, families };
248
+ for (const f of e.families)
249
+ families.add(f);
250
+ }
251
+ return { all: false, families };
252
+ }
253
+ function dropFamilies(caches, families) {
254
+ let dropped = 0;
255
+ for (const [font, byText] of caches) {
256
+ const family = fontStringFamily(font);
257
+ if (family !== null && families.has(family.toLowerCase())) {
258
+ dropped += byText.size;
259
+ caches.delete(font);
260
+ }
261
+ }
262
+ return dropped;
263
+ }
264
+ /** Drop the cached widths measured in `families` (case-insensitive), or
265
+ * every width when `families` is null, and bump the measurement
266
+ * generation. The listeners of {@link onTextWidthCacheClear} (caches of
267
+ * ink and baselines) clear whole. */
268
+ export function evictTextWidths(families) {
269
+ const set = families === null ? null : new Set(Array.from(families, (f) => f.toLowerCase()));
270
+ if (set === null) {
271
+ // Every language's widths: the one measured in keeps its place.
272
+ C = newCaches();
273
+ _cachesByLanguage = new Map([[_language ?? HOST_LANGUAGE, C]]);
274
+ }
275
+ else {
276
+ for (const caches of _cachesByLanguage.values()) {
277
+ caches.widthEntries -= dropFamilies(caches.width, set);
278
+ caches.runEntries -= dropFamilies(caches.run, set);
279
+ caches.markedEntries -= dropFamilies(caches.marked, set);
280
+ for (const font of [...caches.sensitive.keys()]) {
281
+ const family = fontStringFamily(font);
282
+ // A face of the stack may stand in for another: any font string
283
+ // that names a changed family is asked again.
284
+ if (family === null || [...set].some((f) => font.toLowerCase().includes(f)))
285
+ caches.sensitive.delete(font);
286
+ }
287
+ }
288
+ }
289
+ // Each context resolves its font again on the next measure.
290
+ for (const measurer of [_host, _narrow, _wide])
291
+ if (measurer)
292
+ measurer.font = '';
293
+ _generation++;
294
+ _evictions.push({ generation: _generation, families: set });
295
+ if (_evictions.length > MAX_EVICTIONS)
296
+ _evictions.shift();
297
+ for (const listener of _fontChangeListeners)
298
+ listener();
299
+ }
300
+ const _fontChangeListeners = new Set();
301
+ /** Called whenever {@link clearTextWidthCache} drops the widths (fonts
302
+ * changed): other font-dependent caches clear with it. */
303
+ export function onTextWidthCacheClear(listener) {
304
+ _fontChangeListeners.add(listener);
305
+ }
306
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/measure/canvas/state.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,kEAAkE;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAapD,2CAA2C;AAC3C,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,wEAAwE;AACxE,kEAAkE;AAClE,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,8DAA8D;AAC9D,EAAE;AACF,wEAAwE;AACxE,2EAA2E;AAC3E,uEAAuE;AACvE,0EAA0E;AAC1E,4EAA4E;AAC5E,sDAAsD;AAEtD;kCACkC;AAClC,MAAM,aAAa,GAAG,SAAS,CAAC;AAChC,6EAA6E;AAC7E,MAAM,CAAC,IAAI,SAA6B,CAAC;AAEzC,sEAAsE;AACtE,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,QAA4B;IACrE,IAAI,MAAM,IAAI,GAAG;QAAG,GAAwB,CAAC,IAAI,GAAG,QAAQ,IAAI,aAAa,CAAC;AAChF,CAAC;AAED,mEAAmE;AACnE,EAAE;AACF,kEAAkE;AAClE,uEAAuE;AACvE,uEAAuE;AACvE,0EAA0E;AAC1E,wEAAwE;AACxE,0EAA0E;AAC1E,yEAAyE;AACzE,0EAA0E;AAC1E,uEAAuE;AACvE,yEAAyE;AACzE,kEAAkE;AAClE,wEAAwE;AACxE,uEAAuE;AACvE,0EAA0E;AAC1E,oEAAoE;AACpE,yEAAyE;AACzE,kDAAkD;AAClD,EAAE;AACF,yEAAyE;AACzE,mEAAmE;AACnE,0EAA0E;AA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,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBACtC,gEAAgE;gBAChE,8CAA8C;gBAC9C,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;oBAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7G,CAAC;QACH,CAAC;IACH,CAAC;IACD,4DAA4D;IAC5D,KAAK,MAAM,QAAQ,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,QAAQ;YAAE,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC;IACjF,WAAW,EAAE,CAAC;IACd,UAAU,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5D,IAAI,UAAU,CAAC,MAAM,GAAG,aAAa;QAAE,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1D,KAAK,MAAM,QAAQ,IAAI,oBAAoB;QAAE,QAAQ,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAc,CAAC;AAEnD;2DAC2D;AAC3D,MAAM,UAAU,qBAAqB,CAAC,QAAoB;IACxD,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,27 @@
1
+ export declare function measureTextWidth(text: string, font: string): number;
2
+ /**
3
+ * The width of `text` set in one run, as the browser paints it: two CJK
4
+ * marks that meet are not measured apart (see {@link measureTextWidth}).
5
+ * For the pieces a renderer paints apart (`markPieces`), each of which
6
+ * holds only pairs the layout measured whole.
7
+ */
8
+ export declare function measureRunWidth(text: string, font: string): number;
9
+ /**
10
+ * The width of `text` set between `lead` and `trail`, less theirs: `text`
11
+ * as the browser shapes it in the script of the mark beside it (#725, see
12
+ * `measure/script.ts`; a word with no letter takes the script of the text
13
+ * it stands in). `rtl`: measured in a right-to-left context, as the word is
14
+ * painted. The mark is glued with a no-break space, so nothing kerns
15
+ * across. For text with no CJK character (it is measured in one run).
16
+ */
17
+ export declare function measureMarkedWidth(text: string, font: string, lead: string, trail: string, rtl: boolean): number;
18
+ /**
19
+ * Whether the face `font` draws punctuation or digits otherwise by script:
20
+ * a fixed row of them is measured beside each of `marks` (a character of
21
+ * each script, glued after it) and the widths compared. One false answer
22
+ * a font string for nearly every face, which then goes no further; the
23
+ * answer is dropped with the cached widths when faces change. A measurer
24
+ * that tells nothing apart (no canvas, a stub) answers false.
25
+ */
26
+ export declare function scriptSensitive(font: string, marks: readonly string[]): boolean;
27
+ //# sourceMappingURL=widths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widths.d.ts","sourceRoot":"","sources":["../../../src/measure/canvas/widths.ts"],"names":[],"mappings":"AAYA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA0BnE;AAID;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAkBlE;AAID;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CA2BhH;AAUD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAa/E"}
@@ -0,0 +1,137 @@
1
+ // Cached text widths: plain, run, marked, and the script-sensitivity probe.
2
+ import { cjkMarkPieces } from '../cjk/cjkClasses.js';
3
+ import { hasCJK } from '../cjk/cjk.js';
4
+ import { C, metricsOf } from './state.js';
5
+ // Word-level width cache. Text measurement is the engine's hottest call:
6
+ // tokenizers measure every word (plus hyphenation prefixes), and natural
7
+ // language repeats words constantly. Keyed font → text → width so the key
8
+ // needs no string concatenation. Cleared wholesale when it grows past the
9
+ // cap (rare) or when fonts change (see clearTextWidthCache).
10
+ const MAX_WIDTH_CACHE_ENTRIES = 100_000;
11
+ export function measureTextWidth(text, font) {
12
+ let byText = C.width.get(font);
13
+ if (byText === undefined) {
14
+ byText = new Map();
15
+ C.width.set(font, byText);
16
+ }
17
+ const cached = byText.get(text);
18
+ if (cached !== undefined)
19
+ return cached;
20
+ // Two CJK marks side by side (`)》`, `”“`) are measured apart: the
21
+ // browser would set the first half width in one run (see
22
+ // `cjkMarkCuts`), and the renderers paint them apart. Text with no CJK
23
+ // is never cut (`markCuts`): one measure, with no cut to look for.
24
+ let width = 0;
25
+ if (!hasCJK(text))
26
+ width += metricsOf(text, font).width;
27
+ else
28
+ for (const piece of cjkMarkPieces(text, true))
29
+ width += metricsOf(piece, font).width;
30
+ if (C.widthEntries >= MAX_WIDTH_CACHE_ENTRIES) {
31
+ C.width = new Map();
32
+ C.widthEntries = 0;
33
+ byText = new Map();
34
+ C.width.set(font, byText);
35
+ }
36
+ byText.set(text, width);
37
+ C.widthEntries++;
38
+ return width;
39
+ }
40
+ // Widths of runs as the browser sets them (see `measureRunWidth`): `C.run`.
41
+ /**
42
+ * The width of `text` set in one run, as the browser paints it: two CJK
43
+ * marks that meet are not measured apart (see {@link measureTextWidth}).
44
+ * For the pieces a renderer paints apart (`markPieces`), each of which
45
+ * holds only pairs the layout measured whole.
46
+ */
47
+ export function measureRunWidth(text, font) {
48
+ let byText = C.run.get(font);
49
+ if (byText === undefined) {
50
+ byText = new Map();
51
+ C.run.set(font, byText);
52
+ }
53
+ const cached = byText.get(text);
54
+ if (cached !== undefined)
55
+ return cached;
56
+ const width = metricsOf(text, font).width;
57
+ if (C.runEntries >= MAX_WIDTH_CACHE_ENTRIES) {
58
+ C.run = new Map();
59
+ C.runEntries = 0;
60
+ byText = new Map();
61
+ C.run.set(font, byText);
62
+ }
63
+ byText.set(text, width);
64
+ C.runEntries++;
65
+ return width;
66
+ }
67
+ // Widths of words with no letter, measured in a script (#725): `C.marked`.
68
+ /**
69
+ * The width of `text` set between `lead` and `trail`, less theirs: `text`
70
+ * as the browser shapes it in the script of the mark beside it (#725, see
71
+ * `measure/script.ts`; a word with no letter takes the script of the text
72
+ * it stands in). `rtl`: measured in a right-to-left context, as the word is
73
+ * painted. The mark is glued with a no-break space, so nothing kerns
74
+ * across. For text with no CJK character (it is measured in one run).
75
+ */
76
+ export function measureMarkedWidth(text, font, lead, trail, rtl) {
77
+ let byText = C.marked.get(font);
78
+ if (byText === undefined) {
79
+ byText = new Map();
80
+ C.marked.set(font, byText);
81
+ }
82
+ const key = `${rtl ? '<' : '>'}${lead}\x00${trail}\x00${text}`;
83
+ const cached = byText.get(key);
84
+ if (cached !== undefined)
85
+ return cached;
86
+ // A right-to-left word is measured as it is painted: its brackets mirrored.
87
+ const markKey = `${rtl ? '<' : '>'}${lead}\x00${trail}`;
88
+ let mark = byText.get(markKey);
89
+ if (mark === undefined) {
90
+ mark = metricsOf(lead + trail, font, rtl).width;
91
+ byText.set(markKey, mark);
92
+ C.markedEntries++;
93
+ }
94
+ const width = Math.max(0, metricsOf(lead + text + trail, font, rtl).width - mark);
95
+ if (C.markedEntries >= MAX_WIDTH_CACHE_ENTRIES) {
96
+ C.marked = new Map();
97
+ C.markedEntries = 0;
98
+ byText = new Map();
99
+ C.marked.set(font, byText);
100
+ }
101
+ byText.set(key, width);
102
+ C.markedEntries++;
103
+ return width;
104
+ }
105
+ /** The marks {@link scriptSensitive} compares: the punctuation and digits
106
+ * a face may draw by script. */
107
+ const SCRIPT_PROBE = '.,:;!?()[]\u00AB\u00BB\u201C\u201D\u2018\u2019\'"-\u2013\u2014/\u2026*%&0123456789';
108
+ /** Least difference between two of the probe's widths that counts, as a
109
+ * fraction of the smaller: above the noise of two measures, far below
110
+ * any change of glyph (Amiri's full stop alone moves the row by 1.3 %). */
111
+ const PROBE_TOLERANCE = 0.0005;
112
+ /**
113
+ * Whether the face `font` draws punctuation or digits otherwise by script:
114
+ * a fixed row of them is measured beside each of `marks` (a character of
115
+ * each script, glued after it) and the widths compared. One false answer
116
+ * a font string for nearly every face, which then goes no further; the
117
+ * answer is dropped with the cached widths when faces change. A measurer
118
+ * that tells nothing apart (no canvas, a stub) answers false.
119
+ */
120
+ export function scriptSensitive(font, marks) {
121
+ const known = C.sensitive.get(font);
122
+ if (known !== undefined)
123
+ return known;
124
+ let lo = Infinity;
125
+ let hi = -Infinity;
126
+ for (const mark of marks) {
127
+ const width = metricsOf(SCRIPT_PROBE + mark, font).width - metricsOf(mark, font).width;
128
+ if (width < lo)
129
+ lo = width;
130
+ if (width > hi)
131
+ hi = width;
132
+ }
133
+ const sensitive = Number.isFinite(lo) && lo > 0 && hi - lo > lo * PROBE_TOLERANCE;
134
+ C.sensitive.set(font, sensitive);
135
+ return sensitive;
136
+ }
137
+ //# sourceMappingURL=widths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widths.js","sourceRoot":"","sources":["../../../src/measure/canvas/widths.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE1C,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAC1E,0EAA0E;AAC1E,6DAA6D;AAC7D,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAExC,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,IAAY;IACzD,IAAI,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,MAAM,KAAK,SAAS,EAA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AM,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,KAAwB;IACpE,MAAM,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,EAAE,GAAG,QAAQ,CAAC;IAClB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC;IACnB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,SAAS,CAAC,YAAY,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC;QACvF,IAAI,KAAK,GAAG,EAAE;YAAE,EAAE,GAAG,KAAK,CAAC;QAC3B,IAAI,KAAK,GAAG,EAAE;YAAE,EAAE,GAAG,KAAK,CAAC;IAC7B,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,eAAe,CAAC;IAClF,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACjC,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1,155 +1,5 @@
1
- /** `text` as the measurer hands it to the canvas in a document shaped in
2
- * its own language: a Latin-1 text one byte a character, any other as it
3
- * is. A painter that hands its strings the same way has them shaped as
4
- * they were measured. */
5
- export declare function canvasText(text: string): string;
6
- /**
7
- * The width of `text` in `font` under a letter-spacing of `spacingPx`
8
- * (`ctx.letterSpacing`: the spacing after every letter counted in), in
9
- * the language measured in and on the context its kind of string is
10
- * measured on, kept nowhere. Undefined where the canvas has no
11
- * letter-spacing. For what asks how the browser shapes a tracked text
12
- * (`measure/trackedLigatures.ts`): under a letter-spacing it sets no
13
- * optional ligature.
14
- */
15
- export declare function measureSpacedWidth(text: string, font: string, spacingPx: number): number | undefined;
16
- /**
17
- * The width of `text` in `font` as the canvas gives it, in the language
18
- * measured in, kept nowhere: for a caller with a cache of its own (the
19
- * text library's segments, `measure/pretextLanguage.ts`).
20
- */
21
- export declare function measureUncachedWidth(text: string, font: string): number;
22
- /**
23
- * Measure in `language` from now on: a BCP 47 tag (`zh-Hans`, `ca`), the
24
- * empty string for no language at all, or undefined for the host's (what
25
- * a context has when nobody sets one: the page's on a page, none in a
26
- * worker; a configuration with `bodyText.shapingLanguage: 'host'`). The
27
- * build sets the document's and puts back what it found; a block and a run
28
- * that name their own set it for their text ({@link withMeasureLanguage}).
29
- * Each language keeps its own widths, so going from one to another drops
30
- * nothing measured; a cache kept elsewhere of what was measured in a font
31
- * holds the language in its key ({@link measureLanguageKey}).
32
- */
33
- export declare function setMeasureLanguage(language: string | undefined): void;
34
- /** The language set by {@link setMeasureLanguage}. */
35
- export declare function getMeasureLanguage(): string | undefined;
36
- /** Run `fn` measuring in `language`, then measure again in the language
37
- * in force before, also when `fn` throws. */
38
- export declare function withMeasureLanguage<T>(language: string | undefined, fn: () => T): T;
39
- /** The part of a measurement cache key the language decides: empty for
40
- * the host's, so those keys are unchanged. */
41
- export declare function measureLanguageKey(): string;
42
- export declare function measureTextWidth(text: string, font: string): number;
43
- /**
44
- * The width of `text` set in one run, as the browser paints it: two CJK
45
- * marks that meet are not measured apart (see {@link measureTextWidth}).
46
- * For the pieces a renderer paints apart (`markPieces`), each of which
47
- * holds only pairs the layout measured whole.
48
- */
49
- export declare function measureRunWidth(text: string, font: string): number;
50
- /**
51
- * The width of `text` set between `lead` and `trail`, less theirs: `text`
52
- * as the browser shapes it in the script of the mark beside it (#725, see
53
- * `measure/script.ts`; a word with no letter takes the script of the text
54
- * it stands in). `rtl`: measured in a right-to-left context, as the word is
55
- * painted. The mark is glued with a no-break space, so nothing kerns
56
- * across. For text with no CJK character (it is measured in one run).
57
- */
58
- export declare function measureMarkedWidth(text: string, font: string, lead: string, trail: string, rtl: boolean): number;
59
- /**
60
- * Whether the face `font` draws punctuation or digits otherwise by script:
61
- * a fixed row of them is measured beside each of `marks` (a character of
62
- * each script, glued after it) and the widths compared. One false answer
63
- * a font string for nearly every face, which then goes no further; the
64
- * answer is dropped with the cached widths when faces change. A measurer
65
- * that tells nothing apart (no canvas, a stub) answers false.
66
- */
67
- export declare function scriptSensitive(font: string, marks: readonly string[]): boolean;
68
- /** Drop all cached text widths. Must be called whenever font faces are
69
- * (un)registered: widths measured against fallback glyphs are stale. */
70
- export declare function clearTextWidthCache(): void;
71
- /** The current measurement generation: a counter bumped by every
72
- * {@link evictTextWidths} (and so by `clearMeasurementCache` and the
73
- * per-family eviction when faces arrive). */
74
- export declare function measurementGeneration(): number;
75
- /** What changed since `generation`: every family (`all`), or the
76
- * families named by the evictions after it (lower case). */
77
- export declare function evictionsSince(generation: number): {
78
- all: boolean;
79
- families: Set<string>;
80
- };
81
- /** Drop the cached widths measured in `families` (case-insensitive), or
82
- * every width when `families` is null, and bump the measurement
83
- * generation. The listeners of {@link onTextWidthCacheClear} (caches of
84
- * ink and baselines) clear whole. */
85
- export declare function evictTextWidths(families: Iterable<string> | null): void;
86
- /** Called whenever {@link clearTextWidthCache} drops the widths (fonts
87
- * changed): other font-dependent caches clear with it. */
88
- export declare function onTextWidthCacheClear(listener: () => void): void;
89
- /** The ink box of `text` in `font` above and below the alphabetic
90
- * baseline (px), or null when the measurer gives no ink metrics. Not
91
- * cached. */
92
- export declare function measureInkBox(text: string, font: string): {
93
- ascent: number;
94
- descent: number;
95
- } | null;
96
- /** The line box `font` is laid out in, above and below the alphabetic
97
- * baseline (px), or null when the measurer gives no face metrics. These
98
- * are the numbers a browser sets a line box by: text in a box of
99
- * `line-height: L` stands on a baseline `(L + ascent − descent) / 2`
100
- * from the box's top, and `line-height: normal` makes L their sum. */
101
- export declare function measureFontBox(font: string): {
102
- ascent: number;
103
- descent: number;
104
- } | null;
105
- /** Whether the measurer has a face of `font`'s own family (by family, by
106
- * weight and by slant), rather than setting it in its fallback: the same
107
- * probe in a family nothing has is measured and its line box read, and
108
- * the face counts as present where either differs.
109
- *
110
- * A host may hold a book's faces without having registered them where it
111
- * measures — a worker has none of the page's fonts — and everything it
112
- * measures is then set in the fallback. Text whose places the layout
113
- * already holds is unharmed; text measured again as it is written out is
114
- * not, so the writer asks this before it measures anything of its own.
115
- *
116
- * A book set in a generic family (`serif`, `sans-serif`) reads as absent,
117
- * since that is what the fallback is: the writer then keeps to what it
118
- * can place from the layout, which is never wrong, only less exact. */
119
- export declare function measuresOwnFace(font: string): boolean;
120
- /** How far the ink of a text reaches above and below the baseline at each
121
- * pixel column along it (see {@link measureInkProfile}). */
122
- export interface InkProfile {
123
- /** Where column 0 stands, px from the pen's origin (negative when the
124
- * ink overhangs the origin). */
125
- start: number;
126
- /** The text's advance, px. */
127
- advance: number;
128
- /** Per column: px of ink above the baseline (−Infinity: no ink). */
129
- above: Float32Array;
130
- /** Per column: px of ink below the baseline (−Infinity: no ink). */
131
- below: Float32Array;
132
- }
133
- /**
134
- * The ink of `text` in `font` column by column: the text is painted from
135
- * its left edge, left to right as the page paints it, and each pixel
136
- * column records its highest and lowest inked pixel. Null when nothing can
137
- * be painted and read back (no canvas, or a measurer without pixels) or
138
- * the text has no ink. Not cached.
139
- */
140
- export declare function measureInkProfile(text: string, font: string): InkProfile | null;
141
- /** Where the ink of `text` in `font` starts and ends along the line, px
142
- * from the pen's origin (the start is negative when the ink overhangs
143
- * it), or null when the measurer gives no ink metrics or the text has no
144
- * ink. Not cached. */
145
- export declare function measureInkExtent(text: string, font: string): {
146
- start: number;
147
- end: number;
148
- } | null;
149
- /** Measure a short glyph (e.g. a list bullet) in the given font. */
150
- export declare function measureGlyphWidth(text: string, font: string): number;
151
- /** Compute the normal space width for a given font, used to express justified
152
- * spacing as a multiplier of the natural space. */
153
- export declare function normalSpaceWidthFor(font: string): number;
154
- export declare function cleanSoftHyphens(text: string): string;
1
+ export { canvasText, measureSpacedWidth, measureUncachedWidth, setMeasureLanguage, getMeasureLanguage, withMeasureLanguage, measureLanguageKey, clearTextWidthCache, measurementGeneration, evictionsSince, evictTextWidths, onTextWidthCacheClear } from './canvas/state.js';
2
+ export { measureTextWidth, measureRunWidth, measureMarkedWidth, scriptSensitive } from './canvas/widths.js';
3
+ export { measureInkBox, measureFontBox, measuresOwnFace, measureInkProfile, measureInkExtent, measureGlyphWidth, normalSpaceWidthFor, cleanSoftHyphens } from './canvas/ink.js';
4
+ export type { InkProfile } from './canvas/ink.js';
155
5
  //# sourceMappingURL=canvas.d.ts.map