From 1469152f4a4b183811439e159bc69aeca058c32d Mon Sep 17 00:00:00 2001 From: jfboeve Date: Thu, 16 Apr 2026 16:47:46 +0200 Subject: [PATCH] Revert "fix: update font loading to use platform fetch abstraction" --- src/core/text-rendering/SdfFontHandler.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/text-rendering/SdfFontHandler.ts b/src/core/text-rendering/SdfFontHandler.ts index 70709d26..0d9103e3 100644 --- a/src/core/text-rendering/SdfFontHandler.ts +++ b/src/core/text-rendering/SdfFontHandler.ts @@ -302,11 +302,14 @@ export const loadFont = async ( const nwff: CoreTextNode[] = (nodesWaitingForFont[fontFamily] = []); // Create loading promise const loadPromise = (async (): Promise => { - // Load font JSON data via the platform's fetch abstraction so behaviour - // can be overridden per platform (XHR, Fetch API, custom loaders, etc.). - const blob = (await stage.platform.fetch(atlasDataUrl)) as Blob; - const fontData = JSON.parse(await blob.text()) as SdfFontData; - if (fontData === null || fontData.chars === undefined) { + // Load font JSON data + const response = await fetch(atlasDataUrl); + if (!response.ok) { + throw new Error(`Failed to load font data: ${response.statusText}`); + } + + const fontData = (await response.json()) as SdfFontData; + if (!fontData || !fontData.chars) { throw new Error('Invalid SDF font data format'); }