Next: , Previous: Multilingual fonts, Up: Fonts and text translation

5.4 How do I use bdf fonts with Emacs?

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/gnu/intlfonts as an example put together by Jason Rumney.

Download 16dots.tar.gz 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 (see How can I have Emacs use a font menu like on X?) to select the bdf: 16-dot medium fontset, or you can select it by setting the default font:

         (set-frame-font "fontset-bdf")

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).