Friday, February 8, 2008

Adding TTF fonts to the X server

This is a little survey on how to add fonts to your Xorg server. I did this on my FreeBSD 6.2 running Xorg 6.9 and I hope that doing the same on Xorg 7.x will be quite similar.

I installed my TTF (TrueType) fonts on /usr/local/lib/X11/fonts/myfonts. So in order to get Xorg using it, edit your /etc/xorg.conf and modify it to look like the following

Section "Files"
FontPath "/usr/X11R6/lib/X11/fonts/TTF/"
FontPath "/usr/local/lib/X11/fonts/myfonts/"
...
EndSection

Once /etc/xorg.conf has been saved. Run the following commands

# cd /usr/local/lib/X11/fonts/myfonts
# /usr/X11R6/bin/mkfontscale
(on Xorg 7.x this could be /usr/local/bin/mkfontscale)
# /usr/X11R6/bin/mkfontdir
(on Xorg 7.x this could be /usr/local/bin/mkfontdir)

The last step is giving the users the oportunity to choose from the added fonts on their font chooser dialogs. Just edit /usr/X11R6/etc/fonts/local.conf (or /usr/local/etc/fonts/local.conf if you're using Xorg 7.x) and the directory to the configuration as follows:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "/etc/fonts/fonts.dtd">

<fontconfig>
<dir>/usr/local/lib/X11/fonts/myfonts</dir>
</fontconfig>

Restart X, and voilĂ !

Wednesday, January 30, 2008

Upgrade from gnupg1.x to gnupg2

I'm a regular user of Thunderbird+Enigmail+gnupg on my FreeBSD box.

Until now I used gnupg 1.x, but I wanted to upgrade to gnupg2 (2.0.4).
Why? Because of a combination of envy and fun. No more to tell. The former version filled my needs.

So how to upgrade? First of all install gnupg2 (it's on /usr/ports/security/gnupg) and pinentry (it's on /usr/ports/security/pinentry). gnupg2 cannot be run without pinentry, so the latter should be added as a dependency of gnupg, but it's not. So you need to install both by hand.

Once you've installed both packages, you have add the gpg-agent.conf on your ${HOME}/.gnupg. Mine contains:

pinentry-program /usr/local/bin/pinentry-gtk-2
no-grab
default-cache-ttl 600

(see man 1 gpg-agent just to know what these options do).

And that's all! Thunderbird+Enigmail runs like a charm with gnupg2. My gnupg1.x keys work correctly with gnupg2.0.

Environment: FreeBSD 6.2, thunderbird-2.0.0.0 (installed from ports), thunderbird-enigmail-0.95.0 (installed from ports), gnupg-2.0.4 (installed from packages), pinentry-0.7.2_5 (installed from packages).