3

I'm currently playing with Polybar and I'm trying to customize the beautiful themes provided here.

To display nice looking icons on the bar, the above mentioned themes use the Material Icons, by setting:

content =  <- here is the character icon

As you can see above, stackoverflow does not render the character properly.

My problem is two-fold:

  • my text editors don't render the fonts properly either (I use SublimeText 3 and Vim): I see either a square or a blank. Not easy to know without launching Polybar what is the icon that is set.
  • if I want to use a new icon, I don't know how to type it. Should I copy/paste it? From where? Should I use a tool such as CharMap? And then, how do I insert the unicode in the text editor?

Information on the character show above

U+E1BD  - No such unicode character name in database
UTF-8: ee 86 bd  UTF-16BE: e1bd  Decimal: &#57789;
 ()
Uppercase: U+E1BD
Category: Co (Other, Private Use)
Bidi: L (Left-to-Right)

Icon can be found here: https://material.io/tools/icons/?icon=widgets&style=baseline


I am using

  • OS: Antergos -> Arch
  • vim: in a urxvt terminal
  • The character is in the private use area, so you will need a custom font, or other customisation. – ctrl-alt-delor Apr 2 at 9:23
  • Sorry, I don't understand what you mean by private use area. The character can be found line 99 here: github.com/adi1090x/polybar-themes/blob/master/polybar-1/dark/… . I have installed the Material Icons fonts properly (I think) using pacman (I'm on Antergos) and I can find the icon set in /usr/share/fonts. When I display them with display font.ttf, I only see squares – Ben Apr 2 at 9:27
  • private use, means that it is not defined in the standard. We are free to use it how we want. Each font/application may use it as a different character. However it should be OK if your font and application are compatible. – ctrl-alt-delor Apr 2 at 9:31
  • I just rebooted my computer and now sublime text 3 correctly displays the font... Vim still does not however. For me, the problem is solved, but I'll let the question here in case someone has an answer for vim that could help other users. – Ben Apr 2 at 11:39
1

if I want to use a new icon, I don't know how to type it. Should I copy/paste it? From where? Should I use a tool such as CharMap? And then, how do I insert the unicode in the text editor?

The go-to tool to find such font icons is GNOME Character Map (gucharmap for short).

First you will probably need to set gucharmap to group the characters by unicode block, this is done by selecting View -> By Unicode Block:

Font icons are generally located in the "Private Use Area" block which is a block without predefined characters where font can define characters without restrictions, you can select "Private Use Area" on the left (you might need to scroll a bit):

gucharmap private use area

After that you can select the font you want to display characters from in the top left. And finally you should also enable View -> Show only glyphs from this font, this will make sure that you only see characters that this font provides.

Now you should be easily able to browse through all available characters as well as double click them to paste them into the text field at the bottom from where you can copy the characters. Pasting the copied characters into your editor works, even if the editor itself cannot display the character.

my text editors don't render the fonts properly either (I use SublimeText 3 and Vim): I see either a square or a blank. Not easy to know without launching Polybar what is the icon that is set.

For graphical applications like sublime and gvim it is generally possible to define a list of fonts that the application should gather font icons from. You need to add your icon font to that font list.

If you use vim in the terminal, it depends entirely on your terminal to display the character vim plays no role here. As above, terminal emulators generally give you the ability to define a list of fonts. For example with urxvt you can set URxvt.font inside your .Xresources file to a list of fonts that it uses to display text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.