1d522f475Smrg-- $XFree86: xc/programs/xterm/README.i18n,v 1.1 2003/11/13 01:16:37 dickey Exp $
2d522f475Smrg
3d522f475SmrgUsing xterm in your language
4d522f475Smrg============================
5d522f475Smrg
6d522f475SmrgSince XFree86 version 4.0, the internationalization (i18n) feature of
7d522f475Smrgxterm is gradually improved.  Xterm is being improved even now.  You
8d522f475Smrgneed only set the standard locale environment variables such as
9d522f475SmrgLC_CTYPE, LC_ALL, LC_CTYPE, or LANG.  Once the locale is set up you can
10d522f475Smrguse xterm in your favorite character encoding.
11d522f475Smrg
12d522f475SmrgThis document explains how the i18n feature is realized and how to
13d522f475Smrgconfigure xterm for your character encoding.
14d522f475Smrg
15d522f475SmrgRefer to locale(7) for details of the locale mechanism.
16d522f475Smrg
17d522f475Smrg
18d522f475SmrgBasic i18n-related settings and resources
19d522f475Smrg=========================================
20d522f475Smrg
21d522f475SmrgThese settings apply to XFree86 xterm patch #181, and the program luit
22d522f475Smrgwhich is distributed with XFree86 4.4
23d522f475Smrg
24d522f475Smrg1.  Usage of "locale mode"
25d522f475Smrg
26d522f475Smrg    On startup, xterm must be in "locale mode" to make it follow the
27d522f475Smrg    current locale.  You can invoke xterm in locale mode in these ways:
28d522f475Smrg
29d522f475Smrg    a.  Set "vt100.locale" resource "true".  This resource was
30d522f475Smrg        introduced since XFree86 4.3.  The default value of the "locale"
31d522f475Smrg        resource is "medium", which means xterm follows the locale only
32d522f475Smrg        in Chinese, Japanese, Korean, or Thai locales.  For example,
33d522f475Smrg
34d522f475Smrg          XTerm*locale: true
35d522f475Smrg
36d522f475Smrg        in your ~/.Xresources file.
37d522f475Smrg
38d522f475Smrg    or
39d522f475Smrg
40d522f475Smrg    b.  Invoke xterm with the "-lc" option.
41d522f475Smrg
42d522f475Smrg2.  Converter program "luit"
43d522f475Smrg
44d522f475Smrg    The "luit" must be available in the standard XFree86 binary
45d522f475Smrg    directory.  It is usually available because it is part of the
46d522f475Smrg    XFree86 distribution.  The standard binary directory may differ from
47d522f475Smrg    system to system.  /usr/X11R6/bin/luit is an example.
48d522f475Smrg
49d522f475Smrg    "luit" is used to convert between Unicode and the character encoding
50d522f475Smrg    for your locale.  When built for XFree86, xterm includes logic for
51d522f475Smrg    invoking luit.
52d522f475Smrg
53d522f475Smrg3.  Locale setting
54d522f475Smrg
55d522f475Smrg    Finally, you will need to configure your locale.  We expect that you
56d522f475Smrg    have already configured your locale for other software.  For example,
57d522f475Smrg
58d522f475Smrg      LANG=de_DE@euro
59d522f475Smrg      export LANG
60d522f475Smrg
61d522f475Smrg    in your ~/.xsession file.  There are many ways to configure locale. 
62d522f475Smrg    For example, your display manager may have a mechanism to invoke a
63d522f475Smrg    window manager in your favorite locale, or you may have system-wide
64d522f475Smrg    locale setting in /etc/environment.  You may also have set the
65d522f475Smrg    LC_ALL variable instead of the LANG variable.
66d522f475Smrg
67d522f475Smrg
68d522f475SmrgHow to use xterm in different locale temporarily
69d522f475Smrg================================================
70d522f475Smrg
71d522f475SmrgYou may sometimes need to invoke xterm in a different character encoding
72d522f475Smrgthan your current locale.  For example, use xterm to login remote systems
73d522f475Smrgin different locale.
74d522f475Smrg
75d522f475SmrgDo this by invoking xterm in the target locale.  For example,
76d522f475Smrg
77d522f475Smrg  $ LANG=ru_RU.KOI8-R xterm &
78d522f475Smrg
79d522f475SmrgPreviously, font setting has been used in such cases.
80d522f475Smrg
81d522f475Smrg  $ xterm -fn -misc-fixed-medium-r-normal--10-*-*-*-*-*-koi8-r &
82d522f475Smrg
83d522f475SmrgThis does not work well in conjunction with the "locale" resource,
84d522f475Smrgbecause luit and xterm combined rely upon Unicode fonts.
85d522f475Smrg
86d522f475Smrg
87d522f475SmrgHow to set fonts for UTF-8/locale modes
88d522f475Smrg=======================================
89d522f475Smrg
90d522f475SmrgSince xterm patch #181, xterm can automatically use Unicode fonts in
91d522f475SmrgUTF-8 mode and locale mode.  Few of you will need to modify the default
92d522f475Smrgsetting to display your language.  In particular, Unicode fonts in
93d522f475Smrgcombination with locale mode will satisfy the needs of not only
94d522f475SmrgISO-8859-1 users but also East Asian and other non-ISO-8859-1 users.
95d522f475Smrg
96d522f475SmrgIf you want to set your favorite Unicode font for UTF-8 and locale
97d522f475Smrgmodes, you should add a line such as the following in your ~/.Xresources
98d522f475Smrgfile:
99d522f475Smrg
100d522f475Smrg    XTerm*VT100.utf8Fonts.font: \
101d522f475Smrg         -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
102d522f475Smrg
103d522f475SmrgThe leading "XTerm*" pattern is more specific than the system's
104d522f475Smrgapp-defaults file, therefore it overrides the corresponding line
105d522f475Smrgbeginning with
106d522f475Smrg
107d522f475Smrg    *VT100.utf8Fonts.font:
108d522f475Smrg
109d522f475SmrgHere is an additional note.  If you want to display East Asian
110d522f475Smrgdoublewidth characters (CJK Ideogram, Hiragana, Katakana, Hangul,
111d522f475Smrgand so on), we recommend using
112d522f475Smrg
113d522f475Smrg    -misc-fixed-medium-r-semicondensed--13-*-*-*-*-*-iso10646-1
114d522f475Smrg
115d522f475Smrgor
116d522f475Smrg
117d522f475Smrg    -misc-fixed-medium-r-normal--18-*-*-*-*-*-iso10646-1
118d522f475Smrg
119d522f475Smrgbecause these two fonts have corresponding doublewidth fonts.  These
120d522f475Smrgfonts are used as default font and default "Large" font, respectively.
121d522f475Smrg
122d522f475Smrg
123d522f475SmrgThe internals of xterm i18n
124d522f475Smrg===========================
125d522f475Smrg
126d522f475SmrgYou do not need to read this section if you only want to configure your
127d522f475Smrgxterm.  Here we describe how xterm is implemented to support i18n.
128d522f475Smrg
129d522f475SmrgThe original version of xterm does not support locale or character
130d522f475Smrgencoding.  Its I/O stream is interpreted as a mere 8-bit index for a
131d522f475Smrgfont.
132d522f475Smrg
133d522f475SmrgBeginning with XFree86 4.0, xterm supported UTF-8.  It was implemented
134d522f475Smrgas a separate UTF-8 mode from the conventional 8-bit mode.  Character
135d522f475Smrgencodings had no effect on the 8-bit mode.  The UTF-8 mode has been
136d522f475Smrgextended to support doublewidth characters (for East Asian characters)
137d522f475Smrgand combining characters (such as accents for Latin alphabets and Thai
138d522f475Smrgvowels/tone marks).
139d522f475Smrg
140d522f475SmrgDoublewidth characters are characters that occupy two continuing
141d522f475Smrgcolumns on the terminal.  Xterm uses separate fonts for normal
142d522f475Smrg(singlewidth) characters and doublewidth characters.  Though xterm has
143d522f475Smrgconfiguration items for specifying doublewidth fonts, it will
144d522f475Smrgautomatically search for a font with exactly twice as wide and the same
145d522f475Smrgname as the specified normal font.
146d522f475Smrg
147d522f475SmrgThe default behavior of xterm was modified to use this UTF-8 mode in
148d522f475SmrgUTF-8 locales.  A command line option of "-u8" and a resource of "utf8"
149d522f475Smrgwere introduced to choose UTF-8 mode.
150d522f475Smrg
151d522f475Smrg"luit" was introduced to XFree86 at version 4.2.  It converts between
152d522f475SmrgUTF-8 and other encodings.  When luit is invoked in a UTF-8 terminal,
153d522f475Smrgthe terminal acts as if it is really running in the other encoding.
154d522f475Smrg
155d522f475SmrgSince XFree86 version 4.3, xterm provides a new mode to invoke luit
156d522f475Smrgautomatically to support various encodings.  The mode where xterm
157d522f475Smrginvokes luit is called "locale mode".  It is the third mode following
158d522f475Smrgconventional 8-bit mode and UTF-8 mode.  In the locale mode, xterm is
159d522f475Smrgaware of the current locale and character encoding.  Since locale mode
160d522f475Smrguses luit, it is based on the UTF-8 mode.  That is, xterm works in UTF-8
161d522f475Smrgmode and luit works as a converter between UTF-8 and the character
162d522f475Smrgencoding for your locale.  This is why the locale mode always needs
163d522f475SmrgUnicode fonts.  The default behavior of xterm is modified so that the
164d522f475Smrg"locale mode" will be adopted in Chinese (Big5 and GB2312), Japanese
165d522f475Smrg(EUC-JP), Korean (EUC-KR), and Thai (ISO-8859-11, as known as TIS-620)
166d522f475Smrglocales.  Locale mode is chosen for these character encodings because
167d522f475Smrgthese encodings are not supported by conventional 8-bit mode even by
168d522f475Smrgchanging fonts (ISO-8859-11 needs combining characters and others need
169d522f475Smrgdoublewidth characters).
170d522f475Smrg
171d522f475SmrgTo control the locale mode, command line options of "-lc" and "-en" and
172d522f475Smrga resource of "locale" were introduced.  The command line option of
173d522f475Smrg"-u8" and a resource of "utf8" were made obsolete by them, though
174d522f475Smrgretained for compatibility.
175d522f475Smrg
176d522f475SmrgSince XFree86 version 4.4, xterm can have two sets of default fonts,
177d522f475Smrgone for conventional 8-bit mode and another for UTF-8 and locale modes,
178d522f475Smrgby introducing the "utf8Fonts" subresource.
179d522f475Smrg
180d522f475Smrg
181d522f475SmrgFuture TODO Items
182d522f475Smrg=================
183d522f475Smrg
184d522f475SmrgWe anticipate that xterm's locale mode will be used increasingly in the
185d522f475Smrgfuture.  Since the UTF-8 and locale modes use more resources than
186d522f475Smrgconventional 8-bit mode (because it needs larger fonts and another
187d522f475Smrgprocess "luit"), faster hardware may be needed to gain complete
188d522f475Smrgacceptance by users.  However, the locale mechanism allows users
189d522f475Smrgto manipulate data in a standard form.  Its usefulness compensates
190d522f475Smrgin part for reduced performance.
191d522f475Smrg
192d522f475SmrgXterm supports antialiased fonts ("-fa" and "-fs" command line options). 
193d522f475SmrgCurrently UTF-8 nor locale modes do not work with antialiased fonts.
194d522f475Smrg
195d522f475SmrgXterm does not support bi-directional or RTL languages such as Hebrew
196d522f475Smrgand Arab.  A simple standard how terminal should behave for these
197d522f475Smrglanguages is needed.
198d522f475Smrg
199d522f475SmrgXterm does not support Unicode characters above U+10000.
200