Fonts in GTK-apps look bad when started from within KDE and not from console
Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Fonts in GTK-apps look bad when started from within KDE and not from console
Hi guys,
I've followed this guide and modified my fonts via the xml-files in /etc/fonts.
Everything worked perfectly and the fonts in both my QT- and my GTK-applications look exactly as I want them to look.
Now the problem. When I boot into console mode (run level 3), add a GTK-app like for example Firefox to my .xinitrc and do a "startx", the fonts look great.
However when I boot into KDE (run level 5) and start Firefox (or any other GTK-app) from within KDE, the fonts look absolutely rubbish.
In my KDE appearance settings I've set "Use anti-aliasing" to "System Settings" and "Force Fonts DPI" to "disabled".
I have neither a ".fonts.conf" nor a ".gtkrc" in my home directory that could interfere.
My screen is set up correctly via xorg.conf:
Code:
schorsch@archie:~$ xdpyinfo | grep -E "(dim|resol)"
dimensions: 1440x900 pixels (381x238 millimeters)
resolution: 96x96 dots per inch
schorsch@archie:~$
I'm using KDE 4.2 on an Arch Linux box.
Does anybody know, what the problem might be? How can KDE screw up my GTK-apps? I always thought the KDE settings would only write to .fonts.conf in my home directory. Does it have some dubious way to mess with my fonts?
If you choose runlevel 5 and KDE, then KDE is your desktop environment. You may need to install the fonts in KDE. Find the "Control Center" in the KMenu, then go to System Administration > Font Installer
If you enter your root password and do it in Administrator mode, all users logging into KDE will have benefit of the installed fonts.
Well, I have installed the fonts via the Arch Linux package manager (pacman) and I can use all the fonts in KDE. I don't think that's the problem. In particular it works fine with all my Qt-apps. So the fonts are installed properly.
But thank you for the tipp. Do you have any other advice?
Well, I have installed the fonts via the Arch Linux package manager (pacman) and I can use all the fonts in KDE. I don't think that's the problem. In particular it works fine with all my Qt-apps. So the fonts are installed properly.
But thank you for the tipp. Do you have any other advice?
I see your point: KDE already has access to the fonts.
Try editing --or creating a userChrome.css file in this directory:
/home/silverbear/.mozilla/firefox/vute79sh.default/chrome
Obviously substitute your own username and whatever profile codename you have instead of "vute79sh.default"
If there isn't a userChrome.css file in that directory, you can edit the existing userChrome-example.css file and save it as userChrome.css
Add an entry thus:
Code:
menu {
font-family : "exactname_of_font" !important ;
}
For the font-family line by "exactname_of_font" I mean copy the name of the installed font, and put it in quote marks, and after a whitespace type
!important
You may need to also put a line for font size, like so:
This is standard CSS, so you must include everything inside the opening & closing {} brackets of menu. And each line must have a colon ( : ) between the item and the value. And each line must end with a semicolon ( ; ).
This can't permanently hurt anything, and if tweaking it doesn't work out well, delete the file.
Obviously, if userChrome.css already exists, back it up in a safe location before screwing with it.
Good Luck, Archer! One way or another we can do this.
BTW, in a shameless plug for rep, I say: click my "Thanks" button if this works for you.
Good Luck, Archer! One way or another we can do this.
BTW, in a shameless plug for rep, I say: click my "Thanks" button if this works for you.
I'll do that when we come up with a working solution. ;-) However you misunderstood my initial problem. I was having problems with ALL gtk-apps, not only with firefox. So the css-file wouldn't have helped.
After reinstalling some fonts and doing a "fc-cache -f", the GTK-Apps look fine now. I don't know what the problem actually was.
However I still have the same problem with Firefox's web site rendering, which brings me to SilverBear's advice...
Nevertheless I'm hesitating to follow your advice, for two reasons:
1.) Like said: the fonts / web site rendering is perfect when I start Firefox from console in run level 3. I don't want to fiddle with Firefox files for now, as long as I don't know why it works from console but not from KDE.
Do you understand what I mean? It works, but somehow KDE screws it up. So Firefox's settings must be correct, otherwise it would look ugly from console, too.
Does that make sense to you?
2.) The CSS-file only affects the Firefox GUI-elements and not the web site rendering if I'm not mistaken. Please, correct me on that.
Are there any KDE files that could interfere with GTK-font rendering and/or Firefox font rendering?
How do font settings in .Xresources and .XProfile interact with settings in /etc/fonts and/or ~/.fonts.conf? What's the difference, which one is responsible for what and which one overrules which when it comes to anti-aliasing and such?
I'll do that when we come up with a working solution. ;-) However you misunderstood my initial problem. I was having problems with ALL gtk-apps, not only with firefox. So the css-file wouldn't have helped.
After reinstalling some fonts and doing a "fc-cache -f", the GTK-Apps look fine now. I don't know what the problem actually was.
However I still have the same problem with Firefox's web site rendering, which brings me to SilverBear's advice...
Nevertheless I'm hesitating to follow your advice, for two reasons:
1.) Like said: the fonts / web site rendering is perfect when I start Firefox from console in run level 3. I don't want to fiddle with Firefox files for now, as long as I don't know why it works from console but not from KDE.
Do you understand what I mean? It works, but somehow KDE screws it up. So Firefox's settings must be correct, otherwise it would look ugly from console, too.
Does that make sense to you?
2.) The CSS-file only affects the Firefox GUI-elements and not the web site rendering if I'm not mistaken. Please, correct me on that.
Are there any KDE files that could interfere with GTK-font rendering and/or Firefox font rendering?
How do font settings in .Xresources and .XProfile interact with settings in /etc/fonts and/or ~/.fonts.conf? What's the difference, which one is responsible for what and which one overrules which when it comes to anti-aliasing and such?
You're right: I misunderstood the scope of the problem.
Some thoughts:
Quote:
2.) The CSS-file only affects the Firefox GUI-elements and not the web site rendering if I'm not mistaken. Please, correct me on that.
That CSS is for the GUI, yes. You should be able to set website rendering via Edit > Preferences > Content > Fonts & Colors > Advanced, or via CSS in userContent.css.
But, yes, it sounds like it is KDE screwing things up.
Try creating another user, and see if when logging into KDE as that user you get the same problem.
Is there a .fonts or .fontsconfig folder? Also, are you experiencing this problem in Arch or Ubuntu?
I've deleted .fontconfig several times, but it didn't help. There is no .fonts.
The problem occurs under Arch Linux with KDE 4.2
The content of my home folder is:
Code:
total 360
drwx------ 39 schorsch schorsch 4096 26. Feb 15:02 .
drwxr-xr-x 4 root root 4096 26. Feb 14:03 ..
-rw------- 1 schorsch schorsch 0 21. Feb 14:10 .ICEauthority
drwx------ 3 schorsch schorsch 4096 23. Feb 00:34 .Skype
-rw------- 1 schorsch schorsch 210 26. Feb 14:43 .Xauthority
drwx------ 3 schorsch schorsch 4096 16. Feb 18:07 .adobe
-rw-r--r-- 1 schorsch schorsch 149 18. Feb 19:18 .appletviewer
drwxr-xr-x 12 schorsch schorsch 4096 19. Feb 09:03 .azureus
-rw------- 1 schorsch schorsch 20673 26. Feb 14:43 .bash_history
-rw-r--r-- 1 schorsch schorsch 7 15. Feb 23:07 .bash_logout
-rw-r--r-- 1 schorsch schorsch 47 15. Feb 16:29 .bash_profile
-rw-r--r-- 1 schorsch schorsch 176 22. Feb 13:50 .bashrc
drwxr-xr-x 11 schorsch schorsch 4096 22. Feb 22:30 .config
drwx------ 3 schorsch schorsch 4096 16. Feb 09:25 .dbus
drwxr-xr-x 4 schorsch schorsch 4096 21. Feb 23:00 .designer
-rw------- 1 schorsch schorsch 22 22. Feb 22:02 .dmrc
drwxr-xr-x 3 schorsch schorsch 4096 16. Feb 18:11 .dvdcss
drwxr-xr-x 2 schorsch schorsch 4096 17. Feb 01:25 .etracer
drwxr-xr-x 2 schorsch schorsch 4096 17. Feb 01:20 .frozen-bubble
drwx------ 3 schorsch schorsch 4096 26. Feb 14:50 .gconf
drwx------ 2 schorsch schorsch 4096 26. Feb 14:57 .gconfd
drwx------ 4 schorsch schorsch 4096 17. Feb 13:51 .gegl-0.0
drwxr-xr-x 22 schorsch schorsch 4096 25. Feb 20:42 .gimp-2.6
drwx------ 3 schorsch schorsch 4096 21. Feb 22:36 .gnupg
drwxr-xr-x 2 schorsch schorsch 4096 22. Feb 16:10 .gstreamer-0.10
-rw-r--r-- 1 schorsch schorsch 61 22. Feb 11:22 .gtk-bookmarks
-rw-r--r-- 1 schorsch schorsch 331 25. Feb 21:49 .gtkrc-2.0-kde4
-rw-r--r-- 1 schorsch schorsch 331 25. Feb 21:49 .gtkrc2.0
drwx------ 2 schorsch schorsch 4096 16. Feb 11:26 .icedteaplugin
drwxr-xr-x 2 schorsch schorsch 4096 25. Feb 21:44 .icons
drwxr-xr-x 3 schorsch schorsch 4096 18. Feb 19:02 .java
drwx------ 3 schorsch schorsch 4096 16. Feb 18:10 .kde
drwx------ 6 schorsch schorsch 4096 20. Feb 10:00 .kde4
drwx------ 3 schorsch schorsch 4096 16. Feb 10:04 .local
drwx------ 3 schorsch schorsch 4096 16. Feb 18:07 .macromedia
drwx------ 5 schorsch schorsch 4096 25. Feb 21:44 .mozilla
drwxr-xr-x 2 schorsch schorsch 4096 19. Feb 08:10 .mplayer
-rw-r--r-- 1 schorsch schorsch 1103 23. Feb 15:21 .nvidia-settings-rc
drwxr-xr-x 3 schorsch schorsch 4096 17. Feb 13:51 .openoffice.org
drwx------ 9 schorsch schorsch 4096 19. Feb 09:54 .opera
drwxr-xr-x 3 schorsch schorsch 4096 18. Feb 23:32 .qbittorrent
drwxr-xr-x 2 schorsch schorsch 4096 16. Feb 18:10 .qt
-rw------- 1 schorsch schorsch 332 17. Feb 14:07 .recently-used
-rw------- 1 schorsch schorsch 8892 19. Feb 21:50 .recently-used.xbel
drwxr-xr-x 2 schorsch schorsch 4096 22. Feb 16:01 .themes
drwx------ 4 schorsch schorsch 4096 16. Feb 16:39 .thumbnails
drwx------ 3 schorsch schorsch 4096 16. Feb 22:03 .thunderbird
-rw------- 1 root root 626 22. Feb 13:48 .viminfo
drwxr-x--- 7 schorsch schorsch 4096 16. Feb 15:45 .wesnoth
drwxr-xr-x 2 schorsch schorsch 4096 19. Feb 18:29 .xine
-rwxr-xr-x 1 schorsch schorsch 237 26. Feb 11:41 .xinitrc
-rw------- 1 schorsch schorsch 113207 26. Feb 15:02 .xsession-errors
drwxr-xr-x 3 schorsch schorsch 4096 25. Feb 21:37 Desktop
drwxr-xr-x 7 schorsch schorsch 4096 25. Feb 07:53 Downloads
drwxr-xr-x 4 schorsch schorsch 4096 25. Feb 00:34 MyStuff
drwxr-xr-x 3 schorsch schorsch 4096 22. Feb 13:42 builds
-rw-r--r-- 1 schorsch schorsch 0 26. Feb 15:02 forum_output.txt
Both .gtkrc2.0 and .gtkrc-2.0-kde4 have the content:
Code:
# This file was written by KDE
# You can edit it in the KDE control center, under "GTK Styles and Fonts"
include "/usr/share/themes/kde4-oxygen/gtk-2.0/gtkrc"
include "/etc/gtk-2.0/gtkrc"
style "user-font"
{
font_name="Sans Serif"
}
widget_class "*" style "user-font"
gtk-theme-name="kde4-oxygen"
gtk-font-name="Sans Serif 10"
Solved it. I manually renamed the files under ~/.kde4 and kept rebooting KDE until I found the guilty one. What a time consuming nightmare!
It was "~/.kde4/share/config/kdeglobals"!
I don't know why redundant information is stored in this evil file, but apparently the font settings in there had not been updated and were therefor messing up my font settings.
I renamed the file, restarted KDE, fonts were fine. Rename again, restart, fonts were ugly. Then I deleted the file and ever since I've been a happy bunny. ^^
Solved it. I manually renamed the files under ~/.kde4 and kept rebooting KDE until I found the guilty one. What a time consuming nightmare!
It was "~/.kde4/share/config/kdeglobals"!
I don't know why redundant information is stored in this evil file, but apparently the font settings in there had not been updated and were therefor messing up my font settings.
I renamed the file, restarted KDE, fonts were fine. Rename again, restart, fonts were ugly. Then I deleted the file and ever since I've been a happy bunny. ^^
GREAT!
I've seen your exchange with folks on http://forum.kde.org about this file, and I have to agree that I don't understand it either.
To be honest, I quit using KDE on Arch when Arch changed over to KDE4 by default. Now that KDE4.2 is out I think I may try it again. As much as I have preferred KDE 3.5x, that is the past, not the future of KDE. So I need to learn the new system sometime. I still have Mepis 8 with KDE 3.5.10 to boot if I want the stable version.
Blackhole, I just have some lingering doubts that deleting ~/.kde4/share/config/kdeglobals is the right thing to do. Might it not screw something else up, a program that needs it? If not now, sometime in the future?
So I can maybe learn what went wrong this time, I have one more question:
Did you install KDE before the gtk fonts, or did you install the fonts first?
GREAT!
I've seen your exchange with folks on http://forum.kde.org about this file, and I have to agree that I don't understand it either.
Aaaaah, a virtual stalker. :P
For all those who are interested in the related thread. here we go: klick me
Quote:
Originally Posted by SilverBear2006
To be honest, I quit using KDE on Arch when Arch changed over to KDE4 by default. Now that KDE4.2 is out I think I may try it again. As much as I have preferred KDE 3.5x, that is the past, not the future of KDE. So I need to learn the new system sometime. I still have Mepis 8 with KDE 3.5.10 to boot if I want the stable version.
I really like KDE 4.2. To me it really seems productive. No more beta-testing flavour to it anymore.
May I ask what WM/DE you're using under Arch?
Quote:
Originally Posted by SilverBear2006
Blackhole, I just have some lingering doubts that deleting ~/.kde4/share/config/kdeglobals is the right thing to do. Might it not screw something else up, a program that needs it? If not now, sometime in the future?
I agree. I could have only remove the few lines about my font settings. However now that I know what it is, I could start from scratch and wipe my user directory completely. So far I've only been playing with the settings. But I feel comfortable enough now to make the move to Linux.
Quote:
Originally Posted by SilverBear2006
So I can maybe learn what went wrong this time, I have one more question:
Did you install KDE before the gtk fonts, or did you install the fonts first?
I installed all my fonts before I installed KDE. I don't know what happened there. The only font that I added afterwards was the Tomaha font from Windows as it doesn't come with the MS font package in Arch.
Still that shouldn't have caused the problem as the screwed up settings were mostly about anti-aliasing and not so much about the chosen font itself.
Take care,
Blackhole
P.S.: For you patience, I hit the "thanks" button. ;-)
Are you using the KDEMod version of KDE? If so, you can check on there forum as well. You might also consider switching, but I'm not sure how thats done...
Are you using the KDEMod version of KDE? If so, you can check on there forum as well. You might also consider switching, but I'm not sure how thats done...
Nah, it's working beautifully now. I'm not running KDEMod and I haven't considered it yet. Thanks for the tipp, though. ^^
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.