Refactor getFontData

This commit is contained in:
Sam Becker 2025-02-10 09:48:14 -06:00
parent d2893326d7
commit cff51a24a2

View File

@ -2,19 +2,17 @@ import fs from 'fs';
import path from 'path';
import { cwd } from 'process';
const FONT_FAMILY_IBM_PLEX_MONO = 'IBMPlexMono';
const FONT_IBM_PLEX_MONO_FAMILY = 'IBMPlexMono';
const FONT_IBM_PLEX_MONO_PATH = '/public/fonts/IBMPlexMono-Medium.ttf';
const getFontData = async () =>
fs.readFileSync(path.join(
cwd(),
'/public/fonts/IBMPlexMono-Medium.ttf',
));
fs.readFileSync(path.join(cwd(), FONT_IBM_PLEX_MONO_PATH));
export const getIBMPlexMonoMedium = () => getFontData()
.then(data => ({
fontFamily: FONT_FAMILY_IBM_PLEX_MONO,
fontFamily: FONT_IBM_PLEX_MONO_FAMILY,
fonts: [{
name: FONT_FAMILY_IBM_PLEX_MONO,
name: FONT_IBM_PLEX_MONO_FAMILY,
data,
weight: 500,
style: 'normal',