mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-05-18 06:24:22 +02:00
chore: use Google Fonts API v2 to get fonts for ogp (#1705)
This commit is contained in:
parent
c98ef7e89f
commit
dc3323b574
@ -35,7 +35,9 @@ export async function getSatoriFont(headerFontName: string, bodyFontName: string
|
|||||||
async function fetchTtf(fontName: string, weight: FontWeight): Promise<ArrayBuffer> {
|
async function fetchTtf(fontName: string, weight: FontWeight): Promise<ArrayBuffer> {
|
||||||
try {
|
try {
|
||||||
// Get css file from google fonts
|
// 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()
|
const css = await cssResponse.text()
|
||||||
|
|
||||||
// Extract .ttf url from css file
|
// Extract .ttf url from css file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user