Skip to content

Commit

Permalink
Handle undefined cbox in Glyph metrics calculation
Browse files Browse the repository at this point in the history
Fix issue with foliojs#306
  • Loading branch information
ptoussai committed Nov 19, 2024
1 parent 39c87bd commit 32d31ab
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/glyph/Glyph.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default class Glyph {
if (this._font.vmtx) {
var {advance:advanceHeight, bearing:topBearing} = this._getTableMetrics(this._font.vmtx);
} else {
if (typeof cbox === 'undefined' || cbox === null) { ({ cbox } = this); }
var advanceHeight = Math.abs(this._font.ascent - this._font.descent);
var topBearing = this._font.ascent - cbox.maxY;
}
Expand Down

0 comments on commit 32d31ab

Please sign in to comment.