I have just installed Emacs 24 from source and would like to install a primary font as well as a fallback font, when the primary font does not include the international glyphs that I need. Under Linux this is done by most environments through fontconfig, but trying to set the font by
(set-default-font "Monospace 11")
doesn't work, instead of the fontconfig Monospace collection, it appears that I get "Sans".
To get a monospace font I need to do something like:
(set-default-font "Dejavu Sans Mono 11")
but unfortunately it does not contain the glyphs that I want. So my question is if emacs provides a "fallback" mechanism that it uses whenever the primary font does not cona
Go to Options -> Set Default Font... . After you choose a font, don't forget to press Options -> Save Options —otherwise your new font will not be saved after you close Emacs.
A fallback font is a reserve typeface containing symbols for as many Unicode characters as possible. When a display system encounters a character that is not part of the repertoire of any of the other available fonts, a symbol from a fallback font is used instead.
Commonly Used Fallback Fonts This means that you should add a list of similar "backup fonts" in the font-family property. If the first font does not work, the browser will try the next one, and the next one, and so on. Always end the list with a generic font family name.
By default, Emacs displays text on graphical displays using a 10-point monospace font, and the font size can be changed interactively (see Text Scale).
Gilles pointed me to the solution which is to use fontsets. I learned that fontsets are flexible enough so that you can use different fonts for different unicode ranges. Thus to use Miriam Mono CLM for Hebrew, you can enter the following configuration option:
(set-fontset-font "fontset-default" '(#x5d0 . #x5ff) "Miriam Mono CLM:bold")
Try
(set-fontset-font t nil (font-spec :size 20 :name "Unifont"))
or
(set-fontset-font t nil (font-spec :size 20 :name "Symbola"))
This will use the named font (and size) for all glyphs with missing definitions. You need to install the font, which can be found on the net.
Alternatively, install the unicode-fonts package from MELPA.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With