If your application has User Interface designs based on screen coordinates,
you might frequently find that switching to large or small font drivers
causes the design to look bad. If you try to remedy the problem by
customizing the design to the system font size in use, you fail because the
system does not know, and cannot report to an application, what font size
the user has selected when configuring the video driver.
Video drivers for the Windows operating systems have historically offered
the capability to operate in large fonts or small fonts. These "modes"
differ in that the fonts used in the system and in applications appear
larger on the display.
Video drivers accomplish this by reporting different values for the
LOGPIXELSY and LOGPIXELSX flags of the GetDeviceCaps() function. They also
install a new set of system raster fonts that directly support the new
display units. The operating system is not aware of this difference and is
not specifically aware of whether the user has selected large fonts or
small fonts. Thus, it cannot report which mode the system is currently in.
Traditionally, video drivers report a value of 96 pixels per inch for small
fonts LOGPIXELSX and LOGPIXELSY values and 120 pixels per inch for large
fonts LOGPIXELSX and LOGPIXELSY values. However, this is not reliable
because there is no standard dictating these values. Furthermore, Windows
95 allows the user to customize these return values to any arbitrary value.
Other methods, such as the name of the video driver, have historically been
used to infer large fonts versus small fonts use as well, but none of these
methods are reliable.
NOTE: The numbers and strings that appear in the Display Settings dialog
box of the operating system are either managed by the display driver or
merely data stored in the system registry. The presence of this data does
not imply that the operating system can report it in a meaningful fashion.
Applications should not attempt to determine the system font size since
there is no reliable way to obtain the information. Typically, developers
request this information because they have used screen coordinates to
design the look of their application to a specific video display setting.
The solution is to avoid using a device dependent means of specifying the
application's user interface layout. Instead, you should use Dialog Base
units as described by the Knowledge Base articles listed in the "References"
section of this article. These methods are portable from instance to
instance of the operating system irrespective of large fonts, small fonts,
or screen size.
For more information on the best methods for dynamically creating dialog
boxes and positioning controls please see the Knowledge Base articles
listed in the "References" section of this article.
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
How to calculate dialog base units with non-system-based