18.2.3 Basics of TrueType Fonts

The TrueType fonts incorporated into Windows 3.1 are much more versatile than the fonts that were available in previous versions of Windows. TrueType fonts can be scaled and rotated; they allow the same fonts to be used on the screen as are used on printers; and they allow documents to be portable between printers, applications, and systems.

The following table lists the 13 core TrueType fonts distributed with Windows version 3.1. (Windows 3.1 may include additional TrueType fonts that supplement this core set.)

Font family Font name Type

Arial Arial Sans serif, variable pitch
  Arial Bold Sans serif, variable pitch
  Arial Italic Sans serif, variable pitch
  Arial Bold Italic Sans serif, variable pitch
Courier New Courier New Serif, fixed pitch
  Courier New Bold Serif, fixed pitch
  Courier New Italic Serif, fixed pitch
  Courier New Bold Italic Serif, fixed pitch
SymbolÒ Symbol N/A
Times New Roman Times New Roman Serif, variable pitch
  Times New Roman Bold Serif, variable pitch
  Times New Roman Italic Serif, variable pitch
  Times New Roman Bold Italic Serif, variable pitch

TrueType font technology offers many benefits to application designers, at little or no cost. It is not necessary to revise an application written for Windows version 3.0 for that application to use TrueType fonts. If you want your application to take full advantage of the greater precision and versatility available with TrueType fonts, however, you can use the following new font functions:

Function Description

CreateScalableFontResource Creates a font resource file for a specified TrueType font.
EnumFontFamilies Retrieves the fonts available on a specified device.
GetCharABCWidths Retrieves the widths of consecutive TrueType characters.
GetFontData Retrieves font-metric data (or the entire font) from a TrueType font file.
GetGlyphOutline Retrieves data describing an individual character in a TrueType font.
GetOutlineTextMetrics Retrieves font metrics for TrueType fonts.
GetRasterizerCaps Determines whether TrueType is installed.

18.2.3.1 Benefits of TrueType

TrueType fonts offer many advantages over previous font technologies for Windows:

What you see is what you get (WYSIWYG).

Applications can scale and rotate TrueType fonts. TrueType fonts are attractive at all sizes. An application can use the same fonts on the screen and the printer.

Printer portability.

TrueType fonts work on different printers. Because detailed font metrics are available, an application can compose documents in a device-independent fashion.

Document portability.

Applications can embed TrueType fonts in documents. TrueType fonts work on different platforms. Applications can use the detailed font metrics to compose documents in a platform-independent fashion.

Simplicity.

The versatility of TrueType fonts reduces the number of required choices and compromises.

TrueType solves two important problems: matching fonts to the printer in use, and presenting high-quality fonts at any size on all devices.

The most obvious benefit of TrueType fonts is that they are scalable. Users can use TrueType to get virtually any point size they like. With TrueType, Windows users no longer need to think about the availability of point sizes on their printer or screen, about running a utility to create raster fonts, or about disk storage for these bitmaps.

TrueType fonts are presented to applications through the same enumeration and selection functions as the raster fonts. As a result, TrueType fonts work with every Windows application. Windows printer drivers have also been modified as required to support the use of TrueType.

18.2.3.2 Compatibility with Earlier Windows Versions

The introduction of TrueType fonts introduces a few issues that are important for applications developed for earlier versions of Windows.

Identifying TrueType Fonts for Users

Before TrueType fonts were introduced, some users had many different fonts to choose between; now, these users have still more choices. (Users can simplify their choices by selecting the “Enable TrueType Fonts” and “Show Only TrueType Fonts in Applications” check boxes in the Fonts dialog box from Control Panel.) Applications can use the standard font dialog box to make it easier for users to manage the fonts on their systems. (For more information about the standard font dialog box, see Section 18.2.6, “Standard Font Dialog Box.”)

Character Widths

TrueType fonts use ABC character spacing, a spacing method that does not rely on the width of a character cell and any overhang (the method used for raster fonts). The extra accuracy of ABC spacing can introduce a problem for applications written prior to Windows version 3.1. Older applications that use character widths instead of ABC widths with TrueType fonts incorrectly calculate the end of the last glyph in the line. This calculation could be off by as much as several pixels. It is also possible that a line could start slightly to the left of the starting point specified by the application. These inaccuracies sometimes lead to problems when the screen is redrawn or when a selection of text is highlighted; pieces of glyphs can be handled incorrectly at either end of a line of text.

Many applications written before TrueType became available use the ExtTextOut function to clip or redraw lines of text that extend beyond the visible margins of the document.This method prevents any extra pieces of glyphs from being left behind because of incorrect character-width calculations.

For more information about ABC character widths, see Section 18.2.4.1, “Line and Character Spacing.”

MS Serif and MS Sans Serif Fonts

In Windows version 3.1, the raster fonts Tms Rmn and Helv have been replaced by identical fonts named MSÒ Serif and MS Sans Serif, respectively. The Tms Rmn and Helv font names are mapped to their replacements in a new section of WIN.INI called [FontSubstitutes]. Whenever an application requests Helv or Tms Rmn, the font mapper checks this section and makes the appropriate substitution. The [FontSubstitutes] section also maps HelveticaÒ to Arial and TimesÒ to Times New Roman.

A user could change the [FontSubstitutes] section to map any font name to any other font name. For example, a user could map Tms Rmn and Helv to the Times New Roman and Arial TrueType fonts. Entries in [FontSubstitutes] do not change the names of fonts, however; a user could not force Arial to appear as Helvetica in font menus.

The EnumFonts and EnumFontFamilies functions use the [FontSubstitutes] section of WIN.INI so that applications written prior to Windows version 3.1 do not fail unexpectedly when enumerating preexisting font names. If an application specifies Helv in a call to EnumFontFamilies, GDI enumerates the available MS Sans Serif fonts. When an application calls either of these functions with a NULL family name, GDI enumerates a representative font from each available family, returning the actual names of the fonts, not the remapped names.

Because most Windows applications display font menus that include only the fonts that can be printed on the current printer, this change in font names does not affect most users. Only users of dot-matrix printers see the new names in font menus and dialog boxes.

Font-Height Metrics Can Depend on Attributes

Because the members of a TrueType font family, such as bold and italic, come from different outlines, in some cases the font-height metrics could be different within a TrueType font family. For raster fonts this is not a problem, because when Windows simulates attributes, these metrics are preserved, and because hand-tuned bitmaps were made with matching heights. For the set of fonts shipped with Windows 3.1, most (but not all) of the height metrics match.