Refactor getFontData
This commit is contained in:
parent
d2893326d7
commit
cff51a24a2
@ -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',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user