[SLUG] Adding fonts to X Window System

john at johnallsopp.co.uk john at johnallsopp.co.uk
Mon Apr 11 21:48:08 BST 2005


Hi y'all

I'm working through Grokking the Gimp which for my money is a bloody
awful title but promised to be a great book, except for all the
mistakes <cough> learning opportunities.

So here's one such learning opportunity. For fun I thought I'd do it,
he makes it seem so easy.

I downloaded two banks/libraries/baskets/buckets/fontettes/flagons of
fonts, freefonts and sharefonts. I gzipped em into
/usr/X11R6/lib/X11/fonts/freefont (or sharefont) cus that's where the
book says RH6 keeps its fonts.

Then I ran:
xset fp+ /usr/X11R6/lib/X11/fonts/freefont and
xset fp rehash

I know not why, cus I was told to. Actually, that doesn't bode well.
He tells me by the end I won't know any tricks, I'll know how to use
the Gimp from the ground up. Fabulous. Well then, a little bit of
explanation about what all that's about might not have gone amiss.

Then, and here's the thing, he says:

"If these fonts were not pre-installed in the usual system directory,
you'll need to tell the X Window System where to find them each time
you start up a new X Session. This can be automated by putting the
last two commands above in your .xinitrc file."

Pre-installed, to me means installed when I installed Linux. So, if
they were pre-installed, why did I just install them? And if they
could possibly have been pre-installed, why didn't we check for that
first.

Anyway, "the usual system directory". Did I just do that? I installed
into a subdirectory of the place where "fonts are typically
installed". I wonder if that counts.

But anyway, my question is this. Having found .xinitrc (thanks for the
non-existent hint about where it might be, mister Grok), there's not a
lot of hint about where to put my two comments.

Here's my file, gimme a clue:
#!/bin/sh
# (c) 1999-2002 Red Hat, Inc.

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
userxkbmap=$HOME/.Xkbmap

sysresources=/etc/X11/Xresources
sysmodmap=/etc/X11/Xmodmap
sysxkbmap=/etc/X11/Xkbmap

# merge in defaults
if [ -f "$sysresources" ]; then
    xrdb -merge "$sysresources"
fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"
fi

# merge in keymaps
if [ -f "$sysxkbmap" ]; then
    setxkbmap `cat "$sysxkbmap"`
    XKB_IN_USE=yes
fi

if [ -f "$userxkbmap" ]; then
    setxkbmap `cat "$userxkbmap"`
    XKB_IN_USE=yes
fi

if [ -z "$XKB_IN_USE" -a ! -L /etc/X11/X ]; then
    if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f
/etc/X11/XF86Config ]; then
	xkbsymbols=`sed -n -e 's/^[ 	]*XkbSymbols[ 	]*"\(.*\)".*$/\1/p'
/etc/X11/XF86Config`
	if [ -n "$xkbsymbols" ]; then
	    setxkbmap -symbols "$xkbsymbols"
	    XKB_IN_USE=yes
	fi
    fi
fi

# xkb and xmodmap don't play nice together
if [ -z "$XKB_IN_USE" ]; then
    if [ -f "$sysmodmap" ]; then
	xmodmap "$sysmodmap"
    fi

    if [ -f "$usermodmap" ]; then
	xmodmap "$usermodmap"
    fi
fi

unset XKB_IN_USE

# run all system xinitrc shell scripts.
for i in /etc/X11/xinit/xinitrc.d/* ; do
    if [ -x "$i" ]; then
	. "$i"
    fi
done

# The user may have their own clients they want to run.  If they don't,
# fall back to system defaults.
# set up ssh agent environment if available.

if [ -f $HOME/.Xclients ]; then
    [ -x /usr/bin/ssh-agent -a -z "$SSH_AGENT_PID" ] && \
	exec ssh-agent $HOME/.Xclients || \
	exec $HOME/.Xclients
elif [ -f /etc/X11/xinit/Xclients ]; then
    [ -x /usr/bin/ssh-agent -a -z "$SSH_AGENT_PID" ] && \
	exec ssh-agent /etc/X11/xinit/Xclients || \
	exec /etc/X11/xinit/Xclients
else
       # failsafe settings.  Although we should never get here
       # (we provide fallbacks in Xclients as well) it can't hurt.
       xclock -geometry 100x100-5+5 &
       xterm -geometry 80x50-50+150 &
       if [ -x /usr/bin/netscape -a -f /usr/share/doc/HTML/index.html
]; then
               netscape /usr/share/doc/HTML/index.html &
       fi
       if [ -x /usr/X11R6/bin/fvwm2 ]; then
               exec fvwm2
       else
               exec twm
       fi
fi

J

PS. Am I missing a chromosome or something? I mean, does everyone else
find this straightforward? Am I Linuxlexic?






More information about the Scarborough mailing list