Fix font style
This commit is contained in:
@@ -32,11 +32,13 @@ export class AppContext {
|
|||||||
const fontFiles = readdirSync(fontDirectory)
|
const fontFiles = readdirSync(fontDirectory)
|
||||||
const fonts = fontFiles.map(file => {
|
const fonts = fontFiles.map(file => {
|
||||||
const basename = path.basename(file, path.extname(file))
|
const basename = path.basename(file, path.extname(file))
|
||||||
|
const italic = basename.includes('Italic')
|
||||||
const [weight, name] = basename.split('-')
|
const [weight, name] = basename.split('-')
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
data: readFileSync(path.join(fontDirectory, file)),
|
data: readFileSync(path.join(fontDirectory, file)),
|
||||||
weight: parseInt(weight),
|
weight: parseInt(weight),
|
||||||
|
style: italic ? 'italic' : 'normal',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return new AppContext({
|
return new AppContext({
|
||||||
|
|||||||
Reference in New Issue
Block a user