Ogonkify patch for processing xkbprint output

The preferred style for making national keyboards in the X Window System is the XKB extension. If you need to document the created layout, you can accomplish it using xkbprint program, which will generate a nice PostScript code describing the layout.

Unfortunately the program supports iso-8859-1 key symbols only. Even when the manual suggests

-lc <locale>
Specifies a locale in which KeySyms should be resolved.

in the reality only latin-1 characters are drawn correctly. The iso-8859-2 key symbols are drawn using their names, e.g. scaron.

I have modified the program ogonkify made by Juliusz Chroboczek, which is widely used to make the printing of non-latin1 accented characters on the PostScript devices possible, to resolve these names. The package is also integrated to a2ps pretty-printing package.

The policy of Juliusz Chroboczek is not to integrate extensions into the main package and instead let the authors to distribute them. That's why I publish the patch instead of trying to merge it into the ogonkify distribution and why the installation is not quite simple.

Only iso-8859-2 key symbols are supported at the moment - I have no possibility to test other encodings. I'll gladly accept patches of this effect.

Installation

Basically you can choose from following methods:

You want to patch a2ps distribution

You can get the distribution here, but chances are that you find it on the installation media of your preferred distribution (e.g. SRPMS directory of the RedHat CD). You then download the patch for a2ps version 4.12 here.

The patch is to be uncompressed and applied in the directory where you have unpacked the distribution using

  patch -p1 < a2ps-xkbprint.patch

If you use some packaging system (RPM etc.) and you know how to use it, you might want to add the patch directly to the package. Then build the a2ps according to its installation instructions.

You want to patch ogonkify distribution

The distribution can be downloaded here and the patch for the version of Thu Sep 3 18:07:37 BST 1998 can be downloaded here.

You unpack the distribution, uncompress the patch, change to ogonkify's top directory and apply the patch using

  patch -p1 < ogonkify-xkbprint.patch

Then install the ogonkify according to its installation instructions.

You have already installed ogonkify and you don't want to mess with the distribution

Then you download this patch, uncompress it, change to the directory where your ogonkify is installed (e.g. /usr/bin), make a backup of it and apply the patch using

  patch < ogonkify.prog-xkbprint.patch

Usage

The patch adds a new option -XP to the ogonkify, that do all the processing needed to draw the iso-8859-2 keyboard layouts. The usage is then e.g.:

Print the actual keyboard layout of first two groups for the slovak locale

  xkbprint -lc sk_SK -nkg 2 -color :0 -o - | ogonkify -XP > layout.ps

Print the named keyboard layout (us_sk_qwerty) of first two groups for the slovak locale

  xkbcomp -R/usr/X11R6/lib/X11/xkb keymap/xfree86 -xkm -m us_sk_qwerty -o - | \
  xkbprint -lc sk_SK -nkg 2 -color :0 -o - | ogonkify -XP > layout.ps

The result (cropped to interesting area of the keyboard to make the characters better visible) is then similar to

sk_us_qwerty

Concluding remarks

This patch is (C) Stanislav Meduna 1999. The usage is completely free and there is ABSOLUTELY NO WARRANTY. I don't have time to actively support it or to explain the usage of this patch and/or XKB. You are basically on your own - if you don't know what patch is, what xkbprint does or how to build things from source, you'll probably need to get this information before you try to use this patch.

Constructive comments, bug reports and patches are welcome on the address below.

Bratislava, 13. 3. 1999

Stanislav Meduna
stano (AT) meduna.org