Understanding Font configuration

After installing starship prompt I noticed the emoji are only showing boxes in my Konsole, I then change the KDE font settings for ‘Fixed width’ from Hack to Noto Color Emoji, it then works but all numbers in terminal are all changed to emoji… Finally I manage to make it works perfectly with creating a file like this:

~ 
❯ cat .config/fontconfig/fonts.conf 
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
 <alias>
   <family>sans-serif</family>
   <prefer>
     <family>Noto Sans</family>
     <family>Noto Color Emoji</family>
     <family>DejaVu Sans</family>
   </prefer> 
 </alias>

 <alias>
   <family>serif</family>
   <prefer>
     <family>Noto Serif</family>
     <family>Noto Color Emoji</family>
     <family>DejaVu Serif</family>
   </prefer>
 </alias>

 <alias>
  <family>monospace</family>
  <prefer>
    <family>Noto Color Emoji</family>
   </prefer>
 </alias>
</fontconfig>

(copied from internet…)
After read the Arch linux Font configuration page, I noticed that this file should replace all monospace font to Noto Color Emoji but actually the numbers works fine and only the boxes (missing emoji) are using Noto Color Emoji (instead of making the change from settings), why?

Starship is suppost to be used with nerd-fonts. install ttf-iosevka-nerd package and set the font to Iosevka Nerd Font Mono in your terminal emulator font settings.

also worth a read " https://starship.rs/guide/ " all info you need

I did this before, it does not work for me, the emoji are still boxes.
The only way I get it to work is by the following

<alias>
  <family>monospace</family>
   <prefer>
    <family>Noto Color Emoji</family>
   </prefer>
 </alias>

with it set, then no matter how I set the font, it works perfectly

btw, the font I am using, hack, is a Nerd font.
This is not starship related problem, it is just an example. My apologise for confusing. Maybe a better way to ask is that:
the entries in .config/fontconfig/fonts.conf does not change the whole font, but only change those missing font, is this the normal behavior?

Do you have one of these packages installed?
image

1 Like

I just installed it, but no luck, the emoji still won’t show without that conf file