chore(og-image): force twemoji for emoji util

This commit is contained in:
Jacky Zhao
2025-03-05 17:21:19 -08:00
parent c97fd7089a
commit 3c8ccde624
2 changed files with 10 additions and 41 deletions

View File

@ -29,15 +29,12 @@ async function generateSocialImage(
width,
height,
fonts,
// `code` will be the detected language code, `emoji` if it's an Emoji, or `unknown` if not able to tell.
// `segment` will be the content to render.
loadAdditionalAsset: async (code: string, segment: string) => {
if (code === "emoji") {
// if segment is an emoji, load the image.
return `data:image/svg+xml;base64,${btoa(await loadEmoji("twemoji", getIconCode(segment)))}`
loadAdditionalAsset: async (languageCode: string, segment: string) => {
if (languageCode === "emoji") {
return `data:image/svg+xml;base64,${btoa(await loadEmoji(getIconCode(segment)))}`
}
// if segment is normal text
return code
return languageCode
},
})