Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
[SOLVED] Text rendering for Qt programs on gnome
[SOLVED] Text rendering for Qt programs on gnome
Hi, I just have installed debian 9 using gnome live image. Almost everything was good so far (except a few things like trust.gpg and netwoking service which could be solved easily). But when I tried to open a qt program (qtcreator actually) fonts were broken and ugly. Tried a few things like playing with /etc/fonts/ config files but it's still sh*t. Dunno what to do.
Last edited by nixmd on 2018-07-09 06:29, edited 1 time in total.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Text rendering for Qt programs on gnome
Please list everything you have tried in order to prevent duplication of effort by any who choose to assist you.nixmd wrote:Tried a few things like playing with /etc/fonts/ config files
Here is a general guide for making Qt applications work in a Gtk desktop:
https://wiki.archlinux.org/index.php/Un ... plications
It is intended for Arch but can be adapted for Debian.
deadbang
Re: Text rendering for Qt programs on gnome
I configure my rendering in ${HOME}/.Xresources:Head_on_a_Stick wrote: Please list everything you have tried in order to prevent duplication of effort by any who choose to assist you.
Code: Select all
Xft.antialias: 1
Xft.autohint: 0
Xft.dpi: 96
Xft.hinting: 0
Xft.hintstyle: hintnone
Xft.lcdfilter: lcddefault
Xft.rgba: rgb
/etc/fonts/local.conf:
Code: Select all
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font"> <edit mode="append" name="antialias"> <bool>true</bool> </edit></match>
<match target="font"> <edit mode="append" name="autohint"> <bool>false</bool> </edit></match>
<match target="font"> <edit mode="append" name="hintstyle"> <const>hintnone</const> </edit></match>
<match target="font"> <edit mode="append" name="hinting"> <bool>false</bool> </edit></match>
<match target="pattern"> <edit mode="append" name="lcdfilter"> <const>lcddefault</const> </edit></match>
<alias>
<family>sans-serif</family>
<prefer>
<family>Noto Sans</family>
<family>Arimo</family>
<family>Liberation Sans</family>
<family>DejaVu Sans</family>
</prefer>
</alias>
<alias>
<family>serif</family>
<prefer>
<family>Noto Serif</family>
<family>Tinos</family>
<family>Liberation Serif</family>
<family>DejaVu Serif</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Noto Mono</family>
<family>Cousine</family>
<family>Liberation Mono</family>
<family>DejaVu Sans Mono</family>
</prefer>
</alias>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Verdana</string></test>
<edit binding="same" mode="prepend" name="family"><string>DejaVu Sans</string></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Arial Black</string></test>
<edit binding="same" mode="prepend" name="family"><string>DejaVu Sans</string></edit>
<edit mode="assign" name="weight"><double>200</double></edit>
</match>
<match target="font"> <!-- Switch off hinging for DejaVu Sans -->
<test compare="eq" name="family" qual="any"><string>DejaVu Sans</string></test>
<edit name="hinting" mode="assign"><bool>false</bool></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Tahoma</string></test>
<edit binding="same" mode="prepend" name="family"><string>Noto Sans</string></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Arial</string></test>
<edit binding="same" mode="prepend" name="family"><string>Arimo</string></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Times New Roman</string></test>
<edit binding="same" mode="prepend" name="family"><string>Tinos</string></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Georgia</string></test>
<edit binding="same" mode="prepend" name="family"><string>Noto Serif</string></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Impact</string></test>
<edit binding="same" mode="prepend" name="family"><string>Noto Serif</string></edit>
<edit mode="assign" name="weight"><double>200</double></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Courier New</string></test>
<edit binding="same" mode="prepend" name="family"><string>Nimbus Mono L</string></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Trebuchet MS</string></test>
<edit binding="same" mode="prepend" name="family"><string>Linux Biolinum O</string></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Lucida Console</string></test>
<edit binding="same" mode="prepend" name="family"><string>DejaVu Sans Mono</string></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Lucida Sans Unicode</string></test>
<edit binding="same" mode="prepend" name="family"><string>DejaVu Sans</string></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Palatinio Linotype</string></test>
<edit binding="same" mode="prepend" name="family"><string>URW Palladio L</string></edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any"><string>Consolas</string></test>
<edit binding="same" mode="prepend" name="family"><string>Inconsolata</string></edit>
</match>
</fontconfig>
- stevepusser
- Posts: 12930
- Joined: 2009-10-06 05:53
- Has thanked: 41 times
- Been thanked: 71 times
Re: Text rendering for Qt programs on gnome
In MX Linux, we get Qt 5 programs to follow the GTK look in xfce4 by adding a /etc/X11/Xsession.d/98qtconfig file with the contents:
I think it will work in GNOME if you chose a theme with both GTK 2 and 3 support; Arc is one such.
Code: Select all
[ "$XDG_CURRENT_DESKTOP" != "KDE" ] && {
export QT_QPA_PLATFORMTHEME=gtk2
export QT_PLATFORMTHEME=gtk2
export QT_PLATFORM_PLUGIN=gtk2
}
MX Linux packager and developer
Re: Text rendering for Qt programs on gnome
tried that. didn't workstevepusser wrote:In MX Linux, we get Qt 5 programs to follow the GTK look in xfce4 by adding a /etc/X11/Xsession.d/98qtconfig file with the contents:
I think it will work in GNOME if you chose a theme with both GTK 2 and 3 support; Arc is one such.Code: Select all
[ "$XDG_CURRENT_DESKTOP" != "KDE" ] && { export QT_QPA_PLATFORMTHEME=gtk2 export QT_PLATFORMTHEME=gtk2 export QT_PLATFORM_PLUGIN=gtk2 }
This is actually what I get here.
left is text in Qt, right is in Gtk
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Text rendering for Qt programs on gnome
That file is not read by all programs.nixmd wrote:I configure my rendering in ${HOME}/.Xresources
Use ~/.config/fontconfig/fonts.conf, try this for more information:
Code: Select all
zcat /usr/share/doc/fontconfig/fontconfig-user.txt.gz
Here's my fonts.conf for aliasing and hinting, note that the settings are "assign"ed rather than "append"ed as in your file, I don't know how much difference that makes:
Code: Select all
<fontconfig>
<match target="font">
<edit mode="assign" name="hinting" >
<bool>true</bool>
</edit>
<edit mode="assign" name="autohint" >
<bool>true</bool>
</edit>
<edit mode="assign" name="hintstyle" >
<const>hintslight</const>
</edit>
<edit mode="assign" name="rgba" >
<const>rgb</const>
</edit>
<edit mode="assign" name="antialias" >
<bool>true</bool>
</edit>
<edit mode="assign" name="lcdfilter">
<const>lcddefault</const>
</edit>
</match>
</fontconfig>
Did you also install the qt5-style-plugins & libqt5svg5 packages? They are required in my dwm desktop:nixmd wrote:tried that. didn't work
^ As you can see, my fonts are lovely under Qt5
deadbang
Re: Text rendering for Qt programs on gnome
Thanks @Head_on_a_Stick
I tried fonts.conf and now my fonts are nice and good looking!
I tried fonts.conf and now my fonts are nice and good looking!