foliojs / font-manager

A C++ module for Node.js providing access to the system font catalog.
MIT License
295 stars 100 forks source link

monospace field is incorrect on Linux #15

Open sedwards2009 opened 8 years ago

sedwards2009 commented 8 years ago

When fetching the font metadata on Linux the monospace field is often incorrect saying true when it should be false. What is interesting is that finding fonts with a the monospace filter does work correctly. Consider the output of this code and its two lists. I would expect both lists to be the same:

const fontManager = require('font-manager');

const monofonts = fontManager.findFontsSync(  { monospace: true}).map( (font) => font.path);

const fonts = fontManager.getAvailableFontsSync();
const monofonts2 = fonts.filter( (font) => font.monospace).map( (font) => font.path);

monofonts.sort();
monofonts2.sort();

console.log("[findFonts]-----------------");
console.log(JSON.stringify(monofonts, null, "  "));
console.log("[getAvailableFonts & filter]-----------------");
console.log(JSON.stringify(monofonts2, null, "  "));