Hi, i am trying to create an archlinux installer. There i have qt5ct configured to use Roboto font. I also tried to create ~/.config/fontconfig/fonts.conf file using qt5ct itself and by hand as well to set a fixed dpi (96) settings. I also tried to set font settings in /etc/fonts/local.conf as per the arch wiki. But whatever i do Qt5 fonts are way bigger than the Gtk apps. I haven't installed Virtualbox guest drivers, my theory is if gtk can get it right qt can too. Anyway here is my setup -
OS - Archlinux 64 bit
Fontconfig version - 2.13.91
Virtualbox version - 6.1
Qt - 5.15.1
Qt5ct version - 1.1
~/.config/fontconfig/fonts.conf file content -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
<edit name="rgba" mode="assign">
<const>none</const>
</edit>
<edit name="autohint" mode="assign">
<bool>false</bool>
</edit>
<edit name="lcdfilter" mode="assign">
<const>lcdnone</const>
</edit>
<edit name="dpi" mode="assign">
<double>96</double>
</edit>
</match>
</fontconfig>
I have also attached a screenshot of showing a gtk and a qt app side by side to compare. Please let me if i am doing something wrong or there is a fix for it. Thanks in advance, I really hope you keep working on this project.
Hi, try to play with QT_AUTO_SCREEN_SCALE_FACTOR and other variables: https://doc.qt.io/qt-5/highdpi.html
Hi, I found both the reason and the solution.
Reason is - virtualbox sets a weird dpi settings when virtualbox driver isn't installed. Qemu handles that part better. Apparantly gtk tries to override any weird dpi settings and falls back to 96x96, but qt doesn't.
Solution - I have added and edited a few xorg related files. First i put
~/.xprofilewith the following content -Then it is sourced by display managers. But to start x without display manager, i added the following lines to
~/.xinitrcfile -These lines must be before any exec command. Anyway i have also added a
~/.Xresourceswith the following content in it -This solved the problem. Thanks to Arch Wiki.
I hope anyone else looking for same issue, will find it helpful.