You are not logged in.

#1 2019-08-13 12:08:15

gribblygook
Member
Registered: 2018-08-12
Posts: 23

Different fonts in polybar

I'm trying to use Chinese characters in my i3 setup, polybar specifically but it's not working. I've found that to use a different font I need to specify it in my polybar config, e.g.

; font-N = <fontconfig pattern>;<vertical offset>
font-0 = "Tamsyn:pixelsize=12;0"
font-1 = "Roboto:size=11:weight=bold;2"
font-2 = "Noto Sans:size=11;1"

label-active-font = 2

What does the last number here mean in each font-N line? ';0' ';2' and ';1'?

I can find what fonts are installed by

fc-list :lang=zh-cn

which outputs many results in the format
/usr/share/fonts/adobe-source-han-serif-cn/SourceHansSerifCN-Regular.otf: Source Han Serif CN, 思源宋体 CN:style=Regular

How am I supposed to use this in the previous format, everytime I do this my polybar disappears

; font-N = <fontconfig pattern>;<vertical offset>
font-0 = "Source Han Serif CN:size=11;0"

label-active-font = 1

Thanks

Offline

#2 2019-09-24 16:44:04

ZeroCC
Member
From: London UK
Registered: 2018-05-25
Posts: 12

Re: Different fonts in polybar

The last figure in the font declaration refers to vertical alignment - useful for centring the bar output.

I am also currently struggling with font usage in Polybar - I've only been playing with it for the last 24 hours though!

Offline

#3 2019-09-24 19:20:11

seth
Member
Registered: 2012-09-03
Posts: 13,073

Re: Different fonts in polybar

It's just a wild guess, but does "Source Han Serif CN" have proper glyphs in ther ASCII range (latin alphabet)?
Try to define more than one font and ensure eg. "Source Sans Pro" is (installed and) among them to complete the code pages.

Offline

#4 2019-09-26 08:06:00

patrickziegler
Member
From: ::1
Registered: 2018-11-02
Posts: 16
Website

Re: Different fonts in polybar

Does your polybar appear entirely or is it just blank. It might use useful to look at the output polybar produces when it is run from a terminal, errors and warnings will appear there.

seth is right, you will need to define multiple fonts, especially one that provides regular ascii characters if you want them to also appear on the bar.

Please also read Debugging Font Issues

Offline

Board footer

Powered by FluxBB