Why do my Unicode character (eg. 🫵) not show in PDF output?

Hi,

I do use unicode in my workflow (editor, file…) and some unicode such as : :index_pointing_at_the_viewer: or​:muscle:, are well represented in my editor, but the pdf have difficulties to display them. I got a ļæ½ in the pdf, but get a good display within html output.

What could I do ?

cED

Typst natively support unicode, and even has an emoji module to easily insert emojis into your document (in your case, emoji.finger.front and emoji.arm.muscle in case you don’t want to copy/paste emojis directly into the source code.

Make sure the font that you are using supports emojis

1 Like

I think the emoji font you use might be the problem. You could try to use a different font that provides emojis.
If you haven’t explicitly set an emoji font, Typst falls back to one available on the system you compile the document on.

#set text(font: (
  "YOUR-TEXT-FONT",
  "YOUR-EMOJI-FONT",
))

I’m a bit naĆÆve: I was somehow expecting typst to be coherent (without beeing harsh).

Still, I’m not an expert and I work on debian. I’ve simply downloaded the typst tool (which I think does not include the font family). The compilator (typst) does not raise any errors.

Does someone can tell me how to download a specific font family for the emoji and how to include it ?

Thanks in advance for your kind help.

I’ve installed the fonts on debian with:

apt install texlive-fonts-extra

and It worked !

Despite everything, I think that the typst tool should include its own font library with the fonts and the emoji, so that it does not depends on some difficult topic, that a normal person can handle.

I think Typst aims to let the user access all Unicode symbols and emojis with nice names like emoji.finger.front (it’s an ongoing work, see the typst/codex project). Embedding fonts in the Typst binary to cover all these symbols would make it significantly larger, but maybe at some point an emoji font will be included…

That you currently get no warning for glyphs not found in the available fonts is a known issue: Add warning when a glyph isn't found in any font Ā· Issue #5137 Ā· typst/typst Ā· GitHub

To install an emoji font, maybe the best option is Noto Color Emoji.

On Debian you can get the rasterized version of Noto Color Emoji with apt install fonts-noto-color-emoji (this is actually what you get by installing texlive-fons-extra as it has a ā€œrecommendedā€ dependency on fonts-noto-color-emoji, but then you also install a ton of other dependencies).

To get the vector version (smaller and scalable, but cannot be used in all software), you would need to install the file manually. You can get the latest release from GitHub - googlefonts/noto-emoji: Noto Emoji fonts Ā· GitHub and extract the file Noto-COLRv1.ttf from the archive. Or you can directly download just this file from git: https://github.com/googlefonts/noto-emoji/raw/main/fonts/Noto-COLRv1.ttf

Once you have the COLRv1 file, copy it to ~/.local/share/fonts (create this directory if it doesn’t exist already). That’s it, the font is installed.

1 Like

Indeed fonts, and in particular emojis, seem to be a common issue and I think supporting new users set up correct fonts could be something a future release improves. The page you link to actually tells us that typst ships with a few fonts,

Typst uses your installed system fonts or embedded fonts in the CLI, which are Libertinus Serif, New Computer Modern, New Computer Modern Math, and DejaVu Sans Mono

However, the same page also tells us that

The priority is: --font-path > system fonts > embedded fonts

Meaning that typst prioritises user-defined fonts over embedded ones. This means that if you have previously installed a font that typst ships with, typst will not use the embedded font even on a clean install, regardless of if you intended for this to happen or not.

What I find confusing here is that editor and browser can show the emoji, so wouldn’t that mean that the font is installed, but in a way that isn’t recognized by Typst? I can imagine that browsers embed some fonts on their own, but the editor too?

1 Like