Skip to content

Cannot get emoji fonts to render with Stylix #1000

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

Open
ixxie opened this issue Mar 14, 2025 · 10 comments
Open

Cannot get emoji fonts to render with Stylix #1000

ixxie opened this issue Mar 14, 2025 · 10 comments

Comments

@ixxie
Copy link

ixxie commented Mar 14, 2025

Thank you for your work on Stylix! I've been enjoying a pretty NixOS for a couple of weeks now and its wonderful!

I'm running Stylix in a flake-based NixOS system; no matter what I try, I can't get Emojis to properly render: instead of seeing a character, I see a blank space (not tofu). Some emojis do render though.

For some applications (e.g. Discord and Firefox) they reliably show all the time. But for my terminals (Ghostty and Alacritty) I have not been able to get them to work correctly.

The only thing that fixes it is disabling Stylix all together. My configuration:

{ pkgs, ... }:

{

  fonts.packages = with pkgs; [
    source-code-pro
    powerline-fonts
    inter
    google-fonts
    nerd-fonts.monaspace
    noto-fonts-color-emoji
  ];

  stylix = {
    enable = true;
    base16Scheme = "${pkgs.base16-schemes}/share/themes/unikitty-dark.yaml";
    opacity.terminal = 0.8;
    cursor.size = 16;

    fonts = {
      serif = {
        package = pkgs.nerd-fonts.monaspace;
        name = "MonaspiceXe Nerd Font";
      };
      sansSerif = {
        package = pkgs.nerd-fonts.monaspace;
        name = "MonaspiceNe Nerd Font";
      };
      monospace = {
        package = pkgs.nerd-fonts.monaspace;
        name = "MonaspiceKr Nerd Font";
      };
      emoji = {
        package = pkgs.google-fonts; # also tried noto-fonts-color-emoji
        name = "Noto Color Emoji";
      };

      sizes = {
        applications = 11;
        terminal = 11;
        popups = 11;
        desktop = 11;
      };
    };
  };
}

Possibly related:

@donovanglover
Copy link
Contributor

I was able to reproduce the blank spaces in alacritty (alacritty/alacritty#153) but ghostty showed the single emoji I tested.

As a workaround you could try kitty, which is well known for its emoji support

@trueNAHO
Copy link
Member

For some applications (e.g. Discord and Firefox) they reliably show all the time. But for my terminals (Ghostty and Alacritty) I have not been able to get them to work correctly.

We merely propagate the fonts as follows:

Maybe this is an application problem, similar to #814?

@ixxie
Copy link
Author

ixxie commented Mar 19, 2025

Maybe this is an application problem, similar to #814?

I don't think so; emojis are invisible on LibreOffice Writer too. I also tried Kitty like @donovanglover suggested but had no luck.

I'm not saying its surely Stylix causing it, but it does seem to be a system issue and not application-specific.

@ixxie
Copy link
Author

ixxie commented Mar 21, 2025

@trueNAHO, after some testing I've discovered this only seems to happen if I also add the google-fonts package to my font.packages. Without it, emoji's render fine.

It should be noted when the issue manifests, it doesn't affect all emojis, but it does affect the majority of them. That is, if you test with only one emoji, there is a chance you get a false negative.

@donovanglover
Copy link
Contributor

Sounds like a font priorities issue. Shouldn't be stylix related. Try changing the fallback order and/or use logging from affected programs to find the offending font(s)

@ixxie
Copy link
Author

ixxie commented Mar 21, 2025

@donovanglover I didn't configure any font fallback priorities; all I did was install some fonts to the system.

In the absence of my own configuration overriding these settings, it seems quite confusing that Stylix would accept configuration options for these fonts and then not ensure their priority is set correctly.

@trueNAHO
Copy link
Member

In the absence of my own configuration overriding these settings, it seems quite confusing that Stylix would accept configuration options for these fonts and then not ensure their priority is set correctly.

As previously mentioned, Stylix currently merely propagates the fonts without much further processing. As donovanglover mentioned, this might be a general font issue that may be out of the scope of Stylix.

For example, you might be able to further debug this with something like:

fc-match emoji

@ixxie
Copy link
Author

ixxie commented Mar 24, 2025

Sorry if I was rude or entitled, I'm just a bit confused.

Running fc-match emoji yields the follow, both with and without the google-fonts package installed:

❯ fc-match emoji
NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"

I think what is confusing me is that I don't understand how font priority is set; as I mentioned, the settings exposed made me assume that priority would be managed.

I'd be happy to open a PR to clarify the documentation once I understand things better!

@trueNAHO
Copy link
Member

Sorry if I was rude or entitled, I'm just a bit confused.

No worries.

I think what is confusing me is that I don't understand how font priority is set; as I mentioned, the settings exposed made me assume that priority would be managed.

I'd be happy to open a PR to clarify the documentation once I understand things better!

If this is not a Stylix issue, the best the documentation could do is something like:

NOTE: Some fonts may sometimes not work in some applications.

Adding such a notice is probably more harmful and confusing than anything else.

I am just blindly going to assume that this is an issue with individual applications, which is clearly out of the scope of Stylix.

Sorry if I sounded rude or harsh this time :)

@ixxie
Copy link
Author

ixxie commented Mar 25, 2025

I am not saying the issue is caused by Stylix, but if the issue is caused by individual applications, then why would it occur for multiple different apps (Ghostty, Alacritty, LibreOffice Writer) in the same way when the package is added?

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

3 participants