opentype.js
opentype.js copied to clipboard
advanceWidth of Glyph is set to NaN after calling getBoundingBox
trafficstars
Expected Behavior
When calling the getBoundingBox method for a glyph, the advanceWidth property does not change
Current Behavior
For some fonts, the advanceWidth is set to NaN.
Steps to Reproduce (for bugs)
Use this font: Sugardrop.otf.zip
// Require modules
const assert = require('assert');
const opentype = require('./opentype.min.js');
// Load the font
opentype.load('./Sugardrop.otf', function(err, font) {
if (err) {
console.error('Font could not be loaded: ' + err);
} else {
// Get glyph for A
const A = font.glyphs.glyphs[36];
// Advance width is equal to 749
assert.equal(A.advanceWidth, 749);
// Get the bounding box
A.getBoundingBox();
// Advance width is not equal to 749 anymore but NaN
assert.equal(A.advanceWidth, 749);
}
});
Your Environment
- Version used:
1.1.0 - Font used: Sugardrop (see link above)
- Browser Name and version: Node
10.17.0 - Operating System and version (desktop or mobile): MacOS Catalina
- Link to your project: see snippet above
Is there any work around for this?
Sounds like this is related to #397 and might have been fixed already, I'm going to check...