Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emojis crash st (simple terminal) #119

Closed
kiprasmel opened this issue Mar 23, 2019 · 18 comments
Closed

emojis crash st (simple terminal) #119

kiprasmel opened this issue Mar 23, 2019 · 18 comments

Comments

@kiprasmel
Copy link
Contributor

kiprasmel commented Mar 23, 2019

Edit:

Previously I thought that the ttf-symbola font was missing from larbs & that installing it would fix the st crashes when encountering emojis.
It turned out to not be the case, and we're now trying to find a fix / work-around to avoid st from crashing while having colorful emojis in other programs.

Feedback & further testing / investigations are very welcome.


Hello,

TL;DR:
I'd like to suggest adding ttf-symbolas installation to larbs by default.


I've had numerous issues with some emojis not being showable (such as st crashing when a file is opened that contains certain emojis) and just recently found this issue LukeSmithxyz/voidrice#232 from voidrice - which actually finally fixed it for me.

The steps I took were:

Install ttf-symbola from AUR @ https://aur.archlinux.org/packages/ttf-symbola/
(for me it failed when using yay or git, instead I used wget (or just regular download),
then cd /path/to/downloaded/ttf-symbola, tar -xvf ttf-symbola, cd ttf-symbola, makepkg -si, sudo pacman -U generated-package-name)

I suggest this so that other people don't get confused:)

Note - there might be more things that are necessary to completely fix the emoji support such as other fonts (ttf-emojione-color; noto-fonts etc) - they'd probably be useful too!

@LukeSmithxyz
Copy link
Owner

ttf-symbola and ttf-emojione are already installed by the LARBS script by default since 8f21ec5 (December 16, 2018). noto-fonts is also installed as it is pulled as the first valid font dependency.

Since as you say you couldn't install symbola via an AUR helper, this is likely a problem on your end involving your keyrings, permissions or something in your Arch install process. I've just now rebuilt all these packages via the AUR and they work fine.

@kiprasmel
Copy link
Contributor Author

Great! Yeah, it was probably me, although I just followed your installation videos. Anyways, glad it's fine, have a nice day Luke:)

@kiprasmel
Copy link
Contributor Author

kiprasmel commented Mar 25, 2019

Welp - Is there are way to cleanly set up fonts & emojis just like you have in your videos, @LukeSmithxyz?


Okay, shoes. I'm kinda lost with emojis rn. If I have ttf-symbola installed, they are available, but they are only black and white. If I uninstall ttf-symbola, some become colorful, and some become unavailable (both scenarios are bad).

I've installed arch based on your videos and then used larbs on a clean install to configure everything about a few weeks ago.

I've also tried

And failed at https://github.com/googlei18n/noto-emoji/ (the building process doesn't seem to work for me) (but these emojis look great and I'm pretty sure you might be using them so if you could help with the build process it'd be great)

It's weird but when I copy an emoji from dmenu (using dmenuunicode) and use notify-send ((some_emoji)), the notification shows the emoji correctly just like I want, but st, nvim, chrome, vscode and other apps don't 😢

Dmenu:

@LukeSmithxyz
Copy link
Owner

LukeSmithxyz commented Mar 25, 2019 via email

@kiprasmel
Copy link
Contributor Author

Strange, I do recall having colorful emojis in st and vim, also in vscode, but not anymore :( (I was installing some fonts like ttf-symbola and they're no longer colorful:s )

I've now installed the same packages as you just mentioned. Thank you @LukeSmithxyz. If I find a way to have colorful emojis in the terminal I'll for sure let ya know!

Here's the output of my stuff just in case:

pacman -Qe | grep "font\|ttf"
noto-fonts-emoji 20180810-2
ttf-emojione 4.5-1
ttf-inconsolata 1:2.0.0.1-3
ttf-linux-libertine 5.3.0-4
ttf-symbola 12.00-1

$HOME/.Xdefaults:

*.font:	Liberation Mono:pixelsize=22:antialias=true:autohint=true;

$HOME/.config/fontconfig/fonts.conf (copied from voidrice):

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>

 <alias>
    <family>serif</family>
    <prefer><family>Linux Libertine</family></prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer><family>Linux Biolinum</family></prefer>
  </alias>
  <alias>
    <family>sans</family>
    <prefer><family>Linux Biolinum</family></prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer><family>Inconsolata</family></prefer>
  </alias>

</fontconfig>

@kiprasmel
Copy link
Contributor Author

kiprasmel commented Mar 26, 2019

Update

TL;DR:

I symlinked 75-emojione.conf to a different directory (suggested by the maintainer of ttf-emojione) and now I have colorful emojis inside vscode and it's built-in terminal (also emojis became better at chrome, firefox etc), but I no longer have like half of emojis available (dmenu doesn't even show them (but copy-pasting works lol)) and st / [n]vim crash when I paste an unavailable emoji / open a file with unavailable emojis...

Wondering if there's a way to

  • know which font vscode is using
    • is there a possibility to use that font with st
  • or is there anything else that would allow to have the same emojis in st / dmenu etc. whom I have in vscode...
  • or at least if I could have the same great emojis in vscode but also have support for st / dmenu etc.

So I just came across this issue kovidgoyal/kitty#73

(specifically kovidgoyal/kitty#73 (comment) and kovidgoyal/kitty#73 (comment))

I suppose this is the maintainer of AURs ttf-emojione.

He's been asked how to enable support for emojis for the kitty terminal using ttf-emojione.

He says to install the package AND to create a symlink for /etc/fonts/conf.d/75-emojione.conf to point to ../conf.avail/75-emojione.conf (which is /etc/fonts/conf.avail/75-emojione.conf

(the command is sudo ln -sf ../conf.avail/75-emojione.conf /etc/fonts/conf.d/75-emojione.conf)

Also, the same is suggested inside the AURs ttf-emojione comments!


After this command I once again have colorful emojis in vscode!!


But, I should mention that now I don't have half of the emojis available, st crashes when I paste an unavailable emoji (so does [n]vim). What do I do now lol?

Dmenu (bad):

Although I CAN copy from dmenu and later paste into, say, chrome or firefox or vscode, it's still bad (st breaking is the worst part)

I'm still trying to mess around with the fonts I have to potentially have colorful support in the st terminal (my ego won't let me give up on issue this after wasting 2+ days on it lmao)


I tried out the kitty terminal and emojis work there - I just have to copy the emoji into primary and then paste it in - it works (if pasting from clipboard, it just pastes U+XXXXX, so I had to re-copy from another program).

Also, echo -e "\U0001F607" works in kitty and echos an emoji.

And st just crashes when I paste or echo the unicode. Could this mean that the emojis would work if a correct font would be supported to st?


Things I also tried that did NOT help:

@pat-s
Copy link

pat-s commented Apr 19, 2019

Having a very similar problem. Did you figure out a solution meanwhile?

@kiprasmel
Copy link
Contributor Author

Hey @pat-s - I couldn't manage to get back even uncolored support for my st terminal and realised that probably some configuration files or fonts interfered. It was annoying because I couldn't even use vim properly - emojis made st crash, taking down vim togerher:s

I recently re-installed arch and now emojis work as expected -- although, sadly, they're only black & white.. I'd love a colorful solution, especially for the terminal, but I haven't figured it out yet.

Best of luck trying & if you make it -- please share!:)

@pat-s
Copy link

pat-s commented Apr 20, 2019

I am having exactly the same problem regarding crashes. This also relates to neomutt then - if only one message in a mailbox has an emoji, st crashes. This makes neomutt basically unusable.

I have an idea what might be the reason but need to track it down further. Will let you know.

@pat-s
Copy link

pat-s commented Apr 22, 2019

So the error looks like this:

X Error of failed request: BadLength (poly request too large or internal Xlib length error)
Major opcode of failed request: 139 (RENDER)
Minor opcode of failed request: 20 (RenderAddGlyphs)
Serial number of failed request: 1442
Current serial number in output stream: 1454 

Some interesting resources from the st mailing list:

https://lists.suckless.org/dev/1709/32318.html
https://lists.suckless.org/dev/1709/32325.html

The whole archive can be found here: https://lists.suckless.org/dev/thread.html

TL;DR: Looks like it is not uncommon that st crashes with emoji stuff. It is probably unrelated to fonts which is why you (and I) were unable to get it working even by using the same fonts as Luke. I also have ttf-symbola installed which fixed the issue for some people.
Still it looks like a different lib is responsible here which may be solved by a system upgrade at some time.

I couldn't reproduce the error on a Antergos Live system. Currently I am on ArchLabs. It could be that even some distro specific packages are causing the error.

I do not really want to re-install my whole system just because of that. But maybe I have to. Not sure yet..
Guess I'll first try it again in a VM.

@pat-s
Copy link

pat-s commented Apr 22, 2019

Summary

I did a new installation. But this was not the problem/solution.
I do not know yet who is to blame here. Definitely not Luke or any of the fonts.

The problem is sitting somewhere in ~/.config/. After deleting all of it, st did not crash anymore and emojis worked fine.
Regardless of the font.

Ofc now that my setup is gone I cannot replicate it anymore - However, I still have a second machine with the same "old" setup now that I could debug step by step (by this I mean removing the config files sequentially and checking after each).

At least I have a full LARBS setup now 👍

@pat-s
Copy link

pat-s commented Apr 24, 2019

I also re-installed machine2. While this worked in the beginning, I am facing the same problem again now.

Machine1 is still fine. I really have no clue...

@pat-s
Copy link

pat-s commented Apr 24, 2019

I am able to reproduce it now. Once I set an emoji font as fallback to have colored emojis in some apps, st crashes.

See here how I do it.

Now I need to figure out how to exclude st (or more specifically monospace fonts) from the emoji fallback.

@kiprasmel
Copy link
Contributor Author

Woah, that's a lot you've done - proud of your effort!

I just tried out your article you just linked, and I get the same results - emojis in chrome, vscode & similar apps are colorful now, but st crashes, sadly:/

Hoping you'll find a way out for us:D - best of luck once again @pat-s!

@kiprasmel
Copy link
Contributor Author

kiprasmel commented Apr 25, 2019

Edit - just using this config as local.conf in /etc/fonts gives the same results.
Mentioned in this reddit comment

The command is

sudo curl -o /etc/fonts/local.conf https://pastebin.com/raw/atfUQQ2j

@pat-s
Copy link

pat-s commented Apr 25, 2019

Got it. If you remove the following block

    <match target="pattern">
        <test name="family"><string>monospace</string></test>
        <edit name="family" mode="append"><string>Noto Color Emoji</string></edit>
    </match>

from the file linked in my previous post, st will not crash.
What this code does is that it sets noto-fonts-emoji as a fallback for monospace fonts. This means st tries to use this font for eomjis but this won't work as these ones are colored.
Symbola is usually used as the default fallback but its explicitly blocked by the following block:

    <!-- Block Symbola from the list of fallback fonts. -->
    <selectfont>
        <rejectfont>
            <pattern>
                <patelt name="family">
                    <string>Symbola</string>
                </patelt>
            </pattern>
        </rejectfont>
    </selectfont>

So when st crashes, I assume that in most cases some colorful emoji font is used as a fallback instead of symbola.

There are some other related issues to colored emojis and crashes:

LukeSmithxyz/st#58
LukeSmithxyz/st#37

And more on the st mailing list..

@kiprasmel
Copy link
Contributor Author

Hey, that's interesting. I tried removing the code block and also tried to comment out the Symbola blocking block, but my st still crashes:S Is there anything else you could've changed? (Probably, I remember trying to fix this myself - you do some many different things that you no longer know what helped and what didn't:D)

@kiprasmel kiprasmel changed the title [Suggestion] Install ttf-symbola by default emojis crash st (simple terminal) Apr 26, 2019
@d-roak
Copy link

d-roak commented Feb 26, 2020

Mine was crashing with same errors due to zsh tmux plugin. You might want to check there too!

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

No branches or pull requests

4 participants