Skip to content
This repository has been archived by the owner on Jan 15, 2020. It is now read-only.

Cannot display some special characters #28

Open
gipert opened this issue Oct 19, 2016 · 15 comments
Open

Cannot display some special characters #28

gipert opened this issue Oct 19, 2016 · 15 comments

Comments

@gipert
Copy link

gipert commented Oct 19, 2016

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?

@krypt-n
Copy link
Owner

krypt-n commented Oct 19, 2016

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?

@ghost
Copy link

ghost commented Nov 26, 2016

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.

@Popkultur
Copy link

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.

@krypt-n
Copy link
Owner

krypt-n commented Oct 11, 2017

@Popkultur have you looked at the ucs4 branch? Specifically 91b444a. 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.

@lyze237
Copy link

lyze237 commented Apr 16, 2018

Edit: Seems to be the same issue as in: #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?

@weilbith
Copy link

weilbith commented Jun 26, 2018

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?

@weilbith
Copy link

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?

@krypt-n
Copy link
Owner

krypt-n commented Jun 27, 2018

.ttf fonts should work. Could you share the lemonbar command you are using and the output of fc-match <font name used with -f>?

@weilbith
Copy link

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.
powerstatus10k_terminal

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.
powerstatus10k_bar

Your requested output for fc-match -f "Sauce Code Pro Nerd Font Complete Mono" is:
Saice Code Pro Nerd Font Complete Mono%

@krypt-n
Copy link
Owner

krypt-n commented Jun 28, 2018

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?

@weilbith
Copy link

weilbith commented Jun 28, 2018

Oh, I c. U meant lemonbars argument -f not fc-caches one. 😆

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.

@krypt-n
Copy link
Owner

krypt-n commented Jun 28, 2018

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.

@weilbith
Copy link

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?

@krypt-n
Copy link
Owner

krypt-n commented Jun 28, 2018

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.

@weilbith
Copy link

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 🤓
Awesome! 😀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants