postext 1.22.3 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/dist/__tests__/bundle.test.js +1 -1
  2. package/dist/__tests__/codeBlocks.test.d.ts +2 -0
  3. package/dist/__tests__/codeBlocks.test.d.ts.map +1 -0
  4. package/dist/__tests__/codeBlocks.test.js +550 -0
  5. package/dist/__tests__/codeBlocks.test.js.map +1 -0
  6. package/dist/__tests__/exports.test.js +19 -0
  7. package/dist/__tests__/exports.test.js.map +1 -1
  8. package/dist/__tests__/hardBreaks.test.d.ts +2 -0
  9. package/dist/__tests__/hardBreaks.test.d.ts.map +1 -0
  10. package/dist/__tests__/hardBreaks.test.js +226 -0
  11. package/dist/__tests__/hardBreaks.test.js.map +1 -0
  12. package/dist/__tests__/headingInlineMarks.test.js +1 -1
  13. package/dist/__tests__/headingLetterSpacing.test.js +1 -1
  14. package/dist/__tests__/headingLetterSpacing.test.js.map +1 -1
  15. package/dist/__tests__/lineNumbers.test.d.ts +2 -0
  16. package/dist/__tests__/lineNumbers.test.d.ts.map +1 -0
  17. package/dist/__tests__/lineNumbers.test.js +304 -0
  18. package/dist/__tests__/lineNumbers.test.js.map +1 -0
  19. package/dist/__tests__/mathSizeMigration.test.js +2 -2
  20. package/dist/__tests__/paragraphDropCap.test.d.ts +2 -0
  21. package/dist/__tests__/paragraphDropCap.test.d.ts.map +1 -0
  22. package/dist/__tests__/paragraphDropCap.test.js +442 -0
  23. package/dist/__tests__/paragraphDropCap.test.js.map +1 -0
  24. package/dist/__tests__/paragraphStyleIndent.test.js +26 -2
  25. package/dist/__tests__/paragraphStyleIndent.test.js.map +1 -1
  26. package/dist/__tests__/pipeline/calloutInlineResourceGap.test.js +1 -1
  27. package/dist/__tests__/pipeline/calloutSplitMinLinesChild.test.js +1 -1
  28. package/dist/__tests__/pipeline/colonListRoom.test.js +1 -1
  29. package/dist/__tests__/pipeline/compoundBreaks.test.js +1 -1
  30. package/dist/__tests__/pipeline/dashBreaks.test.js +1 -1
  31. package/dist/__tests__/pipeline/headingSplitOrphans.test.js +1 -1
  32. package/dist/__tests__/pipeline/inlineFigureSpace.test.js +1 -1
  33. package/dist/__tests__/pipeline/paragraphContainerTail.test.js +1 -1
  34. package/dist/__tests__/pipeline/paragraphStyleFaces.test.js +7 -1
  35. package/dist/__tests__/pipeline/paragraphStyleFaces.test.js.map +1 -1
  36. package/dist/__tests__/pipeline/raggedOptimal.test.js +1 -1
  37. package/dist/__tests__/tabStops.test.d.ts +2 -0
  38. package/dist/__tests__/tabStops.test.d.ts.map +1 -0
  39. package/dist/__tests__/tabStops.test.js +394 -0
  40. package/dist/__tests__/tabStops.test.js.map +1 -0
  41. package/dist/__tests__/verseLines.test.d.ts +2 -0
  42. package/dist/__tests__/verseLines.test.d.ts.map +1 -0
  43. package/dist/__tests__/verseLines.test.js +375 -0
  44. package/dist/__tests__/verseLines.test.js.map +1 -0
  45. package/dist/bundle/configVersion.d.ts +77 -7
  46. package/dist/bundle/configVersion.d.ts.map +1 -1
  47. package/dist/bundle/configVersion.js +239 -5
  48. package/dist/bundle/configVersion.js.map +1 -1
  49. package/dist/bundle/index.d.ts +1 -1
  50. package/dist/bundle/index.d.ts.map +1 -1
  51. package/dist/bundle/index.js +1 -1
  52. package/dist/bundle/index.js.map +1 -1
  53. package/dist/canvas-backend/blockRender.d.ts.map +1 -1
  54. package/dist/canvas-backend/blockRender.js +39 -5
  55. package/dist/canvas-backend/blockRender.js.map +1 -1
  56. package/dist/canvas-backend/index.d.ts.map +1 -1
  57. package/dist/canvas-backend/index.js +3 -0
  58. package/dist/canvas-backend/index.js.map +1 -1
  59. package/dist/cjkMarks.js +1 -1
  60. package/dist/cjkMarks.js.map +1 -1
  61. package/dist/code/highlight.d.ts +34 -0
  62. package/dist/code/highlight.d.ts.map +1 -0
  63. package/dist/code/highlight.js +406 -0
  64. package/dist/code/highlight.js.map +1 -0
  65. package/dist/configWarnings.d.ts.map +1 -1
  66. package/dist/configWarnings.js +192 -3
  67. package/dist/configWarnings.js.map +1 -1
  68. package/dist/defaults/bodyText.d.ts.map +1 -1
  69. package/dist/defaults/bodyText.js +25 -0
  70. package/dist/defaults/bodyText.js.map +1 -1
  71. package/dist/defaults/calloutStyles.d.ts.map +1 -1
  72. package/dist/defaults/calloutStyles.js +7 -0
  73. package/dist/defaults/calloutStyles.js.map +1 -1
  74. package/dist/defaults/codeStyle.d.ts +29 -0
  75. package/dist/defaults/codeStyle.d.ts.map +1 -0
  76. package/dist/defaults/codeStyle.js +284 -0
  77. package/dist/defaults/codeStyle.js.map +1 -0
  78. package/dist/defaults/dropCap.d.ts +49 -0
  79. package/dist/defaults/dropCap.d.ts.map +1 -0
  80. package/dist/defaults/dropCap.js +66 -0
  81. package/dist/defaults/dropCap.js.map +1 -0
  82. package/dist/defaults/headings.d.ts +1 -1
  83. package/dist/defaults/headings.d.ts.map +1 -1
  84. package/dist/defaults/headings.js +11 -0
  85. package/dist/defaults/headings.js.map +1 -1
  86. package/dist/defaults/index.d.ts +3 -0
  87. package/dist/defaults/index.d.ts.map +1 -1
  88. package/dist/defaults/index.js +19 -0
  89. package/dist/defaults/index.js.map +1 -1
  90. package/dist/defaults/lineNumbers.d.ts +19 -0
  91. package/dist/defaults/lineNumbers.d.ts.map +1 -0
  92. package/dist/defaults/lineNumbers.js +101 -0
  93. package/dist/defaults/lineNumbers.js.map +1 -0
  94. package/dist/defaults/paragraphStyles.d.ts.map +1 -1
  95. package/dist/defaults/paragraphStyles.js +20 -0
  96. package/dist/defaults/paragraphStyles.js.map +1 -1
  97. package/dist/defaults/tabStops.d.ts +29 -0
  98. package/dist/defaults/tabStops.d.ts.map +1 -0
  99. package/dist/defaults/tabStops.js +94 -0
  100. package/dist/defaults/tabStops.js.map +1 -0
  101. package/dist/defaults/verse.d.ts +10 -0
  102. package/dist/defaults/verse.d.ts.map +1 -0
  103. package/dist/defaults/verse.js +52 -0
  104. package/dist/defaults/verse.js.map +1 -0
  105. package/dist/fonts/usage.d.ts +7 -0
  106. package/dist/fonts/usage.d.ts.map +1 -1
  107. package/dist/fonts/usage.js +71 -0
  108. package/dist/fonts/usage.js.map +1 -1
  109. package/dist/html-backend.d.ts.map +1 -1
  110. package/dist/html-backend.js +85 -11
  111. package/dist/html-backend.js.map +1 -1
  112. package/dist/index.d.ts +8 -5
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.js +4 -2
  115. package/dist/index.js.map +1 -1
  116. package/dist/measure/bidiLines.js +2 -2
  117. package/dist/measure/bidiLines.js.map +1 -1
  118. package/dist/measure/cache.js +2 -2
  119. package/dist/measure/cache.js.map +1 -1
  120. package/dist/measure/cjkCompose.d.ts.map +1 -1
  121. package/dist/measure/cjkCompose.js +5 -5
  122. package/dist/measure/cjkCompose.js.map +1 -1
  123. package/dist/measure/hardBreaks.d.ts +46 -0
  124. package/dist/measure/hardBreaks.d.ts.map +1 -0
  125. package/dist/measure/hardBreaks.js +216 -0
  126. package/dist/measure/hardBreaks.js.map +1 -0
  127. package/dist/measure/index.d.ts +1 -0
  128. package/dist/measure/index.d.ts.map +1 -1
  129. package/dist/measure/index.js +1 -0
  130. package/dist/measure/index.js.map +1 -1
  131. package/dist/measure/leader.d.ts +20 -0
  132. package/dist/measure/leader.d.ts.map +1 -0
  133. package/dist/measure/leader.js +46 -0
  134. package/dist/measure/leader.js.map +1 -0
  135. package/dist/measure/links.js +1 -1
  136. package/dist/measure/links.js.map +1 -1
  137. package/dist/measure/plain.d.ts.map +1 -1
  138. package/dist/measure/plain.js +18 -25
  139. package/dist/measure/plain.js.map +1 -1
  140. package/dist/measure/rich.d.ts +19 -0
  141. package/dist/measure/rich.d.ts.map +1 -1
  142. package/dist/measure/rich.js +211 -38
  143. package/dist/measure/rich.js.map +1 -1
  144. package/dist/measure/tabs.d.ts +103 -0
  145. package/dist/measure/tabs.d.ts.map +1 -0
  146. package/dist/measure/tabs.js +123 -0
  147. package/dist/measure/tabs.js.map +1 -0
  148. package/dist/measure/types.d.ts +26 -2
  149. package/dist/measure/types.d.ts.map +1 -1
  150. package/dist/measure/types.js +23 -3
  151. package/dist/measure/types.js.map +1 -1
  152. package/dist/parse/blockParser.d.ts +13 -6
  153. package/dist/parse/blockParser.d.ts.map +1 -1
  154. package/dist/parse/blockParser.js +457 -87
  155. package/dist/parse/blockParser.js.map +1 -1
  156. package/dist/parse/codeFence.d.ts +18 -0
  157. package/dist/parse/codeFence.d.ts.map +1 -0
  158. package/dist/parse/codeFence.js +52 -0
  159. package/dist/parse/codeFence.js.map +1 -0
  160. package/dist/parse/index.d.ts +1 -1
  161. package/dist/parse/index.d.ts.map +1 -1
  162. package/dist/parse/index.js.map +1 -1
  163. package/dist/parse/indexMarks.d.ts +3 -1
  164. package/dist/parse/indexMarks.d.ts.map +1 -1
  165. package/dist/parse/indexMarks.js +22 -2
  166. package/dist/parse/indexMarks.js.map +1 -1
  167. package/dist/parse/inlineFormatting.d.ts +50 -0
  168. package/dist/parse/inlineFormatting.d.ts.map +1 -1
  169. package/dist/parse/inlineFormatting.js +94 -0
  170. package/dist/parse/inlineFormatting.js.map +1 -1
  171. package/dist/parse/sourceMapping.d.ts.map +1 -1
  172. package/dist/parse/sourceMapping.js +65 -1
  173. package/dist/parse/sourceMapping.js.map +1 -1
  174. package/dist/parse/types.d.ts +144 -9
  175. package/dist/parse/types.d.ts.map +1 -1
  176. package/dist/pipeline/build.d.ts.map +1 -1
  177. package/dist/pipeline/build.js +143 -18
  178. package/dist/pipeline/build.js.map +1 -1
  179. package/dist/pipeline/buildBlockKind.d.ts.map +1 -1
  180. package/dist/pipeline/buildBlockKind.js +60 -1
  181. package/dist/pipeline/buildBlockKind.js.map +1 -1
  182. package/dist/pipeline/buildHelpers.d.ts +3 -0
  183. package/dist/pipeline/buildHelpers.d.ts.map +1 -1
  184. package/dist/pipeline/buildHelpers.js +7 -2
  185. package/dist/pipeline/buildHelpers.js.map +1 -1
  186. package/dist/pipeline/calloutLayout.d.ts.map +1 -1
  187. package/dist/pipeline/calloutLayout.js +33 -2
  188. package/dist/pipeline/calloutLayout.js.map +1 -1
  189. package/dist/pipeline/chips.d.ts.map +1 -1
  190. package/dist/pipeline/chips.js +4 -0
  191. package/dist/pipeline/chips.js.map +1 -1
  192. package/dist/pipeline/codeBlocks.d.ts +38 -0
  193. package/dist/pipeline/codeBlocks.d.ts.map +1 -0
  194. package/dist/pipeline/codeBlocks.js +146 -0
  195. package/dist/pipeline/codeBlocks.js.map +1 -0
  196. package/dist/pipeline/codeInline.d.ts +22 -0
  197. package/dist/pipeline/codeInline.d.ts.map +1 -0
  198. package/dist/pipeline/codeInline.js +93 -0
  199. package/dist/pipeline/codeInline.js.map +1 -0
  200. package/dist/pipeline/codeLines.d.ts +91 -0
  201. package/dist/pipeline/codeLines.d.ts.map +1 -0
  202. package/dist/pipeline/codeLines.js +399 -0
  203. package/dist/pipeline/codeLines.js.map +1 -0
  204. package/dist/pipeline/config.d.ts.map +1 -1
  205. package/dist/pipeline/config.js +8 -1
  206. package/dist/pipeline/config.js.map +1 -1
  207. package/dist/pipeline/contentWarnings.d.ts +9 -0
  208. package/dist/pipeline/contentWarnings.d.ts.map +1 -1
  209. package/dist/pipeline/contentWarnings.js +60 -2
  210. package/dist/pipeline/contentWarnings.js.map +1 -1
  211. package/dist/pipeline/continuation.d.ts.map +1 -1
  212. package/dist/pipeline/continuation.js +9 -2
  213. package/dist/pipeline/continuation.js.map +1 -1
  214. package/dist/pipeline/dropCap.d.ts +128 -0
  215. package/dist/pipeline/dropCap.d.ts.map +1 -0
  216. package/dist/pipeline/dropCap.js +412 -0
  217. package/dist/pipeline/dropCap.js.map +1 -0
  218. package/dist/pipeline/hardBreaks.d.ts +19 -0
  219. package/dist/pipeline/hardBreaks.d.ts.map +1 -0
  220. package/dist/pipeline/hardBreaks.js +36 -0
  221. package/dist/pipeline/hardBreaks.js.map +1 -0
  222. package/dist/pipeline/headerFooter.d.ts.map +1 -1
  223. package/dist/pipeline/headerFooter.js +4 -1
  224. package/dist/pipeline/headerFooter.js.map +1 -1
  225. package/dist/pipeline/lineNumbers.d.ts +37 -0
  226. package/dist/pipeline/lineNumbers.d.ts.map +1 -0
  227. package/dist/pipeline/lineNumbers.js +441 -0
  228. package/dist/pipeline/lineNumbers.js.map +1 -0
  229. package/dist/pipeline/measureContentBlock.d.ts +31 -5
  230. package/dist/pipeline/measureContentBlock.d.ts.map +1 -1
  231. package/dist/pipeline/measureContentBlock.js +274 -68
  232. package/dist/pipeline/measureContentBlock.js.map +1 -1
  233. package/dist/pipeline/partPalette.d.ts +1 -1
  234. package/dist/pipeline/partPalette.d.ts.map +1 -1
  235. package/dist/pipeline/partPalette.js +24 -2
  236. package/dist/pipeline/partPalette.js.map +1 -1
  237. package/dist/pipeline/styles.d.ts +18 -2
  238. package/dist/pipeline/styles.d.ts.map +1 -1
  239. package/dist/pipeline/styles.js +15 -3
  240. package/dist/pipeline/styles.js.map +1 -1
  241. package/dist/pipeline/tabs.d.ts +35 -0
  242. package/dist/pipeline/tabs.d.ts.map +1 -0
  243. package/dist/pipeline/tabs.js +99 -0
  244. package/dist/pipeline/tabs.js.map +1 -0
  245. package/dist/pipeline/toc.d.ts.map +1 -1
  246. package/dist/pipeline/toc.js +3 -38
  247. package/dist/pipeline/toc.js.map +1 -1
  248. package/dist/pipeline/verseLines.d.ts +78 -0
  249. package/dist/pipeline/verseLines.d.ts.map +1 -0
  250. package/dist/pipeline/verseLines.js +245 -0
  251. package/dist/pipeline/verseLines.js.map +1 -0
  252. package/dist/preflight.d.ts.map +1 -1
  253. package/dist/preflight.js +1 -0
  254. package/dist/preflight.js.map +1 -1
  255. package/dist/types.d.ts +560 -4
  256. package/dist/types.d.ts.map +1 -1
  257. package/dist/vdt.d.ts +240 -7
  258. package/dist/vdt.d.ts.map +1 -1
  259. package/dist/vdt.js +6 -0
  260. package/dist/vdt.js.map +1 -1
  261. package/dist/word/docxRead.d.ts.map +1 -1
  262. package/dist/word/docxRead.js +15 -0
  263. package/dist/word/docxRead.js.map +1 -1
  264. package/dist/word/inline.d.ts +6 -1
  265. package/dist/word/inline.d.ts.map +1 -1
  266. package/dist/word/inline.js +35 -1
  267. package/dist/word/inline.js.map +1 -1
  268. package/dist/word/model.d.ts +14 -0
  269. package/dist/word/model.d.ts.map +1 -1
  270. package/dist/word/model.js.map +1 -1
  271. package/dist/word/template.d.ts +12 -3
  272. package/dist/word/template.d.ts.map +1 -1
  273. package/dist/word/template.js +13 -3
  274. package/dist/word/template.js.map +1 -1
  275. package/dist/word/toDocx.d.ts.map +1 -1
  276. package/dist/word/toDocx.js +52 -8
  277. package/dist/word/toDocx.js.map +1 -1
  278. package/dist/word/toMarkdown.d.ts +5 -1
  279. package/dist/word/toMarkdown.d.ts.map +1 -1
  280. package/dist/word/toMarkdown.js +117 -6
  281. package/dist/word/toMarkdown.js.map +1 -1
  282. package/dist/word/word.test.js +124 -2
  283. package/dist/word/word.test.js.map +1 -1
  284. package/dist/worker/fonts.d.ts +2 -1
  285. package/dist/worker/fonts.d.ts.map +1 -1
  286. package/dist/worker/fonts.js +6 -2
  287. package/dist/worker/fonts.js.map +1 -1
  288. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"rich.d.ts","sourceRoot":"","sources":["../../src/measure/rich.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAc,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAG9G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAQ3C,OAAO,EAAmC,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAcxG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAS1C,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAA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M,EACpB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,aAAa,CAMf;AAijBD;6EAC6E;AAC7E,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE,CAOvE"}
@@ -1,9 +1,11 @@
1
+ import { FORCED_BREAK, measureForcedBreaks } from './hardBreaks';
2
+ import { placeTab } from './tabs';
1
3
  import { uprightArabicSpans, uprightFace } from '../uprightArabic';
2
4
  import { createBoundingBox } from '../vdt';
3
5
  import { hyphenateText, withoutSlashJoints } from '../hyphenate';
4
6
  import { richTokensToItems, computeBreakpoints, reconstructRichLines, } from '../knuthPlass';
5
7
  import { SOFT_HYPHEN } from './types';
6
- import { lineMeasure, uniformMeasureFrom } from './types';
8
+ import { lineIndentAt, lineMeasure, uniformMeasureFrom } from './types';
7
9
  import { cleanSoftHyphens, measureTextWidth, normalSpaceWidthFor } from './canvas';
8
10
  import { isRuntLastLine } from './runts';
9
11
  import { computeJustifiedSpaceRatio, hasOverfullLine } from './plain';
@@ -188,7 +190,9 @@ export function expandSmallCaps(lines, normalFont, boldFont, italicFont, boldIta
188
190
  const segs = line.segments;
189
191
  if (!segs || !segs.some((s) => s.smallCaps))
190
192
  continue;
191
- const before = segs.map((s) => s.text).join('');
193
+ // A leader (#622) is no text of the line.
194
+ const spelled = (list) => list.filter((s) => !s.leader).map((s) => s.text).join('');
195
+ const before = spelled(segs);
192
196
  const out = [];
193
197
  for (const seg of segs) {
194
198
  if (!seg.smallCaps) {
@@ -225,7 +229,7 @@ export function expandSmallCaps(lines, normalFont, boldFont, italicFont, boldIta
225
229
  }
226
230
  line.segments = out;
227
231
  if (line.text === before)
228
- line.text = out.map((s) => s.text).join('');
232
+ line.text = spelled(out);
229
233
  }
230
234
  }
231
235
  /** The text band of a chip box around the baseline, as fractions of the
@@ -353,7 +357,8 @@ const TRAILING_NO_BREAK_RE = new RegExp(`[${NO_BREAK_SPACES}]+$`);
353
357
  function applyChipGaps(tokens, noBreakWidth) {
354
358
  for (let i = 0; i < tokens.length; i++) {
355
359
  const space = tokens[i];
356
- if (space.kind !== 'space')
360
+ // A tab makes its own room (#622).
361
+ if (space.kind !== 'space' || space.tab)
357
362
  continue;
358
363
  const left = tokens[i - 1]?.chip ? tokens[i - 1] : undefined;
359
364
  const right = tokens[i + 1]?.chip ? tokens[i + 1] : undefined;
@@ -894,7 +899,7 @@ export function tokenSegment(t) {
894
899
  ...(t.refResourceId !== undefined ? { refResourceId: t.refResourceId, ...(t.refAnchor ? { refAnchor: true } : {}), ...(t.refPageIndex !== undefined ? { refPageIndex: t.refPageIndex } : {}) } : {}),
895
900
  ...(t.footnoteId !== undefined ? { footnoteId: t.footnoteId } : {}),
896
901
  ...(t.captionLabel ? { captionLabel: true } : {}),
897
- ...(t.labelTab ? { labelTab: true } : {}),
902
+ ...(t.labelTab || t.tab ? { labelTab: true } : {}),
898
903
  ...(t.script ? { script: t.script, fontString: t.scriptFont, baselineShift: t.baselineShift } : {}),
899
904
  ...(t.markerFont && !t.script ? { fontString: t.markerFont } : {}),
900
905
  ...(t.sideRuns ? { sideMarker: { runs: t.sideRuns } } : {}),
@@ -979,6 +984,16 @@ bidi) {
979
984
  for (const span of spans) {
980
985
  const spanBase = spanStart;
981
986
  spanStart += span.text.length;
987
+ // A tab (#622): its width is set where its line gets to it.
988
+ // Tab characters in a row are one character of the text that goes on
989
+ // that many stops: the later ones have no text.
990
+ if (span.tab) {
991
+ const tab = span.tab.px ? { stop: span.tab.px } : {};
992
+ for (let k = 0; k < Math.max(1, span.tab.count ?? 1); k++) {
993
+ tokens.push({ text: k === 0 ? span.text : '', bold: span.bold, italic: span.italic, kind: 'space', width: 0, tab });
994
+ }
995
+ continue;
996
+ }
982
997
  const atomic = atomicSpanToken(span, normalFont, boldFont, italicFont, boldItalicFont, letterSpacingPx);
983
998
  if (atomic) {
984
999
  tokens.push(atomic);
@@ -1387,6 +1402,15 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1387
1402
  const opts = options;
1388
1403
  return withMeasureWritingMode(opts.writingMode, () => measureRichText(spans, plainText, normalFont, boldFont, italicFont, boldItalicFont, maxWidthPx, lineHeightPx, opts));
1389
1404
  }
1405
+ // Forced line breaks (#620): the text between two of them is broken on
1406
+ // its own, by whichever breaker sets it, and the pieces stacked
1407
+ // (`measure/hardBreaks.ts`).
1408
+ if (plainText.includes(FORCED_BREAK)) {
1409
+ return measureForcedBreaks(spans, maxWidthPx, lineHeightPx, options, (piece, opts) => measureRichText(piece, piece.map((s) => s.text).join(''), normalFont, boldFont, italicFont, boldItalicFont, maxWidthPx, lineHeightPx, opts));
1410
+ }
1411
+ // Tabs (#622) are word spaces in vertical text.
1412
+ if (measuringVertically() && spans.some((sp) => sp.tab))
1413
+ spans = tabsAsSpaces(spans);
1390
1414
  // Vertical text: a short number inside a Latin sentence runs sideways
1391
1415
  // with it, read against the whole paragraph (#222).
1392
1416
  if (measuringVertically())
@@ -1402,13 +1426,18 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1402
1426
  // #195, #430), which the composer alone lays out.
1403
1427
  // The paragraph is looked at for CJK text once (`cjkText`); a Latin one
1404
1428
  // then never looks into its words.
1429
+ // A paragraph with a tab (#622) is set by the line breaker below, which
1430
+ // breaks Chinese and Japanese words between their characters under the
1431
+ // document's rules; one with ruby, a warichu note or kanbun marks keeps
1432
+ // the composer, its tabs set as word spaces.
1405
1433
  const cjkText = hasCJK(plainText);
1406
- if ((cjkText && composesAsCjk(plainText)) || spans.some((s) => s.ruby || s.warichu || s.kunten)) {
1407
- return composeCjkParagraph(spans, normalFont, boldFont, italicFont, boldItalicFont, maxWidthPx, lineHeightPx, options);
1434
+ const annotated = spans.some((s) => s.ruby || s.warichu || s.kunten);
1435
+ const hasTabs = spans.some((s) => s.tab);
1436
+ if ((cjkText && composesAsCjk(plainText) && !hasTabs) || annotated) {
1437
+ return composeCjkParagraph(hasTabs ? tabsAsSpaces(spans) : spans, normalFont, boldFont, italicFont, boldItalicFont, maxWidthPx, lineHeightPx, options);
1408
1438
  }
1409
1439
  const shouldHyphenate = options?.hyphenate ?? false;
1410
- const indentPx = options?.firstLineIndentPx ?? 0;
1411
- const hanging = options?.hangingIndent ?? false;
1440
+ const indentOf = (li) => lineIndentAt(options, li);
1412
1441
  const textAlign = options?.textAlign ?? 'left';
1413
1442
  const letterSpacingPx = options?.letterSpacingPx ?? 0;
1414
1443
  const hyphenationZonePx = shouldHyphenate ? options?.hyphenationZonePx : undefined;
@@ -1436,8 +1465,7 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1436
1465
  if (!kashida)
1437
1466
  return;
1438
1467
  justifyLinesWithKashida(lines, (li) => {
1439
- const indent = indentPx > 0 ? (hanging ? (li === 0 ? 0 : indentPx) : (li === 0 ? indentPx : 0)) : 0;
1440
- return lineMeasure(maxWidthPx, options?.restWidths, li) - indent;
1468
+ return lineMeasure(maxWidthPx, options?.restWidths, li) - indentOf(li);
1441
1469
  }, normalSpaceWidth, kashida, (seg, text) => textWidth(text, fontOf(seg), false));
1442
1470
  };
1443
1471
  // Knuth-Plass optimal line breaking path. A Latin paragraph quoting CJK
@@ -1446,25 +1474,16 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1446
1474
  // it too with `optimalRagged`: its word spaces keep their width and each
1447
1475
  // line gets the ragged stretch instead.
1448
1476
  const ragged = textAlign !== 'justify';
1449
- if (options?.optimal && (!ragged || options.optimalRagged)) {
1477
+ // A paragraph that holds a tab is set line by line (#622): a tab's width
1478
+ // depends on where its line starts.
1479
+ if (options?.optimal && (!ragged || options.optimalRagged) && !hasTabs) {
1450
1480
  const maxStretchRatio = ragged ? 1 : options.maxStretchRatio ?? 1.5;
1451
1481
  const minShrinkRatio = ragged ? 1 : options.minShrinkRatio ?? 0.8;
1452
1482
  // The runt threshold counts word spaces on ragged text too.
1453
1483
  const spaceWidth = ragged ? normalSpaceWidthFor(normalFont) + letterSpacingPx : normalSpaceWidth;
1454
1484
  const items = richTokensToItems(tokens, spaceWidth, maxStretchRatio, minShrinkRatio, repeatHyphen);
1455
- const lineWidthFn = (li) => {
1456
- const isFirst = li === 0;
1457
- const indent = indentPx > 0
1458
- ? (hanging ? (isFirst ? 0 : indentPx) : (isFirst ? indentPx : 0))
1459
- : 0;
1460
- return lineMeasure(maxWidthPx, options.restWidths, li) - indent;
1461
- };
1462
- const lineIndentFn = (li) => {
1463
- const isFirst = li === 0;
1464
- return indentPx > 0
1465
- ? (hanging ? (isFirst ? 0 : indentPx) : (isFirst ? indentPx : 0))
1466
- : 0;
1467
- };
1485
+ const lineWidthFn = (li) => lineMeasure(maxWidthPx, options.restWidths, li) - indentOf(li);
1486
+ const lineIndentFn = indentOf;
1468
1487
  const runtPenalty = options.runtPenalty ?? 0;
1469
1488
  const runtMinWidth = runtPenalty > 0
1470
1489
  ? (options.runtMinCharacters ?? 0) * spaceWidth
@@ -1481,7 +1500,7 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1481
1500
  ...(options.avoidHyphenAtLines ? { avoidHyphenAtLines: options.avoidHyphenAtLines } : {}),
1482
1501
  ...(options.keepBreaks?.path === 'rich' ? { fixedBreaks: options.keepBreaks.at } : {}),
1483
1502
  looseness: options.looseness ?? 0,
1484
- lineWidthUniformFrom: uniformMeasureFrom(options.restWidths),
1503
+ lineWidthUniformFrom: uniformMeasureFrom(options.restWidths, options.lineIndentsPx),
1485
1504
  trackingPerChar,
1486
1505
  ...(ragged ? { raggedStretch: raggedStretchPx(normalFont) } : {}),
1487
1506
  ...(ragged && hyphenationZonePx !== undefined ? { hyphenationZone: hyphenationZonePx } : {}),
@@ -1517,11 +1536,14 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1517
1536
  // The line before broke after a compound's hyphen, which this one repeats
1518
1537
  // (`repeatHyphen`).
1519
1538
  let repeatPending = false;
1539
+ // Tabs (#622): a leader is measured in the paragraph's face, tracked as
1540
+ // its words are; a tab past the last stop is a word space.
1541
+ const leaderWidth = (text) => measureTextWidth(text, normalFont) + (letterSpacingPx === 0 ? 0 : letterSpacingPx * graphemeCount(text));
1542
+ const tabSpaceWidth = hasTabs ? normalSpaceWidthFor(normalFont) + letterSpacingPx : 0;
1543
+ // A word space a line may start or end at (a tab is none).
1544
+ const isBreakSpace = (t) => t.kind === 'space' && !t.tab;
1520
1545
  while (tokenIdx < tokens.length) {
1521
- const isFirstLine = lineIndex === 0;
1522
- const lineIndent = indentPx > 0
1523
- ? (hanging ? (isFirstLine ? 0 : indentPx) : (isFirstLine ? indentPx : 0))
1524
- : 0;
1546
+ const lineIndent = indentOf(lineIndex);
1525
1547
  const lineMaxWidth = lineMeasure(maxWidthPx, options?.restWidths, lineIndex) - lineIndent;
1526
1548
  const lineTokens = [];
1527
1549
  let lineWidth = 0;
@@ -1531,8 +1553,10 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1531
1553
  let lineHardHyphen = false;
1532
1554
  // A word of a joining script wider than the line runs past it.
1533
1555
  let lineWordOverflow = false;
1556
+ // The line holds a tab placed at a stop (#622).
1557
+ let lineTabbed = false;
1534
1558
  // Consume leading spaces at line start (skip them)
1535
- while (tokenIdx < tokens.length && tokens[tokenIdx].kind === 'space') {
1559
+ while (tokenIdx < tokens.length && isBreakSpace(tokens[tokenIdx])) {
1536
1560
  tokenIdx++;
1537
1561
  }
1538
1562
  // The compound's hyphen, repeated: the tail it broke from opens the
@@ -1545,10 +1569,63 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1545
1569
  repeatPending = false;
1546
1570
  // This line ends after a compound's hyphen the next one repeats.
1547
1571
  let lineRepeatNext = false;
1572
+ // Tabs (#622): the stop the line's last tab took, and that tab's place
1573
+ // among the line's tokens.
1574
+ let tabUsedPos = -Infinity;
1575
+ let lastTabAt = -1;
1548
1576
  // Greedy: add tokens until we overflow
1549
1577
  while (tokenIdx < tokens.length) {
1550
- const token = tokens[tokenIdx];
1551
- if (lineWidth + token.width <= lineMaxWidth) {
1578
+ let token = tokens[tokenIdx];
1579
+ if (token.tab) {
1580
+ const x = lineIndent + lineWidth;
1581
+ const placement = placeTab(x, tabRun(tokens, tokenIdx, normalFont, boldFont, italicFont, boldItalicFont, letterSpacingPx), { start: lineIndent, end: lineIndent + lineMaxWidth, measure: maxWidthPx, usedPos: tabUsedPos }, options?.tabs, token.tab.stop, leaderWidth);
1582
+ if (placement.kind === 'stop' || (placement.kind === 'overrun' && !lineTokens.some((t) => t.kind !== 'space'))) {
1583
+ // At its stop; or opening its line with no stop the text after
1584
+ // it fits: it takes no room.
1585
+ const width = placement.kind === 'stop' ? placement.width : 0;
1586
+ lineTokens.push({
1587
+ ...token,
1588
+ width,
1589
+ tabPlaced: placement.kind === 'stop' ? { align: placement.align, at: placement.pos } : { align: 'start', at: x },
1590
+ ...(placement.kind === 'stop' && placement.leader ? { tabLeader: placement.leader } : {}),
1591
+ });
1592
+ lineWidth += width;
1593
+ tokenIdx++;
1594
+ if (placement.kind === 'stop')
1595
+ tabUsedPos = placement.pos;
1596
+ lastTabAt = lineTokens.length - 1;
1597
+ lineTabbed = true;
1598
+ continue;
1599
+ }
1600
+ if (placement.kind === 'overrun') {
1601
+ // An end, centre or decimal stop the text before it has passed
1602
+ // takes that text's last word down with it; a start stop breaks
1603
+ // the line before the tab.
1604
+ if (placement.align !== 'start') {
1605
+ let k = lineTokens.length - 1;
1606
+ while (k > lastTabAt + 1 && !(lineTokens[k].kind === 'space' && !lineTokens[k].tab))
1607
+ k--;
1608
+ if (k > lastTabAt + 1 && lineTokens.slice(lastTabAt + 1, k).some((t) => t.kind !== 'space')) {
1609
+ tokenIdx -= lineTokens.length - k;
1610
+ while (lineTokens.length > k)
1611
+ lineWidth -= lineTokens.pop().width;
1612
+ }
1613
+ }
1614
+ break;
1615
+ }
1616
+ // Past the last stop with no default stops: a word space, none at
1617
+ // the line's start.
1618
+ if (!lineTokens.some((t) => t.kind !== 'space')) {
1619
+ tokenIdx++;
1620
+ continue;
1621
+ }
1622
+ const { tab: _tab, ...space } = token;
1623
+ void _tab;
1624
+ token = { ...space, width: tabSpaceWidth, labelTab: 'gap' };
1625
+ }
1626
+ // The text a tab sent to its stop fits as measured: rounding in the
1627
+ // sums is no overflow (#622).
1628
+ if (lineWidth + token.width <= lineMaxWidth + (lineTabbed ? 0.01 : 0)) {
1552
1629
  lineTokens.push(token);
1553
1630
  lineWidth += token.width;
1554
1631
  tokenIdx++;
@@ -1715,23 +1792,27 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1715
1792
  break;
1716
1793
  syllableRun = lineSyllable ? syllableRun + 1 : 0;
1717
1794
  repeatPending = lineRepeatNext;
1718
- // Trim trailing spaces from line tokens
1719
- while (lineTokens.length > 0 && lineTokens[lineTokens.length - 1].kind === 'space') {
1795
+ // Trim trailing spaces from line tokens (a tab stays: a rule to the
1796
+ // line's end is a form's blank)
1797
+ while (lineTokens.length > 0 && isBreakSpace(lineTokens[lineTokens.length - 1])) {
1720
1798
  lineWidth -= lineTokens[lineTokens.length - 1].width;
1721
1799
  lineTokens.pop();
1722
1800
  }
1723
1801
  // Check if this is the last line
1724
1802
  // Skip remaining leading spaces to check if there's more content
1725
1803
  let peekIdx = tokenIdx;
1726
- while (peekIdx < tokens.length && tokens[peekIdx].kind === 'space') {
1804
+ while (peekIdx < tokens.length && isBreakSpace(tokens[peekIdx])) {
1727
1805
  peekIdx++;
1728
1806
  }
1729
1807
  const isLastLine = peekIdx >= tokens.length;
1730
1808
  // Build segments for justified rendering
1731
- const segments = trimChipLineEdges(lineTokens.map(tokenSegment));
1809
+ let segments = trimChipLineEdges(lineTokens.map(tokenSegment));
1810
+ if (lineTabbed)
1811
+ segments = setTabbedLine(segments, lineTokens, lineMaxWidth, textAlign, isLastLine);
1732
1812
  const lineText = lineTokens.map((t) => cleanSoftHyphens(t.text)).join('');
1733
1813
  const contentWidth = segments.reduce((sum, t) => sum + t.width, 0);
1734
- const justifiedSpaceRatio = computeJustifiedSpaceRatio(segments, lineMaxWidth, normalSpaceWidth, textAlign, isLastLine);
1814
+ // A tabbed line is set as measured: its widths are final.
1815
+ const justifiedSpaceRatio = lineTabbed ? undefined : computeJustifiedSpaceRatio(segments, lineMaxWidth, normalSpaceWidth, textAlign, isLastLine);
1735
1816
  lines.push({
1736
1817
  text: lineText,
1737
1818
  bbox: createBoundingBox(lineIndent, y, contentWidth, lineHeightPx),
@@ -1743,6 +1824,7 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1743
1824
  isLastLine,
1744
1825
  ...(justifiedSpaceRatio !== undefined ? { justifiedSpaceRatio } : {}),
1745
1826
  ...(lineWordOverflow ? { wordOverflow: true } : {}),
1827
+ ...(lineTabbed ? { tabbed: true, ...(textAlign === 'justify' ? { ragged: true } : {}) } : {}),
1746
1828
  });
1747
1829
  y += lineHeightPx;
1748
1830
  lineIndex++;
@@ -1756,6 +1838,97 @@ function measureRichText(spans, plainText, normalFont, boldFont, italicFont, bol
1756
1838
  withKashida(lines);
1757
1839
  return { lines, totalHeight: y };
1758
1840
  }
1841
+ /** The text a tab at `at` sends to its stop (#622): the tokens after it up
1842
+ * to the next tab or the paragraph's end, spaces at either end left out. */
1843
+ function tabRun(tokens, at, normalFont, boldFont, italicFont, boldItalicFont, letterSpacingPx) {
1844
+ let from = at + 1;
1845
+ while (from < tokens.length && tokens[from].kind === 'space' && !tokens[from].tab)
1846
+ from++;
1847
+ let to = from;
1848
+ while (to < tokens.length && !tokens[to].tab)
1849
+ to++;
1850
+ while (to > from && tokens[to - 1].kind === 'space')
1851
+ to--;
1852
+ let width = 0;
1853
+ for (let k = from; k < to; k++)
1854
+ width += tokens[k].width;
1855
+ return {
1856
+ width,
1857
+ decimalWidth: (char) => {
1858
+ if (char.length === 0)
1859
+ return undefined;
1860
+ let before = 0;
1861
+ for (let k = from; k < to; k++) {
1862
+ const t = tokens[k];
1863
+ const idx = t.kind === 'text' && !t.mathRender && !t.chip && !t.swatch ? t.text.indexOf(char) : -1;
1864
+ if (idx >= 0) {
1865
+ const head = cleanSoftHyphens(t.text.slice(0, idx));
1866
+ const font = tokenFont(t, normalFont, boldFont, italicFont, boldItalicFont);
1867
+ return before + textWidth(head, font, t.smallCaps) + (letterSpacingPx === 0 ? 0 : wordLetterSpacing(head, letterSpacingPx) * graphemeCount(head));
1868
+ }
1869
+ before += t.width;
1870
+ }
1871
+ return undefined;
1872
+ },
1873
+ };
1874
+ }
1875
+ /**
1876
+ * The segments of a line holding a tab at its stop (#622): each tab with a
1877
+ * leader becomes the tab's space up to the leader, the leader (`leader`,
1878
+ * no character of the text) and the gap after it (an empty space). In a
1879
+ * justified paragraph the word spaces after the line's last tab take the
1880
+ * slack, the line not being the paragraph's last (the renderers set the
1881
+ * line as it is: it is `ragged`); in a centred or right-aligned one an empty
1882
+ * space fills the line to its measure, so it is set from its start side as
1883
+ * its stops are.
1884
+ */
1885
+ function setTabbedLine(segments, lineTokens, lineMaxWidth, textAlign, isLastLine) {
1886
+ const out = [];
1887
+ let lastTab = -1;
1888
+ segments.forEach((seg, i) => {
1889
+ const token = lineTokens[i];
1890
+ if (token?.tab)
1891
+ lastTab = out.length;
1892
+ const placed = token?.tabPlaced;
1893
+ const leader = token?.tabLeader;
1894
+ const tabSeg = placed ? { ...seg, tab: { align: placed.align, at: placed.at } } : seg;
1895
+ if (!token?.tab || !leader) {
1896
+ out.push(tabSeg);
1897
+ return;
1898
+ }
1899
+ out.push({ ...tabSeg, width: Math.max(0, leader.end - leader.width) });
1900
+ out.push({ kind: 'text', text: leader.text, width: leader.width, leader: leader.rule ? 'rule' : 'text' });
1901
+ const after = seg.width - leader.end;
1902
+ if (after > 0)
1903
+ out.push({ kind: 'space', text: '', width: after, labelTab: true });
1904
+ lastTab = out.length - 1;
1905
+ });
1906
+ const natural = out.reduce((sum, seg) => sum + seg.width, 0);
1907
+ const slack = lineMaxWidth - natural;
1908
+ if (slack > 0.01 && textAlign === 'justify' && !isLastLine) {
1909
+ const spaces = out.map((seg, k) => (k > lastTab && seg.kind === 'space' && !seg.labelTab ? k : -1)).filter((k) => k >= 0);
1910
+ if (spaces.length > 0) {
1911
+ const share = slack / spaces.length;
1912
+ for (const k of spaces)
1913
+ out[k] = { ...out[k], width: out[k].width + share };
1914
+ }
1915
+ }
1916
+ else if (slack > 0.01 && (textAlign === 'center' || textAlign === 'right')) {
1917
+ out.push({ kind: 'space', text: '', width: slack, labelTab: true });
1918
+ }
1919
+ return out;
1920
+ }
1921
+ /** `spans` with their tabs (#622) set as word spaces: vertical text, and a
1922
+ * paragraph the CJK composer sets for its ruby, warichu or kanbun marks. */
1923
+ export function tabsAsSpaces(spans) {
1924
+ return spans.map((s) => {
1925
+ if (!s.tab)
1926
+ return s;
1927
+ const { tab: _tab, ...rest } = s;
1928
+ void _tab;
1929
+ return { ...rest, text: ' ' };
1930
+ });
1931
+ }
1759
1932
  /** Give each Arabic word of a justified paragraph its kashida capacity
1760
1933
  * (`RichToken.kashida`), which Knuth–Plass counts as the stretch of its
1761
1934
  * box. A word in pieces (styled runs of a Latin word, a reference label, a