You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I call height/widthOfString and draw a rect+stroke with the dimensions returned, I would expect the rect to encompass the text. But that isn't the behavior I'm seeing.
Here are the issues I'm seeing:
With Helvetica, the box is too wide (wider than the pdf) and too tall:
But as soon as I give the Inter text a negative line gap, the height is wrong:
My goal is to measure the size of text and choose the largest font size that will fill a given area. If I can't compute that area the task is impossible.
Is there a better way of getting the area of the rendered text?
Bug Report
Description of the problem
If I call
height
/widthOfString
and draw a rect+stroke with the dimensions returned, I would expect the rect to encompass the text. But that isn't the behavior I'm seeing.Here are the issues I'm seeing:
My goal is to measure the size of text and choose the largest font size that will fill a given area. If I can't compute that area the task is impossible.
Is there a better way of getting the area of the rendered text?
Code sample
code that demonstrates these issues: https://github.com/altano/pdfkit-bugs/tree/main
Just clone,
npm install && npm start
Your environment
The text was updated successfully, but these errors were encountered: