[java] Text of an arbitrary size.
I need to create a Font object that will make a Graphics object display text at a certain size so everything in the window lines up. Is there a conversion formula for a font point size making characters of a certain number of pixels?
If you would read my post more closely you would notice that I need to go from pixels to point size, not the other way around.
I did read it carefully and it sounded like you wanted to know how many pixels a point size takes up.
Not quite; I want to know how many point sizes a certain number of pixels takes up. If I have a cell 10x14 pixels, for example, what size font do I paste in there to fill it?
Found this:
http://www.experts-exchange.com/Programming/Game_Development/Game_Graphics/Q_20686438.html
I think the default setting is 72 dpi. So a 10 point font will be 10 pixels by 10 pixels. However, a proportional font will be a max of 10 pixels wide.
http://www.experts-exchange.com/Programming/Game_Development/Game_Graphics/Q_20686438.html
Quote:
A point is 1/72 inch. With that formula you can convert between inches and points. What's missing is the number of pixels in an inch. You can retrieve that by calling GetDeviceCaps( hdc, LOGPIXELSY ) which returns the number of pixels in 1 logical inch of your screen. A logical inch isn't exactly 1 inch if you measure it, but that isn't a problem as the point size only relates to logical inches on your screen.
I think the default setting is 72 dpi. So a 10 point font will be 10 pixels by 10 pixels. However, a proportional font will be a max of 10 pixels wide.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement