inkoxide 0.2.0 → 0.4.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.
package/README.md CHANGED
@@ -48,7 +48,7 @@ try {
48
48
  console.error(e.code, e.path, e.message);
49
49
  }
50
50
 
51
- // All problems at once, without rendering: [{ code, path, message }, …]
51
+ // The problems at once (at most 100), without rendering: [{ code, path, message }, …]
52
52
  console.log(validate(JSON.stringify(doc)));
53
53
  ```
54
54
 
package/index.d.ts CHANGED
@@ -54,7 +54,10 @@ export interface RenderOptions {
54
54
  * `meta.creationDate`. With neither set no date is written. Default: none.
55
55
  */
56
56
  creationDate?: string;
57
- /** Worker threads for this render. Default: all cores. `1` renders on one thread. */
57
+ /**
58
+ * Worker threads for this render. Default: all cores. `1` renders on the libuv thread that
59
+ * runs it, with no parallelism inside, so concurrent renders do not wait for each other.
60
+ */
58
61
  threads?: number;
59
62
  /** Embed only the glyphs the document uses. Default `true`; `false` embeds whole fonts. */
60
63
  subsetFonts?: boolean;
@@ -84,7 +87,7 @@ export class InkoxideError extends Error {
84
87
  readonly path: string;
85
88
  }
86
89
 
87
- /** Registers (or replaces) a TrueType or CFF OpenType font in the process-wide cache. */
90
+ /** Registers (or replaces) a TrueType, CFF OpenType, WOFF or WOFF2 font in the process-wide cache. */
88
91
  export function registerFont(id: string, data: Uint8Array): void;
89
92
  /** Removes a registered font; returns whether it existed. */
90
93
  export function unregisterFont(id: string): boolean;
@@ -92,16 +95,18 @@ export function unregisterFont(id: string): boolean;
92
95
  * Registers (or replaces), for all later renders, TeX hyphenation patterns
93
96
  * for a language: a hyph-utf8 file such as `hyph-en-us.tex` with
94
97
  * `\patterns{…}` and optional `\hyphenation{…}` groups, in UTF-8.
95
- * `lang` is a BCP-47 tag (`"en"`, `"en-GB"`); patterns apply to its
96
- * language. Registered patterns win over the built-in ones. Throws
97
- * `HYPHENATION_ERROR` for malformed patterns.
98
+ * `lang` is a BCP-47 tag with a two- or three-letter language (`"en"`,
99
+ * `"en-GB"`, `"haw"`). Text uses the patterns of its own tag, else of the
100
+ * nearest less specific one (`"en-GB"`, then `"en"`), else the built-in
101
+ * ones. Throws `HYPHENATION_ERROR` for a malformed tag or patterns.
98
102
  */
99
103
  export function registerHyphenationPatterns(lang: string, data: Uint8Array | string): void;
100
- /** Removes registered patterns; returns whether there were any. */
104
+ /** Removes the patterns registered for exactly `lang`; returns whether there were any. */
101
105
  export function unregisterHyphenationPatterns(lang: string): boolean;
102
106
  /**
103
107
  * Validates a document against the schema and the registered fonts. Image
104
- * references are checked only when `images` is given.
108
+ * references are checked only when `images` is given. Returns at most 100
109
+ * problems; one in the document's structure is returned alone.
105
110
  */
106
111
  export function validate(
107
112
  doc: Uint8Array | string,
package/index.js CHANGED
@@ -121,5 +121,6 @@ export const render = async (doc, options) => {
121
121
  export const renderSync = (doc, options) =>
122
122
  toUint8Array(call(native.renderSync, [doc, options ?? undefined]));
123
123
  export const version = () => call(native.version, []);
124
- // Test hook, not public API and not in index.d.ts: a panic behind the native boundary.
125
- export const __testPanic = () => call(native.__testPanic, []);
124
+ // Test hook, not public API and not in index.d.ts: a panic behind the native boundary. A
125
+ // non-enumerable property of InkoxideError, so it is not on the module namespace.
126
+ Object.defineProperty(InkoxideError, '__testPanic', { value: () => call(native.__testPanic, []) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inkoxide",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Native PDF layout and rendering engine: declarative document tree in, PDF bytes out.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,11 +26,11 @@
26
26
  "node": ">=22"
27
27
  },
28
28
  "optionalDependencies": {
29
- "@inkoxide/linux-x64-gnu": "0.2.0",
30
- "@inkoxide/linux-x64-musl": "0.2.0",
31
- "@inkoxide/linux-arm64-gnu": "0.2.0",
32
- "@inkoxide/darwin-arm64": "0.2.0",
33
- "@inkoxide/darwin-x64": "0.2.0",
34
- "@inkoxide/win32-x64-msvc": "0.2.0"
29
+ "@inkoxide/linux-x64-gnu": "0.4.0",
30
+ "@inkoxide/linux-x64-musl": "0.4.0",
31
+ "@inkoxide/linux-arm64-gnu": "0.4.0",
32
+ "@inkoxide/darwin-arm64": "0.4.0",
33
+ "@inkoxide/darwin-x64": "0.4.0",
34
+ "@inkoxide/win32-x64-msvc": "0.4.0"
35
35
  }
36
36
  }