mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
fix: correct Google Fonts API URL construction for proper weight fetching
This commit is contained in:
@@ -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",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user