|
8 | 8 | makeDesktopItem, |
9 | 9 | makeWrapper, |
10 | 10 | opensc, |
| 11 | + liberation_ttf, |
| 12 | + writeText, |
11 | 13 | writeTextDir, |
12 | 14 | configText ? "", |
13 | 15 | }: |
|
26 | 28 |
|
27 | 29 | mainProgram = "horizon-client"; |
28 | 30 |
|
| 31 | + # Horizon renders its broker/desktop launch-item (tile) labels with |
| 32 | + # "DejaVu Sans", but fails to instantiate the font when fontconfig resolves it |
| 33 | + # to a symlinked file -- which is exactly what nixpkgs' dejavu_fonts provides |
| 34 | + # (it is a symlink tree into dejavu-fonts-minimal). The labels then render as |
| 35 | + # blank boxes; the rest of the UI uses the GTK theme font and is unaffected. |
| 36 | + # Other toolkits load the same symlinked font without issue, so this is |
| 37 | + # specific to the client's font handling. |
| 38 | + # |
| 39 | + # The FHS sandbox bind-mounts the host's /etc/fonts, so the FHS environment's |
| 40 | + # own fontconfig does not apply. Point the client at a config that keeps the |
| 41 | + # host's fonts but maps "DejaVu Sans" onto a bundled, regular-file font |
| 42 | + # (Liberation Sans). This is deterministic and independent of the host's |
| 43 | + # font configuration. |
| 44 | + fontconfigFile = writeText "omnissa-horizon-fontconfig.conf" '' |
| 45 | + <?xml version="1.0"?> |
| 46 | + <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> |
| 47 | + <fontconfig> |
| 48 | + <include ignore_missing="yes">/etc/fonts/fonts.conf</include> |
| 49 | + <dir>${liberation_ttf}/share/fonts</dir> |
| 50 | + <match target="pattern"> |
| 51 | + <test name="family" qual="any"> |
| 52 | + <string>DejaVu Sans</string> |
| 53 | + </test> |
| 54 | + <edit name="family" mode="assign" binding="same"> |
| 55 | + <string>Liberation Sans</string> |
| 56 | + </edit> |
| 57 | + </match> |
| 58 | + </fontconfig> |
| 59 | + ''; |
| 60 | + |
29 | 61 | # This forces the default GTK theme (Adwaita) because Horizon is prone to |
30 | 62 | # UI usability issues when using non-default themes, such as Adwaita-dark. |
31 | 63 | wrapBinCommands = path: name: '' |
32 | 64 | makeWrapper "$out/${path}/${name}" "$out/bin/${name}_wrapper" \ |
33 | 65 | --set GTK_THEME Adwaita \ |
| 66 | + --set FONTCONFIG_FILE "${fontconfigFile}" \ |
34 | 67 | --suffix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}" \ |
35 | 68 | --suffix LD_LIBRARY_PATH : "$out/lib/omnissa/horizon/crtbora:$out/lib/omnissa" |
36 | 69 | ''; |
|
0 commit comments