@solidtv/renderer 1.6.2 → 1.6.4

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.
@@ -4,11 +4,13 @@ import {
4
4
  waitingForFont,
5
5
  isFontLoaded,
6
6
  getFontData,
7
+ canRenderFont,
7
8
  MAX_FONT_LOAD_RETRIES,
8
9
  } from '../SdfFontHandler.js';
9
10
  import { EventEmitter } from '../../../common/EventEmitter.js';
10
11
  import { TextureError, TextureErrorCode } from '../../TextureError.js';
11
12
  import type { Stage } from '../../Stage.js';
13
+ import type { TrProps } from '../TextRenderer.js';
12
14
 
13
15
  // Minimal XHR stand-in: synchronously delivers valid SDF font JSON so loadFont
14
16
  // proceeds to create the atlas texture and attach its event listeners.
@@ -294,6 +296,47 @@ describe('SdfFontHandler loadFont — multiple names for one font', () => {
294
296
  }
295
297
  });
296
298
 
299
+ it('reports every name as renderable while the font is still loading', async () => {
300
+ const { stage, textures } = makeStage();
301
+ const names = ['MidLoadPrimary', 'MidLoadAlias'];
302
+
303
+ const promise = loadFont(stage, opts(names));
304
+
305
+ // Mid-load: nothing is in fontCache yet, so this is answered purely by the
306
+ // in-flight markers. An alias that answers `false` here makes the stage
307
+ // resolve a *different* text renderer for the node — silently substituting
308
+ // a Canvas face, or throwing "No compatible text renderer found" when SDF
309
+ // is the only engine. Both names must answer the same.
310
+ for (let i = 0; i < names.length; i++) {
311
+ expect(canRenderFont({ fontFamily: names[i]! } as TrProps)).toBe(true);
312
+ }
313
+ expect(isFontLoaded(names[1]!)).toBe(false);
314
+
315
+ await flush();
316
+ textures[0]!.emit('loaded');
317
+ await promise;
318
+
319
+ for (let i = 0; i < names.length; i++) {
320
+ expect(canRenderFont({ fontFamily: names[i]! } as TrProps)).toBe(true);
321
+ expect(isFontLoaded(names[i]!)).toBe(true);
322
+ }
323
+ });
324
+
325
+ it('dedupes a load requested under an alias onto the in-flight load', async () => {
326
+ const { stage, textures } = makeStage();
327
+
328
+ const first = loadFont(stage, opts(['DedupePrimary', 'DedupeAlias']));
329
+ const second = loadFont(stage, opts('DedupeAlias'));
330
+
331
+ expect(second).toBe(first);
332
+
333
+ await flush();
334
+ // A single atlas fetch served both calls.
335
+ expect(textures.length).toBe(1);
336
+ textures[0]!.emit('loaded');
337
+ await first;
338
+ });
339
+
297
340
  it('wakes nodes parked under an alias, not just the primary name', async () => {
298
341
  const { stage, textures } = makeStage();
299
342
  const names = ['MultiWakePrimary', 'MultiWakeAlias'];
@@ -654,16 +654,16 @@ export type RendererMainSettings = RendererRuntimeSettings & {
654
654
  * ignore it, returning straight (non-premultiplied) alpha. This causes edge
655
655
  * "ghosting" on images with transparency.
656
656
  *
657
- * `'auto'` (the default) detects via a cheap startup probe (one 1×1 PNG
658
- * decode + texture upload + framebuffer readback). On devices that honor the
659
- * option — the vast majority — the probe returns `true` and behavior is
660
- * identical to assuming it honored; only devices that actually ignore it
661
- * (e.g. the Movistar STB) switch to the WebGL-side premultiply fallback, so
662
- * the change is invisible everywhere it isn't needed. Set to a boolean to
663
- * force the value and skip the probe (`false` forces the GL-premultiply
664
- * fallback; `true` skips it).
665
- *
666
- * @defaultValue `'auto'` (probe once at startup)
657
+ * Set to `'auto'` to detect via a cheap startup probe (one 1×1 PNG decode +
658
+ * texture upload + framebuffer readback). On devices that honor the option —
659
+ * the vast majority — the probe returns `true` and behavior is identical to
660
+ * assuming it honored; only devices that actually ignore it (e.g. the
661
+ * Movistar STB) switch to the WebGL-side premultiply fallback. Set to a
662
+ * boolean to force the value (`false` forces the GL-premultiply fallback;
663
+ * `true` skips it). Leave unset to assume the option is honored the
664
+ * default, which preserves existing behavior with no probe overhead.
665
+ *
666
+ * @defaultValue `true` (assume honored; no probe)
667
667
  */
668
668
  premultiplyAlphaHonored?: boolean | 'auto';
669
669
 
@@ -825,11 +825,11 @@ export class RendererMain extends EventEmitter {
825
825
  textureProcessingTimeLimit: settings.textureProcessingTimeLimit || 10,
826
826
  canvas: settings.canvas,
827
827
  createImageBitmapSupport: settings.createImageBitmapSupport || 'auto',
828
- // undefined -> 'auto' (probe once at startup); 'auto' -> probe;
829
- // explicit boolean -> force the value, skip the probe.
828
+ // undefined -> true (assume honored, no probe); 'auto' -> probe;
829
+ // explicit boolean -> force the value.
830
830
  premultiplyAlphaHonored:
831
831
  settings.premultiplyAlphaHonored === undefined
832
- ? 'auto'
832
+ ? true
833
833
  : settings.premultiplyAlphaHonored,
834
834
  platform: settings.platform || null,
835
835
  maxRetryCount: settings.maxRetryCount ?? 5,