I want to display phonetic alphabet characters alongside general text in a somewhat coherent manner.
My default font is JetBrains Mono, so at the very least, the characters of the phonetic alphabet should be shown in a monospace font with the same pixel width and height. Now JetBrains Mono is intended for coding rather than linguistics, so it does not support the required characters. In general, that is not a problem, and as some other answers suggest, you simply set a fontset font that does support them for those specific characters (all of the following was tested starting Emacs 27.2 as emacs -Q
on a Ubuntu 20.04.3 LTS):
(set-face-attribute 'default nil :font "JetBrains Mono")
(set-fontset-font t 'phonetic (font-spec :family "Liberation Mono"))
You can even select a specific character or character range, e.g.:
(set-face-attribute 'default nil :font "JetBrains Mono")
(set-fontset-font t (cons #x0250 #x02af) (font-spec :family "Liberation Mono"))
However, that does not work for at least some of the characters belonging to the latin
script. For example, the following will not display U+02D0 in Liberation Mono:
(set-face-attribute 'default nil :font "JetBrains Mono")
(set-fontset-font t #x02d0 (font-spec :family "Liberation Mono"))
It will not even display it in JetBrains Mono. The font I find when I use C-u C-x =
on it is the completely unrelated variable-width font Gentium (which again for some reason differs from the fallback font that was used before specifying (set-face-attribute 'default nil :font "JetBrains Mono")
). The problem persists when I use (setq use-default-font-for-symbols nil)
beforehand (so the answer to this question does not apply).
So my question: How do I make Emacs display U+02D0 (and other latin characters not supported by my default font) in a font of my choice?
This question seems related, but differs insofar as Emacs there defaults to the default font. In my case the default font does not even support the characters in question, but still forces the use of some arbitrary font.
Any help is much appreciated.