Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix bugs in textAscent/Descent
  • Loading branch information
dhowe committed Mar 22, 2025
commit a000a7c8ea9c4e072663cecf293fddb1ef8f76af
4 changes: 2 additions & 2 deletions src/type/textCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ function textCore(p5, fn) {
*/
Renderer.prototype.textAscent = function (txt = '') {
if (!txt.length) return this.fontAscent();
return this.textDrawingContext().measureText(txt)[prop];
return this.textDrawingContext().measureText(txt).actualBoundingBoxAscent;
};

/**
Expand All @@ -334,7 +334,7 @@ function textCore(p5, fn) {
*/
Renderer.prototype.textDescent = function (txt = '') {
if (!txt.length) return this.fontDescent();
return this.textDrawingContext().measureText(txt)[prop];
return this.textDrawingContext().measureText(txt).actualBoundingBoxDescent;
};

/**
Expand Down