Partilhar via


120 is the new 96 – Testing Applications with High DPI

DPI (dots per inch) refers to the number of pixels present per inch of display screen.

Windows Vista provides a system DPI setting which can be set to closely match the physical DPI/PPI of the screen. Assuming the system DPI is set correctly, an application can adjust its user interface elements to appear at the appropriate physical size, regardless of the screen size or the resolution.

During our Application Compatibility tests, we found that almost 10% of the applications tested have issues with non-standard DPI settings. You can find more information here.

A lot of the bugs that we found are even more severe on localized versions of applications (for example font related problems, text truncations).

Typical Types of Defects

Here is a list of the most commonly found types of defects:

· Incorrect font size (text is too big or too small).
This could be critical for applications that are localized to other languages. If the font appears too small, East Asian character might be illegible

· Truncation
This can often be found in static text controls (labels) or buttons. The problem might be more severe on localized versions of the application. This is by far the most common issue type.

· Custom control rendering

Implementations of custom controls need to make sure that graphical elements and fonts scale correctly

· UI Events
Mouse-events that rely on relative coordinatesmight not work correctly

· Application icons/menu icons are blurred
Applications should provide high-resolution icons in different sizes to avoid stretching and blurring. See https://msdn.microsoft.com/library/ms701681(VS.85).aspx for details.

· Components are drawn at the wrong location
This can be caused by incorrect scaling

Aware vs. Unaware

Depending on your system settings as well as on the program itself, there are three different ways the application could be handled:

· DPI aware applications
Applications that declare themselves DPI-ware need to implement correct scaling. Windows will not attempt to interfere with the behavior. See https://msdn.microsoft.com/library/ms701681(VS.85).aspx for details on how to create DPI-aware applications.

· Not DPI aware - Vista mode
Windows pretends that the application is running in 96 DPI. When displaying the application window, the graphics is resized to fit the actual resolution. As a result, the user interface might appear not as sharp as under the default setting and text might become unreadable. This mode is the default setting for DPI values of 120 or higher.

· Not DPI aware - XP mode
Default fonts and GUI elements are using scaled value but for hard-coded values, the user experience will suffer. This mode is enabled by default for settings of 120 DPI and lower, since 96 DPI and 120 DPI are not that far away and most legacy applications work correctly in 120 DPI.

Ultimately, the end-user can decide whether to use Windows XP or Windows Vista mode for non-DPI aware applications. The setting can be configured for an individual application (Shortcut àProperties à Compatibility à “Disable Display Scaling on high DPI settings”) or system wide (Personalization à DPI settings à Custom DPI settings à “Use Windows XP style DPI scaling”)

Recommendations

As monitor resolutions continue to improve, more users will use a setting of at least 120 DPI. Thus, testing for your application’s behavior under high DPI settings (minimum 120) is crucial.

If your application is not DPI-aware, you should test it in both the Windows XP and Windows Vista scaling mode. Watch out for the types of bugs discussed above.

If your application gets localized into different languages, you need to test each version with a high DPI setting as some bugs might only exist in localized versions of your application.

Comments

  • Anonymous
    November 06, 2008
    The comment has been removed