mordak / Term48

49 stars 20 forks source link

Powerline symbols? #27

Open mmore500 opened 6 years ago

mmore500 commented 6 years ago

I'm having problems getting Powerline symbols to render properly on my device. As recommended in #17 , I've tried copying a .ttf file with the symbols I want to my device and adjusting the font_path variable of .term48rc. I noticed the font change, but the symbols do not display properly (they show up as empty squares). Here is what I see:

img_20180621_181505

Here are links the two fonts that I have tried:

Any ideas what could be going on here?

Thanks! I love using Term48.

mordak commented 6 years ago

Hmm. Getting the square means that TTF_RenderUNICODE_Shaded() couldn't find the correct glyph in the font file. I assume the font has unicode mappings for those glyphs, and the glyphs are present.

Everything that the shell (or whatever program) sends into the terminal is converted to Unicode with iconv, and the terminal encoding is given with the 'tty_encoding' variable in .term48rc. The default tty encoding is UTF-8. I would guess that the characters being emitted by whatever program is trying to draw the powerline glyphs are not encoded as UTF-8, and the conversion to Unicode is wrong? If you know what locale / character encoding is in use by the program emitting powerline characters, you can set the tty_encoding preference in .term48rc to match, and that might make the conversion to Unicode map into the right characters so the glyphs are found in the font file. Alternately, you could try setting the locale on the source to UTF-8.

I hope this helps. I am not really able to debug myself since I'm not on BB10 anymore, so don't have a device to test with.

mmore500 commented 6 years ago

Thanks for the pointers! I appreciate it. I'll investigate further and let you know if I figure anything out.

vaskas commented 4 years ago

It really sounds like the same symptoms I'm getting in https://github.com/BerryFarm/berrymuch/issues/24. I think it's specific to ncurses apps (vim is one of them).

vaskas commented 4 years ago

I think there is another side of this story too: https://stackoverflow.com/questions/59657628/characters-in-an-ncurses-app-showing-correctly-only-in-tmux

It sounds like there are 2 issues: 1. Term48 doesn't support ACS properly 2. ncurses on bb10 has bugs with double-length characters. @mordak do you have any thoughts? (I know you are not on the blackberry tools anymore)

mordak commented 4 years ago

I would not be surprised if Term48 does not support ACS properly, and given that it works in tmux (which itself handles TERM translation between the application and the parent terminal) I think that's probably the case here.

Term48 doesn't handle double width characters correctly - if it finds a glyph for the unicode code point it will draw it, but the insertion point will only advance by one, so double width characters will have their right half overwritten by the next glyph. I don't know if libncurses on bb10 has issues with double width characters, but term48 definitely does.