[ Combined Document ] | Contents | Previous | Next
Fonts in Emacs are named using the standard X Windows format for fonts.
For an explanation of what each element in a font string means and how Emacs on NT uses it, see Andrew's note.
These font names are the names that can be used as arguments on the command line or in lisp functions. To see the font name corresponding to a font chosen using the font selection dialog, execute the following elisp code in the *scratch* buffer:
(insert (prin1-to-string (w32-select-font))) ; Emacs 20
To see the complete list of fonts that Emacs has access to, execute the following elisp code in the *scratch* buffer:
(insert (prin1-to-string (x-list-fonts "*")))
The font support currently is a little rough around the edges. In particular, italic fonts give Emacs some problems; see below for more info about using italic fonts. Generally it performs as expected, but occasionally you might get unexpected results (e.g., Emacs didn't quite use the font you told it to use). Work is underway to fix these problems, but for now I suggest experimenting if you encounter problems.
Also, X Windows has the luxury of a set of font aliases (such as fixed) that are convenient names for referring to specific fonts. Work is underway to provide an equivalent alias mechanism under Windows so that naming fonts does not have to be as cumbersome as it currently is.
To customize fonts for specific frames, see the section on customizing frames below.
emacs -font "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1"
To set the font of a particular face, use the set-face-font function.
Value Name: Emacs.Font
Value Type: REG_SZ
Since the font strings are rather cumbersome, I would suggest cutting the font string into the kill-ring (which will place it in the clipboard, too) and pasting it (Ctrl-V) into the regedit dialog. (Note that you shouldn't place quotes around the font string in the registry.)
If you have Emacs frames with specific names, you can also specify a font for that frame. For the Value Name of the entry, use the name of the frame instead of Emacs (e.g., RMAIL.Font for your RMAIL frame).
Emacs currently requires that italic versions of fonts have the same width as the normal version of the font. However, most of the default fonts have italic and italic bold versions whose character widths are larger than the normal version (the only default font that appears to have viable italic and bold versions is Courier New). Because of this, Emacs by default disables the use of italic faces.
You can still enable the use of italic faces with Emacs by setting the variable w32-enable-italics to t in your startup file:
(setq w32-enable-italics t) ; This must be done before font settings! (Emacs 20.x) (set-face-font 'italic "-*-Courier New-normal-i-*-*-11-*-*-*-c-*-iso8859-1") (set-face-font 'bold-italic "-*-Courier New-bold-i-*-*-11-*-*-*-c-*-iso8859-1")
Although this works best with Courier New, there is still one minor glitch: the italics versions are one pixel higher than the other versions, so the line spacing is increased by a pixel when italics are enabled. FONT
Under NT, open the "-" menu. Select "Fonts...", and use the dialog to set the window font to the one you want. Be sure to check the "Save Configuration" checkbox so that your font change will be used in future invocations. Click on "OK", and the window will get resized.
Under Windows 95/98, simply use the popup font menu in the upper left-hand corner of the window. Or click on the font icon in the icon toolbar. Or click on the properties icon in the icon toolbar and go to the "Font" tab and choose the font that you want to use.
(Applies to version 20.4 and later)
If you have a Windows font for the script or language, then you should be able to display it using Emacs 20.4. Emacs 20.4 also supports the bdf fonts that were used with the older MULE for Windows version of Emacs and the more recent Meadow versions (as well as the X Windows versions of Emacs). For details on using the bdf fonts with Emacs, see below .
More about using Windows fonts:
There are a number of languages for which Windows fonts are not yet available, or are not in an appropriate format for Emacs to use, so you will not get every language to display. I also had some problem getting Japanese, Chinese, Cantonese and Korean to display all at once, but this was on Windows 95, and I suspect is a limitation of the OS, rather than a bug in Emacs, as those languages look fine when displayed one at a time (there is a note on the Microsoft language packs that only one may be installed at a time, which I suspect is because of this limitation).
Because some languages can only use proportional fonts, limited support has been added for proportional fonts as the non-ASCII font in fontsets. It should be general enough to work with any font, but it is not full proportional support, so the characters may not appear exactly as you expect. You may need to try several fonts to find one that appears reasonably correct if you wish to use Emacs with languages like Thai which use composition and hence use only proportional Windows fonts.
If you are content with the size and style of font that Emacs uses at startup (Courier New 10), you could try using `fontset-standard', which will give you most languages that you have fonts for and Emacs supports. To use `fontset-standard' for all frames, place the following in your startup file:
(setq default-frame-alist (append '((font . "fontset-startup")) default-frame-alist))
or, to change for the current frame only:
To have more control over which fonts are used in a fontset, you need to specify the fontset manually.
If only one character set is needed, the easiest way to do this is to use `create-fontset-from-ascii-font' whereever you define a font.
(setq default-frame-alist (append '((font . (create-fontset-from-ascii-font "-*-Andale Mono-normal-r-*-*-13-*-*-*-c-*-iso8859-2"))) default-frame-alist))
If you require support for a number of languages, you should use `create-fontset-from-fontset-spec'. Note that installing more than one of the East Asian language packs is not supported by Microsoft, and does not work on Windows 95 at least. It is very difficult to get your system stable again after trying, so it is recommended that you only install the one that you will use the most, and use BDF fonts for the other languages:
(create-fontset-from-fontset-spec "-*-Courier New-normal-r-*-*-12-*-*-*-c-*-fontset-most, latin-iso8859-2:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-2, latin-iso8859-3:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-3, latin-iso8859-4:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-4, cyrillic-iso8859-5:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-5, greek-iso8859-7:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-7, latin-iso8859-9:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-9, japanese-jisx0208:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, katakana-jisx0201:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, latin-jisx0201:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, japanese-jisx0208-1978:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, korean-ksc5601:-*-Gulim-normal-r-*-*-12-*-*-*-c-*-ksc5601-*, chinese-gb2312:-*-MS Song-normal-r-*-*-12-*-*-*-c-*-gb2312-*, chinese-big5-1:-*-MingLiU-normal-r-*-*-12-*-*-*-c-*-big5-*, chinese-big5-2:-*-MingLiU-normal-r-*-*-12-*-*-*-c-*-big5-*" t)
If you leave character sets out of the fontset-spec above, a font will be chosen at random (not necessarily matching any of the other fonts in the fontset). The fontset name is used to generate the "default" font, which covers ASCII and iso8859-1.
To get a full list of character-sets use "M-x describe-fontset" to describe `fontset-standard'.
MS Windows fonts The Windows installation CDROM contains fonts for most European languages. If you did not install "Multilanguage Support" when you installed Windows, you can install it from the "Add Programs" Control Panel. East Asian Language (Chinese, Japanese, Korean) support for Microsoft Word and Internet Explorer can also be used by Emacs. These are available from http://www.microsoft.com, or on the installation CDROMs. IE5 also has fonts for Thai, Vietnamese and other languages, although it is not known how well these work with Emacs. Fonts for many other languages are available on the WWW; a good starting point is http://babel.uoregon.edu/yamada/guides.html.
X Windows fonts There is a collection of international fonts for use with X Windows, and a set can be found at ftp.gnu.org. They are distributed in the bdf font file format, a format that can be handled by Emacs starting with version 188.8.131.52. For details on how to use these fonts with Emacs, see the section below on using bdf fonts with Emacs.
Define a fontset ( see above ) listing any font of an appropriate size which works with the third party program for the appropriate character set(s). Change the character set to the character set you want displayed so Emacs knows how to display it. For example:
(create-fontset-from-fontset-spec "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-fontset-asian, korean-ksc5601:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-ksc5601-*, chinese-gb2312:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-gb2312-*, chinese-big5-1:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-big5-*, chinese-big5-2:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-big5-*, japanese-jisx0208:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-jisx0208-sjis, katakana-jisx0201:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-jisx0201-sjis, latin-jisx0201:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-jisx0201-sjis, japanese-jisx0208-1978:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-jisx0208-sjis")
If this doesn't work, you may need to set `w32-enable-unicode-output' to nil.
This is most applicable to East Asian users. Others can probably get their fonts working (with a strange looking name), but it is nice to have the names of fonts displayed correctly.
You need to use the function `set-w32-system-coding-system' before the font is specified. If you are setting the font from your .emacs, you will need to make sure the coding-system of your .emacs supports the character set for the font name. An example (for Traditional Chinese) follows:
;; Top line of .emacs: -*- coding: chinese-big-5; -*- (set-w32-system-coding-system 'chinese-big-5)
For Japanese, you would use japanese-shift-jis; for Simplified Chinese, chinese-iso-8bit; for Korean, korean-iso-8bit.
To use bdf fonts with Emacs, you need to tell Emacs where the fonts are located, create fontsets for them, and then use them. We'll use the 16 dot international fonts from ftp.gnu.org/intlfonts as an example put together by Jason Rumney <firstname.lastname@example.org>
Download the 16dots.tar.gz file and unpack it; I'll assume that they are in "c:\intlfonts". Then set w32-bdf-filename-alist to the list of fonts returned by using w32-find-bdf-fonts to enumerate all of the font files. It is a good idea to set the variable bdf-directory-list at the same time so ps-print knows where to find the fonts:
(setq bdf-directory-list '("c:/intlfonts/Asian" "c:/intlfonts/Chinese" "c:/intlfonts/Chinese-X" "c:/intlfonts/Ethiopic" "c:/intlfonts/European" "c:/intlfonts/Japanese" "c:/intlfonts/Japanese-X" "c:/intlfonts/Korean-X" "c:/intlfonts/Misc/")) (setq w32-bdf-filename-alist (w32-find-bdf-fonts bdf-directory-list))
Then create fontsets for the BDF fonts:
(create-fontset-from-fontset-spec "-*-fixed-medium-r-normal-*-16-*-*-*-c-*-fontset-bdf, japanese-jisx0208:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1983-*, katakana-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*, latin-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*, japanese-jisx0208-1978:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1978-*, thai-tis620:-misc-fixed-medium-r-normal--16-160-72-72-m-80-tis620.2529-1, lao:-misc-fixed-medium-r-normal--16-160-72-72-m-80-MuleLao-1, tibetan-1-column:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-80-MuleTibetan-1, ethiopic:-Admas-Ethiomx16f-Medium-R-Normal--16-150-100-100-M-160-Ethiopic-Unicode, tibetan:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-160-MuleTibetan-0")
Many of the international bdf fonts from gnu.org are type 0, and therefore need to be added to font-encoding-alist:
;; Need to add some fonts to font-encoding-alist since the bdf fonts ;; are type 0 not the default type 1. (setq font-encoding-alist (append '(("MuleTibetan-0" (tibetan . 0)) ("GB2312" (chinese-gb2312 . 0)) ("JISX0208" (japanese-jisx0208 . 0)) ("JISX0212" (japanese-jisx0212 . 0)) ("VISCII" (vietnamese-viscii-lower . 0)) ("KSC5601" (korean-ksc5601 . 0)) ("MuleArabic-0" (arabic-digit . 0)) ("MuleArabic-1" (arabic-1-column . 0)) ("MuleArabic-2" (arabic-2-column . 0))) font-encoding-alist))
You can now use the Emacs font menu (not the popup dialog; see below ) to select the "bdf: 16-dot medium" fontset, or you can select it by setting the default font:
Try loading the file etc/HELLO, and you should be able to see the various international fonts displayed (except for Hindi, which is not included in the 16-dot font distribution).
Place the following in your startup file:
(setq w32-use-w32-font-dialog nil)
If you have set w32-use-w32-font-dialog to nil, you can add fonts to the font menu by changing `w32-fixed-font-alist'. For example:
(setq w32-fixed-font-alist (append w32-fixed-font-alist '(("Monotype.com" ("8" "-*-Monotype.com-normal-r-*-*-11-*-*-*-c-iso8859-1") ("9" "-*-Monotype.com-normal-r-*-*-12-*-*-*-c-iso8859-1") ("10" "-*-Monotype.com-normal-r-*-*-13-*-*-*-c-iso8859-1") ("11" "-*-Monotype.com-normal-r-*-*-15-*-*-*-c-iso8859-1")))))
There are a number of methods by which you can control automatic CR/LF translation in Emacs, a situation that reflects the fact that the default support isn't very robust. For a discussion of this issue, take a look at this collection of email messages on the topic.
The first method is by file extension using the alist file-name-buffer-file-type-alist. This alist contains pairs of regular expressions and booleans that determine whether a file is opened in binary (untranslated) or text (translated) mode. The alist already contains a number of pairs that you can use as examples for creating your own; do a "C-h v" on the variable name to see the help text and the default pairs.
You could add your own pairs to the alist, or change the alist entirely. For example, if you wanted to open every file in binary mode except for batch files, you could add the following to your startup file:
(setq file-name-buffer-file-type-alist '(("\.bat$" . nil) (".*" . t)))
The first pair says anything ending with the .bat extension should be opened in text mode, and the second pair opens everything else that doesn't match the first pair in binary mode.
A second method for controlling translation is with the functions at the end of untranslate.el. These functions enable you to turn on and off translation on a filesystem basis (e.g., open anything on C: in translated mode, and anything on U: in untranslated mode). If you want to use these functions, download and place untranslate.el in your load-path and have it loaded from your startup file. Then you can place calls to add-untranslated-filesystem to selectively access filesystems in binary mode.
A third method for controlling translation is to have Emacs scan files and automatically determine whether they are binary or text by looking at the line breaks in the file (i.e., no line breaks or just linefeeds imply binary, carriage return/linefeed pairs imply text). Chris Weikart <email@example.com> contributed the following code snippet from his .emacs file:
(defun set-buffer-file-eol-type (eol-type) "Set the file end-of-line conversion type of the current buffer to EOL-TYPE. This means that when you save the buffer, line endings will be converted according to EOL-TYPE. EOL-TYPE is one of three symbols: unix (LF) dos (CRLF) mac (CR) This function marks the buffer modified so that the succeeding \\[save-buffer] surely saves the buffer with EOL-TYPE. From a program, if you don't want to mark the buffer modified, use coding-system-change-eol-conversion directly [weikart]." (interactive "SEOL type for visited file (unix, dos, or mac): ") (setq buffer-file-coding-system (coding-system-change-eol-conversion buffer-file-coding-system eol-type)) (set-buffer-modified-p t) (force-mode-line-update)) (global-set-key "\^Cu" (lambda () (interactive) (set-buffer-file-eol-type 'unix))) (global-set-key "\^Cd" (lambda () (interactive) (set-buffer-file-eol-type 'dos))) (global-set-key "\^Cm" (lambda () (interactive) (set-buffer-file-eol-type 'mac))) ;; Make the mode-line display the standard EOL-TYPE symbols (used above)... (setq eol-mnemonic-undecided "(?)" ;; unknown EOL type eol-mnemonic-unix "(unix)" ;; LF eol-mnemonic-dos "(dos)" ;; CRLF eol-mnemonic-mac "(mac)") ;; CR
[ Combined Document ]
| Contents |
Steve Kemp, FAQ Maintainer
Last Modified : Thursday 1 August 2002