0

Sorry if this was answered somewhere else, but I could not find an answer.

All the text editors installed in my system can display emojis except Emacs (version 27), even if they use the same font.

As an example, I configured both Emacs and Gedit to use the JetBrains Mono font. Gedit can display the shrug emoji 🤷 but Emacs cannot.

It seems, this can be workaround by specifying a fallback font that will display these symbols:

(set-fontset-font t nil "Symbola" nil 'append)

However other editors do not require such trick (although maybe they use a similar mechanism by default).

Are editors like Gedit or Visual Studio using a some trick to display emojis that Emacs does not?

4
  • Which font? Also, show an example character that doesn't get displayed correctly? – phils Oct 16 '20 at 10:41
  • Thanks for the remark @phils. I edited the question. – Damian Nadales Oct 16 '20 at 10:54
  • 1
    FWIW a vanilla Emacs 27.1 instance displays that character for me (using Symbola, but I didn't configure Emacs to do it). – phils Oct 16 '20 at 11:02
  • Yeah, you're right. I removed other packages I had, and now Emacs seems to default to Symbola. – Damian Nadales Oct 19 '20 at 8:10
2

This question is based on a false premise: Jet Brains Mono does not contain emoji characters at all. Unless your text editor performs automatic font fallback to fill in missing glyphs not provided by the chosen font, you will not see any emoji whatsoever. Therefore there's the following two camps they usually fall into:

  • Perform automatic font fallback using a library such as fontconfig: Many editors do that and automatically pick a suitable font. The downside of this approach is that the automatic choice may not be what the user wanted and therefore requires extra tweaking, such as by editing fontconfig's configuration files or in the case of special applications (mobile apps, browsers, ...) bundling a special emoji font.
  • Perform manual font fallback: Emacs does this for the greatest possible customizability independent of the operating system (see also urxvt for another example). Ironically Emacs does use fontconfig when available to select the most suitable font per script family; an unusual, but supported usecase. More fine-grained setup is performed in fontset.el. I've handed in a bug about this behavior in 2015 and as a result of this Emacs defaults to falling back to Symbola for the emoji range. Therefore I find it hard to believe you need the above line, unless that font triggers another bug inside Emacs (the debbugs thread suggests some tricks for debugging such issues).

To summarize: The trick is doing things in the simplest supported way while disregarding compatibility across operating systems. Emacs neither does things the simple way (at least not when it would impede customizability) nor has the luxury of dropping any code it accrued over many years.

1
  • Thanks. It's clear now. BTW, I removed other packages I had, and now Emacs seems to default to Symbola for emojis. – Damian Nadales Oct 19 '20 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.