[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Trying to use the Droid fonts in xterm



Siard wrote:
> Camaleón wrote:
> > But if I set the font face and font size from "~/.Xresources" it
> > seems to be omitted (no warning nor error, but the font does not
> > change) :-?
> 
> As far as I remember, ~/.Xdefaults should be used instead since a few
> years.

Actually it is the other way around.  In the beginning it was
.Xdefaults (and actually still is) but now it is .Xresources.  But the
reasoning isn't simple.  There are something like six different unique
places that applications can get resource information.  Some of those
override others and some do not.  It isn't pretty nor simple.

The .Xdefaults file is used by default from the X server unless there
is data set by 'xrdb'.  In which case the .Xdefault file is ignored.
You read that right, it is the default but mostly ignored.

Normally in the session startup the xrdb program is called to load a
personal .Xresources file or a system Xresources file.  Therefore for
the 99.44% of us (a number I just made up from reading an ivory soap
package) reading this mailing list that are running X will have data
loaded from xrdb and the .Xdefaults file will be ignored.  The rest
will have started X using 'xinit' and have total control with the
$HOME/.xinitrc file.  (And I can't remember what the 'startx' script
does.  You can browse the script to figure it out.)

Normally by default in Debian the X startup flow will start with the
/etc/X11/Xsession script which chains through the script
/etc/X11/Xsession.d/30x11-common_xresources which runs xrdb and loads
up resources from the /etc/X11/Xresources/* and the $HOME/.Xresources
file if it exists.  Because of that you typically want to make
resource changes to ~/.Xresources and then reload it with xrdb.
Changes to the file do not take effect until loaded.

  xrdb -merge ~/.Xresources

That works to modify or add resources.  But of course if you are
deleting them then you will need to dump them first, remove the ones
you want to remote, and then load the result.  Because if you load
your ~/.Xresources then you also drop all of the resources from
/etc/X11/Xresources/* which are merged in.  (Whew!  That is too much
to know!  My brain hurts.)

I say normally by default because a lot of users do not run a Debian
default X environment through gdm/kdm/xdm and instead start X using
either xinit or startx from the command line.  This allows complete
customization and of course many of those users will never have called
xrdb and therefore will actually default to the .Xdefaults file.  (I
had to add this paragraph or otherwise each and every one of those
unique users would have commented upon it.)

Now by this point you may have forgotten some important questions.
Here is the important questions you should be asking.  Why have
.Xdefaults *and* .Xresources?  Why is .Xresources newer?  What is the
advantage of .Xresources over .Xdefaults?  Why is it preferred?

The answer is that .Xdefaults is a local file in your home directory.
But X is designed as a network transparent windowing system.  If you
throw your display onto a different network host then it won't have
access to your $HOME/.Xdefaults file on the other machine.  (Unless
you are also using something like NFS.  But that is a different
story.)  If you have a different $HOME on a different host then you
will have to set your fonts and colors and such all over again on that
other host.  But wait it gets worse.  If you have a display that is
large and a display that is small then both are forced to use the same
.Xdefaults.  It's a problem.  [Plus if that happens to be a shared
account (more common when X was designed) then you get to fight over
the settings with other users of that account.]

Instead the Xresources set through xrdb is a property of your display.
One display that is large can set small fonts.  Another display that
is small can set large fonts.  You can have one set of defaults when
logged in with your desktop and a different set of defaults when
connected using a smartphone/pda with a small screen.  The resources
are available over the network.  When the application queries it for
resources they are all in one place and available from your display.
This solves most of the problems of a $HOME/.Xdefaults file.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: