I did find the utility font.getName("postscriptName", "en"), so that's probably what I'll use for the time being. However, it's certainly not intuitive, and was tricky to find.
I'm wondering if we could support setting a default language, like font.setLanguage("en"), or even higher like fontkit.setDefaultLanguage("en") ... so that all font properties can be interpreted with that language, instead of just "whatever is first"?
FWIW, in most fonts I've looked at, the name.records.postscriptName object contains 2 entries, and they're usually the same. It usually looks like { "0-0": "Corbel", "en": "Corbel" }.
In some fonts, though, specifically the Microsoft font "Corbel Light", the first entry is different than the second: { "0-0": "Corbel-Light", "en": "CorbelLight" }.
I was looking at https://github.com/foliojs/fontkit/blob/master/src/TTFFont.js#L93-L94, which looks up the
postscriptName
by "whatever language comes first".I did find the utility
font.getName("postscriptName", "en")
, so that's probably what I'll use for the time being. However, it's certainly not intuitive, and was tricky to find. I'm wondering if we could support setting a default language, likefont.setLanguage("en")
, or even higher likefontkit.setDefaultLanguage("en")
... so that all font properties can be interpreted with that language, instead of just "whatever is first"?FWIW, in most fonts I've looked at, the
name.records.postscriptName
object contains 2 entries, and they're usually the same. It usually looks like{ "0-0": "Corbel", "en": "Corbel" }
. In some fonts, though, specifically the Microsoft font "Corbel Light", the first entry is different than the second:{ "0-0": "Corbel-Light", "en": "CorbelLight" }
.