Skip to content

Commit

Permalink
Setting zero coordinates for empty glyphs (space)
Browse files Browse the repository at this point in the history
Signed-off-by: Vsevolod Volkov <[email protected]>
  • Loading branch information
Vsevolod Volkov committed Apr 7, 2023
1 parent 7c7e6ac commit 6b9538a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/glyph/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ export default class Path {
}
}

if (this.commands.length === 0) {
// No content, put 0 instead of Infinity
cbox.minX = 0;
cbox.minY = 0;
cbox.maxX = 0;
cbox.maxY = 0;
}

this._cbox = Object.freeze(cbox);
}

Expand Down Expand Up @@ -172,6 +180,14 @@ export default class Path {
}
}

if (this.commands.length === 0) {
// No content, put 0 instead of Infinity
bbox.minX = 0;
bbox.minY = 0;
bbox.maxX = 0;
bbox.maxY = 0;
}

return this._bbox = Object.freeze(bbox);
}

Expand Down

0 comments on commit 6b9538a

Please sign in to comment.