After I read the note on this question on the Kitty terminal FAQ I started paying attention to editors, ide's and terminals that support fallback fonts.
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. Typically, a fallback font will contain symbols representative of the various types of Unicode characters. 1
But not all editors, ide's or terminals support them. Like the terminal emulator alacritty for example.
But Linux's fontconfig package is very complete and it allows you to create font families, which I understood are virtual fonts you create in order to have the fallback mechanism manually set up.
So let's cut to the chase! First create a file in ~/.config/fontconfig
called fonts.conf
with the following contents:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="font">
<edit name="autohint" mode="assign">
<bool>true</bool>
</edit>
</match>
<alias>
<family>my-chosen-font-family</family>
<prefer>
<family>JetBrains Mono</family>
<family>Symbols Nerd Font</family>
<family>Noto Color Emoji</family>
</prefer>
</alias>
</fontconfig>
The <match>
tag asks for auto-hinting in order to have better looking fonts.
The <alias>
tag contains the name of your virtual font my-chosen-font-family
and the set of fonts that belong to it. In my case I have an unpatched (original) font, the symbols nerd font and the emoji one.
Now all you have to do is configure your apps to use it. In alacritty it would be:
font:
normal:
family: my-chosen-font-family
style: Regular
bold:
family: my-chosen-font-family
style: Bold
italic:
family: my-chosen-font-family
style: Italic
bold_italic:
family: my-chosen-font-family
style: Bold Italic
Enjoy!
Top comments (0)