omnissa-horizon-client: fix blank desktop tile labels

Prior to this change, the omnissa-horizon-client renders server labels as empty
boxes, while the rest of the UI renders fine (using GTK theme font).

With this change the server labels render correctly.

Horizon renders its server labels with "DejaVu Sans" but fails to load the font
when fontconfig resolves it to a symlinked file, which is what it finds if
dejavu-fonts-minimal is installed on the host.

This fix points the client at a fontconfig which maps DejaVu Sans to a font
bundled in the FHS sandbox (Liberation Sans).

Assisted-by: Claude Code (Claude Opus 4.8)
This commit is contained in:
Carl Zulauf
2026-06-29 16:24:51 -05:00
parent 7a1a64774a
commit 17a6a2f6a0
@@ -8,6 +8,8 @@
makeDesktopItem,
makeWrapper,
opensc,
liberation_ttf,
writeText,
writeTextDir,
configText ? "",
}:
@@ -26,11 +28,42 @@ let
mainProgram = "horizon-client";
# Horizon renders its broker/desktop launch-item (tile) labels with
# "DejaVu Sans", but fails to instantiate the font when fontconfig resolves it
# to a symlinked file -- which is exactly what nixpkgs' dejavu_fonts provides
# (it is a symlink tree into dejavu-fonts-minimal). The labels then render as
# blank boxes; the rest of the UI uses the GTK theme font and is unaffected.
# Other toolkits load the same symlinked font without issue, so this is
# specific to the client's font handling.
#
# The FHS sandbox bind-mounts the host's /etc/fonts, so the FHS environment's
# own fontconfig does not apply. Point the client at a config that keeps the
# host's fonts but maps "DejaVu Sans" onto a bundled, regular-file font
# (Liberation Sans). This is deterministic and independent of the host's
# font configuration.
fontconfigFile = writeText "omnissa-horizon-fontconfig.conf" ''
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<include ignore_missing="yes">/etc/fonts/fonts.conf</include>
<dir>${liberation_ttf}/share/fonts</dir>
<match target="pattern">
<test name="family" qual="any">
<string>DejaVu Sans</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>Liberation Sans</string>
</edit>
</match>
</fontconfig>
'';
# This forces the default GTK theme (Adwaita) because Horizon is prone to
# UI usability issues when using non-default themes, such as Adwaita-dark.
wrapBinCommands = path: name: ''
makeWrapper "$out/${path}/${name}" "$out/bin/${name}_wrapper" \
--set GTK_THEME Adwaita \
--set FONTCONFIG_FILE "${fontconfigFile}" \
--suffix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}" \
--suffix LD_LIBRARY_PATH : "$out/lib/omnissa/horizon/crtbora:$out/lib/omnissa"
'';