Skip to content

Commit 5670e2c

Browse files
committed
fix textToModel to return empty geometry for space characters
1 parent 2adc450 commit 5670e2c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/type/p5.Font.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,10 @@ export class Font {
545545
const extrude = options?.extrude || 0;
546546

547547
let contours = this.textToContours(str, x, y, width, height, options);
548+
if (!contours || contours.length === 0) {
549+
return new p5.Geometry();
550+
}
551+
548552
// Step 2: build base flat geometry - single shape
549553
const geom = this._pInst.buildGeometry(() => {
550554
const prevValidateFaces = this._pInst._renderer._validateFaces;

0 commit comments

Comments
 (0)