opentype.js
opentype.js copied to clipboard
Letter render on top of each other.
trafficstars
Hi i got this weird behavior for multiple fonts before and i have no idea what's wrong.
for most fonts it works perfectly but for others, the letters just crumble on top pf each other like you can see here
Not 100% sure why but for some fonts Opentype mutates the glyph data after already calculated all metrics and overwrites the advance width with NaN. I use this snippet to avoid this:
Object.defineProperty(Glyph.prototype, 'advanceWidth', {
get() {
return this.storedAdvanceWidth;
},
set(value) {
if (!Number.isNaN(value)) {
this.storedAdvanceWidth = value;
}
},
});
@Hassan-Azzam @swingerman could you please provide at least one font where this happens?