How to get true Font size?
-
Hello everyone, I'm back again... I'm working on some printing dialog with integrated preview. The problem is how to determine corrent font size (height) for the preview. Of course, the preview image size is measured in pixels, so for the A4 you have e.g 176x140 px large image. When I want to draw something on it with font of user-defined size in px, the preview size must be some N-times smaller. The key problem is how to get the N. Images are printed correctly, because I can convert its sizes in some useful units, like inches or percents, so they can be drawn with knowledge of document size in hundreths-per-inch units correctly. But with fonts, I can use only some
Font.GetHeight(...)
method, which returns (for my printer resolution) value of 186.8591 (inches or what :mad:?) for the 10px font. -
Hello everyone, I'm back again... I'm working on some printing dialog with integrated preview. The problem is how to determine corrent font size (height) for the preview. Of course, the preview image size is measured in pixels, so for the A4 you have e.g 176x140 px large image. When I want to draw something on it with font of user-defined size in px, the preview size must be some N-times smaller. The key problem is how to get the N. Images are printed correctly, because I can convert its sizes in some useful units, like inches or percents, so they can be drawn with knowledge of document size in hundreths-per-inch units correctly. But with fonts, I can use only some
Font.GetHeight(...)
method, which returns (for my printer resolution) value of 186.8591 (inches or what :mad:?) for the 10px font. -
Hello everyone, I'm back again... I'm working on some printing dialog with integrated preview. The problem is how to determine corrent font size (height) for the preview. Of course, the preview image size is measured in pixels, so for the A4 you have e.g 176x140 px large image. When I want to draw something on it with font of user-defined size in px, the preview size must be some N-times smaller. The key problem is how to get the N. Images are printed correctly, because I can convert its sizes in some useful units, like inches or percents, so they can be drawn with knowledge of document size in hundreths-per-inch units correctly. But with fonts, I can use only some
Font.GetHeight(...)
method, which returns (for my printer resolution) value of 186.8591 (inches or what :mad:?) for the 10px font.You can use the
Graphics.MeasureString( ... )
function to get the pixel height of aFont
's output. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty