Add Comic Sans easter egg

This commit is contained in:
hazycora 2023-08-03 14:28:31 -05:00
parent 3cb301360e
commit 7d6cf5b09f
No known key found for this signature in database
GPG key ID: 215AF1F81F86940E
7 changed files with 55 additions and 18 deletions

View file

@ -110,3 +110,30 @@ export const DMSans = [
style: 'normal'
}
]
export const ComicSans = [
{
name: 'Comic Sans MS',
data: fs.readFileSync('./assets/ComicSans/ComicSans-Regular.ttf'),
weight: 400,
style: 'normal'
},
{
name: 'Comic Sans MS',
data: fs.readFileSync('./assets/ComicSans/ComicSans-Italic.ttf'),
weight: 400,
style: 'italic'
},
{
name: 'Comic Sans MS',
data: fs.readFileSync('./assets/ComicSans/ComicSans-Bold.ttf'),
weight: 700,
style: 'normal'
},
{
name: 'Comic Sans MS',
data: fs.readFileSync('./assets/ComicSans/ComicSans-BoldItalic.ttf'),
weight: 700,
style: 'italic'
}
]

View file

@ -1,15 +1,10 @@
import html2png, { renderHtml as htmlParser } from '@besties/html2png'
import fs from 'node:fs'
import { DMSans } from './fonts.js'
const css = fs.readFileSync('./assets/style.css', 'utf8')
const renderOptions = {
fonts: DMSans
}
export default async function (html, options = {}) {
return html2png(html, css, { ...renderOptions, ...options })
return html2png(html, css, options)
}
export async function renderHtml(html) {