postext-pdf 1.28.6 → 1.29.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 (61) hide show
  1. package/dist/__tests__/japaneseShaping.test.js +30 -11
  2. package/dist/__tests__/japaneseShaping.test.js.map +1 -1
  3. package/dist/__tests__/otLanguages.test.d.ts +2 -0
  4. package/dist/__tests__/otLanguages.test.d.ts.map +1 -0
  5. package/dist/__tests__/otLanguages.test.js +105 -0
  6. package/dist/__tests__/otLanguages.test.js.map +1 -0
  7. package/dist/__tests__/scriptContextHan.test.js +19 -7
  8. package/dist/__tests__/scriptContextHan.test.js.map +1 -1
  9. package/dist/__tests__/shapingLanguage.test.d.ts +2 -0
  10. package/dist/__tests__/shapingLanguage.test.d.ts.map +1 -0
  11. package/dist/__tests__/shapingLanguage.test.js +329 -0
  12. package/dist/__tests__/shapingLanguage.test.js.map +1 -0
  13. package/dist/__tests__/shapingLanguageDocument.test.d.ts +2 -0
  14. package/dist/__tests__/shapingLanguageDocument.test.d.ts.map +1 -0
  15. package/dist/__tests__/shapingLanguageDocument.test.js +237 -0
  16. package/dist/__tests__/shapingLanguageDocument.test.js.map +1 -0
  17. package/dist/__tests__/taskBox.test.d.ts +2 -0
  18. package/dist/__tests__/taskBox.test.d.ts.map +1 -0
  19. package/dist/__tests__/taskBox.test.js +137 -0
  20. package/dist/__tests__/taskBox.test.js.map +1 -0
  21. package/dist/fontCache.d.ts.map +1 -1
  22. package/dist/fontCache.js +2 -1
  23. package/dist/fontCache.js.map +1 -1
  24. package/dist/harfbuzz.d.ts +5 -0
  25. package/dist/harfbuzz.d.ts.map +1 -1
  26. package/dist/harfbuzz.js +10 -0
  27. package/dist/harfbuzz.js.map +1 -1
  28. package/dist/otLanguageData.d.ts +12 -0
  29. package/dist/otLanguageData.d.ts.map +1 -0
  30. package/dist/otLanguageData.js +91 -0
  31. package/dist/otLanguageData.js.map +1 -0
  32. package/dist/otLanguages.d.ts +16 -0
  33. package/dist/otLanguages.d.ts.map +1 -0
  34. package/dist/otLanguages.js +111 -0
  35. package/dist/otLanguages.js.map +1 -0
  36. package/dist/pdf-backend/blockRender.d.ts.map +1 -1
  37. package/dist/pdf-backend/blockRender.js +22 -11
  38. package/dist/pdf-backend/blockRender.js.map +1 -1
  39. package/dist/pdf-backend/index.d.ts.map +1 -1
  40. package/dist/pdf-backend/index.js +9 -6
  41. package/dist/pdf-backend/index.js.map +1 -1
  42. package/dist/pdf-backend/primitives.js +1 -1
  43. package/dist/pdf-backend/primitives.js.map +1 -1
  44. package/dist/pdf-backend/renderResourceBlock.d.ts.map +1 -1
  45. package/dist/pdf-backend/renderResourceBlock.js +42 -37
  46. package/dist/pdf-backend/renderResourceBlock.js.map +1 -1
  47. package/dist/pdf-backend/shapedText.d.ts.map +1 -1
  48. package/dist/pdf-backend/shapedText.js +24 -14
  49. package/dist/pdf-backend/shapedText.js.map +1 -1
  50. package/dist/pdf-backend/structureFlow.d.ts.map +1 -1
  51. package/dist/pdf-backend/structureFlow.js +4 -0
  52. package/dist/pdf-backend/structureFlow.js.map +1 -1
  53. package/dist/pdf-backend/taskBox.d.ts +15 -0
  54. package/dist/pdf-backend/taskBox.d.ts.map +1 -0
  55. package/dist/pdf-backend/taskBox.js +46 -0
  56. package/dist/pdf-backend/taskBox.js.map +1 -0
  57. package/dist/shapingLanguage.d.ts +59 -19
  58. package/dist/shapingLanguage.d.ts.map +1 -1
  59. package/dist/shapingLanguage.js +286 -60
  60. package/dist/shapingLanguage.js.map +1 -1
  61. package/package.json +3 -3
@@ -1,50 +1,83 @@
1
1
  /**
2
- * The OpenType language system text is shaped in (#427).
2
+ * The language and the script text is shaped in (#427, #725, #764).
3
3
  *
4
- * One Unicode code point of Han, of the CJK punctuation or of the quotes
5
- * has several regional shapes, and a pan-CJK face (Source Han, Noto CJK)
6
- * holds them all: its `locl` feature picks the Japanese ones under the
7
- * language system `JAN `. The browser selects it from the document's
8
- * `lang` (the canvas's `ctx.lang`, the HTML's `lang`), so the layout was
9
- * measured, and the screen painted, with the Japanese forms; fontkit's
10
- * `layout()` shapes in the font's default language unless it is told
11
- * otherwise, and a PDF of the same page printed Chinese forms. Noto Serif
12
- * JP keeps its default forms Japanese but still sets “ ” and the ASCII
13
- * quotes of Japanese text in their `JAN ` forms.
4
+ * A font draws some characters otherwise by language (`locl`): a pan-CJK
5
+ * face holds the regional shapes of Han and of the CJK punctuation, Noto
6
+ * Serif SC sets its digits and its ASCII quotes otherwise in Chinese, a
7
+ * Latin face has a Catalan `l·l`, a Turkish `i` that keeps `fi` apart, a
8
+ * Romanian `ș`. The browser that measured the layout was told the language
9
+ * (`ctx.lang`, which the engine sets to the document's, and to a run's own
10
+ * where it names one) and handed it to HarfBuzz; so the PDF shapes each
11
+ * text in the language it was measured in, with both its shapers:
14
12
  *
15
- * Every face pdf-lib embeds through fontkit is made to shape in the
16
- * language in force ({@link shapeInCurrentLanguage}), which the page
17
- * painter sets from the document's language for each page and a line
18
- * from a segment's own (`VDTLineSegment.lang`): `JAN ` for Japanese
19
- * ({@link openTypeLanguageOf}), none for any other language, so Chinese,
20
- * Korean, Latin and Arabic text is shaped exactly as before. Pages are
21
- * painted synchronously, so the language in force is the page's.
13
+ * - HarfBuzz (`shapedText.ts`) takes the BCP 47 tag, as the browser's did;
14
+ * - fontkit, which pdf-lib embeds every face through and which sets the
15
+ * plain left-to-right text, takes an OpenType language tag: the first of
16
+ * the language's tags (`otLanguages.ts`, HarfBuzz's own table) that the
17
+ * script of the text has in the font, which is the one HarfBuzz takes.
22
18
  *
23
- * The script in force (#725) works the same way, for one word at a time:
24
- * a word with no letter (`46.`, `1367)`) that the layout measured in the
25
- * script of the text around it (`VDTLineSegment.scriptContext`) is shaped
26
- * in that script ({@link withShapingScript}), where fontkit would read no
27
- * script from its characters and take the font's default. Amiri sets the
28
- * Latin full stop and brackets under `latn` only: without it the PDF
29
- * printed Arabic ones in a Latin note, wider than the places measured.
19
+ * The page painter sets the language in force from the document for each
20
+ * page ({@link withDocumentLanguage}) and a line from a segment's own
21
+ * (`VDTLineSegment.lang`, {@link withSegmentLanguage}). Pages are painted
22
+ * synchronously, so the language in force is the page's.
23
+ *
24
+ * A document that keeps the host's language (`bodyText.shapingLanguage:
25
+ * 'host'`, every configuration stored before `configVersion` 13) is
26
+ * shaped as postext-pdf shaped up to 1.28, so it prints the same bytes:
27
+ * `JAN ` through fontkit for Japanese, with punctuation alone shaped as
28
+ * Han, and no language at all for any other document or through HarfBuzz.
29
+ *
30
+ * The script: a browser's canvas shapes a string with no character above
31
+ * U+00FF as Latin text whatever it holds (Chrome keeps such a string in
32
+ * eight bits, and skips the search for its scripts), so `2026` or `"`
33
+ * measured alone took the Latin forms of the face in the language, where a
34
+ * shaper left to itself reads no script from them and takes the font's
35
+ * default. Text shaped in a document's language follows the canvas
36
+ * ({@link shapingScriptOf}). Any other text with no letter (`……`, `—`)
37
+ * was measured in the default script, by the canvas and by both shapers.
38
+ *
39
+ * The script in force (#725) is for one word at a time: a word with no
40
+ * letter (`46.`, `1367)`) that the layout measured in the script of the
41
+ * text around it (`VDTLineSegment.scriptContext`) is shaped in that script
42
+ * ({@link withShapingScript}). Amiri sets the Latin full stop and brackets
43
+ * under `latn` only: without it the PDF printed Arabic ones in a Latin
44
+ * note, wider than the places measured.
45
+ *
46
+ * Han is the exception, in a document's language: the layout measured the
47
+ * word beside an ideograph, and Chrome's canvas shapes every Han character
48
+ * of a string apart from what stands beside it, so the word was shaped
49
+ * with no script at all (`——` beside 一 is 1.69 em wide in Noto Serif SC
50
+ * in Chinese, and 2 em in a Han run, where the Chinese forms apply). It is
51
+ * shaped in the default script, in the language, whatever it holds.
30
52
  */
31
- import { isJapaneseLanguage } from 'postext';
32
- let current;
33
- /** The OpenType language system fontkit shapes a language's text in:
34
- * `JAN` (fontkit pads it to `JAN `) for Japanese; undefined, the font's
35
- * default, for every other language. */
36
- export function openTypeLanguageOf(tag) {
37
- return isJapaneseLanguage(tag) ? 'JAN' : undefined;
38
- }
39
- /** The language system text is shaped in now (undefined: the font's
40
- * default). */
41
- export function shapingLanguage() {
42
- return current;
53
+ import { isJapaneseLanguage, shapingTagOf } from 'postext';
54
+ import { openTypeLanguagesOf } from './otLanguages';
55
+ /** Japanese in a document that keeps the host's language. */
56
+ const HOST_JAPANESE = { tag: undefined, openType: ['JAN'], host: true, key: 'JAN' };
57
+ const languages = new Map();
58
+ /** Languages kept before the map is emptied (a document names a handful). */
59
+ const LANGUAGE_SLOTS = 200;
60
+ /** The language of the BCP 47 tag `tag` (`''`: none, the forms of no
61
+ * language), for a document shaped in its own. */
62
+ function languageOf(tag) {
63
+ let language = languages.get(tag);
64
+ if (!language) {
65
+ language = { tag, openType: openTypeLanguagesOf(tag), host: false, key: `\u0002${tag}` };
66
+ if (languages.size >= LANGUAGE_SLOTS)
67
+ languages.clear();
68
+ languages.set(tag, language);
69
+ }
70
+ return language;
43
71
  }
44
- /** Run `fn` with text shaped in `language` (see {@link
45
- * openTypeLanguageOf}), then put back the language in force before, also
46
- * when `fn` throws. */
47
- export function withShapingLanguage(language, fn) {
72
+ /** What a document in the host's language shapes a language's text in:
73
+ * `JAN ` for Japanese, nothing for any other. */
74
+ function hostLanguageOf(tag) {
75
+ return isJapaneseLanguage(tag) ? HOST_JAPANESE : undefined;
76
+ }
77
+ let current;
78
+ /** Whether the page being painted keeps the host's language. */
79
+ let hostPage = false;
80
+ function withLanguage(language, fn) {
48
81
  if (language === current)
49
82
  return fn();
50
83
  const previous = current;
@@ -56,6 +89,59 @@ export function withShapingLanguage(language, fn) {
56
89
  current = previous;
57
90
  }
58
91
  }
92
+ /** The BCP 47 tag of the language text is shaped in now, for HarfBuzz
93
+ * (`''`: shaped as a document's text, in no language); undefined with no
94
+ * language in force. */
95
+ export function shapingLanguage() {
96
+ return current?.tag;
97
+ }
98
+ /** Run `fn` with text shaped in the language of the BCP 47 tag `language`
99
+ * (`''`: as a document's text in no language; undefined: no language in
100
+ * force, each shaper left to itself), then put back the language in force
101
+ * before, also when `fn` throws. */
102
+ export function withShapingLanguage(language, fn) {
103
+ return withLanguage(language === undefined ? undefined : languageOf(language), fn);
104
+ }
105
+ /**
106
+ * Run `fn` (the painting of a page) with text shaped in its document's
107
+ * language: `shaping` is the tag the layout measured in
108
+ * (`shapingLanguageOf(config)` of postext), or undefined for a document
109
+ * that keeps the host's language, which is then shaped as before from the
110
+ * tag it declares (`declared`, its `/Lang`).
111
+ */
112
+ export function withDocumentLanguage(shaping, declared, fn) {
113
+ const host = shaping === undefined;
114
+ const previous = hostPage;
115
+ hostPage = host;
116
+ try {
117
+ return withLanguage(host ? hostLanguageOf(declared) : languageOf(shaping), fn);
118
+ }
119
+ finally {
120
+ hostPage = previous;
121
+ }
122
+ }
123
+ /** Whether a segment that names its language (`VDTLineSegment.lang`) is
124
+ * shaped in it wherever it stands: in a document shaped in its own
125
+ * language. One that keeps the host's did so on the lines of the CJK
126
+ * composer only. */
127
+ export function shapesSegmentLanguages() {
128
+ return !hostPage;
129
+ }
130
+ /**
131
+ * Run `fn` (the painting of a segment) with text shaped in the segment's
132
+ * own language `lang` (`VDTLineSegment.lang`, as written), in the
133
+ * language in force when it names none. In a document that keeps the
134
+ * host's language a segment is shaped as it was: with `asBefore`, in `JAN `
135
+ * when its language is Japanese and in the font's default otherwise (the
136
+ * text of the body); without it, in the language in force.
137
+ */
138
+ export function withSegmentLanguage(lang, fn, asBefore = false) {
139
+ if (lang === undefined)
140
+ return fn();
141
+ if (hostPage)
142
+ return asBefore ? withLanguage(hostLanguageOf(lang), fn) : fn();
143
+ return withLanguage(languageOf(shapingTagOf(lang)), fn);
144
+ }
59
145
  /** The scripts a word with no letter may be shaped in (ISO 15924, as
60
146
  * `VDTLineSegment.scriptContext` names them) and their OpenType tags. */
61
147
  const OPENTYPE_SCRIPT = { Latn: 'latn', Grek: 'grek', Cyrl: 'cyrl', Arab: 'arab', Hebr: 'hebr', Hani: 'hani' };
@@ -88,30 +174,161 @@ export function withShapingScript(script, fn) {
88
174
  currentScript = previous;
89
175
  }
90
176
  }
91
- /** The key a cache of shaped `text` holds it under: the text itself in
92
- * the default language and script (as every cache did), else tagged with
93
- * the language and the script it was shaped in. */
177
+ /** Text a browser keeps in eight bits: no character above U+00FF. */
178
+ const LATIN_1_RE = /^[\u0000-\u00FF]*$/;
179
+ /** Whether text is shaped as the canvas shaped it (see the module
180
+ * comment): the text of a document shaped in its own language. */
181
+ function shapedAsCanvas() {
182
+ return current !== undefined && !current.host;
183
+ }
184
+ /**
185
+ * The script (ISO 15924) `text` is shaped in, undefined for the one the
186
+ * shaper reads from the text (the default script, for text with no
187
+ * letter). The script in force; else, and for a word the layout measured
188
+ * beside an ideograph, as the canvas shaped the text of a document in its
189
+ * own language: Latin with no character above U+00FF, no script beside an
190
+ * ideograph. For HarfBuzz; fontkit is told the same
191
+ * ({@link shapeInCurrentLanguage}).
192
+ */
193
+ export function shapingScriptOf(text) {
194
+ if (!shapedAsCanvas())
195
+ return currentScript;
196
+ if (currentScript === 'Hani')
197
+ return undefined;
198
+ return currentScript ?? (LATIN_1_RE.test(text) ? 'Latn' : undefined);
199
+ }
200
+ /** The key a cache of shaped `text` holds it under: the text itself with
201
+ * no language and no script in force (as every cache did), else tagged
202
+ * with the language and the script it was shaped in. */
94
203
  export function shapingKey(text) {
95
204
  if (currentScript !== undefined)
96
- return `${currentScript}\u0001${current ?? ''}\u0000${text}`;
97
- return current === undefined ? text : `${current}\u0000${text}`;
205
+ return `${currentScript}\u0001${current?.key ?? ''}\u0000${text}`;
206
+ return current === undefined ? text : `${current.key}\u0000${text}`;
98
207
  }
99
208
  /** Text with a character of a script of its own (Han, kana, Latin…), from
100
209
  * which fontkit reads the script to shape in; punctuation and symbols
101
210
  * alone (「。」, “, ー) have none. */
102
211
  const STRONG_SCRIPT_RE = /[^\p{Script=Common}\p{Script=Inherited}]/u;
212
+ /** The scripts fontkit falls back to when a font lacks the one asked for
213
+ * (as HarfBuzz does). */
214
+ const DEFAULT_SCRIPTS = ['DFLT', 'dflt', 'latn'];
215
+ /** The OpenType script tags of no script: what fontkit reads from text
216
+ * with no letter. */
217
+ const NO_SCRIPT = [];
218
+ /** The OpenType script tags fontkit reads from each character (the first
219
+ * of a text that has a script decides): asked of fontkit once each. */
220
+ const scriptsByCodePoint = new Map();
221
+ const SCRIPT_SLOTS = 4096;
222
+ /** The OpenType script tags fontkit shapes `text` in when it is told
223
+ * none: those of its first character with a script (`['latn']`,
224
+ * `['dev2', 'deva']`), none for text with no such character. */
225
+ function scriptsOfText(layout, text) {
226
+ const strong = STRONG_SCRIPT_RE.exec(text);
227
+ if (!strong)
228
+ return NO_SCRIPT;
229
+ const cp = text.codePointAt(strong.index);
230
+ let scripts = scriptsByCodePoint.get(cp);
231
+ if (scripts === undefined) {
232
+ const read = layout(String.fromCodePoint(cp), [])?.script;
233
+ scripts = read === undefined ? NO_SCRIPT : Array.isArray(read) ? read : [read];
234
+ if (scriptsByCodePoint.size >= SCRIPT_SLOTS)
235
+ scriptsByCodePoint.clear();
236
+ scriptsByCodePoint.set(cp, scripts);
237
+ }
238
+ return scripts;
239
+ }
240
+ /** The script of `table` text in `scripts` is shaped with: the first of
241
+ * them the table has, else the first default script it has (fontkit's
242
+ * `selectScript`, and HarfBuzz's). */
243
+ function scriptEntry(table, scripts) {
244
+ const list = table?.scriptList;
245
+ if (!list)
246
+ return undefined;
247
+ for (const tags of [scripts, DEFAULT_SCRIPTS]) {
248
+ for (const tag of tags) {
249
+ const entry = list.find((e) => e.tag === tag);
250
+ if (entry)
251
+ return entry;
252
+ }
253
+ }
254
+ return undefined;
255
+ }
256
+ function hasLanguage(entry, tag) {
257
+ const padded = tag.padEnd(4, ' ');
258
+ return entry?.script?.langSysRecords?.some((record) => record.tag === padded) ?? false;
259
+ }
260
+ /** Whether a face has a language system for any of some tags, under any
261
+ * script: by face, then by the tags. Most faces have none for most
262
+ * languages, and their text is then shaped with no more ado. */
263
+ const facesWithLanguage = new WeakMap();
264
+ /** The language system of a face for a language and a script. */
265
+ const systemsByFace = new WeakMap();
266
+ function faceHasAnyLanguage(face, language) {
267
+ let known = facesWithLanguage.get(face);
268
+ if (!known) {
269
+ known = new Map();
270
+ facesWithLanguage.set(face, known);
271
+ }
272
+ let has = known.get(language.key);
273
+ if (has === undefined) {
274
+ const tags = [...language.openType, 'dflt'];
275
+ has = [face.GSUB, face.GPOS].some((table) => table?.scriptList?.some((entry) => tags.some((tag) => hasLanguage(entry, tag))) ?? false);
276
+ known.set(language.key, has);
277
+ }
278
+ return has;
279
+ }
280
+ /**
281
+ * The OpenType language tag fontkit is told for text of `language` shaped
282
+ * in `scripts` (OpenType script tags, none for the default script) with
283
+ * `face`: the first of the language's tags that the script has in the
284
+ * font's `GSUB`, else in its `GPOS`; else `dflt` where the script names a
285
+ * language system so (HarfBuzz takes it before the default one);
286
+ * undefined, the script's default language system, when it has none.
287
+ * HarfBuzz chooses in each table apart; a font whose two tables answer a
288
+ * language with different systems is shaped here in the `GSUB` one.
289
+ */
290
+ function languageSystem(face, scripts, language) {
291
+ if (language.openType.length === 0 || !faceHasAnyLanguage(face, language))
292
+ return undefined;
293
+ let known = systemsByFace.get(face);
294
+ if (!known) {
295
+ known = new Map();
296
+ systemsByFace.set(face, known);
297
+ }
298
+ const key = `${language.key}\u0000${scripts.join(',')}`;
299
+ if (known.has(key))
300
+ return known.get(key);
301
+ const entries = [scriptEntry(face.GSUB, scripts), scriptEntry(face.GPOS, scripts)];
302
+ let system;
303
+ for (const entry of entries)
304
+ system ??= language.openType.find((tag) => hasLanguage(entry, tag));
305
+ for (const entry of entries)
306
+ system ??= hasLanguage(entry, 'dflt') ? 'dflt' : undefined;
307
+ known.set(key, system);
308
+ return system;
309
+ }
103
310
  const shaped = new WeakSet();
104
311
  /**
105
312
  * Make the fontkit face of `font` shape in the language in force when a
106
313
  * caller names none: pdf-lib's encoding and widths, the kerning of
107
314
  * `showTextShaped` and the vertical twin all call `layout()` without one.
108
- * Text of punctuation alone is shaped as Han under a language (fontkit
109
- * would read no script from it, and take the default script, which has no
110
- * language systems), as a browser shapes it with the Japanese text around
111
- * it. With a script in force the text is shaped in it, left to right
112
- * (fontkit would take the direction from the script and set `1367` in an
113
- * Arabic sentence backwards; a right-to-left word is HarfBuzz's). With
114
- * neither in force the call is the one it always was.
315
+ *
316
+ * Text of a document shaped in its own language is told the language
317
+ * system of that language for the script it is shaped in
318
+ * ({@link languageSystem}): the script in force (the default one for a
319
+ * word measured beside an ideograph), else Latin for text with no
320
+ * character above U+00FF, else the one fontkit reads from the text
321
+ * ({@link shapingScriptOf}).
322
+ *
323
+ * Text of a Japanese document that keeps the host's language is told
324
+ * `JAN `, and punctuation alone is shaped as Han under it (fontkit would
325
+ * read no script from it, and take the default script, which has no
326
+ * language systems), as up to postext-pdf 1.28.
327
+ *
328
+ * With a script in force the text is shaped in it, left to right (fontkit
329
+ * would take the direction from the script and set `1367` in an Arabic
330
+ * sentence backwards; a right-to-left word is HarfBuzz's). With neither a
331
+ * language nor a script in force the call is the one it always was.
115
332
  */
116
333
  export function shapeInCurrentLanguage(font) {
117
334
  const face = font.embedder?.font;
@@ -119,13 +336,22 @@ export function shapeInCurrentLanguage(font) {
119
336
  return;
120
337
  const layout = face.layout.bind(face);
121
338
  face.layout = (text, features, script, language, direction) => {
122
- const lang = language ?? current;
123
- if (script === undefined && currentScript !== undefined)
124
- return layout(text, features, OPENTYPE_SCRIPT[currentScript], lang, direction ?? 'ltr');
125
- if (lang === undefined)
126
- return layout(text, features, script, language, direction);
127
- const scriptTag = script ?? (typeof text === 'string' && !STRONG_SCRIPT_RE.test(text) ? 'hani' : undefined);
128
- return layout(text, features, scriptTag, lang, direction);
339
+ const inForce = script === undefined && currentScript !== undefined ? OPENTYPE_SCRIPT[currentScript] : undefined;
340
+ const state = current;
341
+ if (state === undefined || state.host || language !== undefined || typeof text !== 'string') {
342
+ const lang = language ?? (state?.host ? state.openType[0] : undefined);
343
+ if (inForce !== undefined)
344
+ return layout(text, features, inForce, lang, direction ?? 'ltr');
345
+ if (lang === undefined)
346
+ return layout(text, features, script, language, direction);
347
+ const scriptTag = script ?? (typeof text === 'string' && !STRONG_SCRIPT_RE.test(text) ? 'hani' : undefined);
348
+ return layout(text, features, scriptTag, lang, direction);
349
+ }
350
+ // `DFLT`: the default script, which fontkit also takes for a script
351
+ // the font lacks.
352
+ const scriptTag = inForce === 'hani' ? 'DFLT' : inForce ?? script ?? (LATIN_1_RE.test(text) ? 'latn' : undefined);
353
+ const system = languageSystem(face, scriptTag !== undefined ? [scriptTag] : scriptsOfText(layout, text), state);
354
+ return layout(text, features, scriptTag, system, inForce !== undefined ? direction ?? 'ltr' : direction);
129
355
  };
130
356
  shaped.add(face);
131
357
  }
@@ -1 +1 @@
1
- {"version":3,"file":"shapingLanguage.js","sourceRoot":"","sources":["../src/shapingLanguage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C,IAAI,OAA2B,CAAC;AAEhC;;yCAEyC;AACzC,MAAM,UAAU,kBAAkB,CAAC,GAAuB;IACxD,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC;AAED;gBACgB;AAChB,MAAM,UAAU,eAAe;IAC7B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;wBAEwB;AACxB,MAAM,UAAU,mBAAmB,CAAI,QAA4B,EAAE,EAAW;IAC9E,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,EAAE,EAAE,CAAC;IACtC,MAAM,QAAQ,GAAG,OAAO,CAAC;IACzB,OAAO,GAAG,QAAQ,CAAC;IACnB,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;YAAS,CAAC;QACT,OAAO,GAAG,QAAQ,CAAC;IACrB,CAAC;AACH,CAAC;AAED;0EAC0E;AAC1E,MAAM,eAAe,GAAqC,EAAE,IAA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 -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postext-pdf",
3
- "version": "1.28.6",
3
+ "version": "1.29.0",
4
4
  "description": "Browser-native PDF renderer for Postext documents. Consumes the same VDT as the canvas/HTML backends and produces a physical PDF with faithful glyph positioning, justification, crop marks, and baseline grid.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "./package.json": "./package.json"
41
41
  },
42
42
  "peerDependencies": {
43
- "postext": "^1.28.6"
43
+ "postext": "^1.29.0"
44
44
  },
45
45
  "dependencies": {
46
46
  "@pdf-lib/fontkit": "^1.1.1",
@@ -54,7 +54,7 @@
54
54
  "@types/node": "^26.5.0",
55
55
  "eslint": "^9.39.4",
56
56
  "harfbuzzjs": "1.6.2",
57
- "postext": "1.28.6",
57
+ "postext": "1.29.0",
58
58
  "typescript": "^6.0.3",
59
59
  "typescript-eslint": "^8.70.0",
60
60
  "vitest": "^5.0.0"