i found each of three above plays a role in font management. it comes
up to me as so confusing. in /etc/font.conf, one can specify, by means
of font alias, which font is prefered for applications. in gtkrc, one
can specify, by means of puting font item in a style, which font should
be used for applications. in gnome-font-properties, a gui control
center, one can specify a overall fonts choice. but, how does these
things all combined to affect appearance of final looking of an
application? when i decide to use some fonts other than default, which
file/tool i should touch? what will happend if there is any conflict
within them? i got no any clue.
Q2: how about .Xresource or .Xdefault? how about fonts settings in
kcontrol?
I just find nowhere to start up, it seems difference programs will use
difference font strategies. is there a full map covering that? i just
want to know the whole story.
thanks in advance.
-
narke
Maybe this will help, maybe it won't, but bear in mind that fonts are
*inherited* by Gnome, KDE, or the other window managers from "the
system;" that, broadly, being the X Window System. So, what's available
in X is subsequently available to the window manager (that would be
Gnome, KDE, etc.) and other applications (such as OpenOffice).
If you add fonts to your system, you do that in /usr/X11R6/lib/fonts;
e.g., if you copy a bunch of TTF files into the directory
/usr/X11R6/lib/fonts/TTF, those will be available -- system-wide -- to
all applications (including the window managers). Also, if you read the
beginning of /etc/fonts/fonts.conf, you'll see a notice that you do not
edit it because fontconfig does that -- how's fontconfig know what to
do? Ah, there's the rub.
Take a look at /etc/X11/xorg.conf. Look for the Section "Files," and
look further down for the FontPath lines -- those are what tell X where
the fonts are and which ones to make available. On my systems that
section looks like this:
Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
ModulePath "/usr/X11R6/lib/modules"
FontPath "/usr/X11R6/lib/X11/fonts/misc"
FontPath "/usr/X11R6/lib/X11/fonts/TTF"
FontPath "/usr/X11R6/lib/X11/fonts/Type1"
FontPath "/usr/X11R6/lib/X11/fonts/CID"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi"
FontPath "/usr/X11R6/lib/X11/fonts/Adobe"
FontPath "/usr/X11R6/lib/X11/fonts/myfonts"
FontPath "/usr/local/share/fonts"
FontPath "/usr/share/fonts"
FontPath "/usr/X11R6/lib/X11/fonts"
FontPath "/usr/share/fonts/default"
FontPath "/usr/X11R6/lib/X11/fonts/cyrillic"
FontPath "/usr/X11R6/lib/X11/fonts/local"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo"
EndSection
Note that my xorg.conf file was generated by the xorgsetup utility and
that I have font sets (such as the Adobe Type Library) that you probably
won't; the entries in this file should be what you have on your system.
Also, don't be confused by /usr/X11R6/lib/X11/fonts and
/usr/X11R6/lib/fonts -- there is a symbolic link from one to the other;
they're the "same" directory. If one of those lines in commented-out
(and you have font files in the directory), removing the comment (the #)
will make those fonts available.
The above makes all fonts available system-wide -- you do not need to
fiddle around with .Xresources or .Xdefaults or anything else in user's
home directories when fonts are available this way. If you make any
changes in your xorg.conf file, be sure to do so in console mode, then
"startx" so they'll take effect (don't change things while X is
running). In fact, the less fiddling you do the better.
I don't use Gnome so I can't comment on how it works (or doesn't as the
case may be), but with KDE you open the Control Center, open Appearance
& Themes, then open Fonts. You can click the Choose button and select
any font and size you want -- these only affect KDE, by the way. One
thing I always do is choose every one of the menu choices and take the
size down by two points (the default is "big-gunky") and things look
better two points smaller on a 1280 x 1024 display. Also, open a Konsole
session and click Settings; click Font then click Custom and select a
font (Courier is good).
You can select different fonts in Mozilla, OpenOffice and other
applications -- in OpenOffice, you select Options, Text Document, Basic
Fonts (Western) and set something other than the default that's there (I
prefer Times, that's what I set). In Mozilla, use Edit, Preferences,
Appearance, Fonts and choose. Both OpenOffice and Mozilla inherit
available fonts from X as above.
If you want to add fonts -- say you've got a bunch of TrueType Fonts
(TTF) laying around -- that's pretty easy, too. Assuming you have a
CD-ROM with a directory TTF that contains a bunch of TTF font files:
Exit to console (so X isn't running)
Log in as root
mount /dev/cdrom
cd /usr/X11R6/lib/fonts
# make a back up of any existing TTF files
cp -R TTF TTF.bak
cd TTF
# this copies and translates all the file names to lower case
cp `find /mnt/cdrom -name '*.[Tt][Tt][Ff]' | tr [A-Z] [a-z]` .
# the font files do not need to be executable or anything else but
readable
chmod 644 *.ttf
# create an index of scalable fonts in the directory
mkfontscale
# create an index of X font files in the directory
mkfontdir
# create an index of FreeType fonts in the directory
fc-cache
(If you don't have a CD-ROM but do have access to a directory containing
TTF files, just replace the "cdrom" in the above with the path to that
directory.)
Make sure there's a line in /etc/X11/xorg.conf
FontPath "/usr/X11R6/lib/X11/fonts/TTF"
and startx -- you should have the TTF fonts you just installed available
in KDE and other applications.
Most applications -- including the window managers -- default to some
basic font that may or may not be what you like. You can, as mentioned
above, select what you want without having to resort to learning
everything you need to know about .Xresources or .Xdefaults or much of
anything else. Set things system-wide and you don't have to fiddle.
Hope at least some of this helps.
actually, i dont run KDE, Gnome, i use FVWM+Theme instead. FVWM+Theme
is another story in font management by far i dont understand. i have
not managed to find a easy system-wide way of chaning fonts in
FVWM+Theme. and, i sure, even i can did that, the settings won't affect
those KDE/Gnome programs such as firefox, gimp and so on.
that's the pain.
>really a long story, thanks for the efforts! but there is at least one
>thing i can not agree, that is 'setting fonts system-wide and do not
>fiddle with .Xdefaults'. Is there a system-wide way letting me
>specifiy the text font of Emacs windows? the same question rised as
>well for batch of termials such as aterm, xterm, rxvt but not
>gconsole/kconsole.
>
>
This isn't really "setting fonts system-wide," it's more "make them
available" system-wide; it's up to you to set a particular resource for
a particular application (that business about selecting fonts in
OpenOffice and Mozilla and whatever else).
You can use .Xdefaults to set fonts for a given application -- if the
application will let you. I happen to like
XTerm*geometry: 110x46+35+45
XTerm*Font: *courier-bold-r*140*
XTerm*blinkRate: 0
XTerm*Foreground: black
XTerm*Background: lightyellow
XTerm*scrollBar: true
XTerm*saveLines: 500
XTerm*borderWidth: 1
XTerm*borderColor: black
XTerm*XmScrollBar: 2
and have those set on my Solaris work station (which uses CDE for a
window manager). As long as the application understands the X Toolkit
resource names and classes, well, just stick 'em in .Xdefaults in your
home directory and have a ball. You can also stick 'em in a system-wide
defaults file and have X load them when it starts up. I don't set this
on my Slackware boxes because I do use KDE and Konsole and I can set
fonts, colors, geometry and all that from the Settings tab in the
Konsole window.
>actually, i dont run KDE, Gnome, i use FVWM+Theme instead. FVWM+Theme
>is another story in font management by far i dont understand. i have
>not managed to find a easy system-wide way of chaning fonts in
>FVWM+Theme. and, i sure, even i can did that, the settings won't affect
>those KDE/Gnome programs such as firefox, gimp and so on.
>
>that's the pain.
>
>
Start digging in the application documentation for "resources." It's
fairly common (or at least it used to be) that command line options also
have a X Toolkit resource name or there is a separate section of the
manual (or info) that describes those. They're things with names like
those above; e.g., Font, Foreground, Background. The xterm command line
option for Background, for example is -bg, Foreground is -fg.
So, spend some time with the documentation for FVWM+Theme and find out
what the X Toolkit resource names it or they use. The easy ones are
Foreground and Background -- get those to set and you'll know you're on
the right track for Font, geometry and other things.
By the way, Font? Look in the fonts.dir file or fonts.scale file in one
of the directories in /usr/X11R6/lib/fonts. Those contain the full name
of the font that can be abbreviated *courier-bold-r*140*.
Go pick up a copy of (The Complete Guide to) XFree86 for Linux -- it
covers all this in detail -- and, yes, most of it applies to Xorg as
well as to XFree86. Borders, Amazon, Barnes & Noble, etc.
for XFree86, the only free documentation i can find by far is the
XFree86 HOWTO and i found it is trivial, would anyone please suggest a
better one (free) to me?
-
narke
>for XFree86, the only free documentation i can find by far is the
>XFree86 HOWTO and i found it is trivial, would anyone please suggest a
>better one (free) to me?
>
>-
>narke
>
>
>
A Google search for "x + resources" turned up
http://archive.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/resources.html;
there are links that take you to other information. That's only the
first one on the list of... well, quite a few.