Comparing version 0.2.5 to 0.2.6
@@ -17,5 +17,5 @@ "use strict"; | ||
this.path = path; | ||
this.postscriptName = fixGarbled(font.postscriptName.toString()); | ||
this.family = fixGarbled(font.familyName.toString()); | ||
this.style = fixGarbled(font.subfamilyName.toString()); | ||
this.postscriptName = fixIncorrectString(font.postscriptName); | ||
this.family = fixIncorrectString(font.familyName); | ||
this.style = fixIncorrectString(font.subfamilyName); | ||
var isFixedPitch = (_a = font.post) === null || _a === void 0 ? void 0 : _a.isFixedPitch; | ||
@@ -44,5 +44,12 @@ this.monospace = isFixedPitch !== 0; | ||
exports.FontDescriptor = FontDescriptor; | ||
function fixGarbled(str) { | ||
return str.replace(/\\u0000/g, ''); | ||
function fixIncorrectString(str) { | ||
if (typeof str === 'string') | ||
return str; | ||
var newStr = ''; | ||
for (var i = 0; i < str.length; i++) { | ||
if (str[i] !== 0) | ||
newStr += Buffer.from([str[i]]).toString(); | ||
} | ||
return newStr; | ||
} | ||
//# sourceMappingURL=fontDescriptor.js.map |
{ | ||
"name": "fontscan", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "Get font list in specified directory(default system fonts).", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
13517
138