@takumi-rs/wasm 2.4.2 → 2.5.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/dist/export.cjs CHANGED
@@ -133,6 +133,22 @@ var Renderer$1 = class {
133
133
  }
134
134
  };
135
135
  if (Symbol.dispose) Renderer$1.prototype[Symbol.dispose] = Renderer$1.prototype.free;
136
+ /**
137
+ * Sets the byte budget shared by the resolved-glyph and glyph-mask caches;
138
+ * `0` stops caching. Defaults to 8 MiB.
139
+ *
140
+ * These caches live in the module, not in a `Renderer`, so this budget covers
141
+ * every renderer sharing the module instance. The value is read when a cache
142
+ * is first used, so call this before the first render.
143
+ *
144
+ * Raise it for scripts with large glyph sets: a CJK outline runs a few
145
+ * kilobytes, so the default holds around a thousand of them and a page of
146
+ * Chinese re-rasterizes glyphs it just evicted.
147
+ * @param {number} bytes
148
+ */
149
+ function setGlyphCacheMaxBytes(bytes) {
150
+ wasm.setGlyphCacheMaxBytes(bytes);
151
+ }
136
152
  function __wbg_get_imports() {
137
153
  return {
138
154
  __proto__: null,
@@ -555,3 +571,4 @@ var Renderer = class {
555
571
  exports.Renderer = Renderer;
556
572
  exports.default = __wbg_init;
557
573
  exports.initSync = initSync;
574
+ exports.setGlyphCacheMaxBytes = setGlyphCacheMaxBytes;
package/dist/export.d.cts CHANGED
@@ -201,6 +201,19 @@ type AnimationScene = {
201
201
  node: Node$1;
202
202
  durationMs: number;
203
203
  };
204
+ /**
205
+ * Sets the byte budget shared by the resolved-glyph and glyph-mask caches;
206
+ * `0` stops caching. Defaults to 8 MiB.
207
+ *
208
+ * These caches live in the module, not in a `Renderer`, so this budget covers
209
+ * every renderer sharing the module instance. The value is read when a cache
210
+ * is first used, so call this before the first render.
211
+ *
212
+ * Raise it for scripts with large glyph sets: a CJK outline runs a few
213
+ * kilobytes, so the default holds around a thousand of them and a page of
214
+ * Chinese re-rasterizes glyphs it just evicted.
215
+ */
216
+ declare function setGlyphCacheMaxBytes(bytes: number): void;
204
217
  type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
205
218
  interface InitOutput {
206
219
  readonly memory: WebAssembly.Memory;
@@ -212,6 +225,7 @@ interface InitOutput {
212
225
  readonly renderer_renderAnimation: (a: number, b: any) => [number, number, number, number];
213
226
  readonly renderer_renderAsDataUrl: (a: number, b: any, c: any) => [number, number, number, number];
214
227
  readonly renderer_renderSvg: (a: number, b: any, c: number) => [number, number, number, number];
228
+ readonly setGlyphCacheMaxBytes: (a: number) => void;
215
229
  readonly __wbindgen_malloc: (a: number, b: number) => number;
216
230
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
217
231
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -262,4 +276,4 @@ declare class Renderer {
262
276
  free(): void;
263
277
  }
264
278
  //#endregion
265
- export { AnimationOutputFormat, type AnimationOutputFormatOptions, AnimationScene, ByteBuf, ContainerNode, DitheringAlgorithm, Font, FontDetails, type FontLoader, ImageCacheMode, type ImageLoader, ImageNode, ImageSource, type ImagesInput, InitInput, InitOutput, KeyframeRule, Keyframes, KeyframesMap, KeyframesRule, KeyframesRuleList, MeasuredNode, MeasuredTextRun, type Node, NodeMetadata, OutputFormat, type OutputFormatOptions, RegisteredFace, RegisteredFamily, RenderAnimationOptions, RenderOptions, Renderer, RendererOptions, RgbaImage, SvgRenderOptions, SyncInitInput, TextNode, __wbg_init as default, initSync };
279
+ export { AnimationOutputFormat, type AnimationOutputFormatOptions, AnimationScene, ByteBuf, ContainerNode, DitheringAlgorithm, Font, FontDetails, type FontLoader, ImageCacheMode, type ImageLoader, ImageNode, ImageSource, type ImagesInput, InitInput, InitOutput, KeyframeRule, Keyframes, KeyframesMap, KeyframesRule, KeyframesRuleList, MeasuredNode, MeasuredTextRun, type Node, NodeMetadata, OutputFormat, type OutputFormatOptions, RegisteredFace, RegisteredFamily, RenderAnimationOptions, RenderOptions, Renderer, RendererOptions, RgbaImage, SvgRenderOptions, SyncInitInput, TextNode, __wbg_init as default, initSync, setGlyphCacheMaxBytes };
package/dist/export.d.mts CHANGED
@@ -201,6 +201,19 @@ type AnimationScene = {
201
201
  node: Node$1;
202
202
  durationMs: number;
203
203
  };
204
+ /**
205
+ * Sets the byte budget shared by the resolved-glyph and glyph-mask caches;
206
+ * `0` stops caching. Defaults to 8 MiB.
207
+ *
208
+ * These caches live in the module, not in a `Renderer`, so this budget covers
209
+ * every renderer sharing the module instance. The value is read when a cache
210
+ * is first used, so call this before the first render.
211
+ *
212
+ * Raise it for scripts with large glyph sets: a CJK outline runs a few
213
+ * kilobytes, so the default holds around a thousand of them and a page of
214
+ * Chinese re-rasterizes glyphs it just evicted.
215
+ */
216
+ declare function setGlyphCacheMaxBytes(bytes: number): void;
204
217
  type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
205
218
  interface InitOutput {
206
219
  readonly memory: WebAssembly.Memory;
@@ -212,6 +225,7 @@ interface InitOutput {
212
225
  readonly renderer_renderAnimation: (a: number, b: any) => [number, number, number, number];
213
226
  readonly renderer_renderAsDataUrl: (a: number, b: any, c: any) => [number, number, number, number];
214
227
  readonly renderer_renderSvg: (a: number, b: any, c: number) => [number, number, number, number];
228
+ readonly setGlyphCacheMaxBytes: (a: number) => void;
215
229
  readonly __wbindgen_malloc: (a: number, b: number) => number;
216
230
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
217
231
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -262,4 +276,4 @@ declare class Renderer {
262
276
  free(): void;
263
277
  }
264
278
  //#endregion
265
- export { AnimationOutputFormat, type AnimationOutputFormatOptions, AnimationScene, ByteBuf, ContainerNode, DitheringAlgorithm, Font, FontDetails, type FontLoader, ImageCacheMode, type ImageLoader, ImageNode, ImageSource, type ImagesInput, InitInput, InitOutput, KeyframeRule, Keyframes, KeyframesMap, KeyframesRule, KeyframesRuleList, MeasuredNode, MeasuredTextRun, type Node, NodeMetadata, OutputFormat, type OutputFormatOptions, RegisteredFace, RegisteredFamily, RenderAnimationOptions, RenderOptions, Renderer, RendererOptions, RgbaImage, SvgRenderOptions, SyncInitInput, TextNode, __wbg_init as default, initSync };
279
+ export { AnimationOutputFormat, type AnimationOutputFormatOptions, AnimationScene, ByteBuf, ContainerNode, DitheringAlgorithm, Font, FontDetails, type FontLoader, ImageCacheMode, type ImageLoader, ImageNode, ImageSource, type ImagesInput, InitInput, InitOutput, KeyframeRule, Keyframes, KeyframesMap, KeyframesRule, KeyframesRuleList, MeasuredNode, MeasuredTextRun, type Node, NodeMetadata, OutputFormat, type OutputFormatOptions, RegisteredFace, RegisteredFamily, RenderAnimationOptions, RenderOptions, Renderer, RendererOptions, RgbaImage, SvgRenderOptions, SyncInitInput, TextNode, __wbg_init as default, initSync, setGlyphCacheMaxBytes };
package/dist/export.mjs CHANGED
@@ -129,6 +129,22 @@ var Renderer$1 = class {
129
129
  }
130
130
  };
131
131
  if (Symbol.dispose) Renderer$1.prototype[Symbol.dispose] = Renderer$1.prototype.free;
132
+ /**
133
+ * Sets the byte budget shared by the resolved-glyph and glyph-mask caches;
134
+ * `0` stops caching. Defaults to 8 MiB.
135
+ *
136
+ * These caches live in the module, not in a `Renderer`, so this budget covers
137
+ * every renderer sharing the module instance. The value is read when a cache
138
+ * is first used, so call this before the first render.
139
+ *
140
+ * Raise it for scripts with large glyph sets: a CJK outline runs a few
141
+ * kilobytes, so the default holds around a thousand of them and a page of
142
+ * Chinese re-rasterizes glyphs it just evicted.
143
+ * @param {number} bytes
144
+ */
145
+ function setGlyphCacheMaxBytes(bytes) {
146
+ wasm.setGlyphCacheMaxBytes(bytes);
147
+ }
132
148
  function __wbg_get_imports() {
133
149
  return {
134
150
  __proto__: null,
@@ -548,4 +564,4 @@ var Renderer = class {
548
564
  }
549
565
  };
550
566
  //#endregion
551
- export { Renderer, __wbg_init as default, initSync };
567
+ export { Renderer, __wbg_init as default, initSync, setGlyphCacheMaxBytes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/wasm",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "description": "WebAssembly bindings for Takumi, a Rust image rendering engine.",
5
5
  "keywords": [
6
6
  "css",
@@ -117,12 +117,12 @@
117
117
  "publish-lint": "attw --pack . && publint --strict ."
118
118
  },
119
119
  "dependencies": {
120
- "@takumi-rs/helpers": "2.4.2"
120
+ "@takumi-rs/helpers": "2.5.0"
121
121
  },
122
122
  "devDependencies": {
123
123
  "@types/bun": "^1.3.14",
124
124
  "csstype": "^3.2.3",
125
- "tsdown": "0.22.5",
125
+ "tsdown": "0.22.14",
126
126
  "unrun": "^0.3.1"
127
127
  },
128
128
  "peerDependencies": {
Binary file
@@ -9,6 +9,7 @@ export const renderer_render: (a: number, b: any, c: number) => [number, number,
9
9
  export const renderer_renderAnimation: (a: number, b: any) => [number, number, number, number];
10
10
  export const renderer_renderAsDataUrl: (a: number, b: any, c: any) => [number, number, number, number];
11
11
  export const renderer_renderSvg: (a: number, b: any, c: number) => [number, number, number, number];
12
+ export const setGlyphCacheMaxBytes: (a: number) => void;
12
13
  export const __wbindgen_malloc: (a: number, b: number) => number;
13
14
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
14
15
  export const __wbindgen_exn_store: (a: number) => void;