Open davepagurek opened 2 months ago
Thanks @davepagurek -- this is a known-issue discussed in https://github.com/processing/p5.js/pull/6967
The fix, which will hopefully be included in v2.0, is to accept textLeading
(and all other relevant params) as part of options
Most appropriate sub-area of p5.js?
p5.js version
1.9.4
Web browser and version
Firefox, Chrome
Operating system
MacOS
Steps to reproduce this
Steps:
textBounds()
of multiline text, passing in a larger font size than the default (e.g. 50)Snippet:
In this example, I'm setting the font size on a graphic, so the main canvas still has the default text size:
Result:
Expected:
Cause
In the implementation of
textBounds
, it gets the text leading from the main instance's renderer: https://github.com/processing/p5.js/blob/6781c1d1db83cb8beefbca74a9473e546b4f1e1f/src/typography/p5.Font.js#L209I'm not sure the best way to fix this; if you're drawing text onto a different renderer like a graphic, there's not a deterministic way to figure out which renderer to use ahead of time. The best option might be to let you pass that value in, which might require a change to the arguments to this function to not have an overwhelmingly long parameter list.