My dmenu is not able to detect the noto color emoji font. It can detect other fonts but not this one. How to solve this?
➜ fc-list | grep -i "notocoloremoji"
/usr/share/fonts/truetype/noto/NotoColorEmoji.ttf: Noto Color Emoji:style=Regular➜ dmenu -fn "Noto Color Emoji"
no fonts could be loaded. 1 Answer
Several suckless tools like dmenu and st use a library called libxft to handle font rendering. This library has a bug that prevents it from rendering color fonts. Fortunately, this bug has actually been fixed, but for whatever reason hasn't been merged upstream. So, to get color fonts working you need to install this patched version of libxft and then remove a check in dmenu that manually disables colored fonts (because of this bug). I've written the manual steps for doing this below, but as an easier solution you can just install this fork of dmenu that does this for you:
Manual Steps
On arch linux you can install a patched version of libxft (replacing the old version) with this package: libxft-bgra. On other distros you'll need to download the source for libxft, apply the patch, and then manually compile and install the patched version of libxft.
Once you've got the patched library you need to edit dmenu's source to remove the code that disables (formerly broken) color fonts. This check is near the top of drw.c and looks like this:
/* Do not allow using color fonts. This is a workaround for a BadLength * error from Xft with color glyphs. Modelled on the Xterm workaround. See * * * * and lots more all over the internet. */ FcBool iscol; if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) { XftFontClose(drw->dpy, xfont); return NULL; }Remove this bit of code and recompile dmenu and you'll be able to use color fonts! Here's a blog post.