Zsh icons broke in urxvt

manjarooh-my-zshrxvtzsh

so I am currently using manjaro linux and I am using urxvt as my terminal which I love so before all this starts switching the terminal is not an option, sorry if I am being rude.

I installed zsh to it as my default shell and added the theme robbyrussell throught oh-my-zsh. At first it was all fine and everything was working but after an update my icons broke. Particulary(if you are fimiliar with the theme) the arrow icon broke and same with all the icons in all the other themes.

This problem occurrs only with urxvt because when I try with some other terminal such as sterminal the theme works.

Some screenshots you can see here
This is how it's supposed to look(screenshoots taken from sterminal)

And this is how it looks(screenshoots taken from rxvt)

I have been asking for help in reddit, github repos such as oh-my-zsh and robbyrussell officiall repo but no one seemed to help me, so I really am hoping you guys will give me a help.

Here are some information about my os and terminal:

URXVT Version 9.22
Operating System : Manjaro i3 4.12.24-1
No Desktop Envoirment
i3wm as window manager

I am using default oh-my-zsh configurations for my zshrc file and default Xreources from manjaro i3 which you can find here. If you need further information just tell me. Any help would be greatly appreciated!

Best Answer

First of all, there is a significant difference between the terminals types rxvt and unicode-rxvt (often abbreviated to urxvt). You have indicated that the terminal you are using is "URXVT Version 9.22", so to avoid confusion, please use the correct name which is not rxvt but urxvt.

As Mikel has pointed out, the Xresources file is telling urxvt to use the 9x15 font which is (a) the old style X11 server provided font method and (b) a limited capability bitmap font.

The oh-my-zsh Github README file explains

many themes require installing the Powerline Fonts in order to render properly

So in order to show the correct arrow shape you need to have the terminal using the appropriate font. Perhaps your update which broke the feature was an update which reset the font usage by urxvt?

As you state that sterminal displays the prompt correctly, check which font that is using, then change the .Xresources in your ${HOME} directory to use that font after verifying that it works with the manual test urxvt -font "font_name". (For the newer method of Xft supplied fonts, font_name is preceeded by "xft:" and followed by ":size=12" for font size).

Having checked in my urxvt, it seems quite a number of well known truetype and opentype monospace fonts do not provide the "right arrow" glyph and just show an empty box. However one readily available standard font that does work (and should be installed on your system) is Deja Vu Sans Mono.

So try firing up a urxvt with

urxvt -font "xft:Deja Vu Sans Mono:size=12" &

and see if your prompt is correctly displayed.

Take a look at https://bbs.archlinux.org/viewtopic.php?id=173477 for discussion on modifying font resource specification for urxvt in an Xresources/Xdefaults file.

PS Do not forget that you can use multiple urxvt terminals more efficiently if you first start the urxvtd daemon and then fire up terminals with urxvtc.

ADDENDUM

Thanks for confirming that you are using urxvt and you have DejaVu Sans Mono installed.

Confirm that there is no font substitution happening with the command entered in terminal at the prompt

   fc-match  "DejaVu Sans Mono"

producing the output

   DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

The actual font file location and styles available for the font can be verified with

    fc-list | grep --color 'DejaVu Sans Mono'

Now assuming that is all okay, you need to check by firing up a urxvt from the command line of a terminal (sorry for not making that absolutely clear above and I had space between Deja and Vu which might have caused a problem)

    urxvt -font "xft:DejaVu Sans Mono:size=12" &   

that you can cut'n'paste the right-arrow character (from here) "➜" into that urxvt and that it displays correctly which I have checked does work.

I can also confirm that putting the following into an Xresources file

 URxvt.font:                     xft:DejaVu Sans Mono:autohint=true:size=12
 URxvt.boldFont:                 xft:DejaVu Sans Mono:autohint=true:bold:size=12
 URxvt.italicFont:               xft:DejaVu Sans Mono:autohint=true:italic:size=12
 URxvt.boldItalicFont:           xft:DejaVu Sans Mono:autohint=true:bold:italic:size=12

and loading into the Xorg server resource database with xrdb -merge Xresource_file_name to be 100% certain those values will be used and then firing up a terminal with just urxvt at the command line results in a terminal in which the font correctly shows the right arrow character. (you should also notice that characteristic of this font, the l characters are curly and that there is a dot in the center of the zero characters).

The font I normally use in urxvt "Luxi Mono" (easier to read, easy on the eyes IMHO) does not display the right arrow correctly even though the "font-manager" program reveals that "Luxi Mono" does have the glyph. Similarly xterm is also broken but a test in lxterminal, mate-terminal, and xfce4-terminal (checked in preferences that font is set to Luxi Mono) all display the right-arrow correctly. So it does appear that something is broken for some fonts in urxvt and xterm (which if I understand correctly share some code origins) just as the others which work similarly share some common code viz libvte.

Related Question