Font size when changing screen resolution

From: Mark Hatsell (mark.hatsell_at_btinternet.com)
Date: 02/13/04


Date: Fri, 13 Feb 2004 17:14:17 -0000

Hello

I am having a problem with fonts in my application changing point size after
changing the screen resolution in Display Properties. This problem only
seems to occur in Win NT, 2000 and XP and not in Win 98. Basically I have a
window into which I am drawing some text. I have changed the map mode and
viewport origin so that I have a metric coordinate system with positive y
going up.

dc.SetMapMode(MM_HIMETRIC);
TPoint origin (0, GetClientRect().Height());
dc.SetViewportOrg (origin);

In order to draw the text I have converted the font point size specified by
the user into mm by multiplying by 0.3514598. This figure is derived from
the fact that 1 point = 1/72 inch and there are 25.4 mm in an inch. This
seems to draw at the correct size in my native resolution of 1280x1024.
However, if I switch to 800x600, the text in drawn in a much smaller point
size (about half of what it should be). As I mentioned this only happens in
NT, 2000 and XP. In Win 98 the text draws at the correct point size
regardless of the screen resolution.

I did a bit of investigation and found that on XP etc. the HORZSIZE and
VERTSIZE returned from GetDeviceCaps are always the same whatever the screen
resolution. In Win 98 however, these values change according to the
resolution of the screen. This implies that in XP there are more logical
units per pixel the lower the screen res. This means that a font with a
certain height in logical units will draw at a smaller point size in lower
res modes. In 98 however, the logical units per pixel is the same regardless
of resolution and instead the HORZSIZE and VERTSIZE change. This gives a
consistent point size across all resolutions.

My question therefore is how do I draw text of a certain point size in all
screen resolutions in all versions of Window?

Any help appreciated.

Mark



Relevant Pages

  • Re: Font size when changing screen resolution
    ... > size after changing the screen resolution in Display Properties. ... > In order to draw the text I have converted the font point size ... > there are more logical units per pixel the lower the screen res. ... > means that a font with a certain height in logical units will draw at ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Imac G5 repair extension...
    ... The screen resolution is basically the same on the ... >> looks significantly more legible to the blind; I just don't like the form ... Most sites can change font size with your Font +/-, ... If you can't comfortably read an LCD at the native resolution, ...
    (uk.comp.sys.mac)
  • RTF Export truncation
    ... I could not find a resolution for this problem, ... plus some newsgroup posts came up with a solution, so I thought I would post ... The original font was MS Sans Serif and I ... changed it to Microsoft Sans Serif, the screen resolution had to be above ...
    (microsoft.public.access.reports)
  • Re: Screen resolution and dialog size
    ... resolution to create scaling factors for all of the controls. ... Now, when I 'down sized' below design resolution, it looked rather poor ... (granularity of font sizes as they get smaller?). ... they actually do suggest one design at low screen resolution (not taking ...
    (microsoft.public.vc.mfc)
  • Re: Automatic updates changing screen resolution
    ... And it won't let me reset it. ... 'Dell notebook, Vista, and Screen Resolution | Ask Metafilter' ... The actual culprit is TMM, Vista's process that looks for multiple ... Uncheck the box under Settings at "Run in 640 X 480 screen resolution. ...
    (microsoft.public.windows.vista.general)