Is it at all possible to calculate the width size (in inches) of a particular string in the default font ( par()$family
) , and default size ( par()$ps
).
Calculating the height seems relatively simple:
par()$ps * 1/72
The challenge with width is that it is dependent on the string itself. A string of i's "iiiiii" is smaller than a string of o's "ooooooo"
You are looking for the function strwidth
in base
strwidth('this is cool', font = 12, units = 'in')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With