Fonts and text metrics
This topic discusses the outline fonts provided by Windows, font metric values that may change between versions of Windows, and guidance for how to use font metrics in your desktop apps.
- For info specific to font metrics in DirectWrite, see Text Metrics.
- For details on managing text in apps using GDI, see the topics in Fonts and Text.
For more detailed information on font usage and type specifications, see the Microsoft typography site.
The outline fonts supplied with Windows are delivered as OpenType fonts with TrueType outlines (Windows also supports OpenType fonts in the CFF format). For lists of all fonts supplied by Windows, see Microsoft typography: fonts by product or family. All Windows outline fonts conform to the latest version of the OpenType specification.
For a list of all the current and legacy UI fonts, see Locked font metrics below.
To assure backwards compatibility, fonts are rarely removed from Windows. However, fonts are often modified. Modifications may include adding characters, redrawing existing characters, modifying hints, or adding or modifying support for advanced OpenType features and complex script shaping.
Note that some values associated with UI fonts and default fonts used in Microsoft apps are locked. UI fonts are used to render UI elements like captions, dialogs, and menus. Very few changes are made to these fonts, given their high visibility and frequent use. However, because the reported values associated with these fonts are locked, there may be discrepancies between reported and actual font values.
The following reported values are locked for UI and default fonts, and may be inaccurately reported:
- These values from the font’s OS/2 table:
- The unitsPerEm value set in the font’s header
- Values from the Vertical Device metrics table (VDMX)
- The advance widths for individual glyphs
Here's a list of the UI fonts shipped with Windows 8.1 (affected by locked values):
|Script name||UI font|
|Bopomofo||Microsoft JhengHei UI|
|Braille||Segoe UI Symbol|
|Canadian Aboriginal Syllabics||Gadugi|
|Coptic||Segoe UI Symbol|
|Chinese (Simplified)||Microsoft YaHei UI|
|Chinese (Traditional)||Microsoft JhengHei UI|
|Deseret||Segoe UI Symbol|
|Glagolitic||Segoe UI Symbol|
|Gothic||Segoe UI Symbol|
|Old Italic||Segoe UI Symbol|
|Ogham||Segoe UI Symbol|
|Ol Chiki||Nirmala UI|
|Old Turkic||Segoe UI Symbol|
|Runic||Segoe UI Symbol|
|Sora Sompeng||Nirmala UI|
|Tai Le||Microsoft Tai Le|
|New Tai Lue||Microsoft New Tai Lue|
|Yi||Microsoft Yi Baiti|
Here's a list of the legacy UI fonts which are also affected by locked values:
|Script name (legacy)||UI font (legacy)|
|Canadian Aboriginal Syllabics||Euphemia|
|Chinese (Simplified)||Microsoft YaHei and SimSun|
|Chinese (Traditional)||MingLiU and Microsoft JhengHei|
|Japanese||Meiryo and MS Gothic UI|
|Middle Eastern languages||Tahoma|
|Tamil||Latha and Vijaya|
|Thai||Leelawadee and Tahoma|
These fonts are used as defaults in Microsoft apps and are also affected by locked values:
- Courier New
- MS Mincho
- Times New Roman
Other than the locked metrics listed above, font values are accurately reported. If a font is changed in a new version of Windows, dynamic font values will differ between the new and old. For example, when a glyph is added to a font, values in the font’s header may change. Clipping could result if these values (which include xMin, xMax, yMin, and yMax, and report the minimum and maximum bounding box for glyphs in the font) were locked and didn't report true values.
- Compute screen metrics and font metrics (e.g., average width) when an app is launched, and use these values to lay out your app. This will provide consistently accurate rendering, and your layout will respond to changes in fonts or accommodate font fallback. For an overview of font fallback and font linking, see Globalization Step by Step: Fonts. See Using Font Fallback for Uniscribe-specific info.
- To compute a base metric, render representative text for your intended language/script.
- For controls that just contain a single line of unwrapped text, lay them out to fit the full width of the untrimmed text.
- For controls with multiple lines, get the total length, divide by the character length, and you’ve got a solid width to work with. Note that this is trickier for complex scripts where a single ‘character’ to the reader may be multiple code points.
- Use sTypoAscender, sTypoDescender, and unitsPerEm (from the OS/2 table) to calculate vertical spacing. sTypoAscender is used to determine the optimum offset from the top of a text frame to the first baseline and sTypoDescender determines the optimum offset from the bottom of a text frame to the last baseline.
- If you’re using DirectWrite, create a layout using IDWriteTextLayout. IDWriteTextLayout provides ascender + descender + lineGap in natural layout. You can access these specific values with DWRITE_FONT_METRICS. For info on this interface, see Text Formatting and Layout.
- If you’re using GDI, render off screen, then inspect the layout (for example, the line length or characters per line) and recalculate the final layout parameters used in actual rendering.
- Don’t build layouts statically based on particular values for particular versions of fonts. Actual values may change from release to release.
- OS/2 table
- Vertical Device metrics table (VDMX)
- Microsoft typography: fonts by product or family
- Text Metrics (DirectWrite)
- Fonts and Text (GDI)
- Microsoft Typography