Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are Font Awesome characters not rendered or replaced on my terminal shell?

I'm trying to customize my Ubuntus on both of my computers with i3-wm, polybar and zsh (with oh-my-zsh on it)

I have some issues on one of my computers I haven't on the other one, despite proceeding on the same way and using the same config files for both of them in order to have the same workspace on both of my devices.

On zsh, I'm using the powerlevel10k/powerlevel10k theme I installed on oh-my-zsh to have a more beautiful terminal.

The thing is that the shell is showing nice font-awesome icons like the branch icon when I'm on a git project, or the clock icon next to the displayed time, etc.

This working perfectly on my first computer, but not on the second one. The icons are not displayed, so my terminal is less attractive on it.

I have the same problem with polybar. Some icons are well rendered on one computer, while on the other one, they are not rendered. Sometimes, they're even replaced by strange Asian (I think it's from an Asian language but I'm not sure) characters.

I would like to know why I don't have the same result on both devices and how to fix it on computer 2.

Here is a summary of the used versions:

Ubuntu = 18.04 LTS
i3-wm = 4.18
Polybar = 3.4.0
zsh = 5.4.2
oh-my-zsh = Version unknown
like image 341
Bravo2bad Avatar asked Apr 11 '20 17:04

Bravo2bad


People also ask

Why are Font Awesome icons not showing?

If you installed the Free Font Awesome version but try adding Pro icons to your web pages, they won't show. The solution to this is either you use the alternative free icons or upgrade to a Pro subscription/license.

How do I change the font on my oh my zsh?

Open ITerm2 > Preferences > Profiles > Text > Change Font and set it to something that has β€œfor Powerline”.


1 Answers

You need to install a capable font and configure your terminal to use it. Since you are using powerlevel10k, it's a good idea to use the font that powerlevel10k recommends.

Meslo Nerd Font patched for Powerlevel10k

Gorgeous monospace font designed by Jim Lyles for Bitstream, customized by the same for Apple, further customized by AndrΓ© Berg, and finally patched by yours truly with customized scripts originally developed by Ryan L McIntyre of Nerd Fonts. Contains all glyphs and symbols that Powerlevel10k may need. Battle-tested in dozens of different terminals on all major operating systems.

Automatic font installation

If you are using iTerm2 or Termux, p10k configure can install the recommended font for you. Simply answer Yes when asked whether to install Meslo Nerd Font.

If you are using a different terminal, proceed with manual font installation. πŸ‘‡

Manual font installation

Download these four ttf files:

  • MesloLGS NF Regular.ttf
  • MesloLGS NF Bold.ttf
  • MesloLGS NF Italic.ttf
  • MesloLGS NF Bold Italic.ttf

Double-click on each file and click "Install". This will make MesloLGS NF font available to all applications on your system. Configure your terminal to use this font:

  • iTerm2: Open iTerm2 β†’ Preferences β†’ Profiles β†’ Text and set Font to MesloLGS NF. Alternatively, type p10k configure and answer Yes when asked whether to install Meslo Nerd Font.
  • Apple Terminal Open Terminal β†’ Preferences β†’ Profiles β†’ Text, click Change under Font and select MesloLGS NF family.
  • Hyper: Open Hyper β†’ Edit β†’ Preferences and change the value of fontFamily under module.exports.config to MesloLGS NF.
  • Visual Studio Code: Open File β†’ Preferences β†’ Settings, enter terminal.integrated.fontFamily in the search box and set the value to MesloLGS NF.
  • GNOME Terminal (the default Ubuntu terminal): Open Terminal β†’ Preferences and click on the selected profile under Profiles. Check Custom font under Text Appearance and select MesloLGS NF Regular.
  • Konsole: Open Settings β†’ Edit Current Profile β†’ Appearance, click Select Font and select MesloLGS NF Regular.
  • Tilix: Open Tilix β†’ Preferences and click on the selected profile under Profiles. Check Custom font under Text Appearance and select MesloLGS NF Regular.
  • Windows Console Host (the old thing): Click the icon in the top left corner, then Properties β†’ Font and set Font to MesloLGS NF.
  • Windows Terminal (the new thing): Open Settings (Ctrl+,), search for fontFace and set value to MesloLGS NF for every profile.
  • Termux: Type p10k configure and answer Yes when asked whether to install Meslo Nerd Font.

IMPORTANT: Run p10k configure after changing terminal font. The old ~/.p10k.zsh may work incorrectly with the new font.

Note: The content I've copied here can go out of date. To be safe, check the primary source.

like image 53
Roman Perepelitsa Avatar answered Sep 28 '22 01:09

Roman Perepelitsa