Font size when changing screen resolution
From: Mark Hatsell (mark.hatsell_at_btinternet.com)
Date: 02/13/04
- Next message: Christian: "How to stamp an image in GDI+"
- Previous message: James Weatherley: "Layered Windows and OpenGL"
- Next in thread: John Carson: "Re: Font size when changing screen resolution"
- Reply: John Carson: "Re: Font size when changing screen resolution"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Christian: "How to stamp an image in GDI+"
- Previous message: James Weatherley: "Layered Windows and OpenGL"
- Next in thread: John Carson: "Re: Font size when changing screen resolution"
- Reply: John Carson: "Re: Font size when changing screen resolution"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|