Having fun with terminal fonts

Some stuff about fonts in the terminal.

Italic font

I was not aware I could have italic font in the terminal. I have been used to see italic texts with inverted color (for me, bright background and dark foreground).

But yesterday I found that you can try to display italic text in your terminal by typing:

$ echo -e "\e[3mitalic\e[23m"

It worked directly in Allacrity. Yay! Unfortunately, tmux was stil showing me bright background. After reading sone complicated stuff about creating a custom terminal configuration, I just figured out I had my TERM var misconfigured in my zshrc, so I changed it back to screen-256color. And it worked!

Then I tried Vim and discovered that the syntax highlighting was not working anymore. I had to remove set termguicolor option (some old xterm related configuration?).

To show italic text, I also had to add following sets:

set t_ZH=^[[3m
set t_ZR=^[[23m

(Don't type ^[, type Ctrl+v Esc)

BTW follow the link above to have the complete story.

Emojis in alacritty

By default on Linux, it seems that Alacritty shows you monochrome Emojis. It's a bit sad. You have to add a configuration file.

Write this in a file called ~/.config/fontconfig/fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>DejaVu Sans Mono</family>
      <family>Noto Color Emoji</family>
      <family>Noto Emoji</family>
    </prefer>
  </alias>
</fontconfig>

Et voilà

Posted on 2021-02-26 at 22:12

Previous Back Next