Override certain font registration names

This commit is contained in:
Dragon Fire
2021-02-20 10:00:43 -05:00
parent 9c31d1119d
commit 1eb843f1b2
+5 -1
View File
@@ -11,11 +11,15 @@ const weights = {
900: 'heavy',
950: 'extraBlack'
};
const variants = {
'Noto-CJK.otf': 'Noto Sans',
'Noto-Emoji.ttf': 'Noto Sans'
};
module.exports = class Font {
constructor(path, filename, metadata) {
this.path = path;
this.name = metadata.name || filename;
this.name = variants[filename] || metadata.name || filename;
this.style = metadata.style === 'regular' ? 'normal' : metadata.style || 'normal';
this.weight = weights[metadata.weight] || metadata.weight || 'normal';
this.type = metadata.type;