The Problem
st crashes whenever an emoji needs to be rendered.
It turns out to be an issue with the underlying font rendering library libXft.
libXft is the client side font rendering library, using libfreetype, libX11, and the X Render extension to display anti-aliased text.
The Solution
In its current offical mainline form libXft does not support rendering images.
A patch by Maxime Coste exists to add support for BGRA glyphs and scaling, effectively enabling emoji rendering support.
I discovered the Arch AUR has packaged up this patch nicely, and its PKGCONFIG provides the treasure map to patching libXft.
_pkgbasever=2.3.3
pkgname=libxft-bgra
pkgver=2.3.3.r7.7808631e
pkgrel=1
pkgdesc="libXft with BGRA glyph (color emoji) rendering & scaling patches by Maxime Coste"
arch=('x86_64')
license=('custom')
groups=('modified')
provides=('libxft')
conflicts=('libxft')
url="https://gitlab.freedesktop.org/xorg/lib/libxft.git"
depends=('fontconfig' 'libxrender' 'curl' 'xorg-util-macros')
makedepends=('git' 'pkgconf')
source=("git+$url" "https://gitlab.freedesktop.org/xorg/lib/libxft/merge_requests/1.patch")
md5sums=('SKIP' 'SKIP')
build() {
cd libxft
patch -p1 < ../1.patch
sh autogen.sh --sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man
make
}
package() {
cd libxft
make DESTDIR="${pkgdir}" install
install -d -m755 "${pkgdir}/usr/share/licenses/${pkgname}"
install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
}
Running on a Debian machine, needed to tweak some of the steps, here’s a snippet of my bash history:
curl -L -o 1.patch https://gitlab.freedesktop.org/xorg/lib/libxft/merge_requests/1.patch
git clone https://gitlab.freedesktop.org/xorg/lib/libxft.git
cd libxft
patch -p1 < ../1.patch
sudo apt install xutils-dev libtool
sudo sh autogen.sh --sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man
sudo make install
cd /usr/lib/x86_64-linux-gnu
sudo rm -f libXft.*
sudo ln -s /usr/lib/libXft.a libXft.a
sudo ln -s /usr/lib/libXft.so.2.3.4 libXft.so
sudo ln -s /usr/lib/libXft.so.2.3.4 libXft.so.2
sudo ln -s /usr/lib/libXft.so.2.3.4 libXft.so.2.3.4
sudo ldconfig
Restart st and attempt to render something with emojis, I had some emails in neomutt with emojis in their subject lines which was crashing st:

Profit!