fix: correct Google Fonts API URL construction for proper weight fetching

This commit is contained in:
satnaing
2025-03-09 17:54:05 +07:00
parent 673c00969e
commit a4a5ced8a6
+3 -4
View File
@@ -15,7 +15,7 @@ async function loadGoogleFont(
).text(); ).text();
const resource = css.match( const resource = css.match(
/src: url\((.+)\) format\('(opentype|truetype)'\)/ /src: url\((.+?)\) format\('(opentype|truetype)'\)/
); );
if (!resource) throw new Error("Failed to download dynamic font"); if (!resource) throw new Error("Failed to download dynamic font");
@@ -26,8 +26,7 @@ async function loadGoogleFont(
throw new Error("Failed to download dynamic font. Status: " + res.status); throw new Error("Failed to download dynamic font. Status: " + res.status);
} }
const fonts: ArrayBuffer = await res.arrayBuffer(); return res.arrayBuffer();
return fonts;
} }
async function loadGoogleFonts( async function loadGoogleFonts(
@@ -44,7 +43,7 @@ async function loadGoogleFonts(
}, },
{ {
name: "IBM Plex Mono", name: "IBM Plex Mono",
font: "IBM+Plex+Mono:wght@700", font: "IBM+Plex+Mono",
weight: 700, weight: 700,
style: "bold", style: "bold",
}, },