Skip to content

Commit

Permalink
fix: text() swallows characters in CHAR wrap mode processing#7437
Browse files Browse the repository at this point in the history
  • Loading branch information
top-mind committed Dec 20, 2024
1 parent 4443f7c commit 6d3dd45
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/core/p5.Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ class Renderer extends p5.Element {
line = `${chars[charIndex]}`;
}
}
nlines.push(line);
}

nlines.push(line);
let offset = 0;
if (this._textBaseline === constants.CENTER) {
offset = (nlines.length - 1) * p.textLeading() / 2;
Expand Down Expand Up @@ -423,16 +423,16 @@ class Renderer extends p5.Element {
line = `${chars[charIndex]}`;
}
}
this._renderText(
p,
line.trim(),
x,
y - offset,
finalMaxHeight,
finalMinHeight
);
y += p.textLeading();
}
this._renderText(
p,
line.trim(),
x,
y - offset,
finalMaxHeight,
finalMinHeight
);
y += p.textLeading();
}
} else {
// Offset to account for vertically centering multiple lines of text - no
Expand Down

0 comments on commit 6d3dd45

Please sign in to comment.