@bendyline/squisq-formats 2.8.15 → 2.8.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  docToEpub,
11
11
  markdownDocToEpub
12
- } from "./chunk-ZJERBWTB.js";
12
+ } from "./chunk-WPLCWAN3.js";
13
13
  import {
14
14
  BUILTIN_FORMAT_IDS
15
15
  } from "./chunk-2P5HJAQL.js";
@@ -29,7 +29,7 @@ import {
29
29
  renderOutsideInDocument,
30
30
  withOutsideInMarkdownEditing,
31
31
  withOutsideInMetadata
32
- } from "./chunk-BBB7FCK7.js";
32
+ } from "./chunk-JB3ZVN7D.js";
33
33
  import {
34
34
  OUTSIDE_IN_FORMAT_IDS,
35
35
  OUTSIDE_IN_OUTPUT_TEMPLATE_KEY,
@@ -45,7 +45,7 @@ import {
45
45
  defaultRegistry,
46
46
  prepareConversion,
47
47
  resolveConversionLimits
48
- } from "./chunk-KHRX22VW.js";
48
+ } from "./chunk-2IG4BEAX.js";
49
49
  import {
50
50
  ConversionError
51
51
  } from "./chunk-KXOZMWBS.js";
@@ -54,13 +54,13 @@ import {
54
54
  docxToDoc,
55
55
  docxToMarkdownDoc,
56
56
  markdownDocToDocx
57
- } from "./chunk-MF4ZQQJ7.js";
57
+ } from "./chunk-BGQDPDCD.js";
58
58
  import {
59
59
  docToPptx,
60
60
  markdownDocToPptx,
61
61
  pptxToDoc,
62
62
  pptxToMarkdownDoc
63
- } from "./chunk-S5VXWSRR.js";
63
+ } from "./chunk-PIEDORQL.js";
64
64
  import "./chunk-6N2J7C2B.js";
65
65
  import "./chunk-WMIDXNGR.js";
66
66
  import "./chunk-DHAK4PII.js";
@@ -96,7 +96,7 @@ import {
96
96
  markdownDocToPdf,
97
97
  pdfToDoc,
98
98
  pdfToMarkdownDoc
99
- } from "./chunk-NQNIFIDP.js";
99
+ } from "./chunk-NNNHOTVM.js";
100
100
  import "./chunk-34KECNZO.js";
101
101
  import "./chunk-DTJQK7U7.js";
102
102
  import "./chunk-IIQYS2YH.js";
@@ -7,7 +7,7 @@ import {
7
7
  renderOutsideInDocument,
8
8
  withOutsideInMarkdownEditing,
9
9
  withOutsideInMetadata
10
- } from "../chunk-BBB7FCK7.js";
10
+ } from "../chunk-JB3ZVN7D.js";
11
11
  import {
12
12
  OUTSIDE_IN_FORMAT_IDS,
13
13
  OUTSIDE_IN_OUTPUT_TEMPLATE_KEY,
@@ -15,7 +15,7 @@ import {
15
15
  isOutsideInTargetPath,
16
16
  resolveOutsideInLayout
17
17
  } from "../chunk-WJTC5OD6.js";
18
- import "../chunk-KHRX22VW.js";
18
+ import "../chunk-2IG4BEAX.js";
19
19
  import "../chunk-KXOZMWBS.js";
20
20
  import "../chunk-7AWFHP5U.js";
21
21
  export {
@@ -6,30 +6,47 @@ import { ContentContainer } from '@bendyline/squisq/storage';
6
6
  * Unicode text for PDF export.
7
7
  *
8
8
  * The 14 standard PDF fonts encode only WinAnsi (see `winAnsi.ts`), so Greek,
9
- * Cyrillic, Vietnamese, arrows, math, box drawing and most symbols used to
10
- * reach the page as `?` or an ASCII stand-in. When a document holds such text,
11
- * the writer embeds a Unicode font beside the standard ones — by default the
12
- * bundled DejaVu Sans faces — and draws those characters with it.
9
+ * Cyrillic, Vietnamese, arrows, math, box drawing, CJK, emoji and most symbols
10
+ * used to reach the page as `?` or an ASCII stand-in. When a document holds
11
+ * such text, the writer embeds Unicode fonts beside the standard ones and
12
+ * draws those characters with them. The bundled faces are DejaVu Sans for
13
+ * alphabets and symbols, monochrome Noto Emoji, Noto Sans SC for Chinese and
14
+ * Japanese, and Noto Sans KR for Korean; each of the last three loads only for
15
+ * a document with text in its scripts.
13
16
  *
14
17
  * Text is split into runs, each with the font that draws it:
15
18
  * - characters WinAnsi encodes keep the standard font, so ordinary Latin text
16
19
  * looks exactly as it did before;
17
- * - a word that needs the Unicode font is drawn in it whole, so its letters and
18
- * punctuation match rather than alternating faces mid-word;
19
- * - a character neither font can draw (CJK and emoji, with the bundled faces)
20
- * still goes through the WinAnsi sanitizer, which replaces it and counts it
21
- * toward the export's one warning.
20
+ * - a word the main Unicode face can draw is drawn in it whole, so its letters
21
+ * and punctuation match rather than alternating faces mid-word;
22
+ * - otherwise each character (a letter with its marks, a whole emoji sequence)
23
+ * takes the first face that draws it: the emoji face first for one shown as
24
+ * emoji, last for one the other faces draw as text;
25
+ * - a character no face can draw still goes through the WinAnsi sanitizer,
26
+ * which replaces it and counts it toward the export's one warning.
22
27
  */
23
28
 
29
+ type FontBytes = Uint8Array | ArrayBuffer;
24
30
  /**
25
31
  * TrueType or OpenType bytes for the faces that draw what the standard fonts
26
32
  * cannot. Bold falls back to `regular`, and `mono` (used for code) to
27
33
  * `regular` as well.
28
34
  */
29
35
  interface PdfUnicodeFonts {
30
- regular: Uint8Array | ArrayBuffer;
31
- bold?: Uint8Array | ArrayBuffer;
32
- mono?: Uint8Array | ArrayBuffer;
36
+ regular: FontBytes;
37
+ bold?: FontBytes;
38
+ mono?: FontBytes;
39
+ /**
40
+ * Draws emoji: tried first for a character shown as emoji (🙂, or a heart
41
+ * with the emoji variation selector), and last for one the other faces draw
42
+ * as text (♥).
43
+ */
44
+ emoji?: FontBytes;
45
+ /**
46
+ * Further faces, tried in order for what none of the faces above can draw.
47
+ * Every style shares them. The bundled set puts CJK here.
48
+ */
49
+ fallbacks?: readonly FontBytes[];
33
50
  }
34
51
 
35
52
  /**
@@ -40,7 +57,8 @@ interface PdfUnicodeFonts {
40
57
  * headings, paragraphs, inline formatting, lists, code blocks,
41
58
  * blockquotes, tables, thematic breaks, and hyperlinks.
42
59
  *
43
- * Uses the standard PDF fonts for authored text and embeds/subsets Font
60
+ * Uses the standard PDF fonts for authored text. Embeds (subset) Unicode
61
+ * fonts only for text those cannot encode (see `unicodeText.ts`), and Font
44
62
  * Awesome only when the document contains an inline icon.
45
63
  *
46
64
  * @example
@@ -106,10 +124,12 @@ interface PdfExportOptions {
106
124
  onWarning?: (message: string) => void;
107
125
  /**
108
126
  * Fonts that draw what the standard PDF fonts cannot encode — Greek,
109
- * Cyrillic, Vietnamese, arrows, math, box drawing, symbols. Default: the
110
- * bundled DejaVu Sans faces, embedded (subset) only in a document that has
111
- * such text. Pass your own faces to cover other scripts, or `false` to keep
112
- * the standard fonts alone and replace those characters.
127
+ * Cyrillic, Vietnamese, arrows, math, box drawing, symbols, emoji, Chinese,
128
+ * Japanese and Korean. Default: the bundled DejaVu Sans faces, plus Noto
129
+ * Emoji, Noto Sans SC and Noto Sans KR for a document with text in their
130
+ * scripts, embedded (subset) only in a document that has such text. Pass
131
+ * your own faces to cover other scripts, or `false` to keep the standard
132
+ * fonts alone and replace those characters.
113
133
  */
114
134
  unicodeFonts?: PdfUnicodeFonts | false;
115
135
  }
package/dist/pdf/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  pdfToContainer,
6
6
  pdfToDoc,
7
7
  pdfToMarkdownDoc
8
- } from "../chunk-NQNIFIDP.js";
8
+ } from "../chunk-NNNHOTVM.js";
9
9
  import "../chunk-34KECNZO.js";
10
10
  import "../chunk-DTJQK7U7.js";
11
11
  import "../chunk-IIQYS2YH.js";
@@ -4,7 +4,7 @@ import {
4
4
  pptxToContainer,
5
5
  pptxToDoc,
6
6
  pptxToMarkdownDoc
7
- } from "../chunk-S5VXWSRR.js";
7
+ } from "../chunk-PIEDORQL.js";
8
8
  import {
9
9
  analyzePptxLayouts,
10
10
  inspectPptxLayouts
@@ -9,7 +9,7 @@ import {
9
9
  defaultRegistry,
10
10
  prepareConversion,
11
11
  resolveConversionLimits
12
- } from "../chunk-KHRX22VW.js";
12
+ } from "../chunk-2IG4BEAX.js";
13
13
  import {
14
14
  ConversionError
15
15
  } from "../chunk-KXOZMWBS.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/squisq-formats",
3
- "version": "2.8.15",
3
+ "version": "2.8.17",
4
4
  "description": "Document format converters — DOCX, PDF, OOXML import/export",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -130,12 +130,12 @@
130
130
  }
131
131
  },
132
132
  "scripts": {
133
- "build": "tsup && node ../../scripts/generate-bundle-licenses.mjs . @fortawesome/fontawesome-free dejavu-fonts-ttf && node ../../scripts/remove-empty-chunks.mjs dist",
133
+ "build": "tsup && node ../../scripts/generate-bundle-licenses.mjs . @fortawesome/fontawesome-free dejavu-fonts-ttf @expo-google-fonts/noto-emoji @expo-google-fonts/noto-sans-sc @expo-google-fonts/noto-sans-kr && node ../../scripts/remove-empty-chunks.mjs dist",
134
134
  "dev": "concurrently -n js,dts -c blue,gray -r \"tsup --watch --no-dts --no-clean\" \"tsup --watch --dts-only --no-clean\"",
135
135
  "typecheck": "tsc --noEmit"
136
136
  },
137
137
  "dependencies": {
138
- "@bendyline/squisq": "2.13.13",
138
+ "@bendyline/squisq": "2.13.15",
139
139
  "@pdf-lib/fontkit": "1.1.1",
140
140
  "@pdf-lib/upng": "1.0.1",
141
141
  "@xmldom/xmldom": "0.9.12",
@@ -152,6 +152,9 @@
152
152
  }
153
153
  },
154
154
  "devDependencies": {
155
+ "@expo-google-fonts/noto-emoji": "0.4.8",
156
+ "@expo-google-fonts/noto-sans-kr": "0.4.4",
157
+ "@expo-google-fonts/noto-sans-sc": "0.4.4",
155
158
  "@fortawesome/fontawesome-free": "7.3.1",
156
159
  "dejavu-fonts-ttf": "2.37.3",
157
160
  "hyparquet": "1.31.2",
File without changes