postext 1.20.2 → 1.21.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 (185) hide show
  1. package/dist/__tests__/color.test.d.ts +2 -0
  2. package/dist/__tests__/color.test.d.ts.map +1 -0
  3. package/dist/__tests__/color.test.js +110 -0
  4. package/dist/__tests__/color.test.js.map +1 -0
  5. package/dist/__tests__/comics/build.test.js +4 -3
  6. package/dist/__tests__/comics/build.test.js.map +1 -1
  7. package/dist/__tests__/comics/canvas.test.js +21 -2
  8. package/dist/__tests__/comics/canvas.test.js.map +1 -1
  9. package/dist/__tests__/comics/config.test.js +62 -0
  10. package/dist/__tests__/comics/config.test.js.map +1 -1
  11. package/dist/__tests__/comics/geometry.test.js +9 -2
  12. package/dist/__tests__/comics/geometry.test.js.map +1 -1
  13. package/dist/__tests__/comics/html.test.js +31 -0
  14. package/dist/__tests__/comics/html.test.js.map +1 -1
  15. package/dist/__tests__/comics/readingDirection.test.d.ts +2 -0
  16. package/dist/__tests__/comics/readingDirection.test.d.ts.map +1 -0
  17. package/dist/__tests__/comics/readingDirection.test.js +95 -0
  18. package/dist/__tests__/comics/readingDirection.test.js.map +1 -0
  19. package/dist/__tests__/comics/skew.test.d.ts +2 -0
  20. package/dist/__tests__/comics/skew.test.d.ts.map +1 -0
  21. package/dist/__tests__/comics/skew.test.js +57 -0
  22. package/dist/__tests__/comics/skew.test.js.map +1 -0
  23. package/dist/__tests__/comics/strip.test.js +186 -6
  24. package/dist/__tests__/comics/strip.test.js.map +1 -1
  25. package/dist/__tests__/exports.test.js +43 -0
  26. package/dist/__tests__/exports.test.js.map +1 -1
  27. package/dist/__tests__/pipeline/resourceNumbering.test.js +33 -1
  28. package/dist/__tests__/pipeline/resourceNumbering.test.js.map +1 -1
  29. package/dist/__tests__/preflight.test.d.ts +2 -0
  30. package/dist/__tests__/preflight.test.d.ts.map +1 -0
  31. package/dist/__tests__/preflight.test.js +115 -0
  32. package/dist/__tests__/preflight.test.js.map +1 -0
  33. package/dist/__tests__/printConfig.test.d.ts +2 -0
  34. package/dist/__tests__/printConfig.test.d.ts.map +1 -0
  35. package/dist/__tests__/printConfig.test.js +44 -0
  36. package/dist/__tests__/printConfig.test.js.map +1 -0
  37. package/dist/canvas-backend/blockRender.d.ts.map +1 -1
  38. package/dist/canvas-backend/blockRender.js +36 -1
  39. package/dist/canvas-backend/blockRender.js.map +1 -1
  40. package/dist/canvas-backend/comic.d.ts +2 -1
  41. package/dist/canvas-backend/comic.d.ts.map +1 -1
  42. package/dist/canvas-backend/comic.js +6 -9
  43. package/dist/canvas-backend/comic.js.map +1 -1
  44. package/dist/color/authored.d.ts +9 -0
  45. package/dist/color/authored.d.ts.map +1 -0
  46. package/dist/color/authored.js +31 -0
  47. package/dist/color/authored.js.map +1 -0
  48. package/dist/color/catalogue.d.ts +29 -0
  49. package/dist/color/catalogue.d.ts.map +1 -0
  50. package/dist/color/catalogue.js +52 -0
  51. package/dist/color/catalogue.js.map +1 -0
  52. package/dist/color/icc.d.ts +68 -0
  53. package/dist/color/icc.d.ts.map +1 -0
  54. package/dist/color/icc.js +533 -0
  55. package/dist/color/icc.js.map +1 -0
  56. package/dist/color/index.d.ts +6 -0
  57. package/dist/color/index.d.ts.map +1 -0
  58. package/dist/color/index.js +6 -0
  59. package/dist/color/index.js.map +1 -0
  60. package/dist/color/srgbProfile.d.ts +8 -0
  61. package/dist/color/srgbProfile.d.ts.map +1 -0
  62. package/dist/color/srgbProfile.js +86 -0
  63. package/dist/color/srgbProfile.js.map +1 -0
  64. package/dist/color/transform.d.ts +73 -0
  65. package/dist/color/transform.d.ts.map +1 -0
  66. package/dist/color/transform.js +329 -0
  67. package/dist/color/transform.js.map +1 -0
  68. package/dist/comics/index.d.ts +3 -3
  69. package/dist/comics/index.d.ts.map +1 -1
  70. package/dist/comics/index.js +2 -2
  71. package/dist/comics/index.js.map +1 -1
  72. package/dist/comics/layoutPage.d.ts +8 -4
  73. package/dist/comics/layoutPage.d.ts.map +1 -1
  74. package/dist/comics/layoutPage.js +17 -9
  75. package/dist/comics/layoutPage.js.map +1 -1
  76. package/dist/comics/lettering/__tests__/letterPanel.test.js +19 -9
  77. package/dist/comics/lettering/__tests__/letterPanel.test.js.map +1 -1
  78. package/dist/comics/lettering/letter.js +13 -7
  79. package/dist/comics/lettering/letter.js.map +1 -1
  80. package/dist/comics/lettering/placement.d.ts +2 -0
  81. package/dist/comics/lettering/placement.d.ts.map +1 -1
  82. package/dist/comics/lettering/placement.js.map +1 -1
  83. package/dist/comics/lettering/types.d.ts +5 -0
  84. package/dist/comics/lettering/types.d.ts.map +1 -1
  85. package/dist/comics/paint.d.ts +6 -0
  86. package/dist/comics/paint.d.ts.map +1 -1
  87. package/dist/comics/paint.js +23 -0
  88. package/dist/comics/paint.js.map +1 -1
  89. package/dist/comics/script.d.ts.map +1 -1
  90. package/dist/comics/script.js +4 -1
  91. package/dist/comics/script.js.map +1 -1
  92. package/dist/comics/strip.d.ts +50 -3
  93. package/dist/comics/strip.d.ts.map +1 -1
  94. package/dist/comics/strip.js +55 -5
  95. package/dist/comics/strip.js.map +1 -1
  96. package/dist/comics/types.d.ts +3 -0
  97. package/dist/comics/types.d.ts.map +1 -1
  98. package/dist/configWarnings.d.ts +1 -1
  99. package/dist/configWarnings.d.ts.map +1 -1
  100. package/dist/configWarnings.js +93 -4
  101. package/dist/configWarnings.js.map +1 -1
  102. package/dist/defaults/comics.d.ts +48 -1
  103. package/dist/defaults/comics.d.ts.map +1 -1
  104. package/dist/defaults/comics.js +77 -8
  105. package/dist/defaults/comics.js.map +1 -1
  106. package/dist/defaults/index.d.ts +2 -1
  107. package/dist/defaults/index.d.ts.map +1 -1
  108. package/dist/defaults/index.js +10 -1
  109. package/dist/defaults/index.js.map +1 -1
  110. package/dist/defaults/page.d.ts +12 -6
  111. package/dist/defaults/page.d.ts.map +1 -1
  112. package/dist/defaults/page.js +15 -9
  113. package/dist/defaults/page.js.map +1 -1
  114. package/dist/defaults/print.d.ts +13 -0
  115. package/dist/defaults/print.d.ts.map +1 -0
  116. package/dist/defaults/print.js +147 -0
  117. package/dist/defaults/print.js.map +1 -0
  118. package/dist/html-backend.d.ts.map +1 -1
  119. package/dist/html-backend.js +46 -2
  120. package/dist/html-backend.js.map +1 -1
  121. package/dist/htmlComic.d.ts.map +1 -1
  122. package/dist/htmlComic.js +8 -3
  123. package/dist/htmlComic.js.map +1 -1
  124. package/dist/index.d.ts +11 -6
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +6 -3
  127. package/dist/index.js.map +1 -1
  128. package/dist/locale.d.ts +9 -0
  129. package/dist/locale.d.ts.map +1 -1
  130. package/dist/locale.js +11 -0
  131. package/dist/locale.js.map +1 -1
  132. package/dist/pipeline/build.d.ts.map +1 -1
  133. package/dist/pipeline/build.js +211 -36
  134. package/dist/pipeline/build.js.map +1 -1
  135. package/dist/pipeline/calloutLayout.d.ts +5 -0
  136. package/dist/pipeline/calloutLayout.d.ts.map +1 -1
  137. package/dist/pipeline/calloutLayout.js +36 -3
  138. package/dist/pipeline/calloutLayout.js.map +1 -1
  139. package/dist/pipeline/config.d.ts.map +1 -1
  140. package/dist/pipeline/config.js +13 -2
  141. package/dist/pipeline/config.js.map +1 -1
  142. package/dist/pipeline/contentWarnings.d.ts.map +1 -1
  143. package/dist/pipeline/contentWarnings.js +8 -0
  144. package/dist/pipeline/contentWarnings.js.map +1 -1
  145. package/dist/pipeline/crossRefs.d.ts.map +1 -1
  146. package/dist/pipeline/crossRefs.js +2 -1
  147. package/dist/pipeline/crossRefs.js.map +1 -1
  148. package/dist/pipeline/resourceLayout.d.ts +51 -2
  149. package/dist/pipeline/resourceLayout.d.ts.map +1 -1
  150. package/dist/pipeline/resourceLayout.js +96 -51
  151. package/dist/pipeline/resourceLayout.js.map +1 -1
  152. package/dist/pipeline/resourceNumbering.d.ts +5 -0
  153. package/dist/pipeline/resourceNumbering.d.ts.map +1 -1
  154. package/dist/pipeline/resourceNumbering.js +34 -5
  155. package/dist/pipeline/resourceNumbering.js.map +1 -1
  156. package/dist/pipeline/spanEmbeds.d.ts +6 -1
  157. package/dist/pipeline/spanEmbeds.d.ts.map +1 -1
  158. package/dist/pipeline/spanEmbeds.js +18 -3
  159. package/dist/pipeline/spanEmbeds.js.map +1 -1
  160. package/dist/preflight.d.ts +89 -0
  161. package/dist/preflight.d.ts.map +1 -0
  162. package/dist/preflight.js +314 -0
  163. package/dist/preflight.js.map +1 -0
  164. package/dist/types.d.ts +167 -9
  165. package/dist/types.d.ts.map +1 -1
  166. package/dist/vdt.d.ts +47 -5
  167. package/dist/vdt.d.ts.map +1 -1
  168. package/dist/vdt.js.map +1 -1
  169. package/icc/README.md +43 -0
  170. package/icc/fogra27.icc +0 -0
  171. package/icc/fogra28.icc +0 -0
  172. package/icc/fogra29.icc +0 -0
  173. package/icc/fogra30.icc +0 -0
  174. package/icc/fogra39.icc +0 -0
  175. package/icc/fogra40.icc +0 -0
  176. package/icc/fogra45.icc +0 -0
  177. package/icc/fogra47.icc +0 -0
  178. package/icc/fogra51.icc +0 -0
  179. package/icc/fogra52.icc +0 -0
  180. package/icc/gracol2006.icc +0 -0
  181. package/icc/ifra26.icc +0 -0
  182. package/icc/snap2007.icc +0 -0
  183. package/icc/swop3.icc +0 -0
  184. package/icc/swop5.icc +0 -0
  185. package/package.json +4 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAe,mBAAmB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAA+B,WAAW,EAAW,MAAM,OAAO,CAAC;AAC5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKzD,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE,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AAG,QAAQ,GAAG,MAAM,CAAA;CAAE,CACjF,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B;4CACwC;IACxC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B;8DAC0D;IAC1D,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAChC;;qDAEiD;IACjD,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,sEAAsE;IACtE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACrE;wCACoC;IACpC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAqCD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,GAAE,gBAAqB,GAAG,cAAc,EAAE,CA2OpG"}
@@ -0,0 +1,314 @@
1
+ /**
2
+ * Print preflight (#605): what a printer would reject in a laid-out
3
+ * document, found on the VDT so it runs as soon as a page is laid out —
4
+ * the Sandbox shows it in Review, and a Node pipeline can fail a build on
5
+ * it.
6
+ *
7
+ * - Pictures whose effective resolution at their printed size (pixels per
8
+ * inch, crop included) falls under `print.preflight.minImageResolution`
9
+ * (critical under `criticalImageResolution`): figures, table-cell
10
+ * pictures, design images, comic panels.
11
+ * - RGB pictures in a CMYK job (converted on export, or kept RGB by a
12
+ * PDF/X-4 that does not convert them), when the host says which
13
+ * pictures are RGB (`imageColor`).
14
+ * - Rules, borders and strokes thinner than `minRuleWidth`.
15
+ * - Text under `smallTextSize` set with more than one ink.
16
+ * - Colours whose separation exceeds the ink limit.
17
+ * - Text inside the safe zone near the trim, and boxes or pictures that
18
+ * stop short of the trim by less than `bleedSnap` without bleeding.
19
+ */
20
+ import { authoredCmykColors } from './color/authored';
21
+ import { resolvePrintConfig } from './defaults/print';
22
+ import { dimensionToPx } from './units';
23
+ const MM_PER_IN = 25.4;
24
+ const EPS = 0.5;
25
+ function fontSizePx(fontString) {
26
+ const m = fontString ? /(\d+(?:\.\d+)?)px/.exec(fontString) : null;
27
+ return m ? Number(m[1]) : undefined;
28
+ }
29
+ function hex6(color) {
30
+ if (!color)
31
+ return undefined;
32
+ const c = color.trim().toLowerCase();
33
+ if (/^#[0-9a-f]{6}([0-9a-f]{2})?$/.test(c))
34
+ return c.slice(0, 7);
35
+ if (/^#[0-9a-f]{3}([0-9a-f])?$/.test(c))
36
+ return `#${c[1]}${c[1]}${c[2]}${c[2]}${c[3]}${c[3]}`;
37
+ return undefined;
38
+ }
39
+ function isTransparent(color) {
40
+ if (!color)
41
+ return true;
42
+ const c = color.trim().toLowerCase();
43
+ return c === 'transparent' || /^#[0-9a-f]{6}00$/.test(c) || /^#[0-9a-f]{3}0$/.test(c);
44
+ }
45
+ /** Pixel sizes by file id. */
46
+ function bitmapSizes(doc, resources) {
47
+ const out = new Map();
48
+ const note = (r) => {
49
+ const b = r?.bitmap;
50
+ if (r && b && b.width > 0 && b.height > 0 && !out.has(b.fileId))
51
+ out.set(b.fileId, { w: b.width, h: b.height, id: r.id });
52
+ };
53
+ for (const r of resources ?? [])
54
+ note(r);
55
+ for (const block of doc.blocks)
56
+ note(block.resourceBlock?.resource);
57
+ for (const page of doc.pages)
58
+ for (const f of page.floats ?? [])
59
+ note(f.resourceBlock?.resource);
60
+ return out;
61
+ }
62
+ export function preflightDocument(doc, options = {}) {
63
+ const print = options.print ?? doc.config.print ?? resolvePrintConfig();
64
+ const pf = print.preflight;
65
+ if (!pf.enabled)
66
+ return [];
67
+ const dpi = doc.config.page.dpi;
68
+ const pxToPt = (px) => (px / dpi) * 72;
69
+ const pxToMm = (px) => (px / dpi) * MM_PER_IN;
70
+ const offset = doc.pageIndexOffset ?? 0;
71
+ const cmykJob = options.cmyk ?? print.standard !== 'none';
72
+ const sizes = bitmapSizes(doc, options.resources);
73
+ const authored = authoredCmykColors(doc.config);
74
+ const minRulePx = dimensionToPx(pf.minRuleWidth, dpi);
75
+ const smallTextPx = dimensionToPx(pf.smallTextSize, dpi);
76
+ const safePx = dimensionToPx(pf.safeZone, dpi);
77
+ const snapPx = dimensionToPx(pf.bleedSnap, dpi);
78
+ const out = [];
79
+ const t = options.transform;
80
+ const separation = (hex) => {
81
+ const exact = authored.get(hex);
82
+ if (exact)
83
+ return exact;
84
+ if (!t)
85
+ return undefined;
86
+ const r = parseInt(hex.slice(1, 3), 16) / 255;
87
+ const g = parseInt(hex.slice(3, 5), 16) / 255;
88
+ const b = parseInt(hex.slice(5, 7), 16) / 255;
89
+ const k = t.fromRgb(r, g, b);
90
+ return { c: k.c * 100, m: k.m * 100, y: k.y * 100, k: k.k * 100 };
91
+ };
92
+ const inkCount = (hex) => {
93
+ const sep = separation(hex);
94
+ if (sep)
95
+ return [sep.c, sep.m, sep.y, sep.k].filter((v) => v > EPS).length;
96
+ const neutral = hex.slice(1, 3) === hex.slice(3, 5) && hex.slice(3, 5) === hex.slice(5, 7);
97
+ return neutral ? 1 : 3;
98
+ };
99
+ // Ink coverage, once per colour.
100
+ const coverageSeen = new Set();
101
+ const checkCoverage = (color, pageIndex, rect) => {
102
+ const hex = hex6(color);
103
+ if (!hex || !cmykJob || coverageSeen.has(hex))
104
+ return;
105
+ coverageSeen.add(hex);
106
+ const sep = separation(hex);
107
+ if (!sep)
108
+ return;
109
+ const coverage = sep.c + sep.m + sep.y + sep.k;
110
+ if (coverage > print.inkLimit + EPS) {
111
+ out.push({ kind: 'inkLimit', severity: 'warning', pageIndex, color: hex, coverage: Math.round(coverage), limit: print.inkLimit, ...(rect ? { rect } : {}) });
112
+ }
113
+ };
114
+ const checkImage = (fileId, placedW, placedH, fracW, fracH, pageIndex, rect, resourceId, src) => {
115
+ if (!fileId)
116
+ return;
117
+ const size = sizes.get(fileId);
118
+ const source = src?.start !== undefined ? { sourceStart: src.start, ...(src.end !== undefined ? { sourceEnd: src.end } : {}) } : {};
119
+ const rid = resourceId ?? size?.id;
120
+ if (size && placedW > 0 && placedH > 0) {
121
+ const ppi = Math.min((size.w * fracW) / (placedW / dpi), (size.h * fracH) / (placedH / dpi));
122
+ if (ppi < pf.minImageResolution - EPS) {
123
+ out.push({
124
+ kind: 'lowImageResolution',
125
+ severity: ppi < pf.criticalImageResolution - EPS ? 'critical' : 'warning',
126
+ pageIndex, rect, fileId, ppi: Math.round(ppi), minimum: pf.minImageResolution,
127
+ ...(rid ? { resourceId: rid } : {}), ...source,
128
+ });
129
+ }
130
+ }
131
+ if (cmykJob && options.imageColor?.(fileId) === 'rgb') {
132
+ const converted = print.standard === 'pdfx1a' || print.convertImages;
133
+ out.push({ kind: 'rgbImage', severity: converted ? 'info' : 'warning', pageIndex, rect, fileId, converted, ...(rid ? { resourceId: rid } : {}), ...source });
134
+ }
135
+ };
136
+ const checkRule = (widthPx, color, pageIndex, rect) => {
137
+ if (widthPx <= 0 || isTransparent(color))
138
+ return;
139
+ if (widthPx < minRulePx - 1e-6) {
140
+ out.push({ kind: 'thinRule', severity: 'warning', pageIndex, rect, widthPt: Math.round(pxToPt(widthPx) * 100) / 100, minimumPt: Math.round(pxToPt(minRulePx) * 100) / 100, color: hex6(color) ?? String(color) });
141
+ }
142
+ checkCoverage(color, pageIndex, rect);
143
+ };
144
+ for (const page of doc.pages) {
145
+ const pageIndex = page.index + offset;
146
+ const trim = {
147
+ x: doc.trimOffset,
148
+ y: doc.trimOffset,
149
+ width: page.width - 2 * doc.trimOffset,
150
+ height: page.height - 2 * doc.trimOffset,
151
+ };
152
+ const flowPage = !!page.flow;
153
+ // --- text: small multi-ink text, coverage, safe zone
154
+ const smallSeen = new Set();
155
+ const checkLines = (lines, blockFont, blockColor, src, absolute) => {
156
+ let safeIssue;
157
+ for (const line of lines) {
158
+ const segs = line.segments ?? [];
159
+ const runs = segs.length > 0
160
+ ? segs.filter((s) => s.kind === 'text' && s.text.trim()).map((s) => ({ font: s.fontString ?? blockFont, color: s.color ?? blockColor, text: s.text }))
161
+ : line.text.trim() ? [{ font: blockFont, color: blockColor, text: line.text }] : [];
162
+ for (const run of runs) {
163
+ const hex = hex6(run.color);
164
+ if (!hex)
165
+ continue;
166
+ checkCoverage(hex, pageIndex, absolute ? line.bbox : undefined);
167
+ const size = fontSizePx(run.font);
168
+ if (size === undefined || size >= smallTextPx - 1e-6)
169
+ continue;
170
+ const inks = inkCount(hex);
171
+ if (inks <= 1)
172
+ continue;
173
+ const key = `${hex}|${size}`;
174
+ if (smallSeen.has(key))
175
+ continue;
176
+ smallSeen.add(key);
177
+ out.push({
178
+ kind: 'smallProcessText', severity: 'warning', pageIndex,
179
+ sizePt: Math.round(pxToPt(size) * 10) / 10, inks, color: hex, text: run.text.trim().slice(0, 40),
180
+ ...(absolute ? { rect: line.bbox } : {}),
181
+ ...(src.start !== undefined ? { sourceStart: src.start, ...(src.end !== undefined ? { sourceEnd: src.end } : {}) } : {}),
182
+ });
183
+ }
184
+ if (absolute && !flowPage && line.text.trim()) {
185
+ const b = line.bbox;
186
+ const d = Math.min(b.x - trim.x, b.y - trim.y, trim.x + trim.width - (b.x + b.width), trim.y + trim.height - (b.y + b.height));
187
+ // Inside the trim but within the safe zone.
188
+ if (d < safePx - 1e-6 && d > -safePx && (!safeIssue || d < safeIssue.d))
189
+ safeIssue = { d, text: line.text.trim().slice(0, 40), rect: b };
190
+ }
191
+ }
192
+ if (safeIssue) {
193
+ out.push({
194
+ kind: 'safeZone', severity: 'warning', pageIndex, rect: safeIssue.rect,
195
+ distanceMm: Math.round(pxToMm(Math.max(0, safeIssue.d)) * 10) / 10, safeZoneMm: Math.round(pxToMm(safePx) * 10) / 10, text: safeIssue.text,
196
+ ...(src.start !== undefined ? { sourceStart: src.start, ...(src.end !== undefined ? { sourceEnd: src.end } : {}) } : {}),
197
+ });
198
+ }
199
+ };
200
+ // --- boxes / pictures that stop just short of the trim
201
+ const checkNearTrim = (rect) => {
202
+ if (flowPage || snapPx <= 0)
203
+ return;
204
+ const gaps = [
205
+ [rect.x - trim.x, 'left'],
206
+ [rect.y - trim.y, 'top'],
207
+ [trim.x + trim.width - (rect.x + rect.width), 'right'],
208
+ [trim.y + trim.height - (rect.y + rect.height), 'bottom'],
209
+ ];
210
+ for (const [gap, edge] of gaps) {
211
+ if (gap > 1e-3 && gap < snapPx) {
212
+ out.push({ kind: 'nearTrim', severity: 'warning', pageIndex, rect, gapMm: Math.round(pxToMm(gap) * 10) / 10, edge });
213
+ return;
214
+ }
215
+ }
216
+ };
217
+ const checkSlot = (slot) => {
218
+ for (const b of slot?.blocks ?? []) {
219
+ if (b.kind === 'rule') {
220
+ checkRule(b.thicknessPx, b.color, pageIndex, b.bbox);
221
+ }
222
+ else if (b.kind === 'box') {
223
+ if (b.box.borderWidthPx > 0 && b.box.borderColor)
224
+ checkRule(b.box.borderWidthPx, b.box.borderColor, pageIndex, b.bbox);
225
+ if (!isTransparent(b.box.backgroundColor)) {
226
+ checkCoverage(b.box.backgroundColor, pageIndex, b.bbox);
227
+ checkNearTrim(b.bbox);
228
+ }
229
+ }
230
+ else if (b.kind === 'image') {
231
+ if (b.imageKind !== 'svg')
232
+ checkImage(b.fileId, b.bbox.width, b.bbox.height, 1, 1, pageIndex, b.bbox);
233
+ checkNearTrim(b.bbox);
234
+ }
235
+ else if (b.kind === 'text') {
236
+ const hex = hex6(b.color);
237
+ if (b.box && !isTransparent(b.box.backgroundColor))
238
+ checkCoverage(b.box.backgroundColor, pageIndex, b.bbox);
239
+ if (!hex)
240
+ continue;
241
+ checkCoverage(hex, pageIndex, b.bbox);
242
+ const size = fontSizePx(b.fontString);
243
+ const inks = inkCount(hex);
244
+ if (size !== undefined && size < smallTextPx - 1e-6 && inks > 1) {
245
+ out.push({
246
+ kind: 'smallProcessText', severity: 'warning', pageIndex, rect: b.bbox,
247
+ sizePt: Math.round(pxToPt(size) * 10) / 10, inks, color: hex, text: (b.sourceText ?? '').trim().slice(0, 40),
248
+ ...(b.sourceStart !== undefined ? { sourceStart: b.sourceStart, ...(b.sourceEnd !== undefined ? { sourceEnd: b.sourceEnd } : {}) } : {}),
249
+ });
250
+ }
251
+ }
252
+ }
253
+ };
254
+ const checkComic = (comic) => {
255
+ for (const panel of comic?.panels ?? []) {
256
+ if (panel.border.style !== 'none')
257
+ checkRule(panel.border.width, panel.border.color, pageIndex, panel.bbox);
258
+ for (const art of [panel.art, panel.pop]) {
259
+ if (!art || art.kind !== 'bitmap')
260
+ continue;
261
+ const size = sizes.get(art.fileId);
262
+ checkImage(art.fileId, art.box.width, art.box.height, size ? art.source.width / size.w : 1, size ? art.source.height / size.h : 1, pageIndex, art.box, art.resourceId, { start: panel.sourceStart, end: panel.sourceEnd });
263
+ }
264
+ }
265
+ };
266
+ const blocks = [...page.columns.flatMap((c) => c.blocks), ...(page.floats ?? []), ...page.marginNotes];
267
+ for (const block of blocks) {
268
+ if (block.hidden)
269
+ continue;
270
+ const src = { start: block.sourceStart, end: block.sourceEnd };
271
+ checkLines(block.lines, block.fontString, block.color, src, true);
272
+ const rb = block.resourceBlock;
273
+ if (rb) {
274
+ if (rb.captionLines.length > 0)
275
+ checkLines(rb.captionLines, rb.captionFontString, rb.captionColor, src, false);
276
+ const body = { x: block.bbox.x + rb.bodyRect.x, y: block.bbox.y + rb.bodyRect.y, width: rb.bodyRect.width, height: rb.bodyRect.height };
277
+ if (rb.kind === 'bitmap') {
278
+ const s = rb.bodySource;
279
+ checkImage(rb.fileId, rb.bodyRect.width, rb.bodyRect.height, s?.width ?? 1, s?.height ?? 1, pageIndex, body, rb.resource.id, src);
280
+ checkNearTrim(body);
281
+ }
282
+ const table = rb.table;
283
+ if (table) {
284
+ if (table.borderWidthPx > 0)
285
+ checkRule(table.borderWidthPx, table.borderColor, pageIndex, body);
286
+ for (const cell of table.cells ?? []) {
287
+ const img = cell.image;
288
+ if (img && img.kind === 'bitmap')
289
+ checkImage(img.fileId, img.rect.width, img.rect.height, 1, 1, pageIndex, body, img.resourceId, src);
290
+ }
291
+ }
292
+ }
293
+ checkSlot(block.designOverlay);
294
+ checkComic(block.comic);
295
+ }
296
+ if (page.columnRule?.enabled && page.columns.length > 1) {
297
+ checkRule(page.columnRule.lineWidthPx, page.columnRule.color, pageIndex, page.contentArea);
298
+ }
299
+ checkSlot(page.header);
300
+ checkSlot(page.footer);
301
+ checkSlot(page.openerBand);
302
+ checkComic(page.comic);
303
+ }
304
+ // The rich-black recipe against the limit.
305
+ if (cmykJob && print.black.richBlack) {
306
+ const rb = print.black.richBlackColor;
307
+ const coverage = rb.c + rb.m + rb.y + rb.k;
308
+ if (coverage > print.inkLimit + EPS) {
309
+ out.push({ kind: 'inkLimit', severity: 'warning', pageIndex: offset, color: 'rich-black', coverage: Math.round(coverage), limit: print.inkLimit });
310
+ }
311
+ }
312
+ return out;
313
+ }
314
+ //# sourceMappingURL=preflight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preflight.js","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AA2CxC,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,GAAG,GAAG,GAAG,CAAC;AAEhB,SAAS,UAAU,CAAC,UAA8B;IAChD,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC;AAED,SAAS,IAAI,CAAC,KAAyB;IACrC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,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CAAC,CAAC;QAC7F,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3B,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,2CAA2C;IAC3C,IAAI,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QACrC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC;QACtC,MAAM,QAAQ,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC3C,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC;YACpC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrJ,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/types.d.ts CHANGED
@@ -650,6 +650,11 @@ export type ColorModel = 'hex' | 'rgb' | 'cmyk' | 'hsl';
650
650
  export interface ColorValue {
651
651
  hex: string;
652
652
  model: ColorModel;
653
+ /** The exact process values of a colour authored in CMYK (`model:
654
+ * 'cmyk'`), percent: a CMYK print render (`print`, or a `'cmyk'` PDF
655
+ * colour space) sets them as they are instead of separating `hex`,
656
+ * which is their screen rendering. */
657
+ cmyk?: CmykPercent;
653
658
  /** The `colorPalette` entry this colour follows, wherever it sits in the
654
659
  * configuration (designs, callout labels and the `:ref` colour
655
660
  * included): the entry's `hex` / `model` win, and the ones stored here
@@ -756,8 +761,13 @@ export interface PageConfig {
756
761
  * margin is on its right, and viewers show the pairs `[3 | 2]`. With
757
762
  * mirrored margins the recto therefore swaps `left` and `right`: `left`
758
763
  * stays the inner margin. `'auto'` (the default) is `'right'` when
759
- * `layout.writingMode` is `'vertical-rl'` or the document runs right to
760
- * left (`PostextConfig.direction`), else `'left'`. Book-level:
764
+ * `layout.writingMode` is `'vertical-rl'`, when the document runs right
765
+ * to left (`PostextConfig.direction`), or when the config has a
766
+ * `comics` section whose comics read right to left
767
+ * (`comics.readingDirection` resolved, `comicReadingDirection`: a
768
+ * manga, a Japanese or Traditional Chinese edition of a Western comic),
769
+ * else `'left'`. The `comics` section decides, not the `:::page` blocks
770
+ * of a chapter, so every chapter of a book is bound alike. Book-level:
761
771
  * a heading style's own `layout` never changes it. */
762
772
  binding?: PageBinding;
763
773
  }
@@ -782,7 +792,8 @@ export interface ResolvedPageConfig {
782
792
  lineWidth: Dimension;
783
793
  };
784
794
  pageNumbering: ResolvedPageNumberingConfig;
785
- /** `binding` resolved: `'auto'` is `'right'` in a vertical document. */
795
+ /** `binding` resolved: `'auto'` is `'right'` in a vertical document, a
796
+ * right-to-left one and a comic book read right to left. */
786
797
  binding: 'left' | 'right';
787
798
  }
788
799
  /** How the body is divided into columns. `'single'`, `'double'` and
@@ -4180,6 +4191,133 @@ export interface ResolvedCjkConfig {
4180
4191
  kunten: ResolvedCjkKuntenConfig;
4181
4192
  }
4182
4193
  export type PdfColorSpace = 'rgb' | 'cmyk' | 'grayscale';
4194
+ /** The PDF/X flavour postext-pdf writes: none (an ordinary PDF), PDF/X-1a
4195
+ * (CMYK only, no transparency; PDF/X-1a:2003) or PDF/X-4 (transparency
4196
+ * kept, colour-managed; PDF/X-4:2010). */
4197
+ export type PdfXStandard = 'none' | 'pdfx1a' | 'pdfx4';
4198
+ /** How colours outside the output gamut are mapped: relative colorimetric
4199
+ * (in-gamut colours stay exact, paper white = white) or perceptual (the
4200
+ * whole gamut is compressed). */
4201
+ export type PrintRenderingIntent = 'relative' | 'perceptual';
4202
+ /** A CMYK recipe in percent (0..100 each). */
4203
+ export interface CmykPercent {
4204
+ c: number;
4205
+ m: number;
4206
+ y: number;
4207
+ k: number;
4208
+ }
4209
+ /** How black prints in a CMYK job. */
4210
+ export interface PrintBlackConfig {
4211
+ /** Black and grey (neutral) colours print with black ink only, never as
4212
+ * a four-colour grey. Defaults to true. */
4213
+ kOnlyNeutrals?: boolean;
4214
+ /** 100 % K text and strokes overprint (no knock-out, so misregistration
4215
+ * never shows a white halo). Defaults to true. */
4216
+ overprint?: boolean;
4217
+ /** Large black areas (backgrounds, bands, boxes, shapes whose smaller
4218
+ * side reaches `richBlackMinSize`) print in rich black instead of
4219
+ * K only. Text never does. Defaults to true. */
4220
+ richBlack?: boolean;
4221
+ /** The rich-black recipe. Defaults to C60 M40 Y40 K100. */
4222
+ richBlackColor?: CmykPercent;
4223
+ /** The smaller side an area needs to print in rich black. Defaults to
4224
+ * 6 mm. */
4225
+ richBlackMinSize?: Dimension;
4226
+ }
4227
+ export interface ResolvedPrintBlackConfig {
4228
+ kOnlyNeutrals: boolean;
4229
+ overprint: boolean;
4230
+ richBlack: boolean;
4231
+ richBlackColor: CmykPercent;
4232
+ richBlackMinSize: Dimension;
4233
+ }
4234
+ /** Thresholds of the print preflight (the Sandbox's Review panel, and
4235
+ * `preflightDocument`). */
4236
+ export interface PrintPreflightConfig {
4237
+ /** Run the checks. Defaults to true. */
4238
+ enabled?: boolean;
4239
+ /** Placed images below this effective resolution (pixels per inch at
4240
+ * their printed size) get a warning. Defaults to 300. */
4241
+ minImageResolution?: number;
4242
+ /** Below this they are critical. Defaults to 150. */
4243
+ criticalImageResolution?: number;
4244
+ /** Rules and strokes thinner than this get a warning. Defaults to
4245
+ * 0.25 pt. */
4246
+ minRuleWidth?: Dimension;
4247
+ /** Text smaller than this printed with more than one ink (a process
4248
+ * colour, rich black) gets a warning. Defaults to 9 pt. */
4249
+ smallTextSize?: Dimension;
4250
+ /** Distance inside the trim where text and important elements risk the
4251
+ * cut. Defaults to 5 mm. */
4252
+ safeZone?: Dimension;
4253
+ /** Backgrounds, pictures and bands whose edge stops this close to the
4254
+ * trim without reaching the bleed should bleed. Defaults to 3 mm. */
4255
+ bleedSnap?: Dimension;
4256
+ /** Report fonts a placed PDF print master does not embed. Defaults to
4257
+ * true. */
4258
+ checkFonts?: boolean;
4259
+ }
4260
+ export interface ResolvedPrintPreflightConfig {
4261
+ enabled: boolean;
4262
+ minImageResolution: number;
4263
+ criticalImageResolution: number;
4264
+ minRuleWidth: Dimension;
4265
+ smallTextSize: Dimension;
4266
+ safeZone: Dimension;
4267
+ bleedSnap: Dimension;
4268
+ checkFonts: boolean;
4269
+ }
4270
+ /** An ICC output profile the user uploaded (their printer's), stored
4271
+ * out-of-band like a font or a picture. */
4272
+ export interface CustomOutputProfile {
4273
+ /** The profile's name (its `desc` tag, or the file name). */
4274
+ name: string;
4275
+ /** Identifier of the stored `.icc` file. */
4276
+ fileId: string;
4277
+ /** The printing condition's registry name when the profile is one
4278
+ * (e.g. `FOGRA51`), for the PDF/X OutputConditionIdentifier; else
4279
+ * `Custom`. */
4280
+ registryName?: string;
4281
+ /** Total ink limit of the condition, percent. */
4282
+ inkLimit?: number;
4283
+ }
4284
+ /** Print production: the PDF/X standard, the output profile CMYK is
4285
+ * separated with, how black prints, and the preflight thresholds. Layout
4286
+ * ignores it; postext-pdf and the preflight read it. */
4287
+ export interface PrintConfig {
4288
+ /** PDF/X flavour. Defaults to `'none'`. Any PDF/X standard writes CMYK
4289
+ * through the output profile whatever `pdfGeneration.colorSpace` says. */
4290
+ standard?: PdfXStandard;
4291
+ /** The output profile, by catalogue id (`OUTPUT_PROFILES`), or
4292
+ * `'custom'` for `customProfile`. Defaults to `'fogra39'`. */
4293
+ outputProfile?: string;
4294
+ customProfile?: CustomOutputProfile;
4295
+ /** Defaults to `'relative'`. */
4296
+ renderingIntent?: PrintRenderingIntent;
4297
+ /** Map sRGB black to the darkest printable black (relative intent).
4298
+ * Defaults to true. */
4299
+ blackPointCompensation?: boolean;
4300
+ /** Convert RGB pictures to the output CMYK. PDF/X-1a always does; in
4301
+ * PDF/X-4 false keeps them RGB, tagged sRGB, for the printer's RIP.
4302
+ * Defaults to true. */
4303
+ convertImages?: boolean;
4304
+ /** Total area coverage limit, percent. Defaults to the profile's. */
4305
+ inkLimit?: number;
4306
+ black?: PrintBlackConfig;
4307
+ preflight?: PrintPreflightConfig;
4308
+ }
4309
+ export interface ResolvedPrintConfig {
4310
+ standard: PdfXStandard;
4311
+ outputProfile: string;
4312
+ customProfile?: CustomOutputProfile;
4313
+ renderingIntent: PrintRenderingIntent;
4314
+ blackPointCompensation: boolean;
4315
+ convertImages: boolean;
4316
+ /** The configured limit, else the profile's. */
4317
+ inkLimit: number;
4318
+ black: ResolvedPrintBlackConfig;
4319
+ preflight: ResolvedPrintPreflightConfig;
4320
+ }
4183
4321
  /** How postext-pdf writes the file. Layout ignores it; the VDT carries it
4184
4322
  * (`doc.config.pdfGeneration`), and `renderToPdf` takes each setting from
4185
4323
  * its own options first, then from here (the first document's, for a
@@ -5088,10 +5226,15 @@ export interface ResolvedIndexConfig {
5088
5226
  }
5089
5227
  /** The direction the panels of a comic page are read in: `'ltr'` (Western
5090
5228
  * comics: the first panel of a tier at the left), `'rtl'` (manga and
5091
- * Arabic comics: at the right), `'auto'`: `'rtl'` in a right-to-left
5092
- * document (an Arabic edition mirrors its pages), else the direction the
5093
- * art was drawn for (`artDirection`): a Japanese edition of a Western
5094
- * comic reads left to right, a manga right to left in any language. */
5229
+ * Arabic comics: at the right), `'auto'`: the direction of the edition's
5230
+ * language, `'rtl'` in a right-to-left document (an Arabic edition), in
5231
+ * a vertical one and in a Japanese or Traditional Chinese one
5232
+ * (`comicsLocaleDirection`): a Japanese edition of a Western comic reads
5233
+ * right to left. Otherwise the direction the art was drawn for
5234
+ * (`artDirection`): a manga reads right to left in any language, a
5235
+ * Western comic left to right in English, Simplified Chinese or Korean.
5236
+ * With `page.binding: 'auto'` a book whose comics read right to left is
5237
+ * bound on the right. A page's `direction` attribute wins. */
5095
5238
  export type ComicReadingDirection = 'auto' | 'ltr' | 'rtl';
5096
5239
  /** How a panel's border is drawn: a clean stroke, none, or a hand-drawn
5097
5240
  * line (a stroke that wobbles, seeded from the panel, so the same page
@@ -5263,6 +5406,12 @@ export interface BalloonStyleConfig {
5263
5406
  haloColor?: ColorValue;
5264
5407
  /** Rotation in degrees (sound effects). */
5265
5408
  rotate?: number;
5409
+ /** Lean of the letters' upright strokes, degrees (sound effects, text
5410
+ * written on the art): positive leans them forward like italic, negative
5411
+ * back. Applied before `rotate`, about the same centre, so a title on a
5412
+ * book cover seen in perspective follows both the cover's top edge
5413
+ * (`rotate`) and its sides (`skew`). Default `0`. */
5414
+ skew?: number;
5266
5415
  }
5267
5416
  export interface ResolvedBalloonStyleConfig {
5268
5417
  id: string;
@@ -5288,6 +5437,7 @@ export interface ResolvedBalloonStyleConfig {
5288
5437
  fontScale: number;
5289
5438
  align: 'center' | 'start';
5290
5439
  rotate: number;
5440
+ skew: number;
5291
5441
  /** Unset: the lettering's. */
5292
5442
  fontFamily?: string;
5293
5443
  bold?: boolean;
@@ -5316,9 +5466,15 @@ export interface ComicCastMember {
5316
5466
  * panel styles, the lettering, the balloon styles and the cast. Only
5317
5467
  * documents with comic pages read it. */
5318
5468
  export interface ComicsConfig {
5319
- /** Default `'auto'`. */
5469
+ /** The order panels are read in (see {@link ComicReadingDirection}).
5470
+ * Default `'auto'`: the edition's language decides (right to left in
5471
+ * Arabic, Japanese, Traditional Chinese and vertical documents), else
5472
+ * {@link artDirection}. */
5320
5473
  readingDirection?: ComicReadingDirection;
5321
- /** The direction the art was drawn for. Default `'ltr'`. */
5474
+ /** The direction the art was drawn for: what `'auto'` reads in when the
5475
+ * edition's language has no direction of its own, and what
5476
+ * {@link mirrorArt} compares the page's direction with. Default
5477
+ * `'ltr'`. */
5322
5478
  artDirection?: 'ltr' | 'rtl';
5323
5479
  /** Mirror the pictures of a page read in the other direction than
5324
5480
  * {@link artDirection} (a panel opts out with `mirror=false`). Default
@@ -5490,6 +5646,8 @@ export interface PostextConfig {
5490
5646
  * lettering, cast. */
5491
5647
  comics?: ComicsConfig;
5492
5648
  pdfGeneration?: PdfGenerationConfig;
5649
+ /** Print production: PDF/X, output profile, black, preflight. */
5650
+ print?: PrintConfig;
5493
5651
  colorPalette?: ColorPaletteEntry[];
5494
5652
  /** User-provided font families. Referenced the same way as Google Fonts:
5495
5653
  * set `bodyText.fontFamily` (or any other font-family field) to the