Best Unicode Fonts for Emacs

Perm url with updates: http://xahlee.org/emacs/emacs_unicode_fonts.html

Best Unicode Fonts for Emacs

Xah Lee, 2010-04-05

This page shows you some of the best Unicode fonts for emacs.

Today, Unicode is getting very popular and is a standard in lots of computer languages and web standards ( XML, Java, C#, Python 3). (see for example: Unicode Popularity On Web) Even if English is your only language, Unicode provide many useful symbols. Here's some example of popular Unicode chars: “ ” ← → ↑ ↓ ⇒ £ € © ® ™ — … ¶ † ● α β ° π ⊕ ⊗ « » 『 』 ✓ ▶ ★ ◇ ♠ ♣ ♥ ♦ ♪ ☺ . Open this file in emacs and see how well your setup does: unicode_chars.txt.

Best Proportional Unicode Font for Windows

If you are on Windows, get Arial Unicode MS.

It comes with Microsoft Windows Office. If you don't have it, you can download the trial version just to get this font then uninstall Office. It supports all Unicode chars, and is the best quality Unicode font by far.

emacs Arial Unicode MS font

Arial Unicode MS in emacs displaying Unicode chars.

Best Monospaced Unicode Fonts for Windows

GNU Unifont is probably the best one out there. This is the standard font in most linuxes.

You can download here: unifont-5.1.20080907.ttf.zip. Its home page is here: http://unifoundry.com/unifont.html.

Bitmapped Design in Scalable Format

This font has been converted into a scalable format (TrueType) in 2008 by Paul Hardy. However, the font design itself is still based on tiny squares. That means, if you make the font very large, you'll see a lot little squares. Still, this font is quite practical for normal everyday coding and contains practically all Unicode chars.

One advantage of this font in emacs is that when emacs encounter a char that's not in current font, it'll fall back to this one. So, at least all your Unicode will show, may it be math symbols, Chinese, or ancient language.

emacs GNU Unifont

GNU Unifont when enlarged.

Fixedsys and Code2000

There are 2 other Unicode fonts i've tried. Fixedsys is a mono spaced font, and Code2000 is proportional. Both are free. Code2000 practically contains ALL Unicode chars. Fixedsys misses some rare unicode chars. One advantage over GNU Unifont is that these are real scalable fonts. So, when enlarged, they don't show zigzags of squares.

What About Mac?

Apple has very good font technology, including font substitution technology, to the degree that you don't need to worry about it. If you are using Carbon Emacs or Aquamacs Emacs, both will display any Unicode out of the box, and you can easily choose the many beautiful fonts from Mac OS X.

Quickly Switching Fonts

When coding in Python or viewing directories, mono-spaced font is necessary. However, proportional font works great in coding too. Try it. You may be surprised.

Proportional font is easier to read, and shows more characters per line. I got used to using proportional fonts for html, xml, perl, lisp...

One problem is that it is difficult to switch font in emacs. Here's a elisp code that cycle fonts.

(defun cycle-font ()
  "Change font in current frame.
When called repeatedly, cycle thru a predefined set of fonts.
Warning: tested on Windows Vista only."
  (interactive)

  (let (fontList fontToUse currentState)
    ;; states starts from 1.
    (setq fontList (list "Courier New-10" "Arial Unicode MS-10"
                         "Unifont-12" "FixedsysTTF-11" "Code2000-11" "Lucida Sans Unicode-10"))
    (setq currentState (if (get this-command 'state) (get this-command 'state) 1))
    (setq fontToUse (nth (1- currentState) fontList))

    (set-frame-parameter nil 'font fontToUse)
    (message "Current font is: %s" fontToUse)
    (put this-command 'state (1+ (% currentState (length fontList))))
    (redraw-frame (selected-frame))
    )
  )

Modify the line on fontList so that you can use this function to cycle among the fonts of your choice.

You can set a shortcut key like this:

(global-set-key (kbd "<C-f9>") 'cycle-font) ; Ctrl+F9

(See: Defining Your Own Keyboard Shortcuts)

Also, if you are not using emacs 23, you probably should upgrade, because emacs 23 switched its internal char encoding to Unicode (utf-8), and has a new font engine that supports operating system's fonts and anti-aliasing. (see: New Features in Emacs 23)

What font are you using? Any suggestions for addition? Please let me know!

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs