From aa4968faaa98ed5e72d8c6bee8316a0ee2ff300a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 28 Mar 2020 11:18:33 +0400 Subject: [PATCH] Re-use fontconfig fallback code in snap --- Telegram/SourceFiles/platform/linux/specific_linux.cpp | 4 ++-- Telegram/cmake/telegram_options.cmake | 5 +++++ snap/snapcraft.yaml | 7 +------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 9e77745bf..33304fe00 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -96,7 +96,7 @@ bool RunShellCommand(const QByteArray &command) { } void FallbackFontConfig() { -#ifdef TDESKTOP_USE_FONT_CONFIG_FALLBACK +#ifdef TDESKTOP_USE_FONTCONFIG_FALLBACK const auto custom = cWorkingDir() + "tdata/fc-custom-1.conf"; const auto finish = gsl::finally([&] { if (QFile(custom).exists()) { @@ -131,7 +131,7 @@ void FallbackFontConfig() { } QFile(":/fc/fc-custom.conf").copy(custom); -#endif // TDESKTOP_USE_FONT_CONFIG_FALLBACK +#endif // TDESKTOP_USE_FONTCONFIG_FALLBACK } bool GenerateDesktopFile( diff --git a/Telegram/cmake/telegram_options.cmake b/Telegram/cmake/telegram_options.cmake index 50b57c9c1..442ed596a 100644 --- a/Telegram/cmake/telegram_options.cmake +++ b/Telegram/cmake/telegram_options.cmake @@ -4,6 +4,7 @@ # For license and copyright information please follow this link: # https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +option(TDESKTOP_USE_FONTCONFIG_FALLBACK "Use custom fonts.conf (Linux only)." OFF) option(TDESKTOP_FORCE_GTK_FILE_DIALOG "Force using GTK file dialog (Linux only)." OFF) option(TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME "Disable automatic 'tg://' URL scheme handler registration." ${DESKTOP_APP_USE_PACKAGED}) option(TDESKTOP_DISABLE_NETWORK_PROXY "Disable all code for working through Socks5 or MTProxy." OFF) @@ -63,6 +64,10 @@ if (DESKTOP_APP_SPECIAL_TARGET) target_compile_definitions(Telegram PRIVATE TDESKTOP_ALLOW_CLOSED_ALPHA) endif() +if (TDESKTOP_USE_FONTCONFIG_FALLBACK) + target_compile_definitions(Telegram PRIVATE TDESKTOP_USE_FONTCONFIG_FALLBACK) +endif() + if (TDESKTOP_FORCE_GTK_FILE_DIALOG) target_compile_definitions(Telegram PRIVATE TDESKTOP_FORCE_GTK_FILE_DIALOG) endif() diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index a1294231c..fcaf9e9cc 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -102,6 +102,7 @@ parts: - -DDESKTOP_APP_USE_PACKAGED_EXPECTED=OFF - -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF - -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF + - -DTDESKTOP_USE_FONTCONFIG_FALLBACK=ON override-pull: | snapcraftctl pull @@ -118,10 +119,6 @@ parts: snapcraftctl set-version "$version" sed -i 's|^Icon=.*|Icon=/share/icons/hicolor/512x512/apps/telegram.png|g' lib/xdg/telegramdesktop.desktop - override-build: | - snapcraftctl build - mkdir -p "$SNAPCRAFT_PART_INSTALL/etc/fonts" - cp "$SNAPCRAFT_PART_SRC/Telegram/lib_ui/qt_conf/fc-custom.conf" "$SNAPCRAFT_PART_INSTALL/etc/fonts/fonts.conf" after: - cmake - desktop-qt5 @@ -159,13 +156,11 @@ parts: - locales-all - xdg-user-dirs - fcitx-frontend-qt5 - stage: [-etc/fonts/fonts.conf] qt5-gtk-platform: plugin: nil stage-packages: - qt5-gtk-platformtheme - stage: [-etc/fonts/fonts.conf] cmake: source: "https://gitlab.kitware.com/cmake/cmake.git"