KOI-8 Step-By-Step for the X Window System
©1996 Marat BoshernitsanThis page has been accessed
06/12/96 Some long-awaited revisions had been done to this document. Check out the Table of Contents for details. Watch out for bugs.
02/14/96 Please beware that this page is constantly evolving. Things may not work as advertised and there is a high probability of errors and omissions. If you want to see this page improved, please send your comments to MBoshernitsan@lbl.gov
Coming (soon?):
- How to set up browsers other than Netscape (anyone still using them? -- drop me a note)
- How to translate to/from KOI-8 from/to other Cyrillic encodings
- Anything else? Send you questions/suggestions to MBoshernitsan@lbl.gov
Table of Contents
- Introduction
- How to install fonts
- Get the fonts
- Unpack
- Compile
- Verify permissions
- Tell your X server about the fonts
- Check your installation
- Remove BDF files
- How to set up software
- X server startup files
- X server resource files
- Netscape 1.x
- Netscape 2.x
![[updated]](/~maratb/Images/HTML/Misc/updated.gif)
- Netscape 3.x
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- Emacs 19.x
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- Other software
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- Cyrillic font test tor browsers
- Frequently Asked Questions
- Mysterious error messages from
xset(1) - "Pattern unmatched" error from
xlsfonts(1)![[new]](/~maratb/Images/HTML/Misc/new.gif)
- How to setup KOI-8 fonts in Netscape 2.x Mail,
News, Bookmarks, and Address Book windows
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- How to setup KOI-8 fonts in Netscape 2.x
menus/dialogs/etc.
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- Why Netscape 2.x shows some Russian-language
pages with Latin letters, and some with proper Cyrillic?
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- Why doesn't Netscape use KOI-8 in window
titles?
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- Why can't Netscape print KOI-8 documents?
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- How to print KOI-8 to PostScript printers
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- How to input KOI-8 from keyboard
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- Great places to visit with KOI-8
- Further references
- Credits
![[new]](/~maratb/Images/HTML/Misc/new.gif)
- Disclaimer
Introduction
This document provides step-by-step instructions on how to set up Cyrillic (KOI-8) fonts for the X Window System (X11R5/R6). These instructions are aimed at the average user with moderate knowledge of the UNIX environment, i.e. one should know how to log in, log out, run commands and use some editor. If you are uncomfortable with X Window System or UNIX, take a look at Introduction to UNIX and/or Introduction to X Windows.How To Install Fonts
The instructions assume that you are like the most of us (i.e. without root access) and you are installing the fonts in your home directory. Presumably, if you are a system administrator, you can infer from these instructions how to set up Cyrillic fonts so that they are globally accessible.
NOTE: If your X server is configured to use the font server for fonts (sure
thing if you are using an X terminal), you have no choice but to install the
fonts globally, where the font server can find them. You can tell if you are
using a font server by typing "xset q" at the
prompt and looking toward the end of the output for the section named "Font
Path". If this section contains a whole bunch of path names, you are probably
in the good shape. If, instead, it contains "tcp/...", you are out of luck --
go bug your system administrator.
-
Get the Cronyx font set as GNUzipped tar
archive (354K) or Compressed
tar archive (514K). The complete installation (assuming you removed BDF files) takes about 1M of disk space.
The instructions that follow, assume that you are using
Cronyx font set; you may or may not be able to follow these instructions
with other font sets.
-
Go to your home directory and unpack the font files:
This should create cronyx subdirectory with a whole bunch of files in it.% cdIf you have downloaded the .gz file:% gunzip < cronyx.tar.gz | tar xvf -or, if you have downloaded the .Z file:% zcat cronyx.tar.Z | tar xvf - -
Go to cronyx directory and compile the fonts:
This will compile the fonts for the architecture you are using. To save the disk space, the font files are also compressed by% cd cronyx % makecompress(1). If your server cannot read compressed fonts, you can decompress them by typing"uncompress *.Z"at the prompt or editing the Makefile to prevent compression in the first place.Note on font formats (read this if you are curious): The fonts are distributed in Binary Distribution Format (BDF), although all X servers can understand this format, the files in this format are large and the loading of the fonts is slower (not to mention the disk space). Compilation converts the font files into Portable Compiled Format (PCF). The files in this format are much smaller and are optimized to be read by the platform for which they are compiled. Although, other platforms can read PCF as well (hence the name), the reformatting takes time, so compile on the platform you use the most.
-
Make sure the cronyx directory is readable and
searchable by others and files in this directory are readable by others:
Also, make sure that all directories leading to it are also readable and searchable by others. Not doing so, may result in mysterious error messages from% chmod o+rx . % chmod o+r *xset(1). -
Let the server know where to find the fonts:
If you get mysterious error messages about failing requests, see the FAQ list for possible causes.% xset fp+ `pwd` % xset fp rehash -
Check your installation:
You should see a listing of about 70 fonts scroll by your screen. If% xlsfonts '*koi8*'xlsfonts(1)replies with "pattern *koi8* unmatched", you've got a problem.See the FAQ list for possible solutions
-
(Optional) Remove the BDF files from font directory to preserve disk
space:
% rm *.bdf
How To Set Up Software
-
X server startup files. When you log in at the X
terminal the X server executes certain startup files. You will need to
edit these files and add commands so that the server can find Cyrillic
fonts. Most common files are .xinitrc and
.xsession. These reside in your home directory;
however, if you don't have any of these, consult a local guru on how to
customize your environment. Add the following lines to the beginning of
the startup file that you are using (if you have both and are not sure
which one is being used, add these lines to both files just to be on the
safe side):
Where <full-path-to-font-dir> is precisely whatxset fp+ <full-path-to-font-dir> xset fp rehashpwd(1)returns within the font directory. -
X server resource files. When you log in at the X
terminal, the X server reads a resource database file. A resource file
is the usual place to specify fonts, colors and other things for the
applications. Such file is usually called .Xdefaults or
.Xresources and is located in your home directory. If
you cannot find either of these files, create one, say
.Xresources, and add the following line in your start up file before anything
else:
You can leave the file empty for now -- you will want to add stuff to it later.xrdb -l .Xresources -
To set up Netscape
1.x to use Cyrillic fonts, add the following lines to resource file:
and reload the resource database:Netscape*documentFonts*registry: koi8 Netscape*documentFonts*encoding: r
Now, restart Netscape, and test Cyrillic fonts.% cd % xrdb -l <resource-file-name> -
To set up Netscape
2.x to use Cyrillic fonts, add the following lines to resource file:
and reload the resource database:Netscape*documentFonts.defaultFont*iso-8859-2.prop: cronyx-times-120-noscale Netscape*documentFonts.defaultFont*iso-8859-2.fixed: cronyx-courier-100-noscale Netscape*documentFonts.charsetlang*iso-8859-2: Russian Netscape*documentFonts.charset*koi8-r: iso-8859-2 Netscape*menuBar*latin2.labelString: Russian (KOI-8)
Now, restart Netscape, go to the Options menu and select General Preferences.... This should open a dialog box. Select Fonts, change encoding to Russian (iso-8859-2), change proportional font to Times (Cronyx), and change fixed font to Courier (Cronyx). You can switch to Cyrillic by going to the Options/Document Encoding menu and selecting Russian (KOI-8) encoding. You should now be ready to test Cyrillic fonts.% cd % xrdb -l <resource-file-name>See the FAQ list for information on how to set up Cyrillic fonts in Mail, News, Address Book, Bookmark windows, menus, dialogs, etc.
-
(Note, the following has been tested with Netscape 3.0b4: your mileage
may vary with older beta releases)
Netscape 3.x (finally) includes some limited support for Cyrillic characters, so you only need to add two lines to the resource file, telling Netscape which fonts to use:
That's it. You should now reload the resource database, restart Netscape and test Cyrillic fonts.Netscape*documentFonts.defaultFont*koi8-r.prop: cronyx-times-120-noscale Netscape*documentFonts.defaultFont*koi8-r.fixed: cronyx-courier-100-noscaleUnfortunately, Netscape 3,x still does not use Cyrillic fonts outline/subject lists for Mail, News, Address Book, and Bookmark windows. Consult FAQ list for information on how to set this up.
-
To use Cyrillic with Emacs
19.x, you will first need to make sure that Emacs is using Cyrillic
fonts. If you have followed the above instructions exactly and your
Emacs is using some fixed-width font, you are probably in good shape.
Otherwise, you will need to add the following line to the resource file:
Don't forget to reload the resource database and restart Emacs. To be able to view and input Cyrillic with Emacs, you will also need to turn on the support for international characters by adding the following lines to .emacs file (this file may be in your home directory, if it's not there -- create it):emacs*font: -cronyx-fixed-medium-r-normal--13-120-75-75-c-80-koi8-r
You will also need to set up your keyboard to be able to input Cyrillic characters. See Frequently Asked Questions list for information on how to do that.(standard-display-european t) (set-input-mode (car (current-input-mode)) (nth 1 (current-input-mode)) 0)A better approach that does not require special keyboard setup and allows Emacs commands to be issued in KOI-8 insertion mode, is to use russian.el mode. This file is available at ftp://archive.cis.ohio-state.edu/pub/gnu/emacs/elisp-archive/packages/russian.el.Z. You will need to uncompress (using
uncompress(1)) and install this file in cronyx directory, and add the following line to your .emacs file (Note that you no longer need to add any of the stuff mentioned above):
See the beginning of the russian.el file for the information on how to use this mode.(load-file "~/cronyx/russian.el") -
Most other software that uses fixed fonts, will use Cyrillic fonts
automatically. Software that requires some fancier font selection, will
have to be configured individually. Please refer to your software
documentation. (Hint: in most cases you will need to add some lines to
the resource file, use the above instructions
for Netscape as an example)
See the FAQ list for instructions on configuring keyboard under X Window System.
Cyrillic font test for browsers
This is what your Cyrillic letters should look like in your browser with the above setup (these are images):
Proportional font:

Fixed font:

This is what Cyrlillic letters look like in your browser:
Proportional font:
а б в г д е ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я
А Б В Г Д Е Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я
Fixed font:
а б в г д е ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я
А Б В Г Д Е Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я
Frequently Asked Questions
-
Mysterious error messages from
xset(1)The
xset(1)program (part of X11 distribution) is notorious for indecipherable error messages such as these:
The version supplied with X11R6 is a little better since it is somewhat more eloquent, but even its error messages are sometimes difficult to understand.X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 51 (X_SetFontPath) Value in failed request: 0xa Serial number of failed request: 4 Current serial number in output stream: 6If you get something like the above from
xset(1)the first things to check are:- Valid path name. You should give the correct path
name to the font directory. If you are running
xset(1)from a shell script, don't forget that some shells (sh, ksh) do not understand the tilde (~) shortcut for the home directory. - Font directory permissions. The font directory as
well as all directories leading to it must be readable and
searchable by
otherand font files must be readable byother, otherwise, the X server can't find fonts. - Missing fonts.dir. This file must be
present so that the server can map font names to files. If this
file is missing, you can create it by typing
"mkfontdir ."in font directory.
- Valid path name. You should give the correct path
name to the font directory. If you are running
-
"Pattern unmatched" error from
xlsfonts(1)First off, make sure that you are doing
"xlsfonts '*koi*'"(an asterisk before and after "koi"). If this does not show any fonts, try looking at fonts.dir in cronyx directory, it should show something like this:koi10x20.pcf.Z -cronyx-fixed-medium-r-normal--20-200-75-75-c-100-koi8-r koi12x24.pcf.Z -cronyx-fixed-medium-r-normal--24-170-100-100-c-120-koi8-r koi10x16b.pcf.Z -cronyx-fixed-bold-r-normal--16-120-100-100-c-80-koi8-r ...If this files is empty, or not there, it is possible that your X server does not recognize compressed fonts, in that case, type"uncompress *.Z"followed by"mkfontdir .", and repeat the stuff with"xset fp+ ..."and"xset fp rehash". Also, it is possible that yourxset(1)does not show error message, so make sure that all permissions are set correctly. Lastly, it is absolutely necessary for font directory to be accessible on the machine which is running the X server (i.e. this will not work with fontservers and such).One more thing, some system administrators do not allow users to install their fonts and disable or cripple the corresponding commands. This is another thing to check.
-
How to setup KOI-8 fonts in Netscape 2.x/3.x Mail, News, Bookmarks, and
Address Book windows
If you followed the instructions for Netscape 2.x/3.x, you may have noticed that Netscape still uses its standard fonts for outline/subject lists in Mail, News, Bookmarks, and Address Book windows. To fix that, add the following lines to .Xresources/.Xdefaults file:
Note that there should be no spaces after commas. Reload the resource file and restart Netscape. You should now be able to see Cyrillic in message/article subjects, bookmark window, etc. To test, try reading relcom.humor newsgroup.Netscape*XmLGrid*fontList:\ -*-helvetica-medium-r-*-*-*-100-*-*-*-*-koi8-r,\ -*-helvetica-bold-r-*-*-*-100-*-*-*-*-koi8-r=BOLD,\ -*-helvetica-medium-o-*-*-*-100-*-*-*-*-koi8-r=ITALIC -
How to setup KOI-8 fonts in Netscape 2.x/3.x menus/dialogs/etc.
(this is useful if you would like to see Cyrillic titles in Bookmarks/Go
menus, etc.)
To have Netscape use Cyrillic fonts virtually everywhere, add the following lines to the resource file:
(Note that this already includes all changes needed to Cyrillify outline/subject lists in Netscape Mail, News, Bookmarks, and Address Book windows.) Reload the resource file and restart Netscape. You should now be able to see Cyrillic everywhere. To test, try visiting some homepage with Russian in the title.Netscape*fontList: -*-helvetica-bold-r-*-*-*-140-*-*-*-*-koi8-r Netscape*XmTextField.fontList: -*-courier-medium-r-*-*-*-140-*-*-*-*-koi8-r Netscape*XmText.fontList: -*-courier-medium-r-*-*-*-140-*-*-*-*-koi8-r Netscape*XmList*fontList: -*-courier-medium-r-*-*-*-140-*-*-*-*-koi8-r Netscape*menuBar*fontList: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-koi8-r Netscape*menuBar*historyTruncated.fontList: -*-helvetica-medium-o-*-*-*-120-*-*-*-*-koi8-r Netscape*popup*fontList: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-koi8-r Netscape*topArea*fontList: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-koi8-r Netscape*topArea*XmTextField.fontList: -*-courier-medium-r-*-*-*-120-*-*-*-*-koi8-r Netscape*topArea*XmText.fontList: -*-courier-medium-r-*-*-*-120-*-*-*-*-koi8-r Netscape*mouseDocumentation.fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-koi8-r Netscape*docinfoButton.fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-koi8-r Netscape*mailto*urlLabel.fontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-koi8-r Netscape*licenseDialog*text.fontList: -*-courier-medium-r-*-*-*-120-*-*-*-*-koi8-r Netscape*XmLGrid*fontList:\ -*-helvetica-medium-r-*-*-*-100-*-*-*-*-koi8-r,\ -*-helvetica-bold-r-*-*-*-100-*-*-*-*-koi8-r=BOLD,\ -*-helvetica-medium-o-*-*-*-100-*-*-*-*-koi8-r=ITALIC -
Why Netscape 2.x shows some Russian-language pages with Latin letters,
and some with proper Cyrillic?
Some sites specify the character set with every page they send you. When this happens to be the case, their settings override your settings in Options/Document Encoding menu. Some Russian-language sites (National News Service, for example) set koi8-r as the desired character set. (This can be verified by selecting View/Document Info from the menu.) Unfortunately, koi8-r is not one of the character sets built into Netscape 2.x, and so you cannot view these pages with 2.x version of Navigator. Fortunately, release 3.0 of Netscape Navigator (at least starting with 3.0b4) does support koi8-r character set and will display these pages correctly. You can follow the instructions above to set up Netscape 3.x.
-
Why doesn't Netscape use KOI-8 in window titles?
Window titles are controlled by a separate program called window manager and not by Netscape. To use Cyrillic fonts in window titles, refer to your window manager documentation.
-
Why can't Netscape print KOI-8 documents?
The PostScript font names are hardcoded inside Netscape, and hence there is no way to instruct Netscape to use Cyrillic fonts. To work around this limitation, save the document you wish to print using File/Save As... and follow the instructions for printing KOI-8 to PostScript printers.
-
How to print KOI-8 to PostScript printers
To print KOI-8 text to PostScript printer you will need a special program-converter. One such program, a2ps is available here as ftp://genome.lbl.gov/pub/maratb/a2ps.tar.gz (GNUzipped tar archive) and as ftp://genome.lbl.gov/pub/maratb/a2ps.tar.Z (Compressed tar archive). Unfortunately, to use this program you need to compile it first. If you don't know how to compile programs on your computer, get some local guru to help you. Also, be sure to read all three README files for instructions.
-
How to input KOI-8 from keyboard
First of all, if you are just editing some files and you are using Emacs 19.x, you should be able to get by without installing X Window keyboard mapping by using russian.el. See the section for Emacs 19.x for details.
If you need to input Cyrillic into some terminal-based editor, or any other program, for that matter, you will need to obtain and install X Window keyboard mapping. Firstly, you have to decide what kind of character mapping you wish to use:
- YAWERTY is a so called naive mapping. Cyrillic letters correspond to their Latin sound-alikes (with a few exceptions). This mapping is easy to use and you don't have to mark Cyrillic letters on the keycaps. To use this mapping, get yawery.koi8.xmm.
- JCUKEN is an official Russian keyboard mapping developed by GOST (the standard association). This mapping is recommended for those with russian keyboards that have both Latin and Cyrillic letters on keycaps. To use this mapping, get jcuken.koi8.xmm.
To install the keyboard mapping, copy the .xmm file to cronyx directory and type:
That's it. You should now be able to switch your keyboard to Cyrillic mode with Caps Lock key. You may add the% xmodmap ~/cronyx/<your-.xmm-file>xmodmap(1)command to the startup file. If you need to restore default keyboard mapping, load default.xmm. Note, that keyboard mappings are applied incrementally, so you should always load the default mapping before attempting to reload the Cyrillic map.
Great places to visit with KOI-8
Further references
- Andrey Chernov's KOI8-R page
- FREENet's guide to WWW and Cyrillic
- Hypertext manual pages for UNIX (many varieties) and X Window System
Credits
All of this document is the original work by Marat Boshernitsan. However, to give credit where credit is due, I should mention the following sites and people that inspired, motivated, and suggested material for this document:
- Andrey Chernov's KOI8-R page
- Страничка кирилизации by Maksim Moshkow
- The Linux Cyrillic HOWTO by Alexander L. Belikoff
Disclaimer
This document is provided "AS IS". Although the author of this guide attempts to make everything as accurate as possible, there still is the potential for mistakes and errors. If mistakes and errors are found by the reader(s), please report them to MBoshernitsan@lbl.gov. The author will not be held liable for any consequences incurred by the user for using this guide.
This page is by: Marat Boshernitsan <MBoshernitsan@lbl.gov>
Last updated: June 12, 1996


