337 lines
12 KiB
HTML
337 lines
12 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||
<HTML>
|
||
<HEAD>
|
||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
||
<TITLE>The Linux Thai HOWTO: Applications with Thai language</TITLE>
|
||
<LINK HREF="Thai-HOWTO-4.html" REL=next>
|
||
<LINK HREF="Thai-HOWTO-2.html" REL=previous>
|
||
<LINK HREF="Thai-HOWTO.html#toc3" REL=contents>
|
||
</HEAD>
|
||
<BODY>
|
||
<A HREF="Thai-HOWTO-4.html">Next</A>
|
||
<A HREF="Thai-HOWTO-2.html">Previous</A>
|
||
<A HREF="Thai-HOWTO.html#toc3">Contents</A>
|
||
<HR>
|
||
<H2><A NAME="s3">3. Applications with Thai language</A></H2>
|
||
|
||
<P>This is the tricky part. Most applications support ISO-8859-1
|
||
character set. For example, emacs can display
|
||
ISO-8859-1 character. If we set emacs to display
|
||
ISO-8859-1 and use
|
||
Thai font, you can edit Thai document with emacs. But this is not a good
|
||
policy. You should avoid using this trick as possible. What we need is Thai
|
||
locale or Thai supported applications to manage these things.
|
||
<P>
|
||
<P>To make X window application displays Thai font,
|
||
you should run the application with <CODE>-fn</CODE> option. For example,
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
%xedit -fn thai8x16
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
|
||
Note that <CODE>thai8x16</CODE> is just a one of Thai font names. You can see all
|
||
available fonts by command <CODE>xlfonts</CODE>.
|
||
If you don't want to fill <CODE>-fn</CODE> option every time you run
|
||
application. You should set Thai font in your <CODE>~/.Xdefaults</CODE> or
|
||
<CODE>~/.Xresources</CODE> like this
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
XTerm*font: thai8x16
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
<P>
|
||
<P>
|
||
<H2><A NAME="ss3.1">3.1 Some X applications and Thai language</A>
|
||
</H2>
|
||
|
||
<P>
|
||
<P>
|
||
<H3>txterm</H3>
|
||
|
||
<P><CODE>txterm</CODE> is Thai version of <CODE>xterm</CODE>. There are several programs running
|
||
under <CODE>xterm</CODE> such as shell, <CODE>pine</CODE>, <CODE>vi</CODE>, <CODE>less</CODE>, etc. We can type Thai
|
||
characters without any problems with <CODE>txterm</CODE>. <CODE>Txterm</CODE> also provides
|
||
its own Thai input method by pressing " F1 " key. <CODE>Txterm</CODE> will
|
||
use fonts <CODE>thai9x13</CODE> as default Thai font. You can change this by add <CODE>-fn</CODE> option.
|
||
<P>You can get <CODE>txterm</CODE> from
|
||
<A HREF="http://thaigate.nacsis.ac.jp">Thaigate</A> or
|
||
<A HREF="ftp://ftp.fedu.uec.ac.jp/pub/thai/UEC/ZzzThai/Software/Linux">ZzzThai</A>.
|
||
<P>
|
||
<P>
|
||
<DL>
|
||
<DT><B><CODE>bash shell</CODE> :</B><DD><P>Normally, shell accepts only ASCII character set. To type Thai characters in
|
||
shell command line, you should set environment <CODE>LC_CTYPE</CODE> to
|
||
<CODE>iso_8859_1</CODE>.
|
||
<P>I don't set <CODE>LC_CTYPE</CODE> environment variable to
|
||
iso_8859_1 because this environment variable will effect
|
||
other applications too. With bash shell, you can specify which
|
||
environment variable to be passed to the application. For example, I can make
|
||
a fake Thai X
|
||
terminal with this syntax.
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
LC_CTYPE=iso_8859_1 xterm -fn thai8x16
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
|
||
This xterm display Thai characters well, but not good for typing Thai
|
||
characters. I strongly recommend you to use <CODE>txterm</CODE>.
|
||
<P>
|
||
<DT><B><CODE>ls</CODE> :</B><DD><P>If you name a filename in Thai. Issue the command as
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
ls -N
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
|
||
<P>You may set <CODE>alias</CODE> in <CODE>~/.bashrc</CODE> or <CODE>~/.cshrc</CODE>, so
|
||
you can type <CODE>ls</CODE> without option. If you don't use <CODE>ls</CODE> with
|
||
<CODE>-N</CODE> option, you may see Thai filename as ?????.
|
||
<P>
|
||
</DL>
|
||
<P>
|
||
<H3>Emacs, Mule</H3>
|
||
|
||
<P>Mule stands for " Multilingual Enhancement to GNU Emacs " . It has
|
||
the same functions as emacs and supports many languages. <CODE>Mule</CODE> provides
|
||
its own input method, so you don't need any configuration for typing Thai. You
|
||
needs only Thai fonts for <CODE>mule</CODE> which you can get from,
|
||
<A HREF="ftp://ftp.fedu.uec.ac.jp/pub/thai/UEC/ZzzThai/Software/Linux/fonts/">ZzzThai</A> or
|
||
<A HREF="ftp://etlport.etl.go.jp/pub/mule/fonts/ETL/">Etl site</A>.
|
||
These Thai fonts are fixed width fonts.
|
||
<P>You need some configuration for <CODE>mule</CODE>. Puts the following lines in
|
||
your <CODE>.emacs</CODE>.
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
;;
|
||
;; Thai System, add in .emacs
|
||
;;
|
||
(set-file-coding-system-for-read '*tis620*)
|
||
(set-default-file-coding-system '*tis620*)
|
||
(set-display-coding-system '*tis620*)
|
||
(set-keyboard-coding-system '*tis620*)
|
||
(setq-deafault quail-current-package (assoc "thai" quail-package-alist))
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
|
||
Add the following lines in <CODE>.Xdefaults</CODE>.
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
!
|
||
! Emacs, Mule - Font menu
|
||
!
|
||
Emacs*FontSetList: thai14, thai16, thai24
|
||
Emacs*FontSet-thai14:\
|
||
-etl-fixed-medium-r-normal--14-140-72-72-m-70-tis620.2529-1
|
||
Emacs*FontSet-thai16:\
|
||
-etl-fixed-medium-r-normal--16-160-72-72-m-80-tis620.2529-1
|
||
Emacs*FontSet-thai24:\
|
||
-etl-fixed-medium-r-normal--24-500-72-72-m-120-tis620.2529-1
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
<P>When you hold shift key and press
|
||
left mouse's button, you can select Thai fonts to display in <CODE>mule</CODE> window.
|
||
To type Thai characters, press " Ctrl + ] " . To type English, press
|
||
" Ctrl + ] " again.
|
||
<P>You can get <CODE>mule</CODE> from
|
||
<A HREF="ftp://etlport.etl.go.jp/pub/mule/">ElectroTechnical Laboratory(ETL)</A><P>
|
||
<H3>vi</H3>
|
||
|
||
<P>Vi should be run on <CODE>txterm</CODE>.
|
||
<P>
|
||
<H3>pine</H3>
|
||
|
||
<P>In the past, we could not send 8-bit characters through E-mail. Now, although
|
||
mail transfer agent can handle 8-bit characters but some old mail transfer
|
||
agent can not.
|
||
We can send Thai e-mail by using e-mail application that supports MIME (Multipurpose Internet Mail Extensions)
|
||
E-mail applications that support
|
||
MIME are <CODE>pine</CODE>, <CODE>elm</CODE>, Netscape mail, etc.
|
||
<P>Put the following definition in your <CODE>~/.pinerc</CODE> file:
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
character-set=ISO-8859-1
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
|
||
This can also be set via the <CODE>Setup</CODE> option in <CODE>pine</CODE> window. You can find
|
||
it under <CODE>Config</CODE>. You can read Thai news from pine, too.
|
||
<P><CODE>Pine</CODE> should be run in <CODE>txterm</CODE>.
|
||
<P>
|
||
<H3>Netscape</H3>
|
||
|
||
<P>If you have Thai fonts in your system. Just set Thai font from
|
||
preference. Thai fonts will appear in User defined area. See
|
||
<A HREF="http://www.fedu.uec.ac.jp/ZzzThai/unix">http://www.fedu.uec.ac.jp/ZzzThai/unix</A> for setting Thai
|
||
language on Netscape.
|
||
<P>Some movement about Thai Mozilla project at
|
||
<A HREF="http://members.xoom.com/inThai/mozthai.html">http://members.xoom.com/inThai/mozthai.html</A>.
|
||
<P>
|
||
<H3>Ss, Simple thai word Separator</H3>
|
||
|
||
<P><CODE>ss</CODE> is a dictionary based Thai word separation program similar to
|
||
<CODE>cttex</CODE>. It can be used to insert a configurable string between
|
||
Thai words. It can also show words that cannot be found in the
|
||
dictionary. More words can be added to the dictionary. Developed by Mr.Teera
|
||
Kittichareonpot.
|
||
<P>We can use this program to insert <CODE>< WBR ></CODE> tag between Thai words in html
|
||
file. Browser will display Thai homepage better than normal html document.
|
||
<P>
|
||
<H3>Xzthai, X keyboard configurator + simple editor</H3>
|
||
|
||
<P><CODE>Xzthai</CODE>, this is the Tcl/Tk application for mapping Thai keyboard on any
|
||
keyboard with graphical user interface. Also provides simple editor and
|
||
keyboard layout figure. It actually uses
|
||
<CODE>xmodmap</CODE> program in background to map Thai
|
||
keyboard. This may be useful for commercial X server and X server on UNIX.
|
||
<P>
|
||
<H2><A NAME="ss3.2">3.2 Printing Thai document</A>
|
||
</H2>
|
||
|
||
<P><CODE>Thai2ps</CODE> is used to convert plain text file to postscript file.You can use
|
||
ghostscript(<CODE>gs</CODE>) to print your Thai document. For better quality document,
|
||
you have to use (La)TeX.
|
||
<P>
|
||
<H3>Latex and Thai language</H3>
|
||
|
||
<P>Dr. Manop Wongsaisuwan first tried to use Thai language with <CODE>latex</CODE>. He
|
||
wrote some perl script as filter for latex source code that contains Thai
|
||
language. Then pass the result to <CODE>latex</CODE>. Mr. Vuthichai Ampornaramvech
|
||
used this concept and wrote a program in C language, <CODE>cttex</CODE>, to handle this. It runs
|
||
faster and makes Thai word segmentation based on dictionary. <CODE>Cttex</CODE> also
|
||
fixes the position of Thai characters in word, so SARA and WANNAYUK will be
|
||
placed in the beautiful position.
|
||
<P>You can find Thai latex filter from
|
||
<A HREF="http://thaigate.nacsis.ac.jp/files/ttex.html">http://thaigate.nacsis.ac.jp/files/ttex.html</A>.
|
||
<P>
|
||
<H3>Latex's configuration for Thai language</H3>
|
||
|
||
<P>You must have <CODE>latex</CODE> installed in your computer.
|
||
First, download Thai postscript (Type1) fonts, tfm fonts and Thai style
|
||
file. These fonts are needed by
|
||
<CODE>Latex</CODE>. This is the list of files you should download.
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
tfm fonts:
|
||
dbtt.tfm dbttb.tfm dbttbi.tfm dbtti.tfm
|
||
postscript fonts:
|
||
dbtt.pfa dbttb.pfa dbttbi.pfa dbtti.pfa
|
||
style files:
|
||
thai.sty sakka.sty
|
||
Thai Latex filter:
|
||
cttex
|
||
Sample Latex file:
|
||
ttex.ttex test.ttex
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
<P>
|
||
<P>There is <CODE>latex</CODE>'s directory at
|
||
<CODE>/usr/lib/texmf/texmf/</CODE> (RedHat 5.0). I will call <CODE>/usr/lib/texmf/texmf/</CODE> as
|
||
" $texroot " . We will concentrate at <CODE>$texroot/texmf/</CODE> directory.
|
||
In <CODE>$texroot/texmf/</CODE> directory, there are many files
|
||
about tex's configuration. You have to edit files in <CODE>dvips, fonts, tex</CODE> subdirectories.
|
||
<P>Add the following lines to <CODE>$texroot/texmf/dvips/misc/psfonts.map</CODE>
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
dbtt DBThaiText <dbtt.pfa
|
||
dbttb DBThaiTextBold <dbttb.pfa
|
||
dbttbi DBThaiTextBoldItalic <dbttbi.pfa
|
||
dbtti DBThaiTextItalic <dbtti.pfa
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
<P>
|
||
<P>Make a new directories and copy files to the appropriate directories.
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
%mkdir /usr/lib/texmf/texmf/fonts/tfm/public/thai
|
||
%mkdir /usr/lib/texmf/texmf/fonts/type1/public/thai
|
||
%mkdir /usr/lib/texmf/texmf/tex/generic/thai
|
||
%cp *.tfm /usr/lib/texmf/texmf/fonts/tfm/public/thai
|
||
%cp *.pfa /usr/lib/texmf/texmf/fonts/type1/public/thai
|
||
%cp *.sty /usr/lib/texmf/texmf/tex/generic/thai
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
<P>
|
||
<P>Run <CODE>texhash</CODE> or <CODE>MakeTeXls-R</CODE>(in some system) to update <CODE>Tex</CODE> database.
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
%/usr/bin/texhash
|
||
texhash: updating /usr/lib/texmf/texmf/ls-R ...
|
||
texhash: Done.
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
<P>
|
||
<H3>Use Thai <CODE>LaTeX</CODE> filter</H3>
|
||
|
||
<P>We can use <CODE>cttex</CODE> as filter like this,
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
%cttex < ttex.ttex > ttex.tex
|
||
C-TTeX $Revivsion: 1.15 $
|
||
Usage : cttex [cutcode] < infile > outfile
|
||
Usage : cutcode=0 forces operation in HTML mode.
|
||
Build-in dictionary size: 9945 words
|
||
343
|
||
Done
|
||
%latex ttex.tex
|
||
...
|
||
%xdvi ttex.dvi
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
|
||
You can convert dvi file to postscript file by,
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
%dvips -o ttex.ps ttex.dvi
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
<P>Finally, you can print ttex.ps by using <CODE>gs</CODE> or <CODE>lpr</CODE>. You must configure
|
||
printer before printing. See man-pages of <CODE>printcap</CODE>, <CODE>gs</CODE>, <CODE>lpr</CODE>
|
||
for more information.
|
||
<P>
|
||
<H3>Editing <CODE>LaTex</CODE> source file</H3>
|
||
|
||
<P>For new <CODE>latex</CODE> user, <CODE>lyx</CODE> is helpful. But I recommend to use <CODE>mule</CODE>
|
||
to edit Thai <CODE>latex</CODE> source file because <CODE>mule</CODE> supports Thai language
|
||
and it is a powerful editor. You may take a look a
|
||
<A HREF="http://www.fedu.uec.ac.jp/ZzzThai/Linux/ttex">Thai Latex tutorial</A>.
|
||
<P>
|
||
<P>
|
||
<H2><A NAME="ss3.3">3.3 X Application Resources</A>
|
||
</H2>
|
||
|
||
<P>Because Xt based applications allow user to configure
|
||
the applications by resources. We can make the menu or label to be
|
||
Thai language.
|
||
<P>For example, if you want <CODE>xman</CODE> to display Thai labels. You may add
|
||
these lines in your <CODE>.Xdefaults</CODE>
|
||
<BLOCKQUOTE><CODE>
|
||
<PRE>
|
||
......
|
||
!! Xman section
|
||
Xman*Font: thai8x16
|
||
Xman*helpButton.Label: <20><><EFBFBD><EFBFBD>
|
||
Xman*quitButton.Label: <20>͡
|
||
Xman*manpageButton.Label: <20><><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD><CDA1><EFBFBD><EFBFBD><EFBFBD>
|
||
......
|
||
</PRE>
|
||
</CODE></BLOCKQUOTE>
|
||
<P>You can use the same idea to set window manager to be more Thai environment too.
|
||
<P>
|
||
<H2><A NAME="ss3.4">3.4 Thai Extension for Linux (TE)</A>
|
||
</H2>
|
||
|
||
<P>Thai Extension for Linux is a installation package comes with applicaions and
|
||
Thai fonts. You don't have to configure Linux system and applications by yourself.
|
||
Let TE do configuration task for you. After installation, you can use
|
||
Thai language suddenly. Get TE from
|
||
<A HREF="ftp://fedu.uec.ac.jp/pub/thai/UEC/ZzzThai/Software/Linux/">ftp://fedu.uec.ac.jp/pub/thai/UEC/ZzzThai/Software/Linux/</A><P>
|
||
<P>
|
||
<HR>
|
||
<A HREF="Thai-HOWTO-4.html">Next</A>
|
||
<A HREF="Thai-HOWTO-2.html">Previous</A>
|
||
<A HREF="Thai-HOWTO.html#toc3">Contents</A>
|
||
</BODY>
|
||
</HTML>
|