0.33.0+ HarfBuzz: WOFF 字形渲染为堆叠的水平条 (Inter Bold)
import fs from 'node:fs'; import satori from 'satori'; import { html } from 'satori-html';
const font = fs.readFileSync('./inter-bold.woff'); // Inter Bold, static WOFF (not WOFF2)
const svg = await satori(
html(<div style="display:flex;flex-direction:column;width:1200px;height:630px;font-family:Inter;font-weight:700;color:#141a26;font-size:52px;line-height:1.15">Hello Inter</div>),
{
width: 1200,
height: 630,
fonts: [
{
name: 'Inter',
data: font,
weight: 700,
style: 'normal',
},
],
},
);
fs.writeFileSync('out.svg', svg);
console.log('curves', (svg.match(/[CcQq]/g) || []).length);
console.log('rects', (svg.match(/L[\d.]+ [\d.]+L[\d.]+ [\d.]+L[\d.]+ [\d.]+Z/g) || []).length);
0.33.4: out.svg is the
内容来源: vercel/satori