Create a font that is always the same size, regardless of the video settings

I create fonts usign the following method :

int pts = 12;
int height = -((pDC->GetDeviceCaps(LOGPIXELSY) * pts) / 72);
CFont font;
font.CreateFont(height, 0, 0, 0, (bBold ? FW_BOLD : FW_NORMAL), (char)bItalic, (char)bUnderline, 0,
FF_DONTCARE, fontName);

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 ???

Who is Participating?
Use GetDeviceCaps(LOGPIXELSX)/GetDeviceCaps(LOGPIXELSY) on the display dc.
It will return the DPI settings - which are equal to the DPI selected in the 'Display Properties'.
So 120 DPI = 125% of usual size, ...
Hope this is still of interest :)
Try DRAFT_QUALITY and stick to true type
you create two font types, one for 640*480,one for 800*600, you can select the proper font according to the video setting.

yletourAuthor Commented:
This solution does not answer to the question.  How can I know if the user has Large Fonts or not enabled ?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.