Is there a way to display emojis in TeXmacs?

Although not something you would need to do in a research paper, this would be useful in other contexts (e.g., a TODO TeXmacs document).

You should check if a font has it. Then use the unicode code to get them into the document. I’m not sure how they work usually.

Emoji only seems to work for a few icons. When pasting “:paperclip::writing_hand::point_right:🖛” into TeXmacs, only “:writing_hand:” shows up, the others are shown as unicode. I’ve tried different fonts and verified that they support all of these icons in LibreOffice.

Upon closer investigation the standard fonts in TeXmacs don’t support emoji. I have used Gnome Font Manager to check. LibreOffice must do some substitution when a character is not available in the font.

The only Emoji font in the TeXmacs font database is Apple Color Emoji.

I have tried importing an emoji font from my system (Noto Color Emoji) but TeXmacs crashed.

Some more things I have found out trying to get more emoji to work.

TeXmacs looks recursively in specific paths for fonts:

  • On all systems: $TEXMACS_HOME_PATH/fonts/truetype and $TEXMACS_PATH/fonts/truetype
  • On Linux: $HOME/.fonts /usr/share/fonts/truetype and /usr/local/share/fonts/truetype
  • On Windows: $windir/Fonts
  • On Mac: $HOME/Library/Fonts, /Library/Fonts, /System/Library/Fonts, /opt/local/share/texmf-texlive/fonts/truetype, /opt/local/share/texmf-texlive-dist/fonts/truetype

In my case (Fedora Linux) the default system font path is /usr/share/fonts/, which isn’t searched. A quick fix is to create a symlink in $HOME/.fonts to that path. There is also a preference “imported fonts” that is searched (see src/Plugins/Freetype/tt_file.cpp). Using (set-preference "imported fonts" "/usr/share/fonts") should add the directory to the search path.

This way I could select Emoji fonts without TeXmacs crashing. However, color emoji don’t seem to be supported. This led me to this site:

The best current choice for me seems to be SymbolA. Color fonts with black and white fallbacks also don’t seem to work.

And, GNU TeXmacs does not support Noto fonts.

This is not immediately relevant, but I was curious what the “Import…” button in the font selection dialog does. Perhaps it will be useful to others.

It basically adds the parent directory of the selected font file to the “imported fonts” preference (as a colon-separated list) and adds the font file to the global “font_table”.

So, if you move the font file later on, the font will stop working. The file is not copied into your .TeXmacs/fonts folder, for example.

A side-effect of this mechanism is that paths in imported fonts are searched by the “Look for more fonts” function. So, if you import one font from a directory containing many fonts, the next time you search for more fonts they will all appear in the font database.