KDE: XnView doesn't use user system font
Moderators: helmut, XnTriq, xnview, Dreamer
KDE: XnView doesn't use user system font
In 2016 it is normal to configure one's font in the control panel, regardless whether that's in KDE, GNOME, Windows or other, and have programs use the user's chosen font in their interface, and use the user's chosen monospace font for monospace interface elements. However XnView MP seems to have a hard-coded horrible Courier New font for everything. As a result, every program on my system uses the same font except for XnView MP which stands out like a sore thumb. Please make XnView MP inherit the user's font(s).
https://i.imgur.com/8iH4yfv.png
https://i.imgur.com/8iH4yfv.png
Re: User system font
Which GUI toolkit does XnView MP use?
I don't have that font selected as my default font in KDE or Qt5. Gtk+ is set to use my KDE theme.
I don't have that font selected as my default font in KDE or Qt5. Gtk+ is set to use my KDE theme.
Re: KDE: XnView doesn't use user system font
Add in xnview.sh export KDEHOME=~/.kde4 Works on Arch Linux KDE Plasma 5, interface font looks good, same as in system, but the font under the picture is just as bad.
Re: KDE: XnView doesn't use user system font
I have the same issue on Antergos (Arch based). Not using KDE though, installed with XFCE but I'm using i3 window manager.
Running
I get
Therefore, font XnView seems to be using is /usr/share/fonts/TTF/GoudyBookletter1911.ttf which is very close to Courier News (that font is part of the ttf-google-fonts package). If I remove, or symlink that file to another one, XnView will display another strange font entirely (called /usr/share/fonts/TTF/UnifrakturMaguntia-Book.ttf
I tried "qt5ct" (adding export QT_QPA_PLATFORMTHEME="qt5ct" in ~/.profile) but the font changes for the system but not XnView.
It seems the Qt library uses a default font instead?
3 days of trying. Any idea?

EDIT: I noticed these two lines in XnView output in terminal, could be related?
Running
Code: Select all
lsof -p $(pgrep XnView) | awk '/fonts/ {print $NF}'
Code: Select all
/usr/share/fonts/TTF/NanumGothic-Regular.ttf
/usr/share/fonts/TTF/DroidSansJapanese.ttf
/usr/share/fonts/TTF/NotoSans-Regular.ttf
/usr/share/fonts/TTF/AdobeBlank-Regular.ttf
/usr/share/fonts/TTF/GoudyBookletter1911.ttf
I tried "qt5ct" (adding export QT_QPA_PLATFORMTHEME="qt5ct" in ~/.profile) but the font changes for the system but not XnView.
It seems the Qt library uses a default font instead?
3 days of trying. Any idea?

EDIT: I noticed these two lines in XnView output in terminal, could be related?
Code: Select all
Fontconfig error: line 39460095: syntax error
Fontconfig error: Cannot load default config file
Last edited by pangwolin on Thu Dec 15, 2016 11:31 pm, edited 1 time in total.
Re: KDE: XnView doesn't use user system font
After doing an , I noticed that XnViewMP tries to load libraries from a LOT of non existing paths. Which explains why it's so slow to start!
Then, I see this output regarding the missing fontconfig config:
What is it expecting from /etc/fonts/fonts.conf exactly? It's formatted correctly for me.
I don't get what that "8192" number means in that "read" syscall. Any idea?
Also, that "error: line 30442431" is always a random number like that one every time I start the program.
After that, it scrapes all the fonts directories... and I noticed right after the Goudy font a strange "brk" syscall... which doesn't occur on other font files? That could explain why it's using that font eventually?
If I remove the GoudtBookletter font from the /fonts directory, there is no "brk" and Unifraktur is (for some reason) the last font read after a bunch of tried in "cache" font files...
Could be that the problem is due to libfontconfig.so that Xnview uses to parse /etc/fonts/fonts.conf. Mine is "/usr/lib/fontconfig.so.1.9.2" and it seems XnView loads it into memory (although ldd doesn't display it, only shows an entry for libfreetype.so.6).
Do I need an outdated version or something? Haha...
Any idea?
Code: Select all
strace xnviewmp &> /tmp/xnview_strace
Then, I see this output regarding the missing fontconfig config:
Code: Select all
open("/etc/fonts/fonts.conf", O_RDONLY|O_CLOEXEC) = 10
read(10, "<?xml version=\"1.0\"?>\n<!DOCTYPE "..., 8192) = 2333
write(2, "Fontconfig error: line 30442431:"..., 33Fontconfig error: line 30442431: ) = 33
write(2, "syntax error", 12syntax error) = 12
[...]
write(2, "Fontconfig error: ", 18Fontconfig error: ) = 18
write(2, "Cannot load default config file", 31Cannot load default config file) = 31
I don't get what that "8192" number means in that "read" syscall. Any idea?
Also, that "error: line 30442431" is always a random number like that one every time I start the program.
After that, it scrapes all the fonts directories... and I noticed right after the Goudy font a strange "brk" syscall... which doesn't occur on other font files? That could explain why it's using that font eventually?
Code: Select all
munmap(0x7f675e9ed000, 110336) = 0
stat("/usr/share/fonts/TTF/GoudyBookletter1911.ttf", {st_mode=S_IFREG|0644, st_size=73496, ...}) = 0
open("/usr/share/fonts/TTF/GoudyBookletter1911.ttf", O_RDONLY) = 11
fcntl(11, F_SETFD, FD_CLOEXEC) = 0
fstat(11, {st_mode=S_IFREG|0644, st_size=73496, ...}) = 0
mmap(NULL, 73496, PROT_READ, MAP_PRIVATE, 11, 0) = 0x7f675e9f6000
close(11) = 0
brk(0x1fd2000) = 0x1fd2000
munmap(0x7f675e9f6000, 73496)
stat("/usr/share/fonts/TTF/Graduate-Regular.ttf", {st_mode=S_IFREG|0644, st_size=22732, ...}) = 0
[...]
Could be that the problem is due to libfontconfig.so that Xnview uses to parse /etc/fonts/fonts.conf. Mine is "/usr/lib/fontconfig.so.1.9.2" and it seems XnView loads it into memory (although ldd doesn't display it, only shows an entry for libfreetype.so.6).
Code: Select all
open("/opt/xnviewmp/lib/libfontconfig.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/opt/xnviewmp/Plugins/libfontconfig.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/opt/xnviewmp/lib/platforms/../../lib/libfontconfig.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libfontconfig.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300q\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=277960, ...}) = 0
mmap(NULL, 2373672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f674c8e4000
mprotect(0x7f674c922000, 2093056, PROT_NONE) = 0
mmap(0x7f674cb21000, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3d000) = 0x7f674cb21000
close(3) = 0
Any idea?
Re: KDE: XnView doesn't use user system font
XnVew is the only program that glitches with libfontconfig.so.1.9.2 on my system.
I have tried with a libfontconfig.so.1.9.0 from an ubuntu 16.04.1 install, same glitch and error.
Anyway, I have managed to fix the font being the wrong one by doing this (thanks to the Arch Linux AUR users)
* mv qt.conf qt.bak
* edit xnview.sh and change for
That way I'm using my system's Qt libraries (which are up to date, I suppose...)
The last line is the only way to fix the font rendering issue: it essentially uses whatever is set up in qt5ct to override the default hardcoded fonts in xnviewmp/Qt libs.
The problem is still there though: fontconfig still produces this error, and XnView crawls ALL the system font directories which makes it load really slow!
Does anyone have advice on how to fix that?
EDIT: I tried symlinking libfontconfig into /opt/xnview/lib and it doesn't seem to crawl fonts anymore!?
Let us know if this fixed your problem too.
I have tried with a libfontconfig.so.1.9.0 from an ubuntu 16.04.1 install, same glitch and error.
Anyway, I have managed to fix the font being the wrong one by doing this (thanks to the Arch Linux AUR users)
* mv qt.conf qt.bak
* edit xnview.sh and change for
Code: Select all
export LD_LIBRARY_PATH="/usr/lib:$dirname/Plugins"
export QT_PLUGIN_PATH="/usr/lib"
QT_QPA_PLATFORMTHEME=qt5ct
The last line is the only way to fix the font rendering issue: it essentially uses whatever is set up in qt5ct to override the default hardcoded fonts in xnviewmp/Qt libs.
The problem is still there though: fontconfig still produces this error, and XnView crawls ALL the system font directories which makes it load really slow!
Does anyone have advice on how to fix that?
EDIT: I tried symlinking libfontconfig into /opt/xnview/lib and it doesn't seem to crawl fonts anymore!?
Code: Select all
sudo ln -s /usr/lib/libfontconfig.so.1.9.2 /opt/xnviewmp/lib/libfontconfig.so.1
Re: KDE: XnView doesn't use user system font
No feedback from problem reporter.
Closed (Please post here in case the problem still occurs).
