alpha2 0.4.4 → 0.4.6

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/project.js CHANGED
@@ -15,7 +15,7 @@
15
15
  * half-open: `[start, end)`.
16
16
  */
17
17
  import { parseHex, parseInsets, parseLength, parseOffset, parsePlacement, parseSize, parseTrackList, } from "./layout-values.js";
18
- import { AUDIO_EFFECT_STATE_MARGIN_MS, MAX_CANVAS_DIMENSION, MAX_CANVAS_PIXELS, MAX_TEXT_CONTENT_BYTES, MAX_FONT_FAMILY_BYTES, MAX_COMPOSITIONS, MAX_COMPOSITION_NODES, MAX_COMPOSITION_CONTROLS, MAX_COMPOSITION_DEPTH, MAX_GROUP_INPUTS, MAX_EFFECT_INPUTS, MAX_FRAME_INLINED_NODES, MAX_INLINED_NODES, MAX_MERGE_LAYERS, MAX_CLIP_MASKS, MAX_DASH_ENTRIES, MAX_GRADIENT_STOPS, MAX_PATH_SUBPATHS, MAX_PATH_VERTICES, MAX_POLYSTAR_POINTS, MAX_SHAPE_DEPTH, MAX_SHAPE_ITEMS, MAX_LAYOUT_DEPTH, MAX_LAYOUT_FONT_SIZE, MAX_LAYOUT_ISOLATED, MAX_LAYOUT_NODES, MAX_LAYOUT_TEXTS, MAX_GRID_TRACKS, MIN_POLYSTAR_POINTS, MAX_CLIPS, MAX_CLIPS_PER_TRACK, MAX_AUDIO_DELAY_MS, MAX_AUDIO_EFFECTS, MAX_CAPTION_FONT_SIZE, MAX_TEXT_GENERATOR_FONT_SIZE, MAX_LINE_HEIGHT, MAX_TEXT_OUTLINE_WIDTH, MAX_TEXT_PADDING, MAX_CHAIN_EFFECTS, MAX_COMPRESSOR_RATIO, MAX_ENVELOPE_MS, MAX_EQ_BANDS, MAX_LOOKAHEAD_MS, MIN_LINE_HEIGHT, MIN_LEVEL_DB, MAX_EQ_FREQUENCY_HZ, MAX_EQ_GAIN_DB, MAX_EQ_Q, MAX_GAIN, MAX_PROJECT_JSON_BYTES, MAX_SAMPLE_RATE, MAX_TRACKS, MAX_TRANSITIONS_PER_TRACK, MIN_EQ_FREQUENCY_HZ, MIN_EQ_Q, MIN_SAMPLE_RATE, MIN_HDR_PEAK_NITS, MAX_HDR_PEAK_NITS, MAX_SEQUENCE_FRAMES, REVERB_DELAY_MS, TICKS_PER_SECOND, } from "./generated/project-schema.js";
18
+ import { AUDIO_EFFECT_STATE_MARGIN_MS, MAX_CANVAS_DIMENSION, MAX_CANVAS_PIXELS, MAX_TEXT_CONTENT_BYTES, MAX_FONT_FAMILY_BYTES, MAX_COMPOSITIONS, MAX_COMPOSITION_NODES, MAX_COMPOSITION_CONTROLS, MAX_COMPOSITION_DEPTH, MAX_GROUP_INPUTS, MAX_EFFECT_INPUTS, MAX_FRAME_INLINED_NODES, MAX_INLINED_NODES, MAX_MERGE_LAYERS, MAX_CLIP_MASKS, MAX_DASH_ENTRIES, MAX_GRADIENT_STOPS, MAX_PATH_SUBPATHS, MAX_PATH_VERTICES, MAX_POLYSTAR_POINTS, MAX_SHAPE_DEPTH, MAX_SHAPE_ITEMS, MAX_LAYOUT_DEPTH, MAX_LAYOUT_FONT_SIZE, MAX_LAYOUT_ISOLATED, MAX_LAYOUT_NODES, MAX_LAYOUT_TEXTS, MAX_GRID_TRACKS, MIN_POLYSTAR_POINTS, MAX_CLIPS, MAX_CLIPS_PER_TRACK, MAX_AUDIO_DELAY_MS, MAX_AUDIO_EFFECTS, MAX_CAPTION_FONT_SIZE, MAX_TEXT_GENERATOR_FONT_SIZE, MAX_FONT_WEIGHT, MAX_LETTER_SPACING, MAX_LINE_HEIGHT, MAX_TEXT_OUTLINE_WIDTH, MAX_TEXT_PADDING, MAX_CHAIN_EFFECTS, MAX_COMPRESSOR_RATIO, MAX_ENVELOPE_MS, MAX_EQ_BANDS, MAX_LOOKAHEAD_MS, MIN_FONT_WEIGHT, MIN_LETTER_SPACING, MIN_LINE_HEIGHT, MIN_LEVEL_DB, MAX_EQ_FREQUENCY_HZ, MAX_EQ_GAIN_DB, MAX_EQ_Q, MAX_GAIN, MAX_PROJECT_JSON_BYTES, MAX_SAMPLE_RATE, MAX_TRACKS, MAX_TRANSITIONS_PER_TRACK, MIN_EQ_FREQUENCY_HZ, MIN_EQ_Q, MIN_SAMPLE_RATE, MIN_HDR_PEAK_NITS, MAX_HDR_PEAK_NITS, MAX_SEQUENCE_FRAMES, REVERB_DELAY_MS, TICKS_PER_SECOND, } from "./generated/project-schema.js";
19
19
  import { PROJECT_SHAPE } from "./generated/project-shape.js";
20
20
  import { MAX_JSON_DEPTH, hasLoneSurrogate, readJsonText, } from "./json-text.js";
21
21
  export * from "./generated/project-schema.js";
@@ -891,6 +891,7 @@ function describeValue(value) {
891
891
  * the field as.
892
892
  */
893
893
  const INTEGER_FORMATS = {
894
+ uint16: { min: 0n, max: 2n ** 16n - 1n },
894
895
  uint32: { min: 0n, max: 2n ** 32n - 1n },
895
896
  uint64: { min: 0n, max: 2n ** 64n - 1n },
896
897
  int64: { min: -(2n ** 63n), max: 2n ** 63n - 1n },
@@ -1181,7 +1182,13 @@ export function canonicalProject(project) {
1181
1182
  const canonicalShapes = new WeakMap();
1182
1183
  /** The defs a value is put in canonical form at, and every def that can hold one of them. */
1183
1184
  const CANONICAL_DEFS = (() => {
1184
- const holding = new Set(["Rgba", "Paint", "Insets", "LayoutOffset"]);
1185
+ const holding = new Set([
1186
+ "Rgba",
1187
+ "Paint",
1188
+ "Insets",
1189
+ "LayoutOffset",
1190
+ "VisualProperties",
1191
+ ]);
1185
1192
  const refs = Object.entries(SHAPE_DEFS).map(([name, def]) => [name, refsIn(def)]);
1186
1193
  for (let grew = true; grew;) {
1187
1194
  grew = false;
@@ -1275,6 +1282,13 @@ function canonicalWalk(node, value) {
1275
1282
  if (canonical !== before)
1276
1283
  (read ??= {})[key] = canonical;
1277
1284
  }
1285
+ // A clip's visual is written whole: each field left out is the schema's default, the engine's.
1286
+ if (schema === SHAPE_DEFS.VisualProperties) {
1287
+ for (const [key, field] of Object.entries(properties)) {
1288
+ if (value[key] === undefined && field.default !== undefined)
1289
+ (read ??= {})[key] = structuredClone(field.default);
1290
+ }
1291
+ }
1278
1292
  return read === undefined ? value : { ...value, ...read };
1279
1293
  }
1280
1294
  /** {@link checkShape} of a value not known to match `node`. */
@@ -1783,17 +1797,17 @@ function validVec2Animation(animation) {
1783
1797
  const values = animationValues(animation);
1784
1798
  return values !== undefined && values.every(validVec2);
1785
1799
  }
1800
+ /** Each field left out is its default, which is valid. */
1786
1801
  function validVisual(visual) {
1787
1802
  if (visual === undefined)
1788
1803
  return true;
1789
1804
  return (isRecord(visual) &&
1790
- validVec2(visual.anchor) &&
1791
- validPointAnimation(visual.position) &&
1792
- validVec2Animation(visual.scale) &&
1793
- visual.rotation_degrees !== undefined &&
1794
- validScalarAnimation(visual.rotation_degrees) &&
1795
- visual.opacity !== undefined &&
1796
- validScalarAnimation(visual.opacity, 0, 1));
1805
+ (visual.anchor === undefined || validVec2(visual.anchor)) &&
1806
+ (visual.position === undefined || validPointAnimation(visual.position)) &&
1807
+ (visual.scale === undefined || validVec2Animation(visual.scale)) &&
1808
+ (visual.rotation_degrees === undefined ||
1809
+ validScalarAnimation(visual.rotation_degrees)) &&
1810
+ (visual.opacity === undefined || validScalarAnimation(visual.opacity, 0, 1)));
1797
1811
  }
1798
1812
  function validEffectValue(value) {
1799
1813
  if (!isRecord(value))
@@ -2161,6 +2175,8 @@ function validTextStyle(style, maxFontSize) {
2161
2175
  within(style.font_size ?? 0.05, 0, maxFontSize, true) &&
2162
2176
  (style.color === undefined || validRgba(style.color)) &&
2163
2177
  within(style.line_height ?? 1.2, MIN_LINE_HEIGHT, MAX_LINE_HEIGHT) &&
2178
+ within(style.letter_spacing ?? 0, MIN_LETTER_SPACING, MAX_LETTER_SPACING) &&
2179
+ validFontWeight(style.font_weight ?? 400) &&
2164
2180
  within(style.max_width ?? 0.9, 0, 1, true) &&
2165
2181
  (style.position === undefined || validVec2(style.position)) &&
2166
2182
  (style.anchor === undefined || validVec2(style.anchor)) &&
@@ -2173,6 +2189,12 @@ function validTextStyle(style, maxFontSize) {
2173
2189
  validRgba(background.color) &&
2174
2190
  within(background.padding ?? 0, 0, MAX_TEXT_PADDING))));
2175
2191
  }
2192
+ /** A weight `FONT_WEIGHT_RANGE` holds: a whole number from 1 to 1000. */
2193
+ function validFontWeight(weight) {
2194
+ return (Number.isInteger(weight) &&
2195
+ weight >= MIN_FONT_WEIGHT &&
2196
+ weight <= MAX_FONT_WEIGHT);
2197
+ }
2176
2198
  /** Mirrors `ProviderSource::kind` and `ProviderSource::is_valid`. */
2177
2199
  function validProvider(provider, kind) {
2178
2200
  if (!isRecord(provider))
@@ -2710,6 +2732,16 @@ function layoutStyleIssue(node, at, shorterSide) {
2710
2732
  lineHeight <= MAX_LINE_HEIGHT)) {
2711
2733
  return outOfRange("line_height");
2712
2734
  }
2735
+ const letterSpacing = node.letter_spacing;
2736
+ if (present(letterSpacing) &&
2737
+ !(finiteNumber(letterSpacing) &&
2738
+ letterSpacing >= MIN_LETTER_SPACING &&
2739
+ letterSpacing <= MAX_LETTER_SPACING)) {
2740
+ return outOfRange("letter_spacing");
2741
+ }
2742
+ if (present(node.font_weight) && !validFontWeight(node.font_weight)) {
2743
+ return outOfRange("font_weight");
2744
+ }
2713
2745
  const outline = node.outline;
2714
2746
  if (present(outline) &&
2715
2747
  !(isRecord(outline) &&
@@ -3533,7 +3565,10 @@ function duckingCycles(tracks) {
3533
3565
  * A valid project's non-fatal diagnostics, computed by the engine's own
3534
3566
  * `Project::lint`, in a fixed order: unused sources, then shapes generators
3535
3567
  * (sources', then composition nodes'), then HDR sources, then each track's
3536
- * clips, transitions, and cues.
3568
+ * clips, transitions, and cues, then compositions' nodes, then generated
3569
+ * sources' trees. A keyframe is checked in its own time: a clip's in timeline
3570
+ * time, a composition node's in the composition time the clips that show it
3571
+ * map to, a generated source's in the picture time its clips' time maps reach.
3537
3572
  *
3538
3573
  * Diagnostics never block a load or an export; they flag what is probably a
3539
3574
  * mistake in a project the engine accepts.
package/dist/text.d.ts CHANGED
@@ -65,6 +65,7 @@ export interface BrowserTextRequest {
65
65
  /** The `WasmTextRasterizer` class that `alpha2/wasm` exports. */
66
66
  export interface WasmTextRasterizerHandle {
67
67
  addFont(family: string, bytes: Uint8Array, faceIndex: number): void;
68
+ addFontFile(family: string, bytes: Uint8Array): void;
68
69
  rasterize(requestJson: string, contentVersion: bigint): {
69
70
  readonly descriptor: string;
70
71
  takePixels(): Uint8Array;
@@ -89,6 +90,16 @@ export interface WasmTextRequest {
89
90
  readonly maxWidth?: number;
90
91
  /** Baseline-to-baseline distance in font-size multiples (default 1.2). */
91
92
  readonly lineHeight?: number;
93
+ /**
94
+ * Space after each character in pixels (default 0), as CSS `letter-spacing` adds it: none after
95
+ * a line's last character or a character of a cursive script. Within -0.5 to 1 font sizes.
96
+ */
97
+ readonly letterSpacing?: number;
98
+ /**
99
+ * The weight a family's faces are matched by, 1 to 1000 (default 400), as CSS matches
100
+ * `font-weight`; a variable face draws at it, held to its `wght` axis. No face is emboldened.
101
+ */
102
+ readonly fontWeight?: number;
92
103
  readonly align?: "start" | "center" | "end";
93
104
  /** Straight (not premultiplied), sRGB-encoded RGBA, each in `0..=255`. */
94
105
  readonly color: readonly [number, number, number, number];
@@ -120,6 +131,12 @@ export declare class WasmTextRasterizer {
120
131
  * change what a request draws.
121
132
  */
122
133
  addFont(family: string, bytes: ArrayBuffer | Uint8Array, faceIndex?: number): void;
134
+ /**
135
+ * Appends every face of an OpenType font file to the fallback stack, in the file's order: each
136
+ * weight of a collection (`.ttc`), so a style's `font_weight` can pick it. The export host
137
+ * registers a font file the same way. Every cached result is dropped.
138
+ */
139
+ addFontFile(family: string, bytes: ArrayBuffer | Uint8Array): void;
123
140
  /**
124
141
  * Shapes and rasterizes `request`, cached by content version: the rasterizer keeps up to 64 MiB
125
142
  * of results, dropping the least recently used past it.
package/dist/text.js CHANGED
@@ -57,6 +57,15 @@ export class WasmTextRasterizer {
57
57
  const view = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
58
58
  this.#handle.addFont(family, view, faceIndex);
59
59
  }
60
+ /**
61
+ * Appends every face of an OpenType font file to the fallback stack, in the file's order: each
62
+ * weight of a collection (`.ttc`), so a style's `font_weight` can pick it. The export host
63
+ * registers a font file the same way. Every cached result is dropped.
64
+ */
65
+ addFontFile(family, bytes) {
66
+ const view = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
67
+ this.#handle.addFontFile(family, view);
68
+ }
60
69
  /**
61
70
  * Shapes and rasterizes `request`, cached by content version: the rasterizer keeps up to 64 MiB
62
71
  * of results, dropping the least recently used past it.
@@ -170,9 +179,12 @@ export class OffscreenTextRasterizer {
170
179
  const measured = lines.map((line) => probe.measureText(line));
171
180
  const textWidth = measured.reduce((maximum, metrics) => Math.max(maximum, metrics.width), 0);
172
181
  const layoutWidth = Math.max(1, request.maxWidth && request.maxWidth > 0 ? request.maxWidth : textWidth);
173
- // The box holds every line's nominal em at fixed baselines; ink past it goes in an equal margin
174
- // on both sides so the box stays centered.
182
+ // The box holds every line's nominal em at fixed baselines, each em centred in its line when
183
+ // lines are more than an em apart; ink past it goes in an equal margin on both sides so the box
184
+ // stays centered.
185
+ const halfLeading = Math.max(0, lineAdvance - fontSize) / 2;
175
186
  const nominalAscent = fontSize * 0.8;
187
+ const firstBaseline = halfLeading + nominalAscent;
176
188
  const layoutHeight = Math.max(1, (lines.length - 1) * lineAdvance + Math.max(lineAdvance, fontSize));
177
189
  const boxWidth = checkedDimension(layoutWidth);
178
190
  const boxHeight = checkedDimension(layoutHeight);
@@ -186,7 +198,7 @@ export class OffscreenTextRasterizer {
186
198
  let ascent = nominalAscent;
187
199
  let descent = fontSize * 0.2;
188
200
  measured.forEach((metrics, index) => {
189
- const baseline = nominalAscent + index * lineAdvance;
201
+ const baseline = firstBaseline + index * lineAdvance;
190
202
  overflowX = Math.max(overflowX, metrics.actualBoundingBoxLeft - x, x + metrics.actualBoundingBoxRight - boxWidth);
191
203
  overflowY = Math.max(overflowY, metrics.actualBoundingBoxAscent - baseline, baseline + metrics.actualBoundingBoxDescent - boxHeight);
192
204
  ascent = Math.max(ascent, metrics.actualBoundingBoxAscent);
@@ -204,7 +216,7 @@ export class OffscreenTextRasterizer {
204
216
  context.textBaseline = "alphabetic";
205
217
  context.textAlign = request.align ?? "start";
206
218
  context.fillStyle = request.color ?? "#ffffffff";
207
- lines.forEach((line, index) => context.fillText(line, marginX + x, marginY + nominalAscent + index * lineAdvance));
219
+ lines.forEach((line, index) => context.fillText(line, marginX + x, marginY + firstBaseline + index * lineAdvance));
208
220
  const image = context.getImageData(0, 0, width, height);
209
221
  premultiplyInPlace(image.data);
210
222
  const result = {
@@ -219,7 +231,7 @@ export class OffscreenTextRasterizer {
219
231
  layoutY: marginY,
220
232
  layoutWidth,
221
233
  layoutHeight,
222
- firstBaseline: nominalAscent,
234
+ firstBaseline,
223
235
  ascent,
224
236
  descent,
225
237
  lineCount: lines.length,
package/dist/worker.d.ts CHANGED
@@ -112,7 +112,10 @@ export interface RenderWorkerScope {
112
112
  export interface TextFont {
113
113
  readonly family: string;
114
114
  readonly bytes: Uint8Array;
115
- /** Face in a font collection (default 0). */
115
+ /**
116
+ * One face of a font collection; without it every face of the file is registered, as the export
117
+ * host registers a font file.
118
+ */
116
119
  readonly faceIndex?: number;
117
120
  }
118
121
  /** What {@link createWasmRenderWorkerHost} registers on every binding it makes. */
package/dist/worker.js CHANGED
@@ -444,7 +444,10 @@ function workerFrameIdentity(source, outputWidth, outputHeight, rotation, mirror
444
444
  }
445
445
  function registerFonts(wasm, fonts) {
446
446
  for (const font of fonts) {
447
- wasm.addFont(font.family, font.bytes, font.faceIndex ?? 0);
447
+ if (font.faceIndex === undefined)
448
+ wasm.addFontFile(font.family, font.bytes);
449
+ else
450
+ wasm.addFont(font.family, font.bytes, font.faceIndex);
448
451
  }
449
452
  }
450
453
  async function registerEffects(wasm, effects) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alpha2",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "license": "MIT",
5
5
  "description": "JavaScript bindings for the standalone alpha2 media engine.",
6
6
  "repository": {
Binary file
Binary file
@@ -180,6 +180,15 @@ export class RasterizedText {
180
180
  export class WasmTextMeasurer {
181
181
  free(): void;
182
182
  [Symbol.dispose](): void;
183
+ /**
184
+ * Appends every face of an OpenType font file to the fallback stack,
185
+ * in the file's order: each weight of a collection (`.ttc`), all
186
+ * checked before any is added.
187
+ *
188
+ * # Errors
189
+ * Rejects malformed font bytes, naming no face added.
190
+ */
191
+ addFontFile(family: string, bytes: Uint8Array): void;
183
192
  /**
184
193
  * Appends an OpenType font to the fallback stack.
185
194
  *
@@ -197,9 +206,11 @@ export class WasmTextMeasurer {
197
206
  * `width` by `height` picture at picture time `time` (ticks), laid
198
207
  * out with these fonts as a frame lays it out, as JSON `{ nodes }`:
199
208
  * each node in preorder as `{ at, border, content, overflow,
200
- * lineCount }`, its boxes `{ left, top, right, bottom }` in fractions
201
- * of the picture, before its clip's transform and node visuals.
202
- * `lineCount` is `null` for a node without text. Measure at the size
209
+ * lineCount, baselines }`, its boxes `{ left, top, right, bottom }` in
210
+ * fractions of the picture, before its clip's transform and node
211
+ * visuals. `lineCount` is `null` for a node without text, and
212
+ * `baselines` (`{ first, last }`, in fractions of the picture height)
213
+ * for a node without text or with empty text. Measure at the size
203
214
  * the picture is drawn at. The layout's `"<n>px"` lengths are pixels
204
215
  * of the project canvas, `canvasWidth` by `canvasHeight`: the
205
216
  * picture's size when they are omitted.
@@ -213,11 +224,13 @@ export class WasmTextMeasurer {
213
224
  /**
214
225
  * Where the text generator `generator_json` (`{ "type": "text",
215
226
  * "text", "style" }`, as a project holds it) lies on a `width` by
216
- * `height` canvas, as JSON `{ layout, content, ink, lineCount }`:
217
- * each a `{ left, top, right, bottom }` rectangle in fractions of the
218
- * canvas, as the style's position is, on the picture the generator
219
- * draws before its clip's transform; `ink` is `null` when the text
220
- * draws nothing. Measure at the project's canvas size: text laid out
227
+ * `height` canvas, as JSON `{ layout, content, ink, lineCount,
228
+ * baselines }`: each a `{ left, top, right, bottom }` rectangle in
229
+ * fractions of the canvas, as the style's position is, on the picture
230
+ * the generator draws before its clip's transform; `ink` is `null`
231
+ * when the text draws nothing. `baselines` is `{ first, last }`, the
232
+ * first and last lines' alphabetic baselines in fractions of the
233
+ * canvas height. Measure at the project's canvas size: text laid out
221
234
  * at another size can break its lines elsewhere.
222
235
  *
223
236
  * # Errors
@@ -237,6 +250,15 @@ export class WasmTextMeasurer {
237
250
  export class WasmTextRasterizer {
238
251
  free(): void;
239
252
  [Symbol.dispose](): void;
253
+ /**
254
+ * Appends every face of an OpenType font file to the fallback stack,
255
+ * in the file's order: each weight of a collection (`.ttc`), all
256
+ * checked before any is added.
257
+ *
258
+ * # Errors
259
+ * Rejects malformed font bytes, naming no face added.
260
+ */
261
+ addFontFile(family: string, bytes: Uint8Array): void;
240
262
  /**
241
263
  * Appends an OpenType font to the fallback stack.
242
264
  *
@@ -343,6 +365,15 @@ export class WebCpuRenderer {
343
365
  private constructor();
344
366
  free(): void;
345
367
  [Symbol.dispose](): void;
368
+ /**
369
+ * Appends every face of an OpenType font file to the fallback stack, in
370
+ * the file's order: each weight of a collection (`.ttc`), all checked
371
+ * before any is added, as the export host registers a file.
372
+ *
373
+ * # Errors
374
+ * Returns an error for malformed font bytes, with no face added.
375
+ */
376
+ addFontFile(family: string, bytes: Uint8Array): void;
346
377
  /**
347
378
  * Appends an OpenType font to the fallback stack text draws with.
348
379
  *
@@ -797,6 +828,15 @@ export class WebEffectRegistry {
797
828
  private constructor();
798
829
  free(): void;
799
830
  [Symbol.dispose](): void;
831
+ /**
832
+ * Appends every face of an OpenType font file to the fallback stack, in
833
+ * the file's order: each weight of a collection (`.ttc`), all checked
834
+ * before any is added, as the export host registers a file.
835
+ *
836
+ * # Errors
837
+ * Returns an error for malformed font bytes, with no face added.
838
+ */
839
+ addFontFile(family: string, bytes: Uint8Array): void;
800
840
  /**
801
841
  * Appends an OpenType font to the fallback stack caption tracks, text
802
842
  * generators and layouts draw and lay out with. Give it the same font
@@ -1516,6 +1556,12 @@ export function compareFingerprints(recorded: string, found: string): string;
1516
1556
  */
1517
1557
  export function conformProject(project: string, catalog: string, purpose: string): string;
1518
1558
 
1559
+ /**
1560
+ * How many faces the font file `bytes` holds: a font collection's
1561
+ * count, else 1. `addFontFile` registers each.
1562
+ */
1563
+ export function fontFaceCount(bytes: Uint8Array): number;
1564
+
1519
1565
  /**
1520
1566
  * Returns the family name a caption style's `font_family` must give to
1521
1567
  * select face `face_index` of the font file `bytes`, read from the font's
@@ -1716,6 +1762,7 @@ export interface InitOutput {
1716
1762
  readonly compareFingerprints: (a: number, b: number, c: number, d: number) => [number, number, number, number];
1717
1763
  readonly compiledeffect_id: (a: number) => [number, number];
1718
1764
  readonly conformProject: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
1765
+ readonly fontFaceCount: (a: number, b: number) => number;
1719
1766
  readonly fontFamily: (a: number, b: number, c: number) => [number, number];
1720
1767
  readonly geometryParityAnswers: () => [number, number];
1721
1768
  readonly hitTest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
@@ -1747,11 +1794,13 @@ export interface InitOutput {
1747
1794
  readonly trimPath: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
1748
1795
  readonly vectorParityHashes: () => [number, number];
1749
1796
  readonly wasmtextmeasurer_addFont: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1797
+ readonly wasmtextmeasurer_addFontFile: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1750
1798
  readonly wasmtextmeasurer_clearFonts: (a: number) => void;
1751
1799
  readonly wasmtextmeasurer_measure: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
1752
1800
  readonly wasmtextmeasurer_measureLayout: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
1753
1801
  readonly wasmtextmeasurer_new: () => number;
1754
1802
  readonly wasmtextrasterizer_addFont: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1803
+ readonly wasmtextrasterizer_addFontFile: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1755
1804
  readonly wasmtextrasterizer_cacheSize: (a: number) => number;
1756
1805
  readonly wasmtextrasterizer_clear: (a: number) => void;
1757
1806
  readonly wasmtextrasterizer_invalidate: (a: number, b: bigint) => void;
@@ -1765,6 +1814,7 @@ export interface InitOutput {
1765
1814
  readonly waveformresult_frames: (a: number) => number;
1766
1815
  readonly waveformresult_levelCount: (a: number) => number;
1767
1816
  readonly webcpurenderer_addFont: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1817
+ readonly webcpurenderer_addFontFile: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1768
1818
  readonly webcpurenderer_aliasVideoFrame: (a: number, b: number, c: number, d: bigint, e: bigint) => [number, number, number];
1769
1819
  readonly webcpurenderer_audioChannels: (a: number) => number;
1770
1820
  readonly webcpurenderer_audioMaxBlock: (a: number) => number;
@@ -1839,6 +1889,7 @@ export interface InitOutput {
1839
1889
  readonly webcpurenderer_uploadedFrameCount: (a: number) => number;
1840
1890
  readonly webcpurenderer_videoFrameCopy: (a: number) => [number, number];
1841
1891
  readonly webeffectregistry_addFont: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1892
+ readonly webeffectregistry_addFontFile: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1842
1893
  readonly webeffectregistry_aliasVideoFrame: (a: number, b: number, c: number, d: bigint, e: bigint) => [number, number, number];
1843
1894
  readonly webeffectregistry_audioChannels: (a: number) => number;
1844
1895
  readonly webeffectregistry_audioMaxBlock: (a: number) => number;
@@ -1921,12 +1972,12 @@ export interface InitOutput {
1921
1972
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___js_sys_dcf218532b47778c___Function_fn_wasm_bindgen_d171202afaeab6f2___JsValue_____wasm_bindgen_d171202afaeab6f2___sys__Undefined___js_sys_dcf218532b47778c___Function_fn_wasm_bindgen_d171202afaeab6f2___JsValue_____wasm_bindgen_d171202afaeab6f2___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
1922
1973
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true_: (a: number, b: number, c: any) => [number, number];
1923
1974
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true_: (a: number, b: number, c: any) => [number, number];
1924
- readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__220: (a: number, b: number, c: any) => [number, number];
1925
- readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__223: (a: number, b: number, c: any) => [number, number];
1926
- readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__224: (a: number, b: number, c: any) => [number, number];
1975
+ readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__225: (a: number, b: number, c: any) => [number, number];
1976
+ readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__228: (a: number, b: number, c: any) => [number, number];
1977
+ readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__229: (a: number, b: number, c: any) => [number, number];
1927
1978
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___web_sys_9e2ae0ace5131457___features__gen_Event__Event______true_: (a: number, b: number, c: any) => void;
1928
1979
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_: (a: number, b: number, c: any) => void;
1929
- readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__222: (a: number, b: number, c: any) => void;
1980
+ readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__227: (a: number, b: number, c: any) => void;
1930
1981
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke_______true_: (a: number, b: number) => void;
1931
1982
  readonly __wbindgen_malloc: (a: number, b: number) => number;
1932
1983
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;