bar
bar copied to clipboard
Cannot display some special characters
For some reason I cannot display characters with hex code point greater than FFFF, instead a "?" glyph (clearly fallback) is printed on the bar, is this possible?
Lemonbar (and this fork) is only able to handle utf-8 characters that are represented by <= 3 bytes if a character needs more bytes, it prints 0xfffd ("replacement character") instead. Could this be the limitation you encountered?
Hmm, I guess I have the same issue.
I wanted to display some characters from FontAwesome, but I just get a "?".
For example, \uf240
doesn't work for me.
it is possible to make some small correction in the code to allow these characters. however, I can not commit since I have not yet learned how to do that. But I made the code change and it works. It is quite logic and simple.
@Popkultur have you looked at the ucs4 branch? Specifically https://github.com/krypt-n/bar/commit/91b444acf57b8d33425fdeac0704647483546778. It replaces the utf8 decoding with a function call to a fontconfig utility method and changes the type of characters to utf32.
Unfortunately this project and lemonbar's original version are quite inactive, but feel free to submit any changes. Caring about source compatibility with lemonboy's version is probably a wasted effort at this point.
Edit: Seems to be the same issue as in: https://github.com/krypt-n/bar/issues/22
I got confused since xfce's character map showed that the font has those symbols in it, lemonbar didn't like that though. So I added dejavu sans
as fallback and now it works.
Hello!
Sorry to add something to this old issue, but I have the same problem.
I've compiled the master and the ucs4 branch, however in both I got the same result when using a font which supports the unicode characters.
echo "%{F#00FF00}Test: ⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⓿ ❶ ❷ ❸ ❹ ❺ ❻ ❼ ❽ ❾ ⓵ ⓶ ⓷ ⓸ ⓹ ⓺ ⓻ ⓼ ⓽" | ./lemonbar -p -f "UbuntuMonoDerivativePowerline Nerd Font" -B "#FF0000" -b
Output: http://0x0.st/sSbU.png
Is there a solution to this?
To hold this issue up: Same problem here. I'm using Nerd Fonts (Source Code Pro for Powerline
) for the whole bar. The Powerfont arrows get shown correct, but any other icon I use are hidden. No weird corrector or so, just nothing.
Any ideas why this happen?
Okay I realized I used the false font, with not the whole set of symbols.
Why can't I use .ttf
fonts? I've my fonts in ~/.fonts
and called xset fp+ $HOME/.fonts
with fc-cache -vf
afterwards. I put in a Sauce Code Pro Nerd Font Complete Mono, recache and set its name to use for the bar. It doesn't get loaded.
Trying some .otf
fonts I've still from "old" days, they work. What's the difference?
.ttf
fonts should work. Could you share the lemonbar command you are using and the output of fc-match <font name used with -f>
?
I break it down to a minimal example. I've take a screenshot from the terminal where I start it, to make sure the special characters are displayed.
And this is the responding result. As you can mazbe see it is not Sauce Code style. Furthermore the first icon is false and the second doesn't appear at all.
Your requested output for fc-match -f "Sauce Code Pro Nerd Font Complete Mono"
is:
Saice Code Pro Nerd Font Complete Mono%
Sorry, I didn't formulate that clearly. The output of fc-match "Sauce Code Pro Nerd Font Complete Mono"
is what I was interested in (without the -f
). But the clock and the calendar both seem to be 4-byte unicode characters and thus run into the limitation described in this issue. Are you using the ucs4 branch?
Oh, I c. U meant lemonbars argument -f
not fc-cache
s one. :laughing:
The output is: DejaVuSans.ttf: "DejaVu Sans" "Book"
.
Sounds weird to me...
Yes, I already tried it with it. In fact the posted output is that with the build of this branch.
The output is: DejaVuSans.ttf: "DejaVu Sans" "Book".
This means that fontconfig can't find a font for the description "Sauce Code Pro Nerd Font Complete Mono" and falls back to DejaVuSans. lemonbar just uses fontconfig so it can't use any font fontconfig can't find.
Make sense to me. I'm really a noob to font packages and just installed it once. To make it short: How can I import the font correctly and how can I list all fonts that are available?
Depends on your distro. I'd recommend reading around in your distro's documentation and the fontconfig manpages. fc-list
prints a list of all font files.
Ha! It works! Thanks for helping me!
The key was, that the font is named differently that the .ttf
file. The fc-list
shows the names after the files, so I just tried it. As I said: noob :nerd_face:
Awesome! :grinning: