Akihiro Saiki
2025-01-04 dc3323b5741845ac6109781da32d34f16e925815
chore: use Google Fonts API v2 to get fonts for ogp (#1705)

1 files modified
4 ■■■ changed files
quartz/util/og.tsx 4 ●●● patch | view | raw | blame | history
quartz/util/og.tsx
@@ -35,7 +35,9 @@
async function fetchTtf(fontName: string, weight: FontWeight): Promise<ArrayBuffer> {
  try {
    // Get css file from google fonts
    const cssResponse = await fetch(`https://fonts.googleapis.com/css?family=${fontName}:${weight}`)
    const cssResponse = await fetch(
      `https://fonts.googleapis.com/css2?family=${fontName}:wght@${weight}`,
    )
    const css = await cssResponse.text()
    // Extract .ttf url from css file