From b62b4161a0b5968f58242e602de2279230cf485b Mon Sep 17 00:00:00 2001 From: Robo Date: Thu, 31 Oct 2024 19:27:30 +0900 Subject: [PATCH] fix: font config detection for snap (#232713) --- resources/linux/snap/electron-launch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/resources/linux/snap/electron-launch b/resources/linux/snap/electron-launch index cf9e946360c..bbd8e76588e 100755 --- a/resources/linux/snap/electron-launch +++ b/resources/linux/snap/electron-launch @@ -96,6 +96,7 @@ function can_open_file() { # Preserve system variables that get modified below copy_env_variable XDG_CONFIG_DIRS copy_env_variable XDG_DATA_DIRS +copy_env_variable XDG_DATA_HOME copy_env_variable LOCPATH copy_env_variable GIO_MODULE_DIR copy_env_variable GSETTINGS_SCHEMA_DIR @@ -167,6 +168,18 @@ fi # Keep an array of data dirs, for looping through them IFS=':' read -r -a data_dirs_array <<< "$XDG_DATA_DIRS" +# Font Config +export FONTCONFIG_PATH="/etc/fonts" +export FONTCONFIG_FILE="/etc/fonts/fonts.conf" + +if [ "$needs_update" = true ]; then + rm -rf "$XDG_DATA_HOME"/fonts + + if [ -d "$SNAP_REAL_HOME/.local/share/fonts" ]; then + ln -s "$SNAP_REAL_HOME/.local/share/fonts" "$XDG_DATA_HOME/fonts" + fi +fi + # Build mime.cache needed for gtk and qt icon # TODO(deepak1556): Re-enable this once we move to core22 # Refs https://github.com/microsoft/vscode/issues/230454#issuecomment-2418352959