embedded-react 0.12.0 → 0.14.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 (38) hide show
  1. package/README.md +222 -6
  2. package/aot/compile.mjs +3316 -364
  3. package/aot/style-map.mjs +30 -6
  4. package/assets/bake-font.mjs +104 -12
  5. package/assets/bake-svg.mjs +11 -1
  6. package/assets/build-builtin-font.mjs +6 -12
  7. package/assets/emit-c.mjs +10 -2
  8. package/assets/emit-container.mjs +4 -2
  9. package/assets/font-config.mjs +49 -0
  10. package/assets/font-sizes.mjs +652 -0
  11. package/assets/glyph-coverage.mjs +281 -0
  12. package/assets/index.mjs +29 -5
  13. package/build.mjs +11 -21
  14. package/cli.mjs +41 -3
  15. package/compile-bin.mjs +71 -0
  16. package/hotreload/pack-app.mjs +8 -21
  17. package/hotreload/pack-split.mjs +12 -27
  18. package/pack-container.mjs +10 -47
  19. package/package.json +2 -1
  20. package/sim/embedded-react.wasm +0 -0
  21. package/sim/index.html +32 -3
  22. package/sim-server.mjs +33 -27
  23. package/src/embedded-react/Animated.js +23 -9
  24. package/src/embedded-react/Button.js +98 -0
  25. package/src/embedded-react/FlatList.js +88 -0
  26. package/src/embedded-react/ImageBackground.js +67 -0
  27. package/src/embedded-react/PanResponder.js +326 -0
  28. package/src/embedded-react/SectionList.js +148 -0
  29. package/src/embedded-react/TouchableOpacity.js +152 -0
  30. package/src/embedded-react/components.js +4 -3
  31. package/src/embedded-react/index.d.ts +867 -60
  32. package/src/embedded-react/index.js +7 -2
  33. package/src/embedded-react/list-child.js +54 -0
  34. package/src/embedded-react/svg-ops.js +309 -77
  35. package/src/embedded-react/warn-props.js +80 -0
  36. package/src/host-config.js +103 -3
  37. package/src/props.js +40 -0
  38. package/src/renderer.js +31 -0
package/aot/style-map.mjs CHANGED
@@ -118,7 +118,8 @@ const dim = v => {
118
118
 
119
119
  /**
120
120
  * A dimension that may be a percentage. `'50%'` → the engine's float `*_pct` field (% of the parent);
121
- * a number → the pixel field. Used for width / height / flexBasis, which the engine resolves at layout.
121
+ * a number → the pixel field. Used for width / height / flexBasis and the four insets, all of which the
122
+ * engine resolves at layout.
122
123
  *
123
124
  * @param {string} pxField ERProps pixel field (e.g. 'width').
124
125
  * @param {string} pctField ERProps percentage field (e.g. 'width_pct').
@@ -130,6 +131,9 @@ const pctOrPx = (pxField, pctField) => v => {
130
131
  throw new Error(
131
132
  `expected a percentage like '50%', got ${JSON.stringify(v)}`,
132
133
  );
134
+ // 0% of any box is 0px, and the engine reads 0.0 in a percentage field as "not set" — so lower an
135
+ // authored 0% onto the pixel field, where it still means the same thing.
136
+ if (n === 0) return [{field: pxField, expr: '0'}];
133
137
  // A valid C float literal needs a decimal point — `50f` is a syntax error, `50.0f` is not.
134
138
  const lit = Number.isInteger(n) ? `${n}.0f` : `${n}f`;
135
139
  return [{field: pctField, expr: lit}];
@@ -185,10 +189,10 @@ const KEYS = {
185
189
  // Positioning: `position: 'absolute'` takes a node out of flow; left/top/right/bottom are its anchors.
186
190
  position: v => [{field: 'position', expr: enumKey(POSITION, 'position')(v)}],
187
191
  display: v => [{field: 'display', expr: enumKey(DISPLAY, 'display')(v)}],
188
- left: v => [{field: 'left', expr: dim(v)}],
189
- top: v => [{field: 'top', expr: dim(v)}],
190
- right: v => [{field: 'right', expr: dim(v)}],
191
- bottom: v => [{field: 'bottom', expr: dim(v)}],
192
+ left: pctOrPx('left', 'left_pct'),
193
+ top: pctOrPx('top', 'top_pct'),
194
+ right: pctOrPx('right', 'right_pct'),
195
+ bottom: pctOrPx('bottom', 'bottom_pct'),
192
196
  // `flex: n` → grow=n, shrink=1, basis=0 (RN semantics; matches native_ui_bridge apply_flex).
193
197
  flex: v => {
194
198
  const n = Number(v);
@@ -212,6 +216,15 @@ const KEYS = {
212
216
  // View visual
213
217
  backgroundColor: v => [{field: 'background_color', expr: colorLiteral(v)}],
214
218
  borderRadius: v => [{field: 'border_radius', expr: dim(v)}],
219
+ // Per-corner radii; the engine reads 0 in one of these as "use borderRadius" (same as Flow A).
220
+ borderTopLeftRadius: v => [{field: 'border_top_left_radius', expr: dim(v)}],
221
+ borderTopRightRadius: v => [{field: 'border_top_right_radius', expr: dim(v)}],
222
+ borderBottomRightRadius: v => [
223
+ {field: 'border_bottom_right_radius', expr: dim(v)},
224
+ ],
225
+ borderBottomLeftRadius: v => [
226
+ {field: 'border_bottom_left_radius', expr: dim(v)},
227
+ ],
215
228
  borderWidth: v => [{field: 'border_width', expr: dim(v)}],
216
229
  borderColor: v => [{field: 'border_color', expr: colorLiteral(v)}],
217
230
  opacity: v => [
@@ -232,6 +245,12 @@ const KEYS = {
232
245
  letterSpacing: v => [{field: 'letter_spacing', expr: dim(v)}],
233
246
  };
234
247
 
248
+ /** Whether the static lowering knows `key` at all (vs. knowing it but rejecting its value). */
249
+ export const isStyleKey = key => Object.hasOwn(KEYS, key);
250
+
251
+ /** Every style key the AOT lowers statically — listed in the "unsupported style key" diagnostic. */
252
+ export const STYLE_KEYS = Object.keys(KEYS);
253
+
235
254
  /**
236
255
  * Lowers one flattened style object to a list of ERProps field assignments.
237
256
  *
@@ -242,7 +261,7 @@ export function lowerStyle(style) {
242
261
  const out = [];
243
262
  for (const [key, value] of Object.entries(style)) {
244
263
  if (value === undefined || value === null) continue;
245
- const fn = KEYS[key];
264
+ const fn = Object.hasOwn(KEYS, key) ? KEYS[key] : undefined;
246
265
  if (!fn)
247
266
  throw new Error(
248
267
  `AOT: unsupported style key "${key}" (not yet lowered to ERProps)`,
@@ -257,6 +276,7 @@ export const NODE_TYPES = {
257
276
  View: 'ER_NODE_VIEW',
258
277
  Text: 'ER_NODE_TEXT',
259
278
  Pressable: 'ER_NODE_PRESSABLE',
279
+ TouchableOpacity: 'ER_NODE_PRESSABLE',
260
280
  Image: 'ER_NODE_IMAGE',
261
281
  ScrollView: 'ER_NODE_SCROLL_VIEW',
262
282
  };
@@ -292,6 +312,10 @@ const NUM_FIELDS = {
292
312
  flexGrow: 'flex_grow',
293
313
  flexShrink: 'flex_shrink',
294
314
  borderRadius: 'border_radius',
315
+ borderTopLeftRadius: 'border_top_left_radius',
316
+ borderTopRightRadius: 'border_top_right_radius',
317
+ borderBottomRightRadius: 'border_bottom_right_radius',
318
+ borderBottomLeftRadius: 'border_bottom_left_radius',
295
319
  borderWidth: 'border_width',
296
320
  zIndex: 'z_index',
297
321
  fontSize: 'font_size',
@@ -58,26 +58,109 @@ const SYMBOL_SETS = {
58
58
  ),
59
59
  };
60
60
 
61
+ // The engine's built-in font (engine/font/font_data.c) covers printable ASCII plus these. It is its
62
+ // own list, not an alias of a named set: build-builtin-font.mjs bakes from it and the coverage check
63
+ // reports against it, so the two can never drift — while the named sets stay free to evolve.
64
+ // Changing it changes the engine's fallback font; re-run `npm run build:builtin-font` if you do.
65
+ export const BUILTIN_EXTRAS = Object.freeze([
66
+ 0x00a2, 0x00a3, 0x00a5, 0x00a7, 0x00a9, 0x00ae, 0x00b0, 0x00b1, 0x00b5,
67
+ 0x00d7, 0x00f7, 0x2013, 0x2014, 0x2018, 0x2019, 0x201c, 0x201d, 0x2020,
68
+ 0x2021, 0x2022, 0x2026, 0x2030, 0x20ac, 0x2122, 0x2190, 0x2191, 0x2192,
69
+ 0x2193, 0x2194, 0x21b5, 0x2202, 0x2206, 0x2211, 0x2212, 0x221a, 0x221e,
70
+ 0x2248, 0x2260, 0x2264, 0x2265, 0x25a0, 0x25c6, 0x25cf, 0x2605, 0x2606,
71
+ 0x2713, 0x2717,
72
+ ]);
73
+
74
+ /**
75
+ * Pixel sizes the engine's built-in font is baked at (engine/font/font_data.c). Like BUILTIN_EXTRAS
76
+ * this is the single source of truth: build-builtin-font.mjs bakes from it and the build-time size
77
+ * check reports against it, so an app rendering at some other size is told what it will snap to.
78
+ * Changing it changes the engine's fallback font; re-run `npm run build:builtin-font` if you do.
79
+ */
80
+ export const BUILTIN_SIZES = Object.freeze([10, 12, 16, 20, 24, 32, 48]);
81
+
82
+ /**
83
+ * Normalizes one codepoint list: numbers are codepoints, a string contributes every character in
84
+ * it — so `'°±'` and `[0x00b0, 0x00b1]` mean the same thing.
85
+ *
86
+ * @param {number|string|Array<number|string>|undefined} spec
87
+ * @param {string} field Config field name, for error messages.
88
+ * @returns {number[]} Codepoints, unsorted and possibly duplicated.
89
+ */
90
+ function toCodepoints(spec, field) {
91
+ if (spec === undefined || spec === null) return [];
92
+ const out = [];
93
+ for (const item of Array.isArray(spec) ? spec : [spec]) {
94
+ if (typeof item === 'string') {
95
+ for (const ch of item) out.push(ch.codePointAt(0));
96
+ } else if (
97
+ typeof item === 'number' &&
98
+ Number.isInteger(item) &&
99
+ item >= 0 &&
100
+ item <= 0x10ffff
101
+ ) {
102
+ out.push(item);
103
+ } else {
104
+ throw new Error(
105
+ `${field}: expected a codepoint number or a string of characters, got ${JSON.stringify(item)}`,
106
+ );
107
+ }
108
+ }
109
+ return out;
110
+ }
111
+
61
112
  /**
62
113
  * Resolves a glyph-coverage spec into a sorted list of extra (sparse) codepoints.
63
114
  *
64
- * @param {string|Array<number>|undefined} glyphs 'ascii' (none), a named set, or explicit codepoints.
115
+ * `glyphs` picks the baseline: 'ascii' (none), a named set, or an explicit list. `extraGlyphs` adds
116
+ * the per-app characters no named set can cover, as codepoints or as the characters themselves.
117
+ *
118
+ * @param {string|Array<number|string>|undefined} glyphs 'ascii', a named set, or explicit codepoints.
119
+ * @param {number|string|Array<number|string>} [extraGlyphs] Per-app additions, on top of `glyphs`.
65
120
  * @returns {number[]} Sorted extra codepoints outside the dense ASCII range.
66
121
  */
67
- export function resolveExtras(glyphs) {
68
- if (!glyphs || glyphs === 'ascii') return [];
122
+ export function resolveExtras(glyphs, extraGlyphs) {
69
123
  let cps;
70
- if (Array.isArray(glyphs)) cps = glyphs.slice();
71
- else if (SYMBOL_SETS[glyphs]) cps = SYMBOL_SETS[glyphs].slice();
72
- else
124
+ if (!glyphs || glyphs === 'ascii') cps = [];
125
+ else if (typeof glyphs === 'string') {
126
+ if (!SYMBOL_SETS[glyphs])
127
+ throw new Error(
128
+ `unknown glyph set "${glyphs}" (use 'ascii', one of [${Object.keys(SYMBOL_SETS).join(', ')}], or a list of codepoints/characters)`,
129
+ );
130
+ cps = SYMBOL_SETS[glyphs].slice();
131
+ } else cps = toCodepoints(glyphs, 'glyphs');
132
+
133
+ // A bare set name here is almost certainly meant for `glyphs` — as characters it would be a
134
+ // silent no-op (all ASCII), so say so instead of baking nothing.
135
+ if (typeof extraGlyphs === 'string' && SYMBOL_SETS[extraGlyphs])
73
136
  throw new Error(
74
- `unknown glyph set "${glyphs}" (use 'ascii', a named set, or a codepoint array)`,
137
+ `extraGlyphs: "${extraGlyphs}" is a named glyph set — put it in \`glyphs\` (extraGlyphs takes the characters themselves)`,
75
138
  );
139
+ cps.push(...toCodepoints(extraGlyphs, 'extraGlyphs'));
140
+
76
141
  return [...new Set(cps)]
77
142
  .filter(c => c < ASCII_FIRST || c > ASCII_LAST)
78
143
  .sort((a, b) => a - b);
79
144
  }
80
145
 
146
+ /**
147
+ * Opens a font file and returns a predicate for "does this file have a glyph for this codepoint?".
148
+ * The coverage check uses it to tell a missing bake ("add it to extraGlyphs") apart from a font that
149
+ * simply cannot draw the character ("pick a different font").
150
+ *
151
+ * @param {string} path Path to the .ttf/.otf file.
152
+ * @returns {(cp:number)=>boolean} Always true if the file can't be read, so a probe failure never
153
+ * turns into a misleading claim about the font.
154
+ */
155
+ export function loadGlyphProbe(path) {
156
+ try {
157
+ const font = opentype.parse(fs.readFileSync(path).buffer);
158
+ return cp => font.charToGlyphIndex(String.fromCodePoint(cp)) !== 0;
159
+ } catch {
160
+ return () => true;
161
+ }
162
+ }
163
+
81
164
  /**
82
165
  * Packs an 8-bit coverage bitmap (one byte per pixel) into the engine's per-row bpp layout.
83
166
  *
@@ -155,14 +238,23 @@ function bakeGlyph(font, cp, pixelSize, baseline, scale, bpp) {
155
238
  * @param {string} opts.family Family name to register under (used by fontFamily lookups).
156
239
  * @param {number[]} opts.sizes Pixel sizes to bake.
157
240
  * @param {number} [opts.bpp] Bits per pixel (default 4).
158
- * @param {string|Array<number>} [opts.glyphs] Extra glyph coverage beyond ASCII (default 'ascii').
159
- * @returns {{family:string, sizes:Array<object>}} Baked data ready for the C emitter.
241
+ * @param {string|Array<number|string>} [opts.glyphs] Extra glyph coverage beyond ASCII (default 'ascii').
242
+ * @param {number|string|Array<number|string>} [opts.extraGlyphs] Per-app additions on top of `glyphs`.
243
+ * @returns {{family:string, path:string, sizes:Array<object>}} Baked data ready for the C emitter.
244
+ * Extras the font file has no glyph for are silently absent from each size's `extras`.
160
245
  */
161
- export function bakeFont({path, family, sizes, bpp = 4, glyphs = 'ascii'}) {
246
+ export function bakeFont({
247
+ path,
248
+ family,
249
+ sizes,
250
+ bpp = 4,
251
+ glyphs = 'ascii',
252
+ extraGlyphs,
253
+ }) {
162
254
  if (![1, 2, 4, 8].includes(bpp))
163
255
  throw new Error(`bpp must be 1, 2, 4, or 8 (got ${bpp})`);
164
256
  const font = opentype.parse(fs.readFileSync(path).buffer);
165
- const extraCps = resolveExtras(glyphs);
257
+ const extraCps = resolveExtras(glyphs, extraGlyphs);
166
258
 
167
259
  const baked = [];
168
260
  for (const pixelSize of sizes) {
@@ -210,5 +302,5 @@ export function bakeFont({path, family, sizes, bpp = 4, glyphs = 'ascii'}) {
210
302
  bitmap,
211
303
  });
212
304
  }
213
- return {family, sizes: baked};
305
+ return {family, path, sizes: baked};
214
306
  }
@@ -33,6 +33,7 @@ import {createHash} from 'node:crypto';
33
33
  import {
34
34
  parsePath,
35
35
  parseColor,
36
+ rectRadii,
36
37
  VOP_SHAPE,
37
38
  VOP_MOVE,
38
39
  VOP_LINE,
@@ -148,7 +149,16 @@ function rectPath(a) {
148
149
  const w = num(a.width);
149
150
  const h = num(a.height);
150
151
  if (w <= 0 || h <= 0) return '';
151
- return `M${x} ${y}L${x + w} ${y}L${x + w} ${y + h}L${x} ${y + h}Z`;
152
+ const [rx, ry] = rectRadii(a.rx, a.ry, w, h);
153
+ if (!rx || !ry)
154
+ return `M${x} ${y}L${x + w} ${y}L${x + w} ${y + h}L${x} ${y + h}Z`;
155
+ // Quarter-ellipse corners; parsePath lowers each `A` to the same single cubic the runtime emits.
156
+ return (
157
+ `M${x + rx} ${y}L${x + w - rx} ${y}A${rx} ${ry} 0 0 1 ${x + w} ${y + ry}` +
158
+ `L${x + w} ${y + h - ry}A${rx} ${ry} 0 0 1 ${x + w - rx} ${y + h}` +
159
+ `L${x + rx} ${y + h}A${rx} ${ry} 0 0 1 ${x} ${y + h - ry}` +
160
+ `L${x} ${y + ry}A${rx} ${ry} 0 0 1 ${x + rx} ${y}Z`
161
+ );
152
162
  }
153
163
  function circlePath(a) {
154
164
  const cx = num(a.cx);
@@ -26,7 +26,7 @@
26
26
  import {resolve, dirname} from 'node:path';
27
27
  import {fileURLToPath} from 'node:url';
28
28
  import {writeFileSync} from 'node:fs';
29
- import {bakeFont} from './bake-font.mjs';
29
+ import {bakeFont, BUILTIN_EXTRAS, BUILTIN_SIZES} from './bake-font.mjs';
30
30
  import {emitBuiltinFont} from './emit-c.mjs';
31
31
 
32
32
  const here = dirname(fileURLToPath(import.meta.url)); // bridges/quickjs/js/assets
@@ -35,23 +35,17 @@ const FONT = resolve(repoRoot, 'assets/fonts/Inter-Regular.ttf');
35
35
  const OUT = resolve(repoRoot, 'engine/font/font_data.c');
36
36
 
37
37
  // The built-in covers printable ASCII plus a fixed set of common symbols (degrees, arrows, math,
38
- // punctuation, etc.) the UI components rely on — kept stable across regenerations.
39
- const SIZES = [10, 12, 16, 20, 24, 32, 48];
40
- const EXTRAS = [
41
- 0x00a2, 0x00a3, 0x00a5, 0x00a7, 0x00a9, 0x00ae, 0x00b0, 0x00b1, 0x00b5,
42
- 0x00d7, 0x00f7, 0x2013, 0x2014, 0x2018, 0x2019, 0x201c, 0x201d, 0x2020,
43
- 0x2021, 0x2022, 0x2026, 0x2030, 0x20ac, 0x2122, 0x2190, 0x2191, 0x2192,
44
- 0x2193, 0x2194, 0x21b5, 0x2202, 0x2206, 0x2211, 0x2212, 0x221a, 0x221e,
45
- 0x2248, 0x2260, 0x2264, 0x2265, 0x25a0, 0x25c6, 0x25cf, 0x2605, 0x2606,
46
- 0x2713, 0x2717,
47
- ];
38
+ // punctuation, etc.) the UI components rely on — kept stable across regenerations. The set lives in
39
+ // bake-font.mjs as BUILTIN_EXTRAS — with BUILTIN_SIZES alongside it — so the build-time coverage
40
+ // checks report against what is actually baked here.
41
+ const SIZES = BUILTIN_SIZES;
48
42
 
49
43
  const font = bakeFont({
50
44
  path: FONT,
51
45
  family: 'Inter',
52
46
  sizes: SIZES,
53
47
  bpp: 4,
54
- glyphs: EXTRAS,
48
+ glyphs: BUILTIN_EXTRAS,
55
49
  });
56
50
  writeFileSync(
57
51
  OUT,
package/assets/emit-c.mjs CHANGED
@@ -84,12 +84,20 @@ export function emitAssetsC({headerName, images = [], fonts = []}) {
84
84
  const is565 = img.format === 'rgb565';
85
85
  const hex = Array.from(
86
86
  img.pixels,
87
- p => '0x' + p.toString(16).toUpperCase().padStart(is565 ? 4 : 8, '0') + 'u',
87
+ p =>
88
+ '0x' +
89
+ p
90
+ .toString(16)
91
+ .toUpperCase()
92
+ .padStart(is565 ? 4 : 8, '0') +
93
+ 'u',
88
94
  );
89
95
  lines.push(
90
96
  `/* image "${img.name}" — ${img.width}x${img.height}${is565 ? ' (RGB565)' : ''} */`,
91
97
  );
92
- lines.push(`static const ${is565 ? 'uint16_t' : 'uint32_t'} ${id}_px[] = {`);
98
+ lines.push(
99
+ `static const ${is565 ? 'uint16_t' : 'uint32_t'} ${id}_px[] = {`,
100
+ );
93
101
  lines.push(rows(hex, is565 ? 12 : 8));
94
102
  lines.push(`};`);
95
103
  lines.push(``);
@@ -56,8 +56,10 @@ export const SECTION_ASSET_PACK = 2;
56
56
  export const SECTION_VENDOR_BYTECODE = 3;
57
57
 
58
58
  /**
59
- * CRC-32/IEEE (zlib polynomial 0xEDB88320), computed without a lookup table to match the C loader's
60
- * crc32_bytes() byte-for-byte.
59
+ * CRC-32/IEEE (zlib polynomial 0xEDB88320), computed without a lookup table to match er_crc32() in
60
+ * bridges/quickjs/er_runtime.c byte-for-byte — the one checksum of the whole delivery pipeline (this
61
+ * container, the hot-reload transport frame that carries it, and the device's verification of both).
62
+ * hotreload/protocol.mjs imports this rather than keeping its own.
61
63
  *
62
64
  * @param {Buffer|Uint8Array} buf Bytes to checksum.
63
65
  * @returns {number} The CRC as an unsigned 32-bit integer.
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Copyright 2026 Cory Lamming
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ // Turns the `fonts` block of a project's assets.config.js into bakeFont() jobs. Six entry points
18
+ // bake fonts (build, pack, sim, sim-server, hot-reload app/split chunks); they share this so a
19
+ // config field means the same thing in every one of them.
20
+
21
+ /** Fallback pixel size when no fontSize could be discovered and the config pins none. */
22
+ const DEFAULT_SIZE = 16;
23
+
24
+ /**
25
+ * Resolves discovered font imports against their per-project config.
26
+ *
27
+ * @param {Map<string,string>} fonts Discovered imports: family → .ttf/.otf path.
28
+ * @param {object} [fontConfig] assets.config.js `fonts` block, keyed by family.
29
+ * @param {number[]} [discoveredSizes] Sizes the bundle uses (font-sizes.mjs analyzeFontSizes).
30
+ * @returns {Array<{path:string, family:string, sizes:number[], bpp:number, glyphs:any,
31
+ * extraGlyphs:any}>} One bakeFont() job per imported font.
32
+ */
33
+ export function resolveFontJobs(fonts, fontConfig = {}, discoveredSizes = []) {
34
+ return [...fonts.entries()].map(([family, path]) => {
35
+ const fc = fontConfig[family] || {};
36
+ return {
37
+ path,
38
+ family,
39
+ sizes: fc.sizes?.length
40
+ ? fc.sizes
41
+ : discoveredSizes.length
42
+ ? discoveredSizes
43
+ : [DEFAULT_SIZE],
44
+ bpp: fc.bpp ?? 4,
45
+ glyphs: fc.glyphs ?? 'ascii',
46
+ extraGlyphs: fc.extraGlyphs,
47
+ };
48
+ });
49
+ }