// 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
Expected Behavior
When calling the
getBoundingBox
method for a glyph, theadvanceWidth
property does not changeCurrent Behavior
For some fonts, the
advanceWidth
is set toNaN
.Steps to Reproduce (for bugs)
Use this font: Sugardrop.otf.zip
Your Environment
1.1.0
10.17.0