]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt/GuiFontLoader.cpp
Allow compiling with Qt6
[lyx.git] / src / frontends / qt / GuiFontLoader.cpp
index 80d45f6afcc5d0571a613c6540a6beabce676ddc..a47e55509295e8a05017029bc07637a9a86f7e54 100644 (file)
@@ -14,7 +14,7 @@
 #include "GuiFontLoader.h"
 
 #include "FontLoader.h"
-#include "FontInfo.h"
+#include "Font.h"
 #include "GuiFontMetrics.h"
 #include "qt_helpers.h"
 
@@ -29,6 +29,8 @@
 #include "support/Package.h"
 #include "support/os.h"
 
+#include "GuiApplication.h"
+
 #include <QFontInfo>
 #include <QFontDatabase>
 
@@ -129,8 +131,8 @@ GuiFontInfo & fontinfo(FontInfo const & f)
             (f.size() < NUM_SIZE);
     if (!fontIsRealized) {
         // We can reset the font to something sensible in release mode.
+        LYXERR0("Unrealized font!" << f);
         LATTEST(false);
-        LYXERR0("Unrealized font!");
         FontInfo f2 = f;
         f2.realize(sane_font);
         GuiFontInfo * & fi = fontinfo_ptr(f2);
@@ -207,14 +209,16 @@ QFont symbolFont(QString const & family, bool * ok)
        upper[0] = family[0].toUpper();
 
        QFont font;
-#if defined Q_WS_X11 || defined(QPA_XCB)
-       // On *nix we have to also specify the foundry to be able to
-       // discriminate our fonts when the texlive fonts are managed by
-       // fontconfig. Unfortunately, doing the same on Windows breaks things.
-       font.setFamily(family + QLatin1String(" [LyEd]"));
-#else
-       font.setFamily(family);
-#endif
+       if (guiApp->platformName() == "qt4x11"
+           || guiApp->platformName() == "xcb"
+           || guiApp->platformName().contains("wayland")) {
+               // On *nix we have to also specify the foundry to be able to
+               // discriminate our fonts when the texlive fonts are managed by
+               // fontconfig. Unfortunately, doing the same on Windows breaks things.
+               font.setFamily(family + QLatin1String(" [LyEd]"));
+       } else {
+               font.setFamily(family);
+       }
        font.setStyleStrategy(QFont::NoFontMerging);
 #if QT_VERSION >= 0x040800
        font.setStyleName("LyX");