First of all, please look at this screenshot
I have GUI Emacs installed via Homebrew on the left and another one running inside iTerm2 with -nw
option on the right. Both of them are using Droid Sans Mono
font.
But, as you can see, the right one can perfectly handle all unicode characters. I think iTerm2 helps here:
display
says that there is no font availabledisplay
is equal to terminal code #xF0 #x9F #x8D #xBA
How can I achieve the same result in GUI Emacs as I can have in iTerm2?
OK, I finally managed this issue with these lines in my emacs config:
;; set proper language (fixes cyrillic letters in ansi-term)
(setenv "LANG" "ru_RU.UTF-8")
;; default font
(set-face-attribute 'default nil :family "Droid Sans Mono")
;; font for all unicode characters
(set-fontset-font t 'unicode "Symbola" nil 'prepend)
;; override font for cyrillic characters
(set-fontset-font t 'cyrillic "Droid Sans Mono")
The first line can be ignored, as it only for fixing cyrillic letters in ansi-term
.
The steps are:
set-face-attribute
set-fontset-font
Of course, I'll need to set specific range of characters for Symbola font, but it works for me now.
P.S. but I still can't get colored emoji in Emacs as I have in iTerm2