Sdílet prostřednictvím


Font Association (Part 1) - A Primer

Characters and Glyphs
Characters are the written symbols that we use to communicate ideas (e.g., N, 9, Θ, Π, 語, @). Glyphs are graphical representations of those characters. Code pages are tables of characters and fonts are tables of glyphs.

Unicode is designed to serve as a single code page for all characters. Because Unicode contains such a large number of characters (over 109,000 as of version 6.0), multiple fonts are required to represent its vast number of scripts. In fact, there are often multiple glyphs available for the same character, depending on its intended use.

When all of the glyphs for the characters used in an application’s user interface exist within a single font, only that font needs to be loaded into memory. However, when a character is encountered that doesn’t exist in the currently-loaded font, an application can use font association to load the glyph from one that does. Depending on the UI framework in use, font association is accomplished via font linking, font fallback, end-user defined characters, or composite fonts.

Font Linking
Font linking is a mechanism used by GDI for linking missing glyphs to the currently-selected font. Windows provides system-level font linking via the registry. Client applications can also provide their own, custom font linking. See Windows’ SystemLink registry key for the default list of fonts:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink

Font Fallback
Uniscribe uses font fallback to provide an alternate font for runs of characters not represented in the originally-specified font. Font fallback uses a hard-coded list of standard fonts based on Unicode character ranges.

End-User Defined Characters
End-User Defined Characters, or EUDC, is a method for assigning custom character values to East Asian language code pages. The character ranges vary by code page, and are registered on a per-user basis. An EUDC font can be created for the defined ranges to be referenced by an application. Alternatively, glyphs can be added to Window’s system default EUDC font. EUDC fonts are normally defined for use within a single organization.

Composite Fonts
In the context of WPF and Silverlight, composite fonts refer to XML-based files containing definitions of Unicode character ranges associated with sets of font families. The composite font is self-contained, in that has no dependencies on the Windows system registry. Examples of predefined composite fonts include Global User Interface and Portable User Interface.

As you can see, there are multiple font association methods available, depending on which UI framework is being used. In part II of this series, I’ll touch on common font association issues and their causes.

Comments

  • Anonymous
    July 02, 2011
    Excitedly await your second installment. Meanwhile, when font developers decide to split their fonts across two or more files, they should apportion the glyphs by Unicode plane rather than Unicode category: the ones I have now do this, so you still can't access all the glyphs in the font because the ones on a different plane from most of the respective files become inaccessible! Meanwhile, I'd love to find a way around this.