home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 2 / CD ACTUAL VOL 2.iso / docs / cyrillic < prev    next >
Encoding:
Text File  |  1995-09-10  |  10.3 KB  |  386 lines

  1.   The Linux Cyrillic HOWTO
  2.   Alexander L. Belikoff, (abel@wisdom.weizmann.ac.il)
  3.   v1.0, 13 August 1995
  4.  
  5.   This document describes how to set up your Linux box to typeset, view
  6.   and print the documents in Russian language.
  7.  
  8.   1.  Introduction
  9.  
  10.  
  11.   This document covers the things you need to successfully typeset view
  12.   and print documents in Russian.
  13.  
  14.   There is some conflict between MS-DOG and Un*x Cyrillic codesets. In
  15.   MS-DOG, the most popular Cyrillic codeset is Alt (so-called
  16.   alternative codeset). In Un*x, however, the traditional codeset with
  17.   Russian characters is KOI-8. It is specified in the RFC 1489
  18.   ("Registration of a Cyrillic Character Set").
  19.  
  20.   The difference in two codesets is usage is pretty minimal (except the
  21.   TeX packages). Therefore, we will describe only KOI-8 codeset setup.
  22.  
  23.   Various people put a lot of effort to create useful packages and
  24.   documents. These are listed through the text.
  25.  
  26.   I appreciate any comments corrections and suggestions concerning the
  27.   document. Don't hesitate to contact me at abel@wisdom.weizmann.ac.il.
  28.  
  29.  
  30.  
  31.   2.  Further plans
  32.  
  33.  
  34.   The next version of this document will be accessible on
  35.   sunsite.unc.edu and tsx-11.mit.edu in HOWTO directory of the Linux
  36.   Document Project.
  37.  
  38.   I am looking forward to include section on TeX and LaTeX and some
  39.   issues on Internationalization and Localization.
  40.  
  41.  
  42.  
  43.   3.  Setting up the environment
  44.  
  45.  
  46.  
  47.  
  48.   3.1.  Console
  49.  
  50.  
  51.   All stuff needed for russification of the Linux console is contained
  52.   in the kbd package. The package is accessible at sunsite.unc.edu or
  53.   tsx-11.mit.edu. Usually, that package is already installed (it is a
  54.   standard part of at least Slackware distribution).
  55.  
  56.   To setup the Cyrillic stuff, one should do three things:
  57.  
  58.  
  59.   1. Set the appropriate screen font. This is performed by the setfont
  60.      program. The fonts files are placed in /usr/lib/kbd/consolefonts.
  61.  
  62.      NOTE: Never run the setfont program under X or it will hang your
  63.      system. This is because it works with low-level video card calls
  64.      which X doesn't like.
  65.  
  66.  
  67.   2. If you use the font in Alt coding (as I do) then you have to set up
  68.      the screen mapping program to perform automatic conversion from Alt
  69.      to KOI-8. For that purpose use the mapscrn program and the
  70.      /usr/lib/kbd/consoletrans/koi2alt file.
  71.  
  72.   3. Load the appropriate keyboard layout with the loadkeys program.
  73.  
  74.   4. Output an ESC(K escape sequence on the screen (ESC stands for the
  75.      Escape character with code 033). Only God knows the purpose of that
  76.      combination. I stole it from the Danish-HOWTO
  77.      <file://sunsite.unc.edu/pub/Linux/docs/HOWTO/Danish-HOWTO> (thanks,
  78.      Thomas Petersen) and it works for me!
  79.  
  80.   The following is an example of a script which sets up the Cyrillic
  81.   mode for console:
  82.  
  83.  
  84.   #!/bin/bash
  85.   #
  86.   # load cyrillic defs for console
  87.   #
  88.   # *** NEVER TRY IT UNDER X!!! ***
  89.  
  90.   loadkeys /usr/lib/kbd/keytables/ru.map
  91.   setfont /usr/lib/kbd/consolefonts/Cyr_a8x16
  92.   mapscrn /usr/lib/kbd/consoletrans/koi2alt
  93.   echo -ne 'ESC(K'        # use the REAL ESCAPE character here !
  94.   echo "Use the right Ctrl key to switch the mode..."
  95.  
  96.  
  97.  
  98.  
  99.  
  100.   3.2.  The X Window System
  101.  
  102.  
  103.   Like the console mode, the X environment also requires some setup.
  104.   This involves setting up the input mode and the X fonts. Both are
  105.   being discussed below.
  106.  
  107.  
  108.  
  109.   3.2.1.  The X fonts.
  110.  
  111.  
  112.   First of all, you have to obtain the fonts collection having the
  113.   Cyrillic glyphs at the appropriate places.
  114.  
  115.   There is a number of such fonts on the net. The author's favorite one
  116.   is the collection VakuFonts created by Serge Vakulenko (vak@kiae.su).
  117.   It can be found in the collection of cyrillic stuff for the X Window
  118.   System <ftp://ftp.funet.fi/pub/culture/russian/comp/xwin> where you
  119.   can find many useful packages for X.
  120.  
  121.   Usually the X fonts are distributed in the BDF format which is
  122.   actually the textual font description. You should compile the fonts to
  123.   the PCF format using the bdftopcf command:
  124.  
  125.  
  126.        bdftopcf -o name.pcf name.bdf
  127.  
  128.  
  129.   It is also possible to compress the compiled font using the compress
  130.   program (I am not sure about the gzip support).
  131.  
  132.  
  133.   Now you should do three things to set everything up:
  134.  
  135.  
  136.   1. Put the compiled (and possibly compressed) fonts to the specified
  137.      directory. If that directory is not already known to the X server,
  138.      then you should make it known. To achieve that, add the following
  139.      commands to the xinitrc file (either local or global one):
  140.  
  141.  
  142.        xset +fp directory_with_fonts xset fp rehash
  143.  
  144.  
  145.  
  146.   2. Recreate the list of fonts for the directory. Simply cd to it and
  147.      run:
  148.  
  149.  
  150.        mkfontdir .
  151.  
  152.  
  153.  
  154.   You should run it once. This will upgrade the the fonts catalog file
  155.   fonts.dir.
  156.  
  157.   3. If the fonts package provides the file of fonts' aliases (usually
  158.      fonts.alias) then append it's contents to the fonts' aliases file
  159.      in the directory containing the fonts.
  160.  
  161.   After you have made the settings above, you can check the availability
  162.   of the new fonts by running the following command:
  163.  
  164.  
  165.        xfd -fn fontname
  166.  
  167.  
  168.   This should show the table of characters of the specified font.
  169.  
  170.  
  171.  
  172.   3.2.2.  The input translation
  173.  
  174.  
  175.   The switching between the different input translations is set up by
  176.   the xmodmap program. This program allows customization of codes
  177.   emitted by various characters and their combinations. It sets the
  178.   things up based on the file containing the translation table, usually
  179.   named ~/.Xmodmap. If you want to create your own table, refer to the
  180.   xmodmap(1). However such tables are generally supplied with the
  181.   various X Cyrillic stuff packages. The good example is the tables in
  182.   the perfect package by Serge Vakulenko described above.
  183.  
  184.   Once you have such file containing the table, you should run the
  185.   command:
  186.  
  187.  
  188.        xmodmap filename
  189.  
  190.  
  191.   every time you start X. Modify your .xinitrc file to perform it. NOTE:
  192.   your .xinitrc can already contain the code to run the xmodmap over
  193.   your local table if the one exists.
  194.  
  195.   The table distributed with the Serge's Vakulenko package didn't work
  196.   for the author. The following patch fixed the problem:
  197.  
  198.  
  199.   diff -u --new-file jcuken.xmm jcuken.xmm.mod
  200.   --- jcuken.xmm  Mon May 20 09:11:36 1991
  201.   +++ jcuken.xmm.mod      Sun Aug 13 15:44:06 1995
  202.   @@ -2,6 +2,8 @@
  203.    ! Cyrillic keyboard mapping table.
  204.    ! Produced by Serge Vakulenko, <vak@kiae.su>, Moscow.
  205.    !
  206.   +! Modified by Alexander L. Belikoff (abel@wisdom.weizmann.ac.il), 1995
  207.   +!
  208.    ! Russian JCUKENG keyboard layout implemented.
  209.    ! Cyrillic characters are entered in koi8 encoding.
  210.    !
  211.   @@ -10,7 +12,9 @@
  212.  
  213.    ! Use CapsLock as rus/lat switch key.
  214.    remove lock = Caps_Lock
  215.   -add mod2 = Caps_Lock
  216.   +keysym Caps_Lock = Mode_switch
  217.   +add mod2 = Mode_switch
  218.   +add lock = Mode_switch
  219.  
  220.    !       Key             Base            Shift           Caps    ShiftCaps
  221.    !------------------------------------------------------------------------
  222.  
  223.  
  224.  
  225.   Now I can use the Caps Lock key to switch between normal and Cyrillic
  226.   input modes.
  227.  
  228.   The author would appreciate the version of the table to support the
  229.   different mode switch key, say Alt or Control.
  230.  
  231.   NOTE: The following is an excerpt from the list of new features
  232.   announced in the XFree 3.1.2:
  233.  
  234.  
  235.        Cyrillic fonts (using KIO8-R encoding) from Cronyx Ltd.
  236.  
  237.  
  238.   Unfortunately the author hasn't had a chance to check it yet.
  239.  
  240.  
  241.  
  242.   4.  Miscellaneous utilities setup
  243.  
  244.  
  245.  
  246.  
  247.   4.1.  bash
  248.  
  249.  
  250.   Three variables should be set on order to make bash understand the
  251.   8-bit characters. The best place is ~/.inputrc file. The following
  252.   should be set:
  253.  
  254.  
  255.   set meta-flag on
  256.   set convert-meta off
  257.   set output-meta on
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.   4.2.  csh/tcsh
  266.  
  267.  
  268.   The following should be set in .cshrc:
  269.  
  270.  
  271.   setenv LC_CTYPE ISO-8859-5
  272.   stty pass8
  273.  
  274.  
  275.  
  276.  
  277.  
  278.   4.3.  remote access
  279.  
  280.  
  281.   Use 'rlogin -8'
  282.  
  283.  
  284.  
  285.   4.4.  emacs
  286.  
  287.  
  288.   The minimal cyrillic support in emacs is done by adding the following
  289.   calls to one's .emacs (provided that the Cyrillic character set
  290.   support is installed for console or X respectively):
  291.  
  292.  
  293.   (standard-display-european t)
  294.  
  295.   (set-input-mode (car (current-input-mode))
  296.      (nth 1 (current-input-mode))
  297.      0)
  298.  
  299.  
  300.  
  301.   This allows the user to view and input documents in Russian.
  302.  
  303.   However, such mode is not of a big convenience because emacs doesn't
  304.   recognize the usual keyboard commands while set in Cyrillic input
  305.   mode. There is a number of packages which use the different approach.
  306.   They don't rely on the input mode stuff established by the environment
  307.   (either X or console. Instead, they allow the user to switch the input
  308.   mode by the special emacs command and emacs itself is responsible for
  309.   re-mapping the character set. There are, at least, two packages of
  310.   that type. One is cyr.el. It can be found in most Emacs-Lisp archives.
  311.   The other one is the package remap which tries to make such support
  312.   more generic. This package is written by Per Abrahamsen
  313.   (abraham@iesd.auc.dk) and is accessible at ftp.iesd.auc.dk.
  314.  
  315.  
  316.  
  317.   4.5.  less
  318.  
  319.  
  320.   So far, less doesn't support the KOI-8 character set, but the
  321.   following environment variable will do the job:
  322.  
  323.  
  324.   LESSCHARSET=latin1
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.   4.6.  ispell
  332.  
  333.  
  334.   Check the sunsite.unc.edu:/pub/academic/russian-studies/Software for
  335.   the russian dictionary created by Neal Dalton (nrd@cray.com) for the
  336.   ispell package.
  337.  
  338.  
  339.  
  340.   4.7.  Netscape
  341.  
  342.  
  343.   Set the following resource:
  344.  
  345.  
  346.   *documentFonts*registry:        koi8
  347.  
  348.  
  349.  
  350.  
  351.  
  352.   5.  Printing
  353.  
  354.  
  355.   To print the text files containing the Russian characters using on
  356.   PostScript printers, you need two things: the fonts and the 8bit-aware
  357.   software able to print the texts using those fonts. The best package
  358.   to print the text files in PostScript is a2ps by Evan Kirshenbaum
  359.   (evan@csli) and Miguel Santana (miguel@imag.imag.fr). The last version
  360.   is 8bit-aware. You can get it from imag.imag.fr:/archive/postscript/.
  361.  
  362.   Check the sunsite.unc.edu:/pub/academic/russian-studies/Software/ in
  363.   order to obtain the Cyrillic PostScript fonts. Also, there is a lot of
  364.   fonts in the SimTel <ftp://oak.oakland.edu/pub/SimTel/> collection.
  365.  
  366.  
  367.  
  368.   6.  Summary of the various useful resources
  369.  
  370.  
  371.   The remap package for Emacs <ftp://ftp.iesd.auc.dk/>
  372.  
  373.   Many fonts collections for X
  374.   <ftp://ftp.funet.fi/pub/culture/russian/comp/xwin>
  375.  
  376.   Useful Cyrillic packages <ftp://sunsite.unc.edu/pub/academic/russian-
  377.   studies/Software>
  378.  
  379.   The kbd package for Linux
  380.   <ftp://sunsite.unc.edu/pub/Linux/system/Keyboards/>
  381.  
  382.   X fonts collections <ftp://ftp.switch.ch/mirror/linux/X11/fonts/>
  383.  
  384.   rspell <ftp://sunsite.unc.edu/pub/academic/russian-
  385.   studies/Software/rspell.tar.gz>
  386.