Thursday, May 9, 2013

DPI in Windows

I'm looking into DPI in Windows today, and how it is handled by the system.

We are designed to run at 96 dpi, the default Windows dpi setting.  This was fine in the old days, but with new high resolution displays coming along, and (hopefully) long standing Windows bugs being (hopefully) fixed, it is becoming more important to support different DPI settings.

Over the weekend, I watched somebody running Howler on a new pressure enabled tablet device, that featured a very high resolution.  They also had Photoshop installed (which also has formatting problems in different DPI settings) so they would switch back to 96 dpi to do actual work.

I've stated before, that historically, Windows had a bug that would delete your user account sporadically when switching DPI settings.  I really, really hope that one's been solved.  That one fact kept me from looking into the DPI problem for a number of years.

Anyways.  I've leaned a few things about how DPI is handled under Windows.
There are 2 modes in which DPI is handled.  One is to let the the OS handle some of the scaling (such as fonts and window elements) and forces the program to handle other layout things.  This is a bit of a mess, because the OS handles things differently depending on which version you're using.

The other option is to have the OS render the program offscreen at 96 dpi, and blit it onto the program window.  All the windows/buttons/text/graphics appear correctly in this mode, and at a larger size, but they appear slightly blurry because they are being bitmap scaled.  This mode is turned on by turning off(!) the "WinXP style scaling" checkbox in the dpi settings program.

Unfortunately, it's all on or all off, you can't just turn it on for a single application.  You can however exclude programs from being rendered in this mode by using the program's compatibility settings.

To further complicate things, these modes are selected differently depending on the DPI you have selected.  96 through 120 dpi get the "XP style" scaling, while other dpi settings get the XP style turned off.  It can however be changed by the user.

No comments:

Post a Comment