mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
i dunno
This commit is contained in:
1 parent
6ee1fa13d3
commit
ce5a53d0ff
5 files changed
+26
-29
No files matched your search
@@ -1,29 +0,0 @@
|
|||||||
import { readFile } from 'fs/promises';
|
|
||||||
import satori from 'satori';
|
|
||||||
|
|
||||||
const FONT_NAME = 'Roboto';
|
|
||||||
const FONT_FILES = [
|
|
||||||
{ weight: 400 as const, path: require('../../assets/fonts/Roboto.ttf') },
|
|
||||||
{ weight: 700 as const, path: require('../../assets/fonts/Roboto-Bold.ttf') },
|
|
||||||
{
|
|
||||||
weight: 900 as const,
|
|
||||||
path: require('../../assets/fonts/Roboto-Black.ttf'),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const fonts = Promise.all(
|
|
||||||
FONT_FILES.map(({ path, weight }) =>
|
|
||||||
readFile(path).then((data) => ({
|
|
||||||
data: Buffer.from(data.buffer),
|
|
||||||
name: FONT_NAME,
|
|
||||||
weight,
|
|
||||||
})),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
export default async function jsxToSvg(jsx: JSX.Element) {
|
|
||||||
return await satori(jsx, {
|
|
||||||
width: 480,
|
|
||||||
fonts: await fonts,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,26 @@
|
|||||||
|
import satori from 'satori';
|
||||||
|
|
||||||
|
const fonts = [
|
||||||
|
{
|
||||||
|
data: require('./Roboto.ttf'),
|
||||||
|
weight: 400 as const,
|
||||||
|
name: 'Roboto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: require('./Roboto-Bold.ttf'),
|
||||||
|
weight: 700 as const,
|
||||||
|
name: 'Roboto-Bold',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: require('./Roboto-Black.ttf'),
|
||||||
|
weight: 900 as const,
|
||||||
|
name: 'Roboto-Black',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default async function jsxToSvg(jsx: JSX.Element) {
|
||||||
|
return await satori(jsx, {
|
||||||
|
width: 480,
|
||||||
|
fonts,
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in new issue
Block a user