diff options
| author | Mike Skec <skec@protonmail.ch> | 2021-02-27 09:23:59 +1100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2021-02-27 11:47:39 +0100 |
| commit | 23feba7e5a1396110d543a676e018bcbdfa50d39 (patch) | |
| tree | d4e2a6fed26a490a5ba2df4f755f6ad90b2203b1 /src/documentstyle.cpp | |
| parent | 435532d97dcfbb23e46f51f690914fd910cc65ee (diff) | |
| download | kristall-23feba7e5a1396110d543a676e018bcbdfa50d39.tar.gz | |
Adds emoji toggle preference.
Diffstat (limited to 'src/documentstyle.cpp')
| -rw-r--r-- | src/documentstyle.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/documentstyle.cpp b/src/documentstyle.cpp index 5edef73..11d29e7 100644 --- a/src/documentstyle.cpp +++ b/src/documentstyle.cpp @@ -430,6 +430,8 @@ DocumentStyle DocumentStyle::derive(const QUrl &url) const auto const patchup_font = [](QFont & font, bool fixed=false) { // Set the "fallback" font, just to be absolutely sure. + // Note the main purpose of this is to avoid emoji fonts + // from taking precedence over text fonts. // (fixes *nix default font issues) emojiFonts[1] = fixed ? kristall::default_font_family_fixed @@ -438,7 +440,7 @@ DocumentStyle DocumentStyle::derive(const QUrl &url) const // Set the primary font as the preferred font. // We ensure that the font family is available first, // so that we don't get an ugly default font - // (fixes Windows' default font) + // (fixes Windows' default font problem) QFontDatabase db; if (!db.families().contains(font.family())) { @@ -451,12 +453,16 @@ DocumentStyle DocumentStyle::derive(const QUrl &url) const emojiFonts.front() = font.family(); } - // We don't support emoji fonts on lower than Qt 5.13 - #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) - font.setFamily(emojiFonts.front()); - #else - font.setFamilies(emojiFonts); - #endif + // Set emoji fonts if supported and enabled. + if (kristall::EMOJIS_SUPPORTED && + kristall::options.emojis_enabled) + { + font.setFamilies(emojiFonts); + } + else + { + font.setFamily(emojiFonts.front()); + } }; patchup_font(themed.h1_font); |
