pdf-codec 1.4.2 → 1.6.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 (170) hide show
  1. package/README.md +56 -15
  2. package/dist/assets/caladea-bold.cjs +5 -0
  3. package/dist/assets/caladea-bold.d.cts +4 -0
  4. package/dist/assets/caladea-bold.d.ts +4 -0
  5. package/dist/assets/caladea-bold.js +4 -0
  6. package/dist/assets/caladea-bolditalic.cjs +5 -0
  7. package/dist/assets/caladea-bolditalic.d.cts +4 -0
  8. package/dist/assets/caladea-bolditalic.d.ts +4 -0
  9. package/dist/assets/caladea-bolditalic.js +4 -0
  10. package/dist/assets/caladea-italic.cjs +5 -0
  11. package/dist/assets/caladea-italic.d.cts +4 -0
  12. package/dist/assets/caladea-italic.d.ts +4 -0
  13. package/dist/assets/caladea-italic.js +4 -0
  14. package/dist/assets/caladea-regular.cjs +5 -0
  15. package/dist/assets/caladea-regular.d.cts +4 -0
  16. package/dist/assets/caladea-regular.d.ts +4 -0
  17. package/dist/assets/caladea-regular.js +4 -0
  18. package/dist/assets/carlito-bold.cjs +5 -0
  19. package/dist/assets/carlito-bold.d.cts +4 -0
  20. package/dist/assets/carlito-bold.d.ts +4 -0
  21. package/dist/assets/carlito-bold.js +4 -0
  22. package/dist/assets/carlito-bolditalic.cjs +5 -0
  23. package/dist/assets/carlito-bolditalic.d.cts +4 -0
  24. package/dist/assets/carlito-bolditalic.d.ts +4 -0
  25. package/dist/assets/carlito-bolditalic.js +4 -0
  26. package/dist/assets/carlito-italic.cjs +5 -0
  27. package/dist/assets/carlito-italic.d.cts +4 -0
  28. package/dist/assets/carlito-italic.d.ts +4 -0
  29. package/dist/assets/carlito-italic.js +4 -0
  30. package/dist/assets/carlito-regular.cjs +5 -0
  31. package/dist/assets/carlito-regular.d.cts +4 -0
  32. package/dist/assets/carlito-regular.d.ts +4 -0
  33. package/dist/assets/carlito-regular.js +4 -0
  34. package/dist/cff-probe.cjs +133 -0
  35. package/dist/cff-probe.d.cts +10 -0
  36. package/dist/cff-probe.d.ts +10 -0
  37. package/dist/cff-probe.js +132 -0
  38. package/dist/cmap-table.cjs +108 -0
  39. package/dist/cmap-table.d.cts +6 -0
  40. package/dist/cmap-table.d.ts +6 -0
  41. package/dist/cmap-table.js +107 -0
  42. package/dist/content-write.cjs +36 -17
  43. package/dist/content-write.d.cts +9 -2
  44. package/dist/content-write.d.ts +9 -2
  45. package/dist/content-write.js +35 -16
  46. package/dist/crypto/aes.cjs +166 -0
  47. package/dist/crypto/aes.d.cts +6 -0
  48. package/dist/crypto/aes.d.ts +6 -0
  49. package/dist/crypto/aes.js +163 -0
  50. package/dist/crypto/md5.cjs +215 -0
  51. package/dist/crypto/md5.d.cts +4 -0
  52. package/dist/crypto/md5.d.ts +4 -0
  53. package/dist/crypto/md5.js +214 -0
  54. package/dist/crypto/rc4.cjs +29 -0
  55. package/dist/crypto/rc4.d.cts +4 -0
  56. package/dist/crypto/rc4.d.ts +4 -0
  57. package/dist/crypto/rc4.js +28 -0
  58. package/dist/crypto/sha2.cjs +261 -0
  59. package/dist/crypto/sha2.d.cts +6 -0
  60. package/dist/crypto/sha2.d.ts +6 -0
  61. package/dist/crypto/sha2.js +258 -0
  62. package/dist/diagnostics.cjs +7 -0
  63. package/dist/diagnostics.d.cts +4 -1
  64. package/dist/diagnostics.d.ts +4 -1
  65. package/dist/diagnostics.js +7 -1
  66. package/dist/document.cjs +38 -2
  67. package/dist/document.js +38 -2
  68. package/dist/embedded-font-CLedn-mT.d.cts +42 -0
  69. package/dist/embedded-font-CbqkKgBl.d.ts +42 -0
  70. package/dist/embedded-font-write.cjs +92 -0
  71. package/dist/embedded-font-write.d.cts +22 -0
  72. package/dist/embedded-font-write.d.ts +22 -0
  73. package/dist/embedded-font-write.js +90 -0
  74. package/dist/embedded-font.cjs +142 -0
  75. package/dist/embedded-font.d.cts +2 -0
  76. package/dist/embedded-font.d.ts +2 -0
  77. package/dist/embedded-font.js +138 -0
  78. package/dist/encrypt.cjs +264 -0
  79. package/dist/encrypt.d.cts +11 -0
  80. package/dist/encrypt.d.ts +11 -0
  81. package/dist/encrypt.js +263 -0
  82. package/dist/filters.cjs +19 -1
  83. package/dist/filters.js +19 -1
  84. package/dist/font-registry-Cn7P9lAh.d.ts +38 -0
  85. package/dist/font-registry-yby02snZ.d.cts +38 -0
  86. package/dist/font-registry.cjs +152 -0
  87. package/dist/font-registry.d.cts +2 -0
  88. package/dist/font-registry.d.ts +2 -0
  89. package/dist/font-registry.js +150 -0
  90. package/dist/font-substitutes.cjs +13 -0
  91. package/dist/font-substitutes.d.cts +5 -0
  92. package/dist/font-substitutes.d.ts +5 -0
  93. package/dist/font-substitutes.js +12 -0
  94. package/dist/font-tables.cjs +127 -0
  95. package/dist/font-tables.d.cts +43 -0
  96. package/dist/font-tables.d.ts +43 -0
  97. package/dist/font-tables.js +122 -0
  98. package/dist/fonts.cjs +1 -0
  99. package/dist/fonts.d.cts +2 -1
  100. package/dist/fonts.d.ts +2 -1
  101. package/dist/fonts.js +1 -1
  102. package/dist/glyf.cjs +127 -0
  103. package/dist/glyf.d.cts +31 -0
  104. package/dist/glyf.d.ts +31 -0
  105. package/dist/glyf.js +125 -0
  106. package/dist/{math-hmtx.cjs → hmtx-table.cjs} +3 -3
  107. package/dist/{math-hmtx.d.ts → hmtx-table.d.cts} +2 -2
  108. package/dist/{math-hmtx.d.cts → hmtx-table.d.ts} +2 -2
  109. package/dist/{math-hmtx.js → hmtx-table.js} +3 -3
  110. package/dist/image/ccitt.cjs +488 -0
  111. package/dist/image/ccitt.d.cts +17 -0
  112. package/dist/image/ccitt.d.ts +17 -0
  113. package/dist/image/ccitt.js +487 -0
  114. package/dist/images-read.cjs +1 -4
  115. package/dist/images-read.js +2 -5
  116. package/dist/index.cjs +8 -0
  117. package/dist/index.d.cts +7 -4
  118. package/dist/index.d.ts +7 -4
  119. package/dist/index.js +5 -3
  120. package/dist/interpret.cjs +173 -38
  121. package/dist/interpret.d.cts +27 -10
  122. package/dist/interpret.d.ts +27 -10
  123. package/dist/interpret.js +174 -39
  124. package/dist/math-font-write.cjs +3 -32
  125. package/dist/math-font-write.js +2 -31
  126. package/dist/math-font.cjs +7 -5
  127. package/dist/math-font.js +5 -3
  128. package/dist/math-table.d.cts +1 -1
  129. package/dist/math-table.d.ts +1 -1
  130. package/dist/{matrix-B3c2_a2f.d.cts → matrix-BHzJESll.d.cts} +2 -1
  131. package/dist/{matrix-B3c2_a2f.d.ts → matrix-BHzJESll.d.ts} +2 -1
  132. package/dist/matrix.cjs +2 -0
  133. package/dist/matrix.d.cts +2 -2
  134. package/dist/matrix.d.ts +2 -2
  135. package/dist/matrix.js +2 -1
  136. package/dist/measure.cjs +65 -14
  137. package/dist/measure.d.cts +8 -1
  138. package/dist/measure.d.ts +8 -1
  139. package/dist/measure.js +64 -15
  140. package/dist/objects.cjs +4 -0
  141. package/dist/objects.d.cts +2 -1
  142. package/dist/objects.d.ts +2 -1
  143. package/dist/objects.js +4 -1
  144. package/dist/read.cjs +43 -4
  145. package/dist/read.d.cts +1 -1
  146. package/dist/read.d.ts +1 -1
  147. package/dist/read.js +43 -4
  148. package/dist/sfnt-V08bb5ut.d.cts +21 -0
  149. package/dist/sfnt-V08bb5ut.d.ts +21 -0
  150. package/dist/sfnt-subset.cjs +250 -0
  151. package/dist/sfnt-subset.d.cts +11 -0
  152. package/dist/sfnt-subset.d.ts +11 -0
  153. package/dist/sfnt-subset.js +249 -0
  154. package/dist/sfnt.cjs +50 -4
  155. package/dist/sfnt.d.cts +2 -17
  156. package/dist/sfnt.d.ts +2 -17
  157. package/dist/sfnt.js +47 -5
  158. package/dist/tounicode.cjs +34 -0
  159. package/dist/tounicode.d.cts +5 -0
  160. package/dist/tounicode.d.ts +5 -0
  161. package/dist/tounicode.js +33 -0
  162. package/dist/write.cjs +81 -11
  163. package/dist/write.d.cts +6 -0
  164. package/dist/write.d.ts +6 -0
  165. package/dist/write.js +82 -12
  166. package/package.json +1 -1
  167. package/dist/math-cmap.cjs +0 -81
  168. package/dist/math-cmap.d.cts +0 -6
  169. package/dist/math-cmap.d.ts +0 -6
  170. package/dist/math-cmap.js +0 -80
@@ -0,0 +1,133 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_sfnt = require("./sfnt.cjs");
3
+ //#region src/cff-probe.ts
4
+ const CFF_HEADER_SIZE = 4;
5
+ const CFF_MAJOR_VERSION = 1;
6
+ const INDEX_COUNT_SIZE = 2;
7
+ const INDEX_OFF_SIZE_SIZE = 1;
8
+ const MIN_OFF_SIZE = 1;
9
+ const MAX_OFF_SIZE = 4;
10
+ const DICT_OPERATOR_MAX = 21;
11
+ const DICT_OPERATOR_ESCAPE = 12;
12
+ const DICT_ROS_ESCAPED_OPERATOR = 30;
13
+ const DICT_OPERAND_INT16 = 28;
14
+ const DICT_OPERAND_INT32 = 29;
15
+ const DICT_OPERAND_REAL = 30;
16
+ const DICT_OPERAND_INT16_SIZE = 3;
17
+ const DICT_OPERAND_INT32_SIZE = 5;
18
+ const DICT_OPERAND_SMALL_FIRST = 32;
19
+ const DICT_OPERAND_SMALL_LAST = 246;
20
+ const DICT_OPERAND_MEDIUM_FIRST = 247;
21
+ const DICT_OPERAND_MEDIUM_LAST = 254;
22
+ const DICT_OPERAND_MEDIUM_SIZE = 2;
23
+ const DICT_REAL_TERMINATOR_NIBBLE = 15;
24
+ function readOffsetAt(bytes, offset, offSize) {
25
+ if (offSize === 1) return require_sfnt.u8(bytes, offset);
26
+ if (offSize === 2) return require_sfnt.u16(bytes, offset);
27
+ if (offSize === 3) return require_sfnt.u24(bytes, offset);
28
+ return require_sfnt.u32(bytes, offset);
29
+ }
30
+ function readIndex(bytes, offset) {
31
+ if (!require_sfnt.hasBytes(bytes, offset, INDEX_COUNT_SIZE)) return;
32
+ const count = require_sfnt.u16(bytes, offset);
33
+ if (count === 0) return {
34
+ count: 0,
35
+ endOffset: offset + INDEX_COUNT_SIZE,
36
+ entry: () => void 0
37
+ };
38
+ if (!require_sfnt.hasBytes(bytes, offset + INDEX_COUNT_SIZE, INDEX_OFF_SIZE_SIZE)) return;
39
+ const offSize = require_sfnt.u8(bytes, offset + INDEX_COUNT_SIZE);
40
+ if (offSize < MIN_OFF_SIZE || offSize > MAX_OFF_SIZE) return;
41
+ const offsetArrayStart = offset + INDEX_COUNT_SIZE + INDEX_OFF_SIZE_SIZE;
42
+ const offsetArrayLength = (count + 1) * offSize;
43
+ if (!require_sfnt.hasBytes(bytes, offsetArrayStart, offsetArrayLength)) return;
44
+ const offsets = [];
45
+ for (let i = 0; i <= count; i++) offsets.push(readOffsetAt(bytes, offsetArrayStart + i * offSize, offSize));
46
+ if (offsets[0] !== 1) return;
47
+ for (let i = 1; i <= count; i++) if (offsets[i] < offsets[i - 1]) return;
48
+ const dataOrigin = offsetArrayStart + offsetArrayLength - 1;
49
+ const dataLength = offsets[count] - 1;
50
+ if (!require_sfnt.hasBytes(bytes, dataOrigin + 1, dataLength)) return;
51
+ return {
52
+ count,
53
+ endOffset: dataOrigin + 1 + dataLength,
54
+ entry: (index) => index < 0 || index >= count ? void 0 : bytes.subarray(dataOrigin + offsets[index], dataOrigin + offsets[index + 1])
55
+ };
56
+ }
57
+ function dictDeclaresRos(data) {
58
+ let i = 0;
59
+ while (i < data.length) {
60
+ const b0 = data[i];
61
+ if (b0 <= DICT_OPERATOR_MAX) {
62
+ if (b0 !== DICT_OPERATOR_ESCAPE) {
63
+ i += 1;
64
+ continue;
65
+ }
66
+ if (i + 1 >= data.length) return;
67
+ if (data[i + 1] === DICT_ROS_ESCAPED_OPERATOR) return true;
68
+ i += 2;
69
+ continue;
70
+ }
71
+ if (b0 === DICT_OPERAND_INT16) {
72
+ if (i + DICT_OPERAND_INT16_SIZE > data.length) return;
73
+ i += DICT_OPERAND_INT16_SIZE;
74
+ continue;
75
+ }
76
+ if (b0 === DICT_OPERAND_INT32) {
77
+ if (i + DICT_OPERAND_INT32_SIZE > data.length) return;
78
+ i += DICT_OPERAND_INT32_SIZE;
79
+ continue;
80
+ }
81
+ if (b0 === DICT_OPERAND_REAL) {
82
+ const end = findRealOperandEnd(data, i + 1);
83
+ if (end === void 0) return;
84
+ i = end;
85
+ continue;
86
+ }
87
+ if (b0 >= DICT_OPERAND_SMALL_FIRST && b0 <= DICT_OPERAND_SMALL_LAST) {
88
+ i += 1;
89
+ continue;
90
+ }
91
+ if (b0 >= DICT_OPERAND_MEDIUM_FIRST && b0 <= DICT_OPERAND_MEDIUM_LAST) {
92
+ if (i + DICT_OPERAND_MEDIUM_SIZE > data.length) return;
93
+ i += DICT_OPERAND_MEDIUM_SIZE;
94
+ continue;
95
+ }
96
+ return;
97
+ }
98
+ return false;
99
+ }
100
+ function findRealOperandEnd(data, start) {
101
+ for (let i = start; i < data.length; i++) {
102
+ const byte = data[i];
103
+ if (byte >> 4 === DICT_REAL_TERMINATOR_NIBBLE || (byte & 15) === DICT_REAL_TERMINATOR_NIBBLE) return i + 1;
104
+ }
105
+ }
106
+ function decodeAscii(bytes) {
107
+ let text = "";
108
+ for (const byte of bytes) text += String.fromCharCode(byte);
109
+ return text;
110
+ }
111
+ function probeCff(bytes) {
112
+ if (!require_sfnt.hasBytes(bytes, 0, CFF_HEADER_SIZE)) return;
113
+ const majorVersion = require_sfnt.u8(bytes, 0);
114
+ const minorVersion = require_sfnt.u8(bytes, 1);
115
+ const headerSize = require_sfnt.u8(bytes, 2);
116
+ if (majorVersion !== CFF_MAJOR_VERSION || headerSize < CFF_HEADER_SIZE) return;
117
+ const nameIndex = readIndex(bytes, headerSize);
118
+ if (nameIndex === void 0 || nameIndex.count === 0) return;
119
+ const nameBytes = nameIndex.entry(0);
120
+ if (nameBytes === void 0) return;
121
+ const topDict = readIndex(bytes, nameIndex.endOffset)?.entry(0);
122
+ if (topDict === void 0) return;
123
+ const cidKeyed = dictDeclaresRos(topDict);
124
+ if (cidKeyed === void 0) return;
125
+ return {
126
+ majorVersion,
127
+ minorVersion,
128
+ name: decodeAscii(nameBytes),
129
+ cidKeyed
130
+ };
131
+ }
132
+ //#endregion
133
+ exports.probeCff = probeCff;
@@ -0,0 +1,10 @@
1
+ //#region src/cff-probe.d.ts
2
+ interface CffProbeResult {
3
+ readonly majorVersion: number;
4
+ readonly minorVersion: number;
5
+ readonly name: string;
6
+ readonly cidKeyed: boolean;
7
+ }
8
+ declare function probeCff(bytes: Uint8Array<ArrayBuffer>): CffProbeResult | undefined;
9
+ //#endregion
10
+ export { CffProbeResult, probeCff };
@@ -0,0 +1,10 @@
1
+ //#region src/cff-probe.d.ts
2
+ interface CffProbeResult {
3
+ readonly majorVersion: number;
4
+ readonly minorVersion: number;
5
+ readonly name: string;
6
+ readonly cidKeyed: boolean;
7
+ }
8
+ declare function probeCff(bytes: Uint8Array<ArrayBuffer>): CffProbeResult | undefined;
9
+ //#endregion
10
+ export { CffProbeResult, probeCff };
@@ -0,0 +1,132 @@
1
+ import { hasBytes, u16, u24, u32, u8 } from "./sfnt.js";
2
+ //#region src/cff-probe.ts
3
+ const CFF_HEADER_SIZE = 4;
4
+ const CFF_MAJOR_VERSION = 1;
5
+ const INDEX_COUNT_SIZE = 2;
6
+ const INDEX_OFF_SIZE_SIZE = 1;
7
+ const MIN_OFF_SIZE = 1;
8
+ const MAX_OFF_SIZE = 4;
9
+ const DICT_OPERATOR_MAX = 21;
10
+ const DICT_OPERATOR_ESCAPE = 12;
11
+ const DICT_ROS_ESCAPED_OPERATOR = 30;
12
+ const DICT_OPERAND_INT16 = 28;
13
+ const DICT_OPERAND_INT32 = 29;
14
+ const DICT_OPERAND_REAL = 30;
15
+ const DICT_OPERAND_INT16_SIZE = 3;
16
+ const DICT_OPERAND_INT32_SIZE = 5;
17
+ const DICT_OPERAND_SMALL_FIRST = 32;
18
+ const DICT_OPERAND_SMALL_LAST = 246;
19
+ const DICT_OPERAND_MEDIUM_FIRST = 247;
20
+ const DICT_OPERAND_MEDIUM_LAST = 254;
21
+ const DICT_OPERAND_MEDIUM_SIZE = 2;
22
+ const DICT_REAL_TERMINATOR_NIBBLE = 15;
23
+ function readOffsetAt(bytes, offset, offSize) {
24
+ if (offSize === 1) return u8(bytes, offset);
25
+ if (offSize === 2) return u16(bytes, offset);
26
+ if (offSize === 3) return u24(bytes, offset);
27
+ return u32(bytes, offset);
28
+ }
29
+ function readIndex(bytes, offset) {
30
+ if (!hasBytes(bytes, offset, INDEX_COUNT_SIZE)) return;
31
+ const count = u16(bytes, offset);
32
+ if (count === 0) return {
33
+ count: 0,
34
+ endOffset: offset + INDEX_COUNT_SIZE,
35
+ entry: () => void 0
36
+ };
37
+ if (!hasBytes(bytes, offset + INDEX_COUNT_SIZE, INDEX_OFF_SIZE_SIZE)) return;
38
+ const offSize = u8(bytes, offset + INDEX_COUNT_SIZE);
39
+ if (offSize < MIN_OFF_SIZE || offSize > MAX_OFF_SIZE) return;
40
+ const offsetArrayStart = offset + INDEX_COUNT_SIZE + INDEX_OFF_SIZE_SIZE;
41
+ const offsetArrayLength = (count + 1) * offSize;
42
+ if (!hasBytes(bytes, offsetArrayStart, offsetArrayLength)) return;
43
+ const offsets = [];
44
+ for (let i = 0; i <= count; i++) offsets.push(readOffsetAt(bytes, offsetArrayStart + i * offSize, offSize));
45
+ if (offsets[0] !== 1) return;
46
+ for (let i = 1; i <= count; i++) if (offsets[i] < offsets[i - 1]) return;
47
+ const dataOrigin = offsetArrayStart + offsetArrayLength - 1;
48
+ const dataLength = offsets[count] - 1;
49
+ if (!hasBytes(bytes, dataOrigin + 1, dataLength)) return;
50
+ return {
51
+ count,
52
+ endOffset: dataOrigin + 1 + dataLength,
53
+ entry: (index) => index < 0 || index >= count ? void 0 : bytes.subarray(dataOrigin + offsets[index], dataOrigin + offsets[index + 1])
54
+ };
55
+ }
56
+ function dictDeclaresRos(data) {
57
+ let i = 0;
58
+ while (i < data.length) {
59
+ const b0 = data[i];
60
+ if (b0 <= DICT_OPERATOR_MAX) {
61
+ if (b0 !== DICT_OPERATOR_ESCAPE) {
62
+ i += 1;
63
+ continue;
64
+ }
65
+ if (i + 1 >= data.length) return;
66
+ if (data[i + 1] === DICT_ROS_ESCAPED_OPERATOR) return true;
67
+ i += 2;
68
+ continue;
69
+ }
70
+ if (b0 === DICT_OPERAND_INT16) {
71
+ if (i + DICT_OPERAND_INT16_SIZE > data.length) return;
72
+ i += DICT_OPERAND_INT16_SIZE;
73
+ continue;
74
+ }
75
+ if (b0 === DICT_OPERAND_INT32) {
76
+ if (i + DICT_OPERAND_INT32_SIZE > data.length) return;
77
+ i += DICT_OPERAND_INT32_SIZE;
78
+ continue;
79
+ }
80
+ if (b0 === DICT_OPERAND_REAL) {
81
+ const end = findRealOperandEnd(data, i + 1);
82
+ if (end === void 0) return;
83
+ i = end;
84
+ continue;
85
+ }
86
+ if (b0 >= DICT_OPERAND_SMALL_FIRST && b0 <= DICT_OPERAND_SMALL_LAST) {
87
+ i += 1;
88
+ continue;
89
+ }
90
+ if (b0 >= DICT_OPERAND_MEDIUM_FIRST && b0 <= DICT_OPERAND_MEDIUM_LAST) {
91
+ if (i + DICT_OPERAND_MEDIUM_SIZE > data.length) return;
92
+ i += DICT_OPERAND_MEDIUM_SIZE;
93
+ continue;
94
+ }
95
+ return;
96
+ }
97
+ return false;
98
+ }
99
+ function findRealOperandEnd(data, start) {
100
+ for (let i = start; i < data.length; i++) {
101
+ const byte = data[i];
102
+ if (byte >> 4 === DICT_REAL_TERMINATOR_NIBBLE || (byte & 15) === DICT_REAL_TERMINATOR_NIBBLE) return i + 1;
103
+ }
104
+ }
105
+ function decodeAscii(bytes) {
106
+ let text = "";
107
+ for (const byte of bytes) text += String.fromCharCode(byte);
108
+ return text;
109
+ }
110
+ function probeCff(bytes) {
111
+ if (!hasBytes(bytes, 0, CFF_HEADER_SIZE)) return;
112
+ const majorVersion = u8(bytes, 0);
113
+ const minorVersion = u8(bytes, 1);
114
+ const headerSize = u8(bytes, 2);
115
+ if (majorVersion !== CFF_MAJOR_VERSION || headerSize < CFF_HEADER_SIZE) return;
116
+ const nameIndex = readIndex(bytes, headerSize);
117
+ if (nameIndex === void 0 || nameIndex.count === 0) return;
118
+ const nameBytes = nameIndex.entry(0);
119
+ if (nameBytes === void 0) return;
120
+ const topDict = readIndex(bytes, nameIndex.endOffset)?.entry(0);
121
+ if (topDict === void 0) return;
122
+ const cidKeyed = dictDeclaresRos(topDict);
123
+ if (cidKeyed === void 0) return;
124
+ return {
125
+ majorVersion,
126
+ minorVersion,
127
+ name: decodeAscii(nameBytes),
128
+ cidKeyed
129
+ };
130
+ }
131
+ //#endregion
132
+ export { probeCff };
@@ -0,0 +1,108 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_sfnt = require("./sfnt.cjs");
3
+ //#region src/cmap-table.ts
4
+ const CMAP_HEADER_SIZE = 4;
5
+ const SUBTABLE_RECORD_SIZE = 8;
6
+ const FORMAT_4_HEADER_SIZE = 14;
7
+ function parseFormat4(bytes, subtableOffset) {
8
+ if (!require_sfnt.hasBytes(bytes, subtableOffset, FORMAT_4_HEADER_SIZE)) return;
9
+ const segCountX2 = require_sfnt.u16(bytes, subtableOffset + 6);
10
+ if (segCountX2 === 0 || segCountX2 % 2 !== 0) return;
11
+ const segCount = segCountX2 / 2;
12
+ const endCodesOffset = subtableOffset + FORMAT_4_HEADER_SIZE;
13
+ const startCodesOffset = endCodesOffset + segCountX2 + 2;
14
+ const idDeltasOffset = startCodesOffset + segCountX2;
15
+ const idRangeOffsetsOffset = idDeltasOffset + segCountX2;
16
+ if (!require_sfnt.hasBytes(bytes, endCodesOffset, segCountX2 * 4 + 2)) return;
17
+ const segments = [];
18
+ for (let i = 0; i < segCount; i++) {
19
+ const idRangeOffsetPos = idRangeOffsetsOffset + i * 2;
20
+ const rawDelta = require_sfnt.u16(bytes, idDeltasOffset + i * 2);
21
+ segments.push({
22
+ endCode: require_sfnt.u16(bytes, endCodesOffset + i * 2),
23
+ startCode: require_sfnt.u16(bytes, startCodesOffset + i * 2),
24
+ idDelta: rawDelta >= 32768 ? rawDelta - 65536 : rawDelta,
25
+ idRangeOffsetPos,
26
+ idRangeOffset: require_sfnt.u16(bytes, idRangeOffsetPos)
27
+ });
28
+ }
29
+ return (codePoint) => {
30
+ if (codePoint > 65535) return;
31
+ for (const segment of segments) {
32
+ if (codePoint < segment.startCode || codePoint > segment.endCode) continue;
33
+ if (segment.idRangeOffset === 0) return codePoint + segment.idDelta & 65535;
34
+ const glyphIndexAddress = segment.idRangeOffsetPos + segment.idRangeOffset + (codePoint - segment.startCode) * 2;
35
+ if (!require_sfnt.hasBytes(bytes, glyphIndexAddress, 2)) return;
36
+ const glyphId = require_sfnt.u16(bytes, glyphIndexAddress);
37
+ return glyphId === 0 ? void 0 : glyphId + segment.idDelta & 65535;
38
+ }
39
+ };
40
+ }
41
+ const FORMAT_12_HEADER_SIZE = 16;
42
+ const FORMAT_12_GROUP_SIZE = 12;
43
+ function parseFormat12(bytes, subtableOffset) {
44
+ if (!require_sfnt.hasBytes(bytes, subtableOffset, FORMAT_12_HEADER_SIZE)) return;
45
+ const numGroups = require_sfnt.u32(bytes, subtableOffset + 12);
46
+ const groupsOffset = subtableOffset + FORMAT_12_HEADER_SIZE;
47
+ if (!require_sfnt.hasBytes(bytes, groupsOffset, numGroups * FORMAT_12_GROUP_SIZE)) return;
48
+ const groups = [];
49
+ for (let i = 0; i < numGroups; i++) {
50
+ const recordOffset = groupsOffset + i * FORMAT_12_GROUP_SIZE;
51
+ groups.push({
52
+ startCharCode: require_sfnt.u32(bytes, recordOffset),
53
+ endCharCode: require_sfnt.u32(bytes, recordOffset + 4),
54
+ startGlyphId: require_sfnt.u32(bytes, recordOffset + 8)
55
+ });
56
+ }
57
+ return (codePoint) => {
58
+ for (const group of groups) if (codePoint >= group.startCharCode && codePoint <= group.endCharCode) return group.startGlyphId + (codePoint - group.startCharCode);
59
+ };
60
+ }
61
+ const FORMAT_6_HEADER_SIZE = 10;
62
+ function parseFormat6(bytes, subtableOffset) {
63
+ if (!require_sfnt.hasBytes(bytes, subtableOffset, FORMAT_6_HEADER_SIZE)) return;
64
+ const firstCode = require_sfnt.u16(bytes, subtableOffset + 6);
65
+ const entryCount = require_sfnt.u16(bytes, subtableOffset + 8);
66
+ const glyphIdArrayOffset = subtableOffset + FORMAT_6_HEADER_SIZE;
67
+ if (!require_sfnt.hasBytes(bytes, glyphIdArrayOffset, entryCount * 2)) return;
68
+ return (codePoint) => {
69
+ const index = codePoint - firstCode;
70
+ if (index < 0 || index >= entryCount) return;
71
+ const glyphId = require_sfnt.u16(bytes, glyphIdArrayOffset + index * 2);
72
+ return glyphId === 0 ? void 0 : glyphId;
73
+ };
74
+ }
75
+ function preferenceRank(subtable) {
76
+ if (subtable.format === 12) {
77
+ if (subtable.platformId === 3 && subtable.encodingId === 10) return 0;
78
+ if (subtable.platformId === 0) return 1;
79
+ return 2;
80
+ }
81
+ if (subtable.format === 4) return subtable.platformId === 3 && subtable.encodingId === 1 ? 3 : 4;
82
+ return 5;
83
+ }
84
+ function buildCmapLookup(font) {
85
+ const cmapBytes = require_sfnt.sfntTableBytes(font, "cmap");
86
+ if (cmapBytes === void 0 || !require_sfnt.hasBytes(cmapBytes, 0, CMAP_HEADER_SIZE)) return;
87
+ const numTables = require_sfnt.u16(cmapBytes, 2);
88
+ if (!require_sfnt.hasBytes(cmapBytes, CMAP_HEADER_SIZE, numTables * SUBTABLE_RECORD_SIZE)) return;
89
+ const subtables = [];
90
+ for (let i = 0; i < numTables; i++) {
91
+ const recordOffset = CMAP_HEADER_SIZE + i * SUBTABLE_RECORD_SIZE;
92
+ const offset = require_sfnt.u32(cmapBytes, recordOffset + 4);
93
+ if (!require_sfnt.hasBytes(cmapBytes, offset, 2)) continue;
94
+ subtables.push({
95
+ platformId: require_sfnt.u16(cmapBytes, recordOffset),
96
+ encodingId: require_sfnt.u16(cmapBytes, recordOffset + 2),
97
+ offset,
98
+ format: require_sfnt.u16(cmapBytes, offset)
99
+ });
100
+ }
101
+ const candidates = subtables.filter((s) => s.format === 4 || s.format === 6 || s.format === 12).sort((a, b) => preferenceRank(a) - preferenceRank(b));
102
+ for (const candidate of candidates) {
103
+ const lookup = candidate.format === 12 ? parseFormat12(cmapBytes, candidate.offset) : candidate.format === 4 ? parseFormat4(cmapBytes, candidate.offset) : parseFormat6(cmapBytes, candidate.offset);
104
+ if (lookup !== void 0) return lookup;
105
+ }
106
+ }
107
+ //#endregion
108
+ exports.buildCmapLookup = buildCmapLookup;
@@ -0,0 +1,6 @@
1
+ import { t as SfntFont } from "./sfnt-V08bb5ut.cjs";
2
+ //#region src/cmap-table.d.ts
3
+ type CmapLookup = (codePoint: number) => number | undefined;
4
+ declare function buildCmapLookup(font: SfntFont): CmapLookup | undefined;
5
+ //#endregion
6
+ export { CmapLookup, buildCmapLookup };
@@ -0,0 +1,6 @@
1
+ import { t as SfntFont } from "./sfnt-V08bb5ut.js";
2
+ //#region src/cmap-table.d.ts
3
+ type CmapLookup = (codePoint: number) => number | undefined;
4
+ declare function buildCmapLookup(font: SfntFont): CmapLookup | undefined;
5
+ //#endregion
6
+ export { CmapLookup, buildCmapLookup };
@@ -0,0 +1,107 @@
1
+ import { hasBytes, sfntTableBytes, u16, u32 } from "./sfnt.js";
2
+ //#region src/cmap-table.ts
3
+ const CMAP_HEADER_SIZE = 4;
4
+ const SUBTABLE_RECORD_SIZE = 8;
5
+ const FORMAT_4_HEADER_SIZE = 14;
6
+ function parseFormat4(bytes, subtableOffset) {
7
+ if (!hasBytes(bytes, subtableOffset, FORMAT_4_HEADER_SIZE)) return;
8
+ const segCountX2 = u16(bytes, subtableOffset + 6);
9
+ if (segCountX2 === 0 || segCountX2 % 2 !== 0) return;
10
+ const segCount = segCountX2 / 2;
11
+ const endCodesOffset = subtableOffset + FORMAT_4_HEADER_SIZE;
12
+ const startCodesOffset = endCodesOffset + segCountX2 + 2;
13
+ const idDeltasOffset = startCodesOffset + segCountX2;
14
+ const idRangeOffsetsOffset = idDeltasOffset + segCountX2;
15
+ if (!hasBytes(bytes, endCodesOffset, segCountX2 * 4 + 2)) return;
16
+ const segments = [];
17
+ for (let i = 0; i < segCount; i++) {
18
+ const idRangeOffsetPos = idRangeOffsetsOffset + i * 2;
19
+ const rawDelta = u16(bytes, idDeltasOffset + i * 2);
20
+ segments.push({
21
+ endCode: u16(bytes, endCodesOffset + i * 2),
22
+ startCode: u16(bytes, startCodesOffset + i * 2),
23
+ idDelta: rawDelta >= 32768 ? rawDelta - 65536 : rawDelta,
24
+ idRangeOffsetPos,
25
+ idRangeOffset: u16(bytes, idRangeOffsetPos)
26
+ });
27
+ }
28
+ return (codePoint) => {
29
+ if (codePoint > 65535) return;
30
+ for (const segment of segments) {
31
+ if (codePoint < segment.startCode || codePoint > segment.endCode) continue;
32
+ if (segment.idRangeOffset === 0) return codePoint + segment.idDelta & 65535;
33
+ const glyphIndexAddress = segment.idRangeOffsetPos + segment.idRangeOffset + (codePoint - segment.startCode) * 2;
34
+ if (!hasBytes(bytes, glyphIndexAddress, 2)) return;
35
+ const glyphId = u16(bytes, glyphIndexAddress);
36
+ return glyphId === 0 ? void 0 : glyphId + segment.idDelta & 65535;
37
+ }
38
+ };
39
+ }
40
+ const FORMAT_12_HEADER_SIZE = 16;
41
+ const FORMAT_12_GROUP_SIZE = 12;
42
+ function parseFormat12(bytes, subtableOffset) {
43
+ if (!hasBytes(bytes, subtableOffset, FORMAT_12_HEADER_SIZE)) return;
44
+ const numGroups = u32(bytes, subtableOffset + 12);
45
+ const groupsOffset = subtableOffset + FORMAT_12_HEADER_SIZE;
46
+ if (!hasBytes(bytes, groupsOffset, numGroups * FORMAT_12_GROUP_SIZE)) return;
47
+ const groups = [];
48
+ for (let i = 0; i < numGroups; i++) {
49
+ const recordOffset = groupsOffset + i * FORMAT_12_GROUP_SIZE;
50
+ groups.push({
51
+ startCharCode: u32(bytes, recordOffset),
52
+ endCharCode: u32(bytes, recordOffset + 4),
53
+ startGlyphId: u32(bytes, recordOffset + 8)
54
+ });
55
+ }
56
+ return (codePoint) => {
57
+ for (const group of groups) if (codePoint >= group.startCharCode && codePoint <= group.endCharCode) return group.startGlyphId + (codePoint - group.startCharCode);
58
+ };
59
+ }
60
+ const FORMAT_6_HEADER_SIZE = 10;
61
+ function parseFormat6(bytes, subtableOffset) {
62
+ if (!hasBytes(bytes, subtableOffset, FORMAT_6_HEADER_SIZE)) return;
63
+ const firstCode = u16(bytes, subtableOffset + 6);
64
+ const entryCount = u16(bytes, subtableOffset + 8);
65
+ const glyphIdArrayOffset = subtableOffset + FORMAT_6_HEADER_SIZE;
66
+ if (!hasBytes(bytes, glyphIdArrayOffset, entryCount * 2)) return;
67
+ return (codePoint) => {
68
+ const index = codePoint - firstCode;
69
+ if (index < 0 || index >= entryCount) return;
70
+ const glyphId = u16(bytes, glyphIdArrayOffset + index * 2);
71
+ return glyphId === 0 ? void 0 : glyphId;
72
+ };
73
+ }
74
+ function preferenceRank(subtable) {
75
+ if (subtable.format === 12) {
76
+ if (subtable.platformId === 3 && subtable.encodingId === 10) return 0;
77
+ if (subtable.platformId === 0) return 1;
78
+ return 2;
79
+ }
80
+ if (subtable.format === 4) return subtable.platformId === 3 && subtable.encodingId === 1 ? 3 : 4;
81
+ return 5;
82
+ }
83
+ function buildCmapLookup(font) {
84
+ const cmapBytes = sfntTableBytes(font, "cmap");
85
+ if (cmapBytes === void 0 || !hasBytes(cmapBytes, 0, CMAP_HEADER_SIZE)) return;
86
+ const numTables = u16(cmapBytes, 2);
87
+ if (!hasBytes(cmapBytes, CMAP_HEADER_SIZE, numTables * SUBTABLE_RECORD_SIZE)) return;
88
+ const subtables = [];
89
+ for (let i = 0; i < numTables; i++) {
90
+ const recordOffset = CMAP_HEADER_SIZE + i * SUBTABLE_RECORD_SIZE;
91
+ const offset = u32(cmapBytes, recordOffset + 4);
92
+ if (!hasBytes(cmapBytes, offset, 2)) continue;
93
+ subtables.push({
94
+ platformId: u16(cmapBytes, recordOffset),
95
+ encodingId: u16(cmapBytes, recordOffset + 2),
96
+ offset,
97
+ format: u16(cmapBytes, offset)
98
+ });
99
+ }
100
+ const candidates = subtables.filter((s) => s.format === 4 || s.format === 6 || s.format === 12).sort((a, b) => preferenceRank(a) - preferenceRank(b));
101
+ for (const candidate of candidates) {
102
+ const lookup = candidate.format === 12 ? parseFormat12(cmapBytes, candidate.offset) : candidate.format === 4 ? parseFormat4(cmapBytes, candidate.offset) : parseFormat6(cmapBytes, candidate.offset);
103
+ if (lookup !== void 0) return lookup;
104
+ }
105
+ }
106
+ //#endregion
107
+ export { buildCmapLookup };
@@ -3,9 +3,11 @@ const require_afm_widths = require("./afm-widths-BoeTOK2r.cjs");
3
3
  const require_bytes_writer = require("./bytes/writer.cjs");
4
4
  const require_objects = require("./objects.cjs");
5
5
  const require_matrix = require("./matrix.cjs");
6
+ const require_embedded_font = require("./embedded-font.cjs");
6
7
  const require_serialize = require("./serialize.cjs");
7
8
  //#region src/content-write.ts
8
- const BEZIER_KAPPA = .5522847498;
9
+ const GLYPH_SPACE_UNITS_PER_EM = 1e3;
10
+ const EMBEDDED_HORIZONTAL_SCALE_PERCENT = 100;
9
11
  function writeRgbOperator(writer, color, operator) {
10
12
  writer.writeAscii(`${require_serialize.formatNumber(color.r)} ${require_serialize.formatNumber(color.g)} ${require_serialize.formatNumber(color.b)} ${operator}\n`);
11
13
  }
@@ -23,8 +25,7 @@ function anchorMatrix(xPt, yPt, rotationDeg) {
23
25
  yPt
24
26
  ];
25
27
  }
26
- function writeUnderline(writer, item, widthPt, measurer) {
27
- const underline = measurer.underlineAtSize(item.font, item.sizePt);
28
+ function writeUnderline(writer, item, widthPt, underline) {
28
29
  writer.writeAscii("q\n");
29
30
  writeMatrixOperator(writer, anchorMatrix(item.xPt, item.yPt, item.rotationDeg), "cm");
30
31
  writeRgbOperator(writer, item.color, "rg");
@@ -32,23 +33,39 @@ function writeUnderline(writer, item, widthPt, measurer) {
32
33
  writer.writeAscii("f\n");
33
34
  writer.writeAscii("Q\n");
34
35
  }
35
- function writeText(writer, item, context, substitutions) {
36
- const font = context.resolveFont(item.font);
37
- const encoded = require_afm_widths.encodeForShow(item.text, font.standardName);
38
- substitutions.push(...encoded.substitutions);
39
- const scalePercent = context.measurer.horizontalScaleFor(item.font) * 100;
36
+ function writeShowTextBlock(writer, item, resourceName, scalePercent, codes) {
40
37
  writer.writeAscii("BT\n");
41
- writer.writeAscii(`/${font.resourceName} ${require_serialize.formatNumber(item.sizePt)} Tf\n`);
38
+ writer.writeAscii(`/${resourceName} ${require_serialize.formatNumber(item.sizePt)} Tf\n`);
42
39
  writer.writeAscii(`${require_serialize.formatNumber(scalePercent)} Tz\n`);
43
40
  writeRgbOperator(writer, item.color, "rg");
44
41
  writeMatrixOperator(writer, anchorMatrix(item.xPt, item.yPt, item.rotationDeg), "Tm");
45
- require_serialize.writeObject(writer, require_objects.pdfHexString(encoded.codes));
42
+ require_serialize.writeObject(writer, require_objects.pdfHexString(codes));
46
43
  writer.writeAscii(" Tj\n");
47
44
  writer.writeAscii("ET\n");
48
- if (item.underline === true) {
49
- const scale = context.measurer.horizontalScaleFor(item.font);
50
- writeUnderline(writer, item, item.widthPt ?? encoded.width1000 / 1e3 * item.sizePt * scale, context.measurer);
45
+ }
46
+ function writeStandardText(writer, item, standardName, resourceName, measurer, substitutions) {
47
+ const encoded = require_afm_widths.encodeForShow(item.text, standardName);
48
+ substitutions.push(...encoded.substitutions);
49
+ const scale = measurer.horizontalScaleFor(item.font);
50
+ writeShowTextBlock(writer, item, resourceName, scale * 100, encoded.codes);
51
+ if (item.underline === true) writeUnderline(writer, item, item.widthPt ?? encoded.width1000 / GLYPH_SPACE_UNITS_PER_EM * item.sizePt * scale, measurer.underlineAtSize(item.font, item.sizePt));
52
+ }
53
+ function writeEmbeddedText(writer, item, face, resourceName, missingGlyphs) {
54
+ const encoded = require_embedded_font.encodeForShowEmbedded(item.text, face);
55
+ missingGlyphs.push(...encoded.substitutions);
56
+ writeShowTextBlock(writer, item, resourceName, EMBEDDED_HORIZONTAL_SCALE_PERCENT, encoded.codes);
57
+ if (item.underline === true) writeUnderline(writer, item, item.widthPt ?? encoded.width1000 / GLYPH_SPACE_UNITS_PER_EM * item.sizePt, {
58
+ offsetPt: face.metrics.underlinePositionGlyphSpace / GLYPH_SPACE_UNITS_PER_EM * item.sizePt,
59
+ thicknessPt: face.metrics.underlineThicknessGlyphSpace / GLYPH_SPACE_UNITS_PER_EM * item.sizePt
60
+ });
61
+ }
62
+ function writeText(writer, item, context, substitutions, missingGlyphs) {
63
+ const font = context.resolveFont(item.font);
64
+ if (font.kind === "embedded") {
65
+ writeEmbeddedText(writer, item, font.face, font.resourceName, missingGlyphs);
66
+ return;
51
67
  }
68
+ writeStandardText(writer, item, font.standardName, font.resourceName, context.measurer, substitutions);
52
69
  }
53
70
  function paintOperatorFor(fill, stroke, fillRule) {
54
71
  const evenOdd = fillRule === "evenodd";
@@ -87,8 +104,8 @@ function writeEllipse(writer, item) {
87
104
  const cy = item.yPt + item.heightPt / 2;
88
105
  const rx = item.widthPt / 2;
89
106
  const ry = item.heightPt / 2;
90
- const kx = rx * BEZIER_KAPPA;
91
- const ky = ry * BEZIER_KAPPA;
107
+ const kx = rx * require_matrix.BEZIER_KAPPA;
108
+ const ky = ry * require_matrix.BEZIER_KAPPA;
92
109
  writer.writeAscii(`${formatPoint(cx + rx, cy)} m\n`);
93
110
  writer.writeAscii(`${formatPoint(cx + rx, cy + ky)} ${formatPoint(cx + kx, cy + ry)} ${formatPoint(cx, cy + ry)} c\n`);
94
111
  writer.writeAscii(`${formatPoint(cx - kx, cy + ry)} ${formatPoint(cx - rx, cy + ky)} ${formatPoint(cx - rx, cy)} c\n`);
@@ -123,7 +140,8 @@ function writeImage(writer, item, context) {
123
140
  function writeContentStream(items, context) {
124
141
  const writer = new require_bytes_writer.ByteWriter();
125
142
  const substitutions = [];
126
- for (const item of items) if (item.kind === "text") writeText(writer, item, context, substitutions);
143
+ const missingGlyphs = [];
144
+ for (const item of items) if (item.kind === "text") writeText(writer, item, context, substitutions, missingGlyphs);
127
145
  else if (item.kind === "image") writeImage(writer, item, context);
128
146
  else if (item.kind === "rect") writeRect(writer, item);
129
147
  else if (item.kind === "line") writeLine(writer, item);
@@ -131,7 +149,8 @@ function writeContentStream(items, context) {
131
149
  else if (item.kind === "path") writePath(writer, item);
132
150
  return {
133
151
  bytes: writer.toBytes(),
134
- substitutions
152
+ substitutions,
153
+ missingGlyphs
135
154
  };
136
155
  }
137
156
  //#endregion
@@ -1,12 +1,18 @@
1
1
  import { r as StandardFontName } from "./afm-widths-DyDq56Ph.cjs";
2
+ import { r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-CLedn-mT.cjs";
2
3
  import { TextMeasurer } from "./measure.cjs";
3
4
  import { WinAnsiSubstitution } from "./winansi.cjs";
4
5
  import { LayoutFont, LayoutItem } from "document-schema.js";
5
6
  //#region src/content-write.d.ts
6
- interface ResolvedFontResource {
7
+ type ResolvedFontResource = {
8
+ readonly kind: 'standard';
7
9
  readonly resourceName: string;
8
10
  readonly standardName: StandardFontName;
9
- }
11
+ } | {
12
+ readonly kind: 'embedded';
13
+ readonly resourceName: string;
14
+ readonly face: EmbeddedFace;
15
+ };
10
16
  interface ResolvedImageResource {
11
17
  readonly resourceName: string;
12
18
  }
@@ -18,6 +24,7 @@ interface ContentWriteContext {
18
24
  interface ContentStreamResult {
19
25
  readonly bytes: Uint8Array<ArrayBuffer>;
20
26
  readonly substitutions: readonly WinAnsiSubstitution[];
27
+ readonly missingGlyphs: readonly EmbeddedFaceSubstitution[];
21
28
  }
22
29
  declare function writeContentStream(items: readonly LayoutItem[], context: ContentWriteContext): ContentStreamResult;
23
30
  //#endregion
@@ -1,12 +1,18 @@
1
1
  import { r as StandardFontName } from "./afm-widths-DyDq56Ph.js";
2
+ import { r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-CbqkKgBl.js";
2
3
  import { TextMeasurer } from "./measure.js";
3
4
  import { WinAnsiSubstitution } from "./winansi.js";
4
5
  import { LayoutFont, LayoutItem } from "document-schema.js";
5
6
  //#region src/content-write.d.ts
6
- interface ResolvedFontResource {
7
+ type ResolvedFontResource = {
8
+ readonly kind: 'standard';
7
9
  readonly resourceName: string;
8
10
  readonly standardName: StandardFontName;
9
- }
11
+ } | {
12
+ readonly kind: 'embedded';
13
+ readonly resourceName: string;
14
+ readonly face: EmbeddedFace;
15
+ };
10
16
  interface ResolvedImageResource {
11
17
  readonly resourceName: string;
12
18
  }
@@ -18,6 +24,7 @@ interface ContentWriteContext {
18
24
  interface ContentStreamResult {
19
25
  readonly bytes: Uint8Array<ArrayBuffer>;
20
26
  readonly substitutions: readonly WinAnsiSubstitution[];
27
+ readonly missingGlyphs: readonly EmbeddedFaceSubstitution[];
21
28
  }
22
29
  declare function writeContentStream(items: readonly LayoutItem[], context: ContentWriteContext): ContentStreamResult;
23
30
  //#endregion