LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-01-2002, 12:47 PM   #1
Rav
Member
 
Registered: Dec 2002
Location: Melbourne, Australia
Distribution: Slackware 10.0
Posts: 52

Rep: Reputation: 15
Default GTK font


Hi everyone

I've searched high and low, and spent literally hours trying to solve this with no luck. So, as a last resort, I'm posting here.

Just to make crystal clear exactly what it is that I need to know;

I've installed the Windows True Type fonts. I can apply them to the KDE and Gnome UI's and even some other programs. No problems there at all.

What I want to know is how I can change the default font for GTK apps like The Gimp. The closest I've come to a solution so far is the gtk-theme-switcher app. Great little proggie for changing themes actually, but when I try to change the font with it, it only applies the change to it's own interface, not other gtk apps. Also, the True Type fonts I've installed aren't in it's list either.

In Drakfont (I'm using Mandrake 9.0) I can import ttf fonts (obviously), and as I said, KDE and Gnome can see them, but they don't show up in Drakfonts list. I decided to launch drakfont from a terminal and watch the output while in did some importing again, and I noticed a shitload of errors. I wont post the entire output unless someone wants to see it, but one of the relevant errors is as follows;

chkfontpath: error opening /usr/X11R6/lib/fonts/drakfont/ttf/fonts.dir, unwilling to add path

When I run chkfontpath, it lists that path, so everything seems ok, but for some reason it's not. Would this have something to do with the fact that the ttf fonts are invisible to some parts of my system?

EDIT: By the way, I did all this as root of course

Any suggestions on how to solve this problem will be much appreciated. Thanks

Last edited by Rav; 12-01-2002 at 12:48 PM.
 
Old 12-01-2002, 01:23 PM   #2
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 49
Does your /etc/X11/XF86Config file list the TTFs in its fontpath? Do you
have an X font server running?
 
Old 12-01-2002, 01:27 PM   #3
Rav
Member
 
Registered: Dec 2002
Location: Melbourne, Australia
Distribution: Slackware 10.0
Posts: 52

Original Poster
Rep: Reputation: 15
The relevant section of my XF86Config-4 file

Section "Files"
# Multiple FontPath entries are allowed (they are concatenated together)
# By default, Mandrake 6.0 and later now use a font server independent of
# the X server to render fonts.
FontPath "unix/:-1"
EndSection

The relevant section of my XftConfig file

# Standard XFree86 Type 1 fonts
dir "/usr/X11R6/lib/X11/fonts/Type1"
# TTF fonts
dir "/usr/X11R6/lib/X11/fonts/TrueType"
dir "/usr/X11R6/lib/X11/fonts/TTF"
# User installed fonts
dir "/usr/X11R6/lib/X11/fonts/drakfont"
dir "/usr/X11R6/lib/X11/fonts/drakfont/ttf"
dir "/usr/X11R6/lib/X11/fonts/drakfont/Type1"
dir "/opt/ttfonts"

Everything seems fine to me, but there's obviously something wrong and I can't fix it.

This is not a major problem. Everything is fine. Linux rocks and it looks great. I'm just trying to get the Tahoma font (which I've applied almost system wide so far) to apply to gtk apps.

Last edited by Rav; 12-01-2002 at 01:29 PM.
 
Old 12-01-2002, 01:45 PM   #4
clavius
Member
 
Registered: Dec 2002
Location: Romania, Tg-Jiu City
Distribution: Slackware
Posts: 35

Rep: Reputation: 15
Quote:
Originally posted by Rav

The relevant section of my XftConfig file

# Standard XFree86 Type 1 fonts
dir "/usr/X11R6/lib/X11/fonts/TrueType"
dir "/usr/X11R6/lib/X11/fonts/TTF"

Everything seems fine to me, but there's obviously something wrong and I can't fix it.
Your problem is that you have the paths ONLY in Xft (which is an advanced font rendering engine). Xft is NOT a X Font Server. You have to provide the paths to Font Server (if you use one) or add them in XF86Config, NOT ONLY in XftConfig !!!

So, if you software doesn't use Xft (like gimp - your version is based on gtk 1.x i think), then it are unable to render the fonts.
 
Old 12-01-2002, 02:28 PM   #5
Rav
Member
 
Registered: Dec 2002
Location: Melbourne, Australia
Distribution: Slackware 10.0
Posts: 52

Original Poster
Rep: Reputation: 15
Thanks for the reply

I followed some instructions on the mandrake site:

http://www.mandrakeforum.com/article.php?sid=2200

My /usr/X11R6/lib/X11/fonts/drakfont/ttf didn't contain "fonts.scale" or "fonts.dir". Drakfont should have created them, but I guess that was what it was having problems with.

After I did this, my true type fonts finally showed up in Drakfont, and were also available with that little gtk-theme-switch app I'm messing around with (but I've noticed now that it's not able to apply ANY fonts to gtk apps, so it obviously didn't apply tahoma when I tried).

After that I came back here.

Ok, I've now changed my Xfree86Config file to look like this;

Section "Files"
FontPath "unix/:-1"
FontPath "/usr/X11R6/lib/X11/fonts/drakfont/ttf"
EndSection

Is that all I need to do? I've restarted xfs. However, since my that little theme switcher app wont apply fonts, can you suggest a method of doing it?

Thanks again!

EDIT: I forgot to mention. gtk-theme-switch is a gtk app itself, and it does actually apply fonts to itself. Just not to any other gtk apps for some reason :/

Last edited by Rav; 12-01-2002 at 02:35 PM.
 
Old 12-02-2002, 02:03 AM   #6
Rav
Member
 
Registered: Dec 2002
Location: Melbourne, Australia
Distribution: Slackware 10.0
Posts: 52

Original Poster
Rep: Reputation: 15
You know, this is like a conspiracy. The answer to this question seems so elusive (googling reveals that there is talk of people doing it, but no one tells you HOW to do it), lol.

I'm hoping someone can still save me from going through the hellish ordeal of editing every single gtkrc file just to see what happens.

Ok, here's a question. In my home/me/.gimp-1.2/ dir there is a file called gtkrc and this is what it contains:

# You can add your own GIMP-specific GTK styles here.

# style <name> [= <name>]
# {
# <option>
# }
#
# widget <widget_set> style <style_name>
# widget_class <widget_class_set> style <style_name>

So, I can add my add my own gimp specific style. Cool

gtk-theme-switch has put a file called .gtkrc in my home/me/ dir and it applies that theme to ALL gtk apps. (Yep, theme switch put it there because on Mandrake it's not there by default). Here's what's in it:

# -- THEME AUTO-WRITTEN DO NOT EDIT
include "/home/rav/.themes/XLiquid_GTK-1.0.1/gtk/gtkrc"

include "/home/rav/.gtkrc.mine"

# -- THEME AUTO-WRITTEN DO NOT EDIT

If you try to apply a font with gtk-theme-switch, the file ends up looking like this;

# -- THEME AUTO-WRITTEN DO NOT EDIT
include "/home/rav/.themes/XLiquid_GTK-1.0.1/gtk/gtkrc"

style "user-font"
{
font="-microsoft-tahoma-medium-r-normal-*-11-*-*-*-p-*-viscii1.1-1"
}
widget_class "*" style "user-font"

include "/home/rav/.gtkrc.mine"

# -- THEME AUTO-WRITTEN DO NOT EDIT

That font is available now (obviously), and that string IS listed in the fonts.dir file in my ttf directory which is now in the font path.

But, it doesn't take. Gimp, Xmms and other GTK apps are still using the default font.

Now, I'm not a linux expert. I feel confident enough to mess around and get my hands pretty dirty, but there's still a lot that goes on that I don't quite understand. Is there a global .gtkrc file that I can edit to achieve what it is that I want to do?

Why doesn't the font in home/rav/.gtkrc take? It doesn't matter what I change it to. Even a larger sized helvetica. I even tried changing ONLY the gimp font in /home/rav/gimp-1.2/gtkrc and the font wont take to gimp, no matter what it is.

Remember how KDE used to do an "Apply FONTS and colors to non kde apps". It only does the colors now, but how do I do what it USED to do, manually?

Help anyone?

Last edited by Rav; 12-02-2002 at 02:06 AM.
 
Old 12-02-2002, 02:48 AM   #7
Rav
Member
 
Registered: Dec 2002
Location: Melbourne, Australia
Distribution: Slackware 10.0
Posts: 52

Original Poster
Rep: Reputation: 15
OMG :)

Don't you love that beautiful feeling when you spend 2 days trying to figure something out and almost give up, then finally you get what you want!

Ok, I came across this:

https://listman.redhat.com/pipermail...er/000702.html
-----------------------------------------------------------------------------------
I've been hacking on this for the last half hour, and I've nailed it.
Use the .gtkrc.mine file, but you really need to put in there is a
little different than Havoc first mentioned. Here's mine now:

style "user-font"
{
fontset =
"-microsoft-verdana-medium-r-normal-*-12-120-75-75-p-0-iso8859-1"
}
class "*" style "user-font"

Notice I'm using "fontset" instead of "font," and "class" instead of
"widget-class."

I'm finally happy with the fonts on RedHat 8!!!

(Whew!)
dk
-----------------------------------------------------------------------------------

Well, FINALLY, after doing this, I can change the default gtk font.
Edit the file that gtk-theme-switch tells you not to edit, lol. Not that you take that seriously anyway. This is another one of those WTF linux situations, but I'm glad it's sorted. Thanks for helping everyone and hopefully some other poor bastard will find this thread after a few days of clawing his hair out and be happy too
 
Old 01-21-2003, 07:06 PM   #8
dwskp
LQ Newbie
 
Registered: Jan 2003
Location: California
Posts: 1

Rep: Reputation: 0
Thanks

Thanks for the pointers, I've been on this for quite a while now and finally figured it out, thanks to google and u guys.
I also had to change something in my gtkrc file.

So for those who want to change the font without having to create a gtkrc.mine file in the user directory, just change the /usr/share/themes/ThemeName/gtk/gtkrc and add this line to it

fontset="Whatever font you want here"

note I used fontset= and not font=

for those who want to see what my file looks like:
------------

# Edit these colors and fonts however you like.
style "default"
{
fg[NORMAL] = "#000000"
fg[ACTIVE] = "#000000"
fg[PRELIGHT] = "#FFFFFF"
fg[SELECTED] = "#FFFFFF"
fg[INSENSITIVE] = "#747474"
bg[NORMAL] = "#D3D3DD"
bg[ACTIVE] = "#C1C1CC"
bg[PRELIGHT] = "#555555"
bg[SELECTED] = "#666666"
bg[INSENSITIVE] = "#D3D3DD"
base[NORMAL] = "#FFFFFF"
base[ACTIVE] = "#D3D3DD"
base[PRELIGHT] = "#FF0000"
base[INSENSITIVE]= "#D3D3DD"
text[INSENSITIVE]= "#D3D3DD"
# helvetica 120 is default, so it's not really needed here..
fontset = "-microsoft-tahoma-medium-r-normal-*-*-110-*-*-p-*-iso8859-1"
#"-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*"
engine "thinice"
{
# You want the // on the handleboxes?
handlebox_marks = TRUE
# Do you want the // marks on the scrollbar handle?
scrollbar_marks = TRUE
# A single / on the scrollbar buttons, perhaps?
scroll_button_marks = TRUE
# Do you want the scrollbar handles rectangular or a bit shaped?
rect_scrollbar = FALSE
}
}

widget "*" style "default"



------------
Drew
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gtk font gong Slackware 0 06-10-2005 06:41 PM
gtk-font problem Config Linux - Software 0 11-07-2004 05:46 PM
GTK Font Problems quaff Linux - Software 6 07-29-2004 06:21 AM
GTK+ 1.2 font madness PiRaSSiC Linux - Software 6 07-26-2004 08:15 AM
Could not init font path element. Could not find default font "fixed" SidA Red Hat 0 06-19-2004 09:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration