Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/TTFFont.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class TTFFont {
}

_decodeDirectory() {
return this.directory = Directory.decode(this.stream, {_startOffset: 0});
return this.directory = Directory.decode(this.stream, { _startOffset: 0 });
}

_decodeTable(table) {
Expand All @@ -101,12 +101,12 @@ export default class TTFFont {
if (record) {
// Attempt to retrieve the entry, depending on which translation is available:
return (
record[lang]
|| record[this.defaultLanguage]
|| record[fontkit.defaultLanguage]
|| record['en']
|| record[Object.keys(record)[0]] // Seriously, ANY language would be fine
|| null
record[lang]
|| record[this.defaultLanguage]
|| record[fontkit.defaultLanguage]
|| record['en']
|| record[Object.keys(record)[0]] // Seriously, ANY language would be fine
|| null
);
}

Expand Down Expand Up @@ -449,8 +449,9 @@ export default class TTFFont {
}

for (let axis of this.fvar.axis) {
const name = axis.name && axis.name.en ? axis.name.en : axis.axisTag.trim();
res[axis.axisTag.trim()] = {
name: axis.name.en,
name,
min: axis.minValue,
default: axis.defaultValue,
max: axis.maxValue
Expand Down Expand Up @@ -481,7 +482,9 @@ export default class TTFFont {
settings[axis.axisTag.trim()] = instance.coord[i];
}

res[instance.name.en] = settings;
// use instance.postscriptNameID as fallback name for namedVariations when the name is not available
const name = instance.name && instance.name.en ? instance.name.en : `PS${instance.postscriptNameID}`;
res[name] = settings;
}

return res;
Expand Down