You are not logged in.

#1 2019-11-15 08:14:50

hoWlExat
Member
Registered: 2019-11-15
Posts: 35

[SOLVED] Enable powerline font for bullet train zsh theme

I'm trying to get the bullet train zsh theme to work on my freshly installed Arch build. It requires powerline fonts to display some special chars in the terminal. I have tried using many packages to get the fonts, including:

powerline
powerline-fonts
powerline-common
ttf-ancient-fonts (AUR)
oh-my-zsh-git (AUR)
bullet-train-oh-my-zsh-theme-git (AUR)

However, I've reverted back and removed all of those packages via pacman. I've done a manual install of oh-my-zsh and the bullet train zsh theme, and I've downloaded and installed the powerline fonts from https://github.com/powerline/fonts by running their `install.sh` script. Those font files now live in `~/.local/share/fonts` and are all either .ttf or .otf files. I've updated my fonts cache with:

fc-cache -vf ~/.local/share/fonts

The output of `locale -a` is:

C
en_US.utf8
POSIX

My bullet train zsh theme is appearing in my zsh, but the special characters that should be provided by powerline fonts just show up as colored dots. It looks something like, but not exactly like this:

https://binhong.me/blog/assets/img/utImage2.png

I've tried using things like `setfont <ttf-or-otf-file-name>`, but it returns `Cannot open font file <ttf-or-otf-file-name>`. Long story short, I don't know how to enable the powerline fonts that I have in `~/.local/share/fonts`, and I've been hacking at this for days.

Does anyone have an idea of how to enable these powerline fonts to be picked up and used by the bullet train zsh theme, or know if I'm not on the right track? Thanks smile


moderator edit -- replaced oversized image with link.
Pasting pictures and code

Last edited by hoWlExat (2019-11-16 06:00:26)

Offline

#2 2019-11-16 06:00:02

hoWlExat
Member
Registered: 2019-11-15
Posts: 35

Re: [SOLVED] Enable powerline font for bullet train zsh theme

This was solved when I discovered that the Linux terminal can only use (to my knowledge) PSF fonts, a.k.a. files that end in `.psf.gz`. Having followed the instructions to set up the bullet train zsh theme (at that link), I only needed to get a compatible powerline font installed in the Linux terminal for things to render correctly. You can do this as follows:

If you clone the power fonts repo and go into the `Terminus/PSF` folder, there are multiple powerline fonts that end in `psf.gz`. These are the only `psf.gz` files in the power fonts repo as of 2019-11-15. You can do the following to get the fonts installed and active:

sudo mv <powerline-fonts-repo>/Terminus/PSF/*.psf.gz /usr/share/kbd/consolefonts/
setfont ter-powerline-v32n  # or another one of the font names (n-suffix = normal weight, b-suffix = bold weight)

Note that this only gets some of the things visualizing, correctly. I think the Terminus font is missing some things that say, Source Code Pro, has. But for the Linux terminal, Terminus is the only PSF powerline font I've found.

If you want to set the font at startup, you will want to make or modify the `/etc/vconsole.conf` file to include this line:

FONT=ter-powerline-v32n  # or another one of the font names

Separately, if you want to have a powerline font take effect in XTerm, say if you have a desktop environment, then you will need to clone the power fonts repo and run:

<powerline-repo-dir>/.install.sh

That will install the fonts in `~/.local/share/fonts` and update your fonts cache for you. Then, you just need to add the following line to `~/.Xresources`:

XTerm*faceName: Source Code Pro for Powerline  # or the name of any other powerline font you just installed in ~/.local/share/fonts

Make sure you have followed the install instructions for the bullet train zsh theme, and have it in the correct location.

Finally, run `xrdb ~/.Xresources` and restart XTerm. Everything should be working, now.

Last edited by hoWlExat (2019-11-23 09:05:09)

Offline

Board footer

Powered by FluxBB