diff --git a/ui/style/style_core.cpp b/ui/style/style_core.cpp index 4232be6..15a34f4 100644 --- a/ui/style/style_core.cpp +++ b/ui/style/style_core.cpp @@ -20,7 +20,7 @@ namespace style { namespace internal { -bool GetUseSystemFont(); +extern bool UseSystemFont; namespace { @@ -32,7 +32,6 @@ auto PaletteChanges = rpl::event_stream<>(); auto ShortAnimationRunning = rpl::variable(false); auto RunningShortAnimations = 0; auto ResolvedMonospaceFont = style::font(); -QString CustomMonospaceFont; std::vector &StyleModules() { static auto result = std::vector(); @@ -58,7 +57,7 @@ void ResolveMonospaceFont() { if (!CustomMonospaceFont.isEmpty()) { tryFont(CustomMonospaceFont); } - if (!GetUseSystemFont()) { + if (!UseSystemFont) { tryFont("Consolas"); tryFont("Liberation Mono"); tryFont("Menlo"); @@ -74,9 +73,7 @@ void ResolveMonospaceFont() { } // namespace -void SetMonospaceFont(const QString &familyName) { - CustomMonospaceFont = familyName; -} +QString CustomMonospaceFont; void registerModule(ModuleBase *module) { StyleModules().push_back(module); diff --git a/ui/style/style_core.h b/ui/style/style_core.h index ce6ced5..9ed088e 100644 --- a/ui/style/style_core.h +++ b/ui/style/style_core.h @@ -15,6 +15,8 @@ namespace style { namespace internal { +extern QString CustomMonospaceFont; + // Objects of derived classes are created in global scope. // They call [un]registerModule() in [de|con]structor. class ModuleBase { @@ -25,8 +27,6 @@ public: }; -void SetMonospaceFont(const QString &familyName); - void registerModule(ModuleBase *module); [[nodiscard]] QColor EnsureContrast(const QColor &over, const QColor &under); diff --git a/ui/style/style_core_font.cpp b/ui/style/style_core_font.cpp index 2b565d2..192ff85 100644 --- a/ui/style/style_core_font.cpp +++ b/ui/style/style_core_font.cpp @@ -167,38 +167,14 @@ QString FontTypeWindowsFallback[FontTypesCount] = { bool Started = false; QString Overrides[FontTypesCount]; +} // namespace + QString CustomMainFont; QString CustomSemiboldFont; bool CustomSemiboldIsBold = false; bool UseSystemFont = false; bool UseOriginalMetrics = false; -} // namespace - -bool GetUseSystemFont() { - return UseSystemFont; -} - -void SetMainFont(const QString &familyName) { - CustomMainFont = familyName; -} - -void SetSemiboldFont(const QString &familyName) { - CustomSemiboldFont = familyName; -} - -void SetSemiboldIsBold(bool isBold) { - CustomSemiboldIsBold = isBold; -} - -void SetUseSystemFont(bool isSystemFont) { - UseSystemFont = isSystemFont; -} - -void SetUseOriginalMetrics(bool isOriginal) { - UseOriginalMetrics = isOriginal; -} - void StartFonts() { if (Started) { return; diff --git a/ui/style/style_core_font.h b/ui/style/style_core_font.h index f936290..c988510 100644 --- a/ui/style/style_core_font.h +++ b/ui/style/style_core_font.h @@ -14,11 +14,11 @@ namespace style { namespace internal { -void SetMainFont(const QString &familyName); -void SetSemiboldFont(const QString &familyName); -void SetSemiboldIsBold(bool isBold); -void SetUseSystemFont(bool isSystemFont); -void SetUseOriginalMetrics(bool isOriginal); +extern QString CustomMainFont; +extern QString CustomSemiboldFont; +extern bool CustomSemiboldIsBold; +extern bool UseSystemFont; +extern bool UseOriginalMetrics; void StartFonts(); [[nodiscard]] QString GetFontOverride(const QString &familyName, int32 flags = 0);