Create a font that is always the same size, regardless of the video settings
Posted on 1998-11-19
I create fonts usign the following method :
int pts = 12;
int height = -((pDC->GetDeviceCaps(LOGPIXELSY) * pts) / 72);
font.CreateFont(height, 0, 0, 0, (bBold ? FW_BOLD : FW_NORMAL), (char)bItalic, (char)bUnderline, 0,
CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH |
This is fine in the normal case, but if I go in my video settings (Start~Settings~Control Panel~Display~Settings). There is an option for Font Size, which will let you select "Large fonts". Also, with some video card drivers, it is possible to select a ratio of the normal size for a font (120% of normal, for example). So when I create a font with a given number of points, I end up with many different possible font sizes...
What I need is a way to create a font that wont be affected by this setting (ie the font will alway be the same number of pixels high for a given pts setting). Is there a way I can go around that setting ???