I want to calculate, automatically, the circumference of random words (written in Arial font) using the height and length.
I used this formula : (H+L)*4.
Nota : I can get the exact circumference in a software (Adobe Illustrator), but I want to calculate it automatically inside a php code.
Then, I run some tests by changing the height or the length of this sentence.
If I keep the the height and change only the length the results are good enough.
But if I change the height and keep the length, the difference between the calculated circumference and the real one is getting bigger proportionally (please take a look to my image).
I'm wondering if we can adjust this formula to get a good result everytime.
Thank you very much. enter image description here