Using MS Shell Dlg and MS Shell Dlg 2
Windows is available in localized editions for many languages. However, the English-language edition can also be used to run applications written in languages other than English. This is true even when the script used for these languages is different, as when applications are written in Greek or Japanese. These applications require a user interface with dialog boxes, icons, and utilities that provide information in the application language, which might be different from the language being used in the current Windows user interface.
The problem in selecting the font for a user interface is obvious. For example, the shell font, also known as the system or default font, for English (United States) Windows 98 is MS Sans Serif, while the shell font for Greek (Greece) Windows 98 is MS Sans Serif Greek. For Japanese (Japan) Windows 98, the shell font is MS UI Gothic. These character sets cannot be directly mapped to each other. Replacing MS Sans Serif with MS Sans Serif Greek when the locale is set to Greek (Greece) does not allow existing applications to run adequately or to display Greek characters in system menus, dialog boxes, and edit controls.
Windows solves this problem by using the MS Shell Dlg and MS Shell Dlg 2 logical fonts to allow selection of the appropriate font for script display. This section addresses several programming considerations for using the logical fonts to implement dialog boxes, menus, and the like for flexible user interfaces that display well on all supported Windows operating systems and across all languages. For more information, see Font Creation and Selection. See also Multilingual User Interface for a discussion of the use of the Multilingual User Interface (MUI) technology in creating user interfaces for your multilingual applications.
The MS Shell Dlg and MS Shell Dlg 2 logical fonts are essentially face names used for mapping to enable support for locales/cultures having characters that are not contained in code page 1252, the Windows character set for the United States and Western Europe. MS Shell Dlg maps to the default shell font associated with the current culture/locale and supports the classic Windows desktop look. MS Shell Dlg 2 face name was introduced in Windows 2000 to support the look that was introduced with Windows 2000.
For example, if your application uses MS Shell Dlg or MS Shell Dlg 2 for its dialog boxes, a localization team creating Greek-language resources for your application can focus on translating text. They don't have to be concerned with issues such as the distinction between MS Sans Serif and MS Sans Serif Greek.
The use of Unicode allows applications to deal with thousands of different characters, but most fonts do not cover all of the Unicode character set. Your applications should not hard-code font names. One reason is that hard-coding a font name that displays characters for one language and not characters for another language causes all localized text in the second language to display incorrectly. Another reason not to hard-code font names is that the desired font might not be loaded on the operating system that is displaying application text.
The best way to treat font names is to consider them as localizable resources. Using a logical font solves the problem of running your interface using any language on Windows NT or Windows 2000, for any language. Setting a font name as a localizable resource makes it possible for your localizer to change the font for the localized user interface.
Some scripts are complex and require a large number of pixels to display properly. For example, most English characters display on a 5x7 grid, but Japanese characters need at least a 16x16 grid to be clearly seen. Whereas Chinese needs a 24x24 grid, Thai only needs 8 pixels for width but at least 22 pixels for height. It is easy to understand that some characters might not be legible at a small font size.
Your application user interface should treat font sizes as localizable resources. Using a logical font solves the problem of running your interface using any language on Windows NT or Windows 2000, for any language. Setting a font size as a localizable resource allows your localizer to change the font for the localized user interface.
Each of the logical fonts is mapped by an entry in the registry to the appropriate shell font for the currently active locale. When one of the logical fonts is used, Windows switches to the font for the currently selected locale at runtime. This operation allows the correct display of the English (United States) Windows user interface, as well as characters not in code page 1252. Thus currently shipping localized applications can run on the English (United States) version of Windows without modification.
Each Windows computer maps MS Shell Dlg and MS Shell Dlg 2 to an appropriate physical font, based on the defined language for non-Unicode programs, described in NLS Terminology. The actual mappings are stored in the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Current Version\FontSubstitutes.
MS Shell Dlg generally maps to a code page-specific version of MS Sans Serif.
MS Shell Dlg maps to MS Sans Serif for Western and Central European, Greek, Turkish, Baltic and languages using Cyrillic script; MS UI Gothic for Japanese; Gulim for Korean; Simsun for Simplified Chinese; PMinglu for Traditional Chinese; etc.
Both logical fonts map to Unicode-based TrueType fonts. MS Shell Dlg uses Microsoft Sans Serif (distinct from MS Sans Serif) if the install language is not Japanese. MS Shell Dlg maps to MS UI Gothic if the install language is Japanese.
On Windows XP MUI systems, MS Shell Dlg maps to MS UI Gothic only when the system locale and UI language are set to Japanese. Otherwise, MS Shell Dlg maps to Microsoft Sans Serif.
On Windows Vista and Windows 7, MS Shell Dlg maps to MS UI Gothic if the machine default UI language is set to Japanese (regardless of the install language). MS Shell Dlg maps to Microsoft Sans Serif if the machine default UI language is set to a language other than Japanese.
MS Shell Dlg 2 simply uses the Tahoma font regardless of language. The main advantage of Tahoma over Microsoft Sans Serif is that Tahoma has a native bold font face. Its main disadvantage is that older operating systems might not have it installed, and might substitute a less attractive font.
Characters that are not implemented in Tahoma or Microsoft Sans Serif may be implemented in other Windows fonts that are used for text display in user interfaces. Depending on what controls or APIs are used to display text, various mechanisms such as font linking may be used by the system to automatically select such fonts for displaying those characters.
Applications can use either Microsoft Sans Serif or Tahoma explicitly, and save the level of indirection involved in using MS Shell Dlg or MS Shell Dlg 2. Because of font linking, specifying Microsoft Sans Serif or Tahoma provides appropriate glyphs for all languages.
On Windows Me/98/95, MS Shell Dlg is not intended for use with a static, non-English user interface application that runs when the user has chosen a locale with a different Windows base character set. In this case, the application user interface language might not be supported with the font that is substituted for MS Shell Dlg.
For example, if the user is using a German-language version of Windows and wants to install a non-Unicode Greek-language application, the user attempts to change the locale to Greek (Greece). This action resets MS Shell Dlg to a Greek font, but this font does not contain all the glyphs necessary to display in German. Therefore, any non-ASCII characters in the German-language user interface will not display properly. To support this scenario, an application has to set MS Shell Dlg to a font that contains both the Western European and the Greek glyphs.