diff --git a/tools/linuxfs/desktop/steamdeck-desktop b/tools/linuxfs/desktop/steamdeck-desktop index 8910ad77a..21c536b01 100644 --- a/tools/linuxfs/desktop/steamdeck-desktop +++ b/tools/linuxfs/desktop/steamdeck-desktop @@ -44,6 +44,28 @@ if [ -d /usr/share/fontconfig/conf.default ] && ! ls /etc/fonts/conf.d/*.conf >/ for f in /usr/share/fontconfig/conf.default/*.conf; do ln -sf "$f" /etc/fonts/conf.d/; done echo "== fontconfig: linked $(ls /etc/fonts/conf.d/*.conf | wc -l) default rules" fi +# Those rules map sans-serif and friends onto whatever a full distribution installs, and this +# rootfs has one family. Naming it outright is what gives every toolkit a default font: without +# one Gecko reports "no fonts" with families found, and draws pages with no text at all. +if [ ! -f /etc/fonts/local.conf ]; then + { echo '' + for generic in sans-serif sans serif monospace mono cursive fantasy system-ui ui-sans-serif; do + case $generic in + serif) face="DejaVu Serif" ;; + mono*|ui-mono) face="DejaVu Sans Mono" ;; + *) face="DejaVu Sans" ;; + esac + printf '%s%s\n' "$generic" "$face" + done + echo '' + } > /etc/fonts/local.conf + echo "== fontconfig: wrote local.conf (DejaVu as the default family)" +fi +# The cache in the image was built before those rules existed; rebuild it once, and only once. +if [ ! -f /var/cache/fontconfig/.steamdeck-built ] && command -v fc-cache >/dev/null 2>&1; then + fc-cache -f >/dev/null 2>&1 && touch /var/cache/fontconfig/.steamdeck-built + echo "== fontconfig: cache rebuilt, default sans is $(fc-match sans-serif 2>/dev/null)" +fi echo "== steamdeck-desktop: labwc ($WLR_RENDERER) on $WAYLAND_DISPLAY" # ~/.steamdeck-desktop-debug: labwc's own debug log (views and layer surfaces mapping) too. DEBUG=; [ -f "$HOME/.steamdeck-desktop-debug" ] && DEBUG=-d