Display resolution and font size
Hi,
It is my understanding that Vista has the ability to scale all text sizes
according to the display resolution (i.e. 12 point fonts will actually be 12
ponts regardless of the display resolution). Has this capability been
implemented in Vista Beta 2? If not, is it going to be? I have tried it out
with Vista Beta 2 and the text sizes still decrease as the monitor resolution
increases.
Thank you kindly.
Unfortunately the word "resolution" has been distorted from its original meeting, which is virtually synonymous with DPI. Many people (and the Windows UI) refer to the screen's size in pixels as its resolution. Not everyone has adapted their usage of the word.
If I spend $1000 on a larger monitor with the same physical DPI, I expect to see more stuff. But if I spend $1000 on a same-size monitor with a higher physical DPI, I expect better, er, resolution. In other words, I expect my text to be the same size, but rendered more clearly. Setting the logical DPI to something other than the physical DPI is a hack to trade off accurate WYSIWYG for either more legibility or more screen real estate.
Most Windows machines have logical DPI set to 96, which was pretty close to the truth for many monitors for many years. Physical sizes and total pixel sizes tended to go up together, leaving the physical DPI very close to 96.
Font scaling is often not linear: the characters in a 10-point font are not necessarily exactly 25% wider than the characters in the same font at 8 points. Instead you'll find they're a little bit wider, in order to make them look balanced at when rasterized. Similarly, rasterizing at a higher DPI won't necessarily give you proportionally-sized characters (in pixels).
This means your UI layouts may not scale well when the logical DPI is changed. As resolution gets high enough, the problem tends to go away. The jump from 96 to 120 DPI can cause pretty drastic differences.
Dialog units were intended to help ameliorate this, but, unless you include enough padding, they aren't precise enough to handle everything. The ideal solution would be dynamic layout based on actual font metrics, but historically that wasn't practical. Even today, it's difficult to implement.
Many programs were written and tested for machines assuming 96 DPI. If you change the logical DPI to something else, you might see clipping, overlap, or egregious spacing.
At last, we have monitors that have significantly different physical DPI. Some small screens in portable devices, for example, go up to 144. High-end desktop monitors can hit 200 or more. With these, it's no longer practical to leave the logical DPI back at 96--the text would simply be too small to read. But if your program was only ever tested at 96 DPI, you might encounter layout problems.
By default, Vista lies to programs. It tells them the resolution is 96 DPI, then it scales the UI like a bitmap (linearly) to the logical DPI setting for the system. This mostly ameliorates the layout problems (though not completely, for the same reasons dialog units weren't good enough) at the cost of some fuzziness when the logical DPI is set to something other than 96.
If a program has been careful to design and test for a range of DPIs, it can tell Vista that it's "DPI-aware" to stop the lies and the scaling. There are rumors there is a way to do this in the application manifest, but I haven't found any documentation for it. Instead, you can call SetProcessDPIAware before you create any UI.
SetProcessDPIAware is a new API for Vista. If your program needs to be backward compatible to pre-Vista versions of Windows, you can use LoadLibrary and GetProcAddress to see if SetProcessDPIAware is available before calling it.