Skip to content

Commit e08618a

Browse files
authored
fix: add font-weight param in og image card style (#453)
1 parent b51a055 commit e08618a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/utils/loadGoogleFont.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
async function loadGoogleFont(
22
font: string,
3-
text: string
3+
text: string,
4+
weight: number
45
): Promise<ArrayBuffer> {
5-
const API = `https://fonts.googleapis.com/css2?family=${font}&text=${encodeURIComponent(text)}`;
6+
const API = `https://fonts.googleapis.com/css2?family=${font}:wght@${weight}&text=${encodeURIComponent(text)}`;
67

78
const css = await (
89
await fetch(API, {
@@ -51,7 +52,7 @@ async function loadGoogleFonts(
5152

5253
const fonts = await Promise.all(
5354
fontsConfig.map(async ({ name, font, weight, style }) => {
54-
const data = await loadGoogleFont(font, text);
55+
const data = await loadGoogleFont(font, text, weight);
5556
return { name, data, weight, style };
5657
})
5758
);

0 commit comments

Comments
 (0)