%% (1999, 2001) Public domain -- prepared in BOP
%% HISTORY:
%% * April, 1999: ver. 1.0 -- first release
%% * April, 2001: ver. 1.1 -- removed mapping of codes < 32
%% email contact: b.jackowski@gust.org.pl

TCX file general format is already explained in Web2c documentation.

In order to provide an access to all characters, TCX tables should be
defined as one-to-one mappings, i.e., permutations of _all_ characters.
Otherwise some surprising effects may emerge.

For example, assume that a character of input code x should be mapped to
internal code y, and that the input code y is not mapped at all (i.e., it
does not belong to the encoded character set). A conflict occurs: x is
mapped to y, and y is (by default) also mapped to y. Assume now that BL User
re-defines the meaning of the character y, using it, e.g., as an active
character -- a mess is bound to occur.

It is a trivial fact that any permutation can be represented as a set of
cycles. The enclosed (G)AWK program computes a set of cycles for a given
pair of external (input, source) encoding and the internal (target) one.

We decided that only characters of having both internal and external
codes > 127 can be mapped. Since characters not occurring explicitly in
a TCX table are displayed in a hexadecimal notation, which is somewhat
annoying, all characters not covered by the encoding are mapped
using identity mapping. Characters of codes < 32 also used to be explicitly
one-to-one mapped which, however, led to strange effects on text terminals.
This unwanted behaviour was pointed out by Marcin Woli\'nski
and Marek Bodnar -- thanks.

%%------
How to make ``good'' TCX files

We use here some naming convention, following proposed
conventions for TCX file names.

1. Prepare `<input encoding>.e' file, e.g., `cp1250.e',
   containing _all_ external characters of codes > 127,
   defining input encoding for TeX.
   The format of an <input encoding>.e file is as follows:

   <decimal code> <char> <glyph name>

Example
--------------------------------------------------------
cp1250 (Windows East European) encoding (codes > 127 only)
128 <char>
129 <char>
130 <char> quotesinglbase
131 <char>
132 <char> quotedblbase
...
--------------------------------------------------------

   The second column (<char>) is a character itself, just for reference,
   regardless of how it can be displayed on some terminals.
   The third column <glyph name> can be empty if a `glyph name'
   is undefined.

2. Prepare `e.<internal TeX encoding>' file, e.g., `e.t1',
   defining internal encoding for TeX for a given font.
   The format of an <internal TeX encoding>.e file is as follows:

   <decimal code> <glyph name>

Example
--------------------------------------------------------
  0               grave
  1               acute
  2          circumflex
  3               tilde
  ...
  ???                 @
--------------------------------------------------------

   All codes from 0 to 255 should be listed in the file. For an empty
   slot, if any, `@' should be used as <glyph name>.

3. Prepare working file <tcxname>.tcd, e.g. il1-t1.tcd, as in the following
   example:

--------------------------------------------------------
%% il1-t1.tcx:              encoding translation table for TeX
%% source (TeX input):      iso8859-1 (iso latin 1) input encoding
%% target (TeX intestines): T1 (Cork) encoding
%% comment:                 Idea of a 1--1 mapping taken from MeX for emTeX
%%                          Generated by e2t-1to1.awk (GAWK) utility
%%                          Public domain -- prepared in BOP (1999)

S >> il1.e      % source
T >> e.t1       % target
R >> il1-t1.tcx % resulting file
--------------------------------------------------------

The last three lines define in an obvious manner input, output and result.
All remaining lines (comments) will be copied verbatim into the resulting
TCX file.

4. Run
       gawk -f e2t-1to1.awk -vDAT=il1-t1.tcd
   to produce the resulting TCX file. We prefer AWK scripts, because
   gawk can be found on almost all systems. e2t-1to1.sh (Unix) and
   e2t-1to1.bat (DOS/Win) are included in the package.

5. Copy TCX file to texmf/web2c/ directory and regenerate ls-R database.

-------------------------------------------------------------------------
