NetBSD polish fonts/keyboard mapping


This howto shows how to setup polish keyboard mapping and fonts on NetBSD *easily*. I managed to write it because when I first attempted to set the polish things for me, it wasn't easy, I had to spend some time google'ing... I hope this'll save your time.

First download polish ISO8859-2 fonts tarball. Grab http://www.biz.net.pl/images/ISO8859-2-pcf.tar.gz and extract it to the proper directory:

 mkdir /usr/X11R6/lib/X11/fonts/latin2
 tar xfvz ISO8859-2-pcf.tar.gz -C /usr/X11R6/lib/X11/fonts/latin2
Add these commands to your starting script (for example /usr/X11R6/lib/X11/xinit/xinirc):
xset fp+ /usr/X11R6/lib/X11/fonts/latin2/100dpi
xset fp+ /usr/X11R6/lib/X11/fonts/latin2/75dpi
xset fp+ /usr/X11R6/lib/X11/fonts/latin2/misc

Now X applications should be able to see the new fonts:

#  xlsfonts | grep iso8859-2
[...]
-biznet-aplos-bold-o-normal--0-0-100-100-p-0-iso8859-2
-biznet-aplos-bold-o-normal--0-0-75-75-p-0-iso8859-2
-biznet-aplos-bold-o-normal--10-100-75-75-p-60-iso8859-2
[...]
So the fonts are installed properly.

Now we'll install TrueType fonts. This step is not necessary, but TrueType fonts look just nicer than standard ones. Install xfstt:

# cd /usr/pkgsrc/x11/xfstt
# make install clean
Grab TrueType fonts from somewhere - if you have access to Windows machine, you can grab them from c:\windows\fonts and put into /usr/X11R6/lib/X11/fonts/TrueType:
# mkdir /usr/X11R6/lib/X11/fonts/TrueType
# cp /msdos/windows/fonts/* /usr/X11R6/lib/X11/fonts/TrueType
Now run the truetype font server:
# xfstt --sync
# xfstt --encoding iso8859-2 --daemon
The first commands tells xfstt to look for fonts, the second one runs the xfstt (TrueType font server). Now XFree to look for fonts in font server -- add
 FontPath   "unix/:7101"
to your XF86Config or alternatively run
xset fp+ unix/:7101

This shell script does the keyboard mapping - launch it for example after starting xwindows:

#!/bin/sh
#
# Skrypt instaluje polskie litery na klawiaturze. Usiluje dostosowac sie do
# aktualnej klawiatury. Sprawdza istnienie klawisza Mode-switch i jezeli
# takiego nie ma usiluje go utworzyc. Sprawdza po kolei istnienie pary
# klawiszy *_L i *_R. Sa to kolejno Alt, Mod, Super i Hyper. Po znalezieniu
# pary odlacza klawisz _R od modyfikatora, przyporzadkowuje mu KeySym rowny
# Mode_switch i przylncza do pierwszego wolnego modyfikatora mod1, mod2, mod3
# lub mod4. Dzialanie klawisza _L pozostaje nie zmienione. Po udanej instalacji
# lub stwierdzeniu istnienia Mode-switch, instaluje KeySym-y polskich liter.
#
PLKBOK=`xmodmap -pm | awk '/Mode_switch/ { print $1; exit }'`
if [ -z "$PLKBOK" ] ; then
  for MODALT in Alt Meta Super Hyper Shift ; do
    SYMALTR=`xmodmap -pk | awk "/${MODALT}_R/ { print \$1; exit }"`
    if [ -n "$SYMALTR" ] ; then
      SYMALTL=`xmodmap -pk | awk "/${MODALT}_L/ { print \$1; exit }"`
      if [ -n "$SYMALTL" ] ; then
        MODALTR=`xmodmap -pm | awk "/${MODALT}_R/ { print \$1; exit }"`
        xmodmap -e "remove $MODALTR = ${MODALT}_R"
        xmodmap -e "keycode $SYMALTR =  Mode_switch"
        MODSWT=`xmodmap -pm | awk '/^mod/ { if ( $2=="" ) { print $1; exit } }'`
        xmodmap -e "add $MODSWT = Mode_switch"
        break
      fi
    fi
  done
fi
PLKBOK=`xmodmap -pm | awk '/Mode_switch/ { print $1; exit }'`
if [ -n "$PLKBOK" ] ; then
  xmodmap -e "keysym A = a A plusminus exclamdown"
  xmodmap -e "keysym L = l L threesuperior sterling"
  xmodmap -e "keysym S = s S paragraph brokenbar"
  xmodmap -e "keysym C = c C ae AE"
  xmodmap -e "keysym O = o O oacute Oacute"
  xmodmap -e "keysym N = n N ntilde Ntilde"
  xmodmap -e "keysym E = e E ecircumflex Ecircumflex"
  xmodmap -e "keysym Z = z Z questiondown macron"
  xmodmap -e "keysym X = x X onequarter notsign"
fi

That's all. I hope it works fine for you. It at least did the right thing here =)

[Powered by NetBSD] [Powered by XML+XSL] [Powered by vi]