Skip to content

Commit a4a5ced

Browse files
committed
fix: correct Google Fonts API URL construction for proper weight fetching
1 parent 673c009 commit a4a5ced

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/utils/loadGoogleFont.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function loadGoogleFont(
1515
).text();
1616

1717
const resource = css.match(
18-
/src: url\((.+)\) format\('(opentype|truetype)'\)/
18+
/src: url\((.+?)\) format\('(opentype|truetype)'\)/
1919
);
2020

2121
if (!resource) throw new Error("Failed to download dynamic font");
@@ -26,8 +26,7 @@ async function loadGoogleFont(
2626
throw new Error("Failed to download dynamic font. Status: " + res.status);
2727
}
2828

29-
const fonts: ArrayBuffer = await res.arrayBuffer();
30-
return fonts;
29+
return res.arrayBuffer();
3130
}
3231

3332
async function loadGoogleFonts(
@@ -44,7 +43,7 @@ async function loadGoogleFonts(
4443
},
4544
{
4645
name: "IBM Plex Mono",
47-
font: "IBM+Plex+Mono:wght@700",
46+
font: "IBM+Plex+Mono",
4847
weight: 700,
4948
style: "bold",
5049
},

0 commit comments

Comments
 (0)