Re: Font size when changing screen resolution
From: John Carson (donaldquixote_at_datafast.net.au)
Date: 02/15/04
- Next message: GrahamH: "CImage Draw problem"
- Previous message: Feng Yuan [MSFT]: "Re: How to stamp an image in GDI+"
- In reply to: Mark Hatsell: "Font size when changing screen resolution"
- Next in thread: Mark Hatsell: "Re: Font size when changing screen resolution"
- Reply: Mark Hatsell: "Re: Font size when changing screen resolution"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 15 Feb 2004 23:23:10 +1100
"Mark Hatsell" <mark.hatsell@btinternet.com> wrote in message
news:ePEbXTl8DHA.1548@tk2msftngp13.phx.gbl
> 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.
I see more or the less the opposite to what you describe. Either you are
using "size" in an unexpected way or you are making some other compensating
change. Are you aiming for a constant size in terms of the number of pixels
used or as measured by a ruler placed against the screen? And how EXACTLY do
you set the lfHeight value in the LOGFONT structure?
Normally, people aim for a pixel count that is independent of screen
resolution, with the result that higher resolutions lead to a smaller font
size as measured by a ruler against the screen. That is what Windows does in
its user interface elements.
You are right that Windows 9x/ME behaves differently from Windows
NT/2000/XP. If you want consistent behaviour, then one way to do it is to
use MM_ISOTROPIC or MM_ANISOTROPIC rather than MM_HIMETRIC. If you can
clarify what you are trying to do and how you are going about it, than I can
be more specific.
-- John Carson 1. To reply to email address, remove donald 2. Don't reply to email address (post here instead)
- Next message: GrahamH: "CImage Draw problem"
- Previous message: Feng Yuan [MSFT]: "Re: How to stamp an image in GDI+"
- In reply to: Mark Hatsell: "Font size when changing screen resolution"
- Next in thread: Mark Hatsell: "Re: Font size when changing screen resolution"
- Reply: Mark Hatsell: "Re: Font size when changing screen resolution"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|