Next: , Previous: Windows Printing, Up: Microsoft Windows

G.10 Specifying Fonts on MS-Windows

Starting with Emacs 23, fonts are specified by their name, size and optional properties. The format for specifying fonts comes from the fontconfig library used in modern Free desktops:


The old XLFD based format is also supported for backwards compatibility.

Emacs 23 and later supports a number of font backends. Currently, the gdi and uniscribe backends are supported on Windows. The gdi font backend is available on all versions of Windows, and supports all fonts that are natively supported by Windows. The uniscribe font backend is available on Windows 2000 and later, and supports TrueType and OpenType fonts. Some languages requiring complex layout can only be properly supported by the Uniscribe backend. By default, both backends are enabled if supported, with uniscribe taking priority over gdi. To override that and use the GDI backend even if Uniscribe is available, invoke Emacs with the -xrm Emacs.fontBackend:gdi command-line argument, or add a Emacs.fontBackend resource with the value gdi in the Registry under either the ‘HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs’ or the ‘HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs’ key (see Resources).

Optional properties common to all font backends on MS-Windows are:

Specifies the weight of the font. Special values light, medium, demibold, bold, and black can be specified without weight= (e.g., Courier New-12:bold). Otherwise, the weight should be a numeric value between 100 and 900, or one of the named weights in font-weight-table. If unspecified, a regular font is assumed.

Specifies whether the font is italic. Special values roman, italic and oblique can be specified without slant= (e.g., Courier New-12:italic). Otherwise, the slant should be a numeric value, or one of the named slants in font-slant-table. On Windows, any slant above 150 is treated as italics, and anything below as roman.
Specifies the font family, but normally this will be specified at the start of the font name.
Specifies the font size in pixels. This can be used instead of the point size specified after the family name.
Specifies additional style information for the font. On MS-Windows, the values mono, sans, serif, script and decorative are recognized. These are most useful as a fallback with the font family left unspecified.

Specifies the character set registry that the font is expected to cover. Most TrueType and OpenType fonts will be Unicode fonts that cover several national character sets, but you can narrow down the selection of fonts to those that support a particular character set by using a specific registry from w32-charset-info-alist here.
Specifies how the font is spaced. The p spacing specifies a proportional font, and m or c specify a monospaced font.
Not used on Windows, but for informational purposes and to prevent problems with code that expects it to be set, is set internally to raster for bitmapped fonts, outline for scalable fonts, or unknown if the type cannot be determined as one of those.

Options specific to GDI fonts:

Specifies a Unicode subrange the font should support.

The following scripts are recognized on Windows: latin, greek, coptic, cyrillic, armenian, hebrew, arabic, syriac, nko, thaana, devanagari, bengali, gurmukhi, gujarati, oriya, tamil, telugu, kannada, malayam, sinhala, thai, lao, tibetan, myanmar, georgian, hangul, ethiopic, cherokee, canadian-aboriginal, ogham, runic, khmer, mongolian, symbol, braille, han, ideographic-description, cjk-misc, kana, bopomofo, kanbun, yi, byzantine-musical-symbol, musical-symbol, and mathematical.

Specifies the antialiasing method. The value none means no antialiasing, standard means use standard antialiasing, subpixel means use subpixel antialiasing (known as Cleartype on Windows), and natural means use subpixel antialiasing with adjusted spacing between letters. If unspecified, the font will use the system default antialiasing.