The System Predefined Fonts
Stock Font Objects
In Windows platforms, there are some stock font objects that can be used by application at any time, with the GetStockObject function. The Open32 NLS Extension supports the stock font objects listed below.
┌──────────────────────────────┬──────────────────────────────────────────────────┐ │Stock Font Object │Meaning │ ├──────────────────────────────┼──────────────────────────────────────────────────┤ │ANSI_FIXED_FONT │Fixed-pitch system font for Windows SBCS ANSI │ │ │character set. Courier 8 point is typically used. │ ├──────────────────────────────┼──────────────────────────────────────────────────┤ │ANSI_VAR_FONT │Variable-pitch system font for Windows SBCS ANSI │ │ │character set. MS Sans Serif (Helv, in OS/2) 8 │ │ │point is typically used. │ ├──────────────────────────────┼──────────────────────────────────────────────────┤ │OEM_FIXED_FONT │OEM dependent fixed-pitch font for OEM character │ │ │set. Typically used in console windows. │ ├──────────────────────────────┼──────────────────────────────────────────────────┤ │DEFAULT_GUI_FONT │Variable-pitch font for system (process, in OS/2) │ │ │default character set. Windows 95 GUI default font│ │ │(can be overridden by user, per GUI element). │ │ │Swiss (SBCS), Modern (DBCS) family font is │ │ │typically used. │ ├──────────────────────────────┼──────────────────────────────────────────────────┤ │SYSTEM_FONT │Variable-pitch system font for system (process, in│ │ │OS/2) default character set. Windows 3.1 GUI font,│ │ │and Windows 3.1 & 95 display device default font. │ ├──────────────────────────────┼──────────────────────────────────────────────────┤ │SYSTEM_FIXED_FONT │Fixed-pitch system font for system (process, in │ │ │OS/2) default character set. Windows 3.0 GUI font,│ │ │and Windows 3.0 display device default font. │ ├──────────────────────────────┼──────────────────────────────────────────────────┤ │DEVICE_DEFAULT_FONT │Device-dependent font for system (process, in │ │ │OS/2) default character set. In Windows 95, this │ │ │is the SYSTEM_FONT compatible scaleable font. │ └──────────────────────────────┴──────────────────────────────────────────────────┘
Stock Font Object Implementation
Actually, the stock font objects are just the system predefined logical fonts. The font mapper must be called whenever a stock font object is selected into a device context, to find out the closest match in the target device.
One exception in implementing the stock font objects is SYSTEM_FONT. This stock object must be match exactly to the display device default font. The logical font for this stock font object need to be decided by checking the default font in the dis play device context at runtime (see next page).
Also some stock font objects need to be compatible with the process default character set. Because the default character set is vary between processes in Open32 environment, these stock font objects must be decided in the Open32 NLS Extension per-process initialization time (see next page).
Logical Font Definitions for Stock Font Objects
The logical font definitions in the table shown below are used for stock font objects.
┌─────────────────────┬──────────────┬───────┬────────────┬──────────┬────────┬────────────────┐ │ Stock Font Object │ CharSet │ Family│ FaceName │ Pitch │ Size │ OutPrecision │ ├─────────────────────┼──────────────┼───────┼────────────┼──────────┼────────┼────────────────┤ │ ANSI_FIXED_FONT │ SBCS ANSI │ Modern│ Courier │ Fixed │ 8 │ Raster │ │ │ see note 1 │ │ │ │ point │ │ ├─────────────────────┼──────────────┼───────┼────────────┼──────────┼────────┼────────────────┤ │ ANSI_VAR_FONT │ SBCS ANSI │ Swiss │ Helv │ Variable │ 8 │ Raster │ │ │ see note 1 │ │ │ │ point │ │ ├─────────────────────┼──────────────┼───────┴────────────┴──────────┴────────┴────────────────┤ │ OEM_FIXED_FONT │ OEM │ same as SYSTEM_FIXED_FONT │ ├─────────────────────┼──────────────┼─────────────────────────────────────────────────────────┤ │ DEFAULT_GUI_FONT │ Process │ must be taken from display device default raster font. │ │ │ Default │ (in SBCS OS/2, System Proportional 10 point will be │ │ │ see note 2 │ found as the result) │ ├─────────────────────┼──────────────┼─────────────────────────────────────────────────────────┤ │ SYSTEM_FONT │ Process │ must be taken from display device default raster font. │ │ │ Default │ (in SBCS OS/2, System Proportional 10 point will be │ │ │ see note 2 │ found as the result) │ ├─────────────────────┼──────────────┴───────┬────────────┬──────────┬─────────────────────────┤ │ SYSTEM_FIXED_FONT │ same as SYSTEM_FONT │ System │ Fixed │ same as SYSTEM_FONT │ │ │ │ MonoSpaced │ │ │ ├─────────────────────┼──────────────────────┴────────────┴──────────┴────────┬────────────────┤ │ DEVICE_DEFAULT_FONT │ same as SYSTEM_FONT │ Outline │ └─────────────────────┴───────────────────────────────────────────────────────┴────────────────┘
Note 1: The fonts of SBCS ANSI CharSet. The process default ANSI codepage should be obtained with GetLocaleInfo Open32 function with LOCALE_IDEFAULTANSICODEPAGE for LOCALE_USER_DEFAULT. Then check if the result is DBCS codepage or not, with GetCP function. If it is one of DBCS codepages, use ANSI_CHARSET as SBCS ANSI CharSet. Otherwise, get process default SBCS ANSI CharSet by translating process default ANSI codepage with TranslateCharsetInfo Open32 function.
Note 2: The fonts of process default ANSI CharSet. The process default ANSI codepage should be obtained with GetLocaleInfo Open32 function with LOCALE_IDEFAULTANSICODEPAGE for LOCALE_USER_DEFAULT. Then get process default ANSI CharSet by translating process default ANSI codepage, with TranslateCharsetInfo Open32 function.
Note 3: The FF_SWISS should be specified if the process default CharSet is for SBCS. The FF_MODERN should be used if the process default CharSet is for DBCS.
Fonts for Graphical User Interface Visual Elements
In the most recent Win32 platforms, the DEFAULT_GUI_FONT stock font object is defined and used for the system Graphical User Interface (GUI) visual elements as default. Also, the system provides the way for users to override the setting of each visual elements in detail with the Control Panel.
To keep the visual element design consistent throughout the system, the applications that have visual elements are guided to check the current setting. The logical fonts used by the visual elements shown below can be obtained with the SystemParametersInfo function.
┌────────────────────┬───────────────────────────────────────────────────────────────────┐ │ Visual Element │ Meaning │ ├────────────────────┴───────────────────────────────────────────────────────────────────┤ │ Option: SPI_GETICONTITLELOGFONT (returns LOGFONT) │ ├────────────────────┬───────────────────────────────────────────────────────────────────┤ │ Icon Title │ Logical font being used by the Icon Title text. │ ├────────────────────┴───────────────────────────────────────────────────────────────────┤ │ Option: SPI_GETNONCLIENTMETRICS (returns NONCLIENTMETRICS structure) │ ├────────────────────┬───────────────────────────────────────────────────────────────────┤ │ lfCaptionFont │ Logical font being used by the Title Bar (Caption) text. │ ├────────────────────┼───────────────────────────────────────────────────────────────────┤ │ lfSmCaptionFont │ Logical font being used by the Tool Palette Title Bar text. │ ├────────────────────┼───────────────────────────────────────────────────────────────────┤ │ fStatusFont │ Logical font being used by the Tooltip (Balloon help) text. │ ├────────────────────┼───────────────────────────────────────────────────────────────────┤ │ fMessageFont │ Logical font being used by the Message and Dialog Box text. │ ├────────────────────┼───────────────────────────────────────────────────────────────────┤ │ fMenuFont │ Logical font being used by the Menu Bar and Selection Item text. │ └────────────────────┴───────────────────────────────────────────────────────────────────┘
Information Sources
The Open32 NLS Extension gets OS/2 GUI font information for each visual element from the sources shown ibelow. In the case the OS2.INI key is not defined, the logical font for DEFAULT_GUI_FONT stock font object is returned.
┌───────────────────┬──────────────────────────────────────────────────────────────┐ │ Visual Element │ OS2.INI Applicaition name and Key name │ ├───────────────────┴──────────────────────────────────────────────────────────────┤ │ Option: SPI_GETICONTITLELOGFONT (returns LOGFONT) │ ├───────────────────┬──────────────────────────────────────────────────────────────┤ │ Icon Title │ PM_SystemFonts : IconText │ ├───────────────────┴──────────────────────────────────────────────────────────────┤ │ Option: SPI_GETNONCLIENTMETRICS (returns NONCLIENTMETRICS structure) │ ├───────────────────┬──────────────────────────────────────────────────────────────┤ │ lfCaptionFont │ PM_SystemFonts : WindowTitles │ ├───────────────────┼──────────────────────────────────────────────────────────────┤ │ lfSmCaptionFont │ PM_SystemFonts : WindowTitles (no equivarent on PM) │ ├───────────────────┼──────────────────────────────────────────────────────────────┤ │ lfStatusFont │ Coach : BUBBLE_FONT │ ├───────────────────┼──────────────────────────────────────────────────────────────┤ │ lfMessageFont │ PM_SystemFonts : WindowText │ ├───────────────────┼──────────────────────────────────────────────────────────────┤ │ lfMenuFont │ PM_SystemFonts : Menus │ └───────────────────┴──────────────────────────────────────────────────────────────┘
Note: For any of the above items, if the corresponding key name does not appear in the OS2.INI file, the following default values are assumed instead.
Icon Tile
Consideration on filling a Logical Font
The OS/2 GUI font information in the OS2.INI files are written in the following formats:
LOGFONT
Value
lfHeight
Note 1: The font mapper must support "EmHeight" matching mode (lfHeight < 0).
Note 2: The fonts of process default ANSI CharSet. The process default ANSI codepage should be obtained with GetLocaleInfo Open32 function with LOCALE_IDEFAULTANSICODEPAGE for LOCALE_USER_DEFAULT. Then get process default ANSI CharSet translating proc ess default ANSI codepage, with TranslateCharsetInfo Open32 function.
Note: Some Open32 APIs that return font information to application may require to build LOGFONT information from OS/2 API supplied FATTRS structure. The mapping is listed bellow.
┌────────────────────┬──────────────────────────────┐ │LOGFONT │FATTRS │ ├────────────────────┼──────────────────────────────┤ │lfHeight │lMaxBaselineExt │ ├────────────────────┼──────────────────────────────┤ │lfWidth │lAveChaeWidth │ ├────────────────────┼──────────────────────────────┤ │lfEscapement │(0) │ ├────────────────────┼──────────────────────────────┤ │lfOrientation │(0) │ ├────────────────────┼──────────────────────────────┤ │lfWeight │(FW_DONTCARE) │ ├────────────────────┼──────────────────────────────┤ │lfItaric │If fsSelection FM_SEL_ITALIC │ │ │bit │ ├────────────────────┼──────────────────────────────┤ │lfUnderline │If fsSelection │ │ │FM_SEL_UNDERSCORE bit │ ├────────────────────┼──────────────────────────────┤ │lfStrikeOut │If fsSelection │ │ │FM_SEL_STRIKEOUT bit │ ├────────────────────┼──────────────────────────────┤ │lfCharSet │Translate usCodePage to │ │ │CharSet using │ │ │TranslateCharsetInfo API │ ├────────────────────┼──────────────────────────────┤ │lfOutPrecision │(0) │ ├────────────────────┼──────────────────────────────┤ │lfClipPrecision │(0) │ ├────────────────────┼──────────────────────────────┤ │lfQuality │(DEFAULT_QUALITY) │ ├────────────────────┼──────────────────────────────┤ │lfPitchAndFamily │If fsType FM_TYPE_FIZED set │ │ │FIXED_PITCH, else │ │ │VARIABLE_PITCH │ ├────────────────────┼──────────────────────────────┤ │lfFaceName │szFacename │ └────────────────────┴──────────────────────────────┘
The Fonts to be Provided by the Base Operating System
The Windows 95 uses the DEFAULT_GUI_FONT to decide the dialog units, that are used to decide item positions on the message and dialog boxes. (In Open32 environment, the SYSTEM_FONT will be used for this purpose - guideline to ISVs needed.).
Because the size of these fonts affects directly to the size and the layout of panels in the applications, these fonts should be chosen carefully by the system. As the example, the following table shows the GUI fonts being provided in OS/2 and Windows 95 in U.S.
┌───────────────────────┬──────────────────────────────┬─────────────────────────────┐ │ System Font │ Warp 4 │ Windows 95 │ ├───────────────────────┼──────────────┬───────────────┼──────────────┬──────────────┤ │ Display Resolution │ 96 dpi │ 120 dpi │ 96 dpi │ 120 dpi │ ├───────────────────────┼──────────────┼───────────────┼──────────────┼──────────────┤ │ Facename │ System │ System │ │ │ │ │ Proportional │ Proportional │ System │ System │ ├───────────────────────┼──────────────┼───────────────┼──────────────┼──────────────┤ │ Point Size │ 10 point │ 10 point │ 10 point │ 10 point │ ├───────────────────────┼──────────────┼───────────────┼──────────────┼──────────────┤ │ AveCharWidth │ 6 pixels │ 8 pixels │ 7 pixels │ 9 pixels │ ├───────────────────────┼──────────────┼───────────────┼──────────────┼──────────────┤ │ BaseLineExt │ 16 pixels │ 20 pixels │ 16 pixels │ 20 pixels │ ├───────────────────────┼──────────────┼───────────────┼──────────────┼──────────────┤ │ Horz Dialog Unit │ 1.5 pixels │ 2.0 pixels │ 1.75 pixels │ 2.25 pixels │ ├───────────────────────┼──────────────┼───────────────┼──────────────┼──────────────┤ │ Vert Dialog Unit │ 2.0 pixels │ 2.5 pixels │ 2.0 pixels │ 2.5 pixels │ └───────────────────────┴──────────────┴───────────────┴──────────────┴──────────────┘
┌────────────────────────┬───────────────────────────────┬───────────────────────────────┐ │ GUI Font │ Warp 4 Workplace Shell │ Windows 95 Shell │ ├────────────────────────┼───────────────┬───────────────┼───────────────┬───────────────┤ │ Display Resolution │ 96 dpi │ 120 dpi │ 96 dpi │ 120 dpi │ ├────────────────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ │ Facename │ Helv │ Helv │ MS Sans Serif │ MS Sans Serif │ ├────────────────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ │ Point Size │ 8 point │ 8 point │ 8 point │ 8 point │ ├────────────────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ │ AveCharWidth │ 5 pixels │ 6 pixels │ 5 pixels │ 7 pixels │ ├────────────────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ │ BaseLineExt │ 13 pixels │ 16 pixels │ 13 pixels │ 16 pixels │ └────────────────────────┴───────────────┴───────────────┴───────────────┴───────────────┘
Note: In OS/2, the display device resolution is decided based on the screen size, by the display device drivers. In Windows 95, the resolution is decided by the GDI, and provided as one of user's choices that can be selected independently from the screen size.