Alacritty loads FiraCode nerdfont apparently fine, but doesn't render ligatures

I been unable to get ligatures to render in Alacritty, though I have been able to get custom icons (like this tux icon: =hexcode f17c copied from here). Is there a common nixos-specific issue that would prevent alacritty from using these fonts?


_lots_ of debugging details here (click)
  • when I say “ligatures” I mean: 1) install “FiraCode” from Nerdfonts, 2) be able to type (eg) three equals (=) chars contiguously and have it render as a class-equivalence glyph
  • wrt alacrity specifically I’ve set config like this:
font:
  normal:
    family: "FiraCode Nerd Font"
    style: Regular

  bold:
    family: "FiraCode Nerd Font"
    style: Bold

  italic:
    family: "FiraCode Nerd Font"
    style: Italic
  • wrt nixos genearlly: I believe I’ve setup my fonts correctly with FiraCode Nerd Font because…
    • my default font: on fresh boot, firefox shows (in “advanced” setting pane) it sees FiraCode as the default monospace for me (indeed overriding things with devtools to font-family: monospace; lets me type ligatures into <textarea> parts of web pages)
    • Gnome’s “Text Editor” lets me override the font to be FiraCode Nerd Font and then indeed renders ligatures (though unsure why the editor doesn’t default to FiraCode, but I digress)
    • alacrity -vvv shows log lines that say it’s loading Fira for me without errors; eg:
$ alacritty -vvv
Created log file at "/tmp/Alacritty-14036.log"
[0.000001749s] [INFO ] [alacritty] Welcome to Alacritty
[0.000100638s] [INFO ] [alacritty] Version 0.12.2
[0.000112111s] [INFO ] [alacritty] Running on Wayland
[0.000643643s] [INFO ] [alacritty] Configuration files loaded from:
                                     "/home/qsu/.config/alacritty/alacritty.yml"
[0.036815433s] [INFO ] [alacritty] Using EGL 1.5
[0.038765955s] [ERROR] [sctk_adwaita] XDG Settings Portal did not return response in time: timeout: 100ms, key: color-scheme
[0.058134274s] [TRACE] [crossfont] Number of fonts is 197
[0.058191521s] [TRACE] [crossfont] Got font path="/nix/store/q74idm55v5km2pp9yh5qhzc4cw639kp4-cantarell-fonts-0.303.1/share/fonts/cantarell/Cantarell-VF.otf", index=262144
[0.058278391s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: NO_BITMAP | TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.065428338s] [INFO ] [alacritty] Window scale factor: 1
[0.066753946s] [DEBUG] [alacritty] Loading "FiraCode Nerd Font" font
[0.073174034s] [TRACE] [crossfont] Number of fonts is 194
[0.073235267s] [TRACE] [crossfont] Got font path="/nix/store/927y0gcwklw7dq5s7yy6p6l38l89j6qp-nerdfonts-3.0.2/share/fonts/truetype/NerdFonts/FiraCodeNerdFont-Regular.ttf", index=0
[0.073310320s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: NO_BITMAP | TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.091644585s] [TRACE] [crossfont] Number of fonts is 172
[0.091716084s] [TRACE] [crossfont] Got font path="/nix/store/927y0gcwklw7dq5s7yy6p6l38l89j6qp-nerdfonts-3.0.2/share/fonts/truetype/NerdFonts/FiraCodeNerdFont-Bold.ttf", index=0
[0.091792684s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: NO_BITMAP | TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.100552867s] [TRACE] [crossfont] Number of fonts is 194
[0.100622902s] [TRACE] [crossfont] Got font path="/nix/store/927y0gcwklw7dq5s7yy6p6l38l89j6qp-nerdfonts-3.0.2/share/fonts/truetype/NerdFonts/FiraCodeNerdFont-Regular.ttf", index=0
[0.100707097s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: NO_BITMAP | TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.107939169s] [TRACE] [crossfont] Number of fonts is 178
[0.107989561s] [TRACE] [crossfont] Got font path="/nix/store/927y0gcwklw7dq5s7yy6p6l38l89j6qp-nerdfonts-3.0.2/share/fonts/truetype/NerdFonts/FiraCodeNerdFont-Bold.ttf", index=0
[0.108001082s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: NO_BITMAP | TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.111840713s] [INFO ] [alacritty] Running on Mesa Intel(R) Xe Graphics (TGL GT2)
[0.111898110s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[0.128387691s] [DEBUG] [alacritty] Filling glyph cache with common glyphs

Edit: sorry I forgot to actually share the nixconfig (even though I’m 99% sure that’s already correct):

 { nixpkgs, config, pkgs, ... }:

  # snipped bunch of system stuff for brevity

  # https://nixos.wiki/wiki/Fonts#Installing_fonts_on_NixOS
  # https://nixos.wiki/wiki/Fonts#Set_multiple_fonts_for_different_languages
  fonts = {
    fontDir.enable = true;
    enableDefaultPackages = true;
    packages = with pkgs; [
      fira-code
      fira-code-symbols
    ];

    fontconfig = {
      enable = true;
      defaultFonts = {
        monospace = [ "FiraCode Nerd Font" ];
      };
    };
  };

does alacrity even support ligatures? It didn’t when I last looked into it, but it might’ve changed.

1 Like

Indeed, not supported https://github.com/alacritty/alacritty/issues/50

Oh wow, lack of support hadn’t even occurred to me - I guess I hadn’t considered that this a client-capability thing to begin with.

Thanks. My head scratching can stop now :slight_smile: