From b3cdf4d0d9a175f4578e4fefaa8d8646b64b3103 Mon Sep 17 00:00:00 2001 From: ilya-fedin Date: Wed, 28 Apr 2021 09:48:54 +0000 Subject: [PATCH] Provide font settings via Ui Integration (#168) --- Telegram/SourceFiles/core/ui_integration.cpp | 31 +++++++------------- Telegram/SourceFiles/core/ui_integration.h | 1 + 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/Telegram/SourceFiles/core/ui_integration.cpp b/Telegram/SourceFiles/core/ui_integration.cpp index 3118da235..cc7a27264 100644 --- a/Telegram/SourceFiles/core/ui_integration.cpp +++ b/Telegram/SourceFiles/core/ui_integration.cpp @@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/click_handler_types.h" #include "ui/basic_click_handlers.h" #include "ui/emoji_config.h" +#include "ui/style/style_core_custom_font.h" #include "lang/lang_keys.h" #include "platform/platform_specific.h" #include "boxes/url_auth_box.h" @@ -113,28 +114,16 @@ void UiIntegration::activationFromTopPanel() { Platform::IgnoreApplicationActivationRightNow(); } -/* -void UiIntegration::startFontsBegin() { - if (!cMainFont().isEmpty()) { - style::internal::CustomMainFont = cMainFont(); - } - if (!cSemiboldFont().isEmpty()) { - style::internal::CustomSemiboldFont = cSemiboldFont(); - } - if (cSemiboldFontIsBold()) { - style::internal::CustomSemiboldIsBold = cSemiboldFontIsBold(); - } - if (!cMonospaceFont().isEmpty()) { - style::internal::CustomMonospaceFont = cMonospaceFont(); - } - if (cUseSystemFont()) { - style::internal::UseSystemFont = cUseSystemFont(); - } - if (cUseOriginalMetrics()) { - style::internal::UseOriginalMetrics = cUseOriginalMetrics(); - } +style::CustomFontSettings UiIntegration::fontSettings() { + return { + cMainFont(), + cSemiboldFont(), + cMonospaceFont(), + cSemiboldFontIsBold(), + cUseSystemFont(), + cUseOriginalMetrics(), + }; } -*/ bool UiIntegration::screenIsLocked() { return Global::ScreenIsLocked(); diff --git a/Telegram/SourceFiles/core/ui_integration.h b/Telegram/SourceFiles/core/ui_integration.h index 2f9cfc618..811aa6903 100644 --- a/Telegram/SourceFiles/core/ui_integration.h +++ b/Telegram/SourceFiles/core/ui_integration.h @@ -42,6 +42,7 @@ public: void activationFromTopPanel() override; bool screenIsLocked() override; + style::CustomFontSettings fontSettings() override; QString timeFormat() override; std::shared_ptr createLinkHandler(