You are not logged in.

#1 2023-12-10 09:11:44

captainbanaynays
Member
Registered: 2022-09-05
Posts: 15

Alacritty, patched fonts, and emoji

Just did a clean install with SwayWM for fun. I can't seem to get Alacritty to support emoji at all, and there are multiple icons that would normally be supported by a patched font that are showing up as tofu boxes. This discussion did not yield any success for me, nor did this very well-written solution on github and I have spent a few hours wrangling fontconfig to no avail.

% fc-match -s monospace

NotoSansMNerdFont-Regular.ttf: "NotoSansM Nerd Font" "Regular"
NotoColorEmoji-Regular.ttf: "Noto Color Emoji" "Regular"
NotoSans-VariableFont_wdth,wght.ttf: "Noto Sans" "Regular"
NotoSansMath-Regular.ttf: "Noto Sans Math" "Regular"
NotoSans-Italic-VariableFont_wdth,wght.ttf: "Noto Sans" "Italic"
<!-- ~/.config/fontconfig/fonts.conf -->

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>NotoSansM Nerd Font</family>
      <family>Noto Color Emoji</family>
     </prefer>
  </alias>
</fontconfig>
# ~/.config/alacritty/alacritty.yml snippet

# Font configuration
font:
    normal:
        family: "monospace"

Alacritty isn't recognizing the preferred monospace family specified in fonts.conf and if I set the family to monospace instead of "NotoSansM Nerd Font" then it uses the default system (variable width) font and is all a mess, even after calling fc-cache --really-force.

Last edited by captainbanaynays (2023-12-10 09:12:18)

Offline

#2 2023-12-10 10:13:44

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,643

Re: Alacritty, patched fonts, and emoji

lose the quotes in the config, though alacritty defaults to "monospace" anyway, and post the entire config file (not a rendition thereof, upload the file to eg. 0x0.st)
yml is whitespace sensitive and fragile AF - if you fucked around w/ 0x9 (tabs), it'll break.

Next: name some codepoints you'd like (?) to see and check their actual support, eg. for the pile of poop

fc-list :charset=1F4A9

Offline

#3 2023-12-10 19:58:12

captainbanaynays
Member
Registered: 2022-09-05
Posts: 15

Re: Alacritty, patched fonts, and emoji

Here's the full alacritty.yml, I don't think that tabbing was the issue but removing the quotes definitely got it to find the proper monospace font.

% fc-list :charset=1F4A9

/usr/share/fonts/noto/NotoColorEmoji-Regular.ttf: Noto Color Emoji:style=Regular
% fc-list :charset=1F980

/usr/share/fonts/noto/NotoColorEmoji-Regular.ttf: Noto Color Emoji:style=Regular

Seems like the correct font is being selected, but it renders as an invisible charachter about 2x the normal character width.

Offline

#4 2023-12-10 20:22:58

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,643

Re: Alacritty, patched fonts, and emoji

an invisible charachter about 2x the normal character width

Screenshot and please the output of "localectl; locale; locale -a"

Since "Noto Color Emoji" isn't a fixed width font, do you get the same problem w/ the poop emoji?
Do you get the same issue w/ a lower block private use emoji (eg U+E231, poison in nerd fonts)?

Offline

#5 2023-12-10 22:29:32

captainbanaynays
Member
Registered: 2022-09-05
Posts: 15

Re: Alacritty, patched fonts, and emoji

Link to screencap of command output

Yes, poop emoji is also an invisible character with 2x width, poison isn't showing up at all, either it's a zero-width invisible character or not being input at all. (Using Control+Shift+U input method or getting the glyph from nerd font website and copy-pasting)

Offline

#6 2023-12-11 09:15:43

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,643

Re: Alacritty, patched fonts, and emoji

"Too many redirects", try imgur or you can also upload images to 0x0.st
Also sorry, I just meant a screenshot of the glyphs, not of the output.
Always just post text, never pictures thereof.

Offline

#7 2023-12-11 09:30:14

captainbanaynays
Member
Registered: 2022-09-05
Posts: 15

Re: Alacritty, patched fonts, and emoji

 % localectl; locale; locale -a

System Locale: LANG=en_US.UTF-8
    VC Keymap: us
   X11 Layout: us
    X11 Model: pc105+inet
  X11 Options: terminate:ctrl_alt_bksp
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
C
C.utf8
en_US.utf8
POSIX

screenshot of glyphs
I'm trying the direct link instead of shortened this time, that may help.
Pictured is three emoji: pile of poo (U+1F4A9), crab (U+1F980), smiling face (U+1F600), the cursor is positioned after all three of them.
Sorry for the misunderstanding, I did find it strange you were asking for a screencap of terminal output!

Last edited by captainbanaynays (2023-12-11 09:33:46)

Offline

#8 2023-12-11 10:08:57

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,643

Re: Alacritty, patched fonts, and emoji

It's not the locale - does https://aur.archlinux.org/packages/ttf- … monochrome work?
Or the non-nerd Noto font (in case the nerd font occupies the desired glyphs but hasthem empty)?

Edit: on a limb, try to reverse the order

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Noto Color Emoji</family>
      <family>NotoSansM Nerd Font</family>
     </prefer>
  </alias>
</fontconfig>

You could also pick up https://github.com/ryanoasis/nerd-fonts … ymbolsOnly and try

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Noto Sans Mono</family>
      <family>Noto Color Emoji</family>
      <family>Symbols Nerd Font Mono</family>
     </prefer>
  </alias>
</fontconfig>

Last edited by seth (2023-12-11 14:24:02)

Offline

#9 2023-12-13 05:58:08

captainbanaynays
Member
Registered: 2022-09-05
Posts: 15

Re: Alacritty, patched fonts, and emoji

Reversing the order had no effect, and switching to the symbols-only font made the nerd font symbols smaller (presumably to fit inside a single character box) even though I explicitly chose the non-mono variant of the nerd font.

Using the monochromatic Noto Emoji font works! screenshot

Updated fontconfig:

~/.config/fontconfig

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>NotoSansM Nerd Font</family>
      <family>Noto Emoji</family>
     </prefer>
  </alias>
</fontconfig>

But, this doesn't solve all of my problems as some of the icons in, say, the lazygit interface are not rendering properly.
The nerd font should have these symbols included? Also, what can I do if I want color emoji?

screencap of lazygit interface with missing icons

Last edited by captainbanaynays (2023-12-13 05:58:58)

Offline

#10 2023-12-13 08:47:26

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,643

Re: Alacritty, patched fonts, and emoji

The nerd font should have these symbols included?

What is the codepoint of the missing glyph?
(afaict the nerd fonts only occupy the private use areas, so if it's a canonical glyph it has to come from somewhere else)

Do the color emojis work w/ a non-nerd font?
(Though the monochromatic versions working hint at an issue w/ alacritty's svg rendering)
Other TEs (kitty, vte3-based ones) work as expected?

Offline

Board footer

Powered by FluxBB