Page 1 of 1

XnView 1.8.6 does not honor system font settings on KDE Plasma 6

Posted: Sat Mar 29, 2025 8:59 pm
by bvitnik
Hi.

After upgrading KDE from 5.x to 6.3, XnView MP is using wrong font and font size for UI. My understanding is that this comes from XnView being based on Qt 5 and using it's own distribution of Qt 5 vs KDE using Qt 6. If I run XnView with:

Code: Select all

QT_DEBUG_PLUGINS=1 xnview
I get some insight into the problem:

Code: Select all

QFactoryLoader::QFactoryLoader() checking directory path "/opt/XnView/lib/platformthemes" ...
QFactoryLoader::QFactoryLoader() looking at "/opt/XnView/lib/platformthemes/libqgtk2.so"
Found metadata in lib /opt/XnView/lib/platformthemes/libqgtk2.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
        "Keys": [
            "gtk2"
        ]
    },
    "archreq": 0,
    "className": "QGtk2ThemePlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("gtk2")
QFactoryLoader::QFactoryLoader() looking at "/opt/XnView/lib/platformthemes/libqgtk3.so"
Found metadata in lib /opt/XnView/lib/platformthemes/libqgtk3.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
        "Keys": [
            "gtk3"
        ]
    },
    "archreq": 0,
    "className": "QGtk3ThemePlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("gtk3")
QFactoryLoader::QFactoryLoader() looking at "/opt/XnView/lib/platformthemes/libqt5ct.so"
Found metadata in lib /opt/XnView/lib/platformthemes/libqt5ct.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
        "Keys": [
            "qt5ct"
        ]
    },
    "archreq": 0,
    "className": "Qt5CTPlatformThemePlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("qt5ct")
QFactoryLoader::QFactoryLoader() looking at "/opt/XnView/lib/platformthemes/libqxdgdesktopportal.so"
Found metadata in lib /opt/XnView/lib/platformthemes/libqxdgdesktopportal.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
        "Keys": [
            "xdgdesktopportal",
            "flatpak",
            "snap"
        ]
    },
    "archreq": 0,
    "className": "QXdgDesktopPortalThemePlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("xdgdesktopportal", "flatpak", "snap")
QFactoryLoader::QFactoryLoader() checking directory path "/opt/XnView/platformthemes" ...
QFont::fromString: Invalid description 'Noto Sans,8,-1,5,400,0,0,0,0,0,0,0,0,0,0,1'
QFont::fromString: Invalid description 'Hack,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1'
QFont::fromString: Invalid description 'Noto Sans,8,-1,5,400,0,0,0,0,0,0,0,0,0,0,1'
QFont::fromString: Invalid description 'Noto Sans,8,-1,5,400,0,0,0,0,0,0,0,0,0,0,1'
So it seems that XnView/Qt5 does not understand the new font specifications used in new KDE/Qt6. A little bit of Googling points to these pages:

https://discuss.kde.org/t/how-to-set-qt ... vianovella
https://forum.endeavouros.com/t/plasma- ... apps/52280

The solution for Qt 5 apps under KDE Plasma 6 in general is to install "plasma-integration5" package (or similar), i.e. /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/KDEPlasmaPlatformTheme5.so library. Unfortunately it does not affect XnView, presumably because it uses it's own distribution of Qt 5 libraries.

Out of curiosity, I tried linking this library from "/opt/XnView/lib/platformthemes":

Code: Select all

/opt/XnView/lib/platformthemes/KDEPlasmaPlatformTheme5.so -> /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/KDEPlasmaPlatformTheme5.so
but it does not work:

Code: Select all

QFactoryLoader::QFactoryLoader() checking directory path "/opt/XnView/platformthemes" ...
Cannot load library /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/KDEPlasmaPlatformTheme5.so: (/lib/x86_64-linux-gnu/libKF5GuiAddons.so.5: undefined symbol: _ZN23QWaylandClientExtensionD2Ev, version Qt_5)
QLibraryPrivate::loadPlugin failed on "/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/KDEPlasmaPlatformTheme5.so" : "Cannot load library /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/KDEPlasmaPlatformTheme5.so: (/lib/x86_64-linux-gnu/libKF5GuiAddons.so.5: undefined symbol: _ZN23QWaylandClientExtensionD2Ev, version Qt_5)"
QFont::fromString: Invalid description 'Noto Sans,8,-1,5,400,0,0,0,0,0,0,0,0,0,0,1'
QFont::fromString: Invalid description 'Hack,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1'
QFont::fromString: Invalid description 'Noto Sans,8,-1,5,400,0,0,0,0,0,0,0,0,0,0,1'
QFont::fromString: Invalid description 'Noto Sans,8,-1,5,400,0,0,0,0,0,0,0,0,0,0,1'
So, in the end, the question is: "Is there a way around this"? Can XnView be made to work with KDE Plasma 6 and honor system font settings?