#!/usr/bin/env bash # noto color emoji, colrv1 flavour. # # typst >= 0.14 exports colr colour glyphs to pdf, but it does not load the cbdt # bitmap font that debian's fonts-noto-color-emoji package installs (`typst fonts` # does not even list it), so emoji used in source.md silently disappear from the # pdf. the colrv1 build is picked up by font fallback, no markup needed. set -euo pipefail # noto-emoji only tags releases sporadically, so pin the font by commit EMOJI_FONT_COMMIT=f3ae03f5e9b3b8516fa151f7168159ca1a3e7515 tmp="$(mktemp -d)" trap 'rm -rf "$tmp"' EXIT # typst, static musl build: x86_64 releases no longer ship a gnu build TYPST_VERSION=0.15.1 case "$(uname -m)" in x86_64 | amd64) typst_arch=x86_64 ;; aarch64 | arm64) typst_arch=aarch64 ;; *) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;; esac curl -fsSL "https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-${typst_arch}-unknown-linux-musl.tar.xz" \ | tar -xJ -C "$tmp" sudo install -m 755 "$tmp/typst-${typst_arch}-unknown-linux-musl/typst" /usr/local/bin/typst curl -fsSL -o "$tmp/Noto-COLRv1.ttf" \ "https://raw.githubusercontent.com/googlefonts/noto-emoji/${EMOJI_FONT_COMMIT}/fonts/Noto-COLRv1.ttf" sudo install -D -m 644 "$tmp/Noto-COLRv1.ttf" /usr/local/share/fonts/Noto-COLRv1.ttf command -v fc-cache > /dev/null && fc-cache -f > /dev/null typst fonts | grep -i emoji