All Windows Platforms

From WxWiki

Jump to: navigation, search

[edit] All Windows Platforms

[edit] Fonts

The size of a font (wxFont) is specified in pixels, not points. This must be accounted for when printing. Printers have much higher dots per inch (DPI) ratings than video displays.

For example, if your font is 4 pixels and you send output to a 600 x 600 DPI printer with a display of 96 DPI, what comes out is a 5.5 point font.

Here is how to set the font properly:

wxFont f2(font);
f2.SetPointSize(((f2.GetPointSize() *
   ::GetDeviceCaps((HDC)m_printHDC.GetHDC(), LOGPIXELSY ))-36)/
   ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY));
Personal tools