LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how to calc font hight (https://www.linuxquestions.org/questions/programming-9/how-to-calc-font-hight-4175476721/)

prw8864 09-11-2013 09:44 AM

how to calc font hight
 
if I have the following:
1) image resolution in pixels
2) hight of region in pixels
3) font type ie. times new roman

is there away to calculate the maximum font size that would fit within the hight of the region given?
I am looking for a formula / translation table to do this.

firstfire 09-13-2013 04:46 AM

Hi.

Disclaimer: I'm just guessing..

Image resolution, as the name suggests, is measured in pixels per inch, not just in pixels. So, if vertical resolution of your image is VR (px/inch) and H is the given height in pixels, then H / VR is height in inches. Now, if you measure font size in points (1 inch is about 72 points), then maximum font size, which will fit in the given height H (pixels) is H/VR*72 (points).


All times are GMT -5. The time now is 09:21 AM.