DeLi Linux 0.8 Chinese Environment Configuration

This is the fifth diary of DeLi Linux Diaries Series, the previous is: DeLi Linux 0.8 Software Installation. This is also the last diary of this series.

I will introduce how to configure a comfortable chinese environment on DeLi Linux 0.8, include console and X Window environment. The console environment will introduce installation and using of softwares below mainly: Zhcon chinese console environment (input method), Screen (full screen window manager); W3m web browser; Vim text editor. X Window environment will introduce mainly: Fcitx input method; Firefox1.5 web browser; Dillo2 web browser and chinese font (e.g., Wen Quan Yi).

Because we need compile softwares from source, so install development tools at first, execute ” pacman -S devel ” to install all development tools in DeLi Linux 0.8. If your have little hard disk space, it seems will work only install ” binutils”, you can try ” pacman -S binutils “.

If you use chinese, and need to revitalize a very old machine (such as 486), console environment is a good choice. What can you do on a 486 plus Linux machine? I have used an Intel 486 DX100 plus 24M RAM machine a long time. I installed redhat linux 9.0 without X in it, I can do plenty of things on it, such as: W3m to surf internet, Wget to download, Mutt to receive and send mail, Mp3blaster to listen music, Gtmess MSN client, vim text editor, CVS, Ftp, Mysql, Emacs, Apache httpd, Jdk1.4, etc..(Some of these softwares I have not used on DeLi until today). So, I introduce console environment on DeLi Linux 0.8 first.

1, Zhcon chinese console environment (include WuBi and PinYin and some other chinese input methods)
DeLi Linux 0.8 has included Zhcon, if you don’t install it, execute “pacman -S zhcon” to install it. login into console, execute ” zhcon ” start it. But, I have executed it faild on a 486 machine, see my bug report, it works after compile it from source. If you meet this situation, download it from here and compile it. Note, execute ” export CXXFLAGS=”$CXXFLAGS -liconv -lintl” ” before ” ./configure “, otherwise, you will can’t compile it. See: Need help, I can’t get a chinese console under DeLi Linux 0.7.90. Get the usage manual by press ” CTRL+ALT+H “.

Additionally, you must login with root account to use Zhcon on DeLi Linux 0.8, then execute ” screen ” to open multiple virtual terminals in one console (so, you don’t need to open another console to perform another program), then execute ” su your-common-account ” to perform common work under DeLi Linux 0.8. But, the mouse can’t work under Zhcon on DeLi 0.8, I don’t know the reason until today.

2, Vim text editor
The “vi” in DeLi Linux 0.8 is “e3vi”, it isn’t good at support chinese. And, Nano text editor can input chinese well under the utf8 environment of Zhcon (start zhcon with command “zhcon –utf8″), but, there is bug when W3m web bowser work under utf8 environment of Zhcon, I don’t know if this bug is caused by Zhcon or W3m. I transplant the Vim-7.1 in DeLi Linux 0.7.2 into DeLi 0.8 with the way introduced in diary DeLi Linux 0.8 Software Installation, download Vim DeLi 0.7.2 package from: http://www.delilinux.de/packages/deli/ap/vim-7.1-i386-1.tgz . Then, create a file called “.vimrc” under your home directory, here is a .vimrc file I modified from an article on internet, you can try it:

set encoding=gb2312
syn on
set guifont=Luxi\ Mono\ 11
set tabstop=4
set shiftwidth=2
set autoindent
set backspace=2
set smartindent
set ai!
set nu!
set showmatch
set ruler
set incsearch
set vb t_vb=

2, W3m web browser
There isn’t W3m in DeLi, so you need compile it from source. At first, you need compile and install Gc, I have tested, it seems new version Gc (such as: version 6.8) can’t be compiled successfully on DeLi, gc6.2 can be compiled successfully. Download Gc6.2 from http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/ , compile and install it with default way.
Then download W3m-0.5.2 from http://prdownloads.sourceforge.net/w3m/ . Before compile W3m, set environment at first: ” export LD_LIBRARY_PATH=”/usr/lib:/usr/local/lib” “, otherwise, you maybe can’t compile it successfully.
After compile and install W3m with default way, add a soft link “libgc.so.1″ which link to “/usr/local/lib/libgc.so.1.0.2″ under directory “/lib” with the command below:

ln -s /usr/local/lib/libgc.so.1.0.2 /lib/libgc.so.1

After finish installation of W3m, I will introduce some usage of W3m on DeLi Linux 0.8.

First, create a soft link under /usr/bin which linked to w3m: ln -s /usr/local/bin/w3m /usr/bin/w3m , otherwise, you will fail to execute “w3m” for can’t find command when you login into system with root and then switch to common user account with ” su ” command.

Use ” w3m http://www.yoururl.com ” open a URL address, press “U” key to enter the URL address you want to go. “H” key to call help menu. “O” key to call option config menu, then configure some necessary options. Note, press “OK” at the end of every section to finish the options config of this section. Select “YES” for “Render frames automatically” of “Display Settings” to support frame page; Modify the “Editor” to “/usr/bin/vim” in “External Program Settings” to use vim text editor which be transplanted ahead; Select “YES” for “Enable cookie processing” and “Accept cookies” in “Cookie Settings” to accept all cookies. Otherwise, you maybe can’t login into some websites. If you will not accept the cookie of special website, add its domain name into “Domains to reject cookies from”. The cookie config of W3m I don’t understand clear, so only for refering; There is a section “Charset Settings” is important to view chinese web page (only for refering too, its only my personal experience), select”NO” for “System charset follows locale(LC_CTYPE)”. Select “Chinese (EUC-CN, GB2312)” when view simplified chinese page and select “Chinese Taiwan (Big5, CP950)” plus switch to traditional chinese environment of zhcon by press “CTRL+F3″ when view traditional chinese web page; If you use w3m in xterm in X Window(because I have set language environment into “zh_CN.UTF-8″), need select “Unicode (UTF-8) ” in “Display charset” option.

Additionally, you can use “mutt + esmtp + fetchmail + procmail” to receive, write and send email. You can do some search about them; You can listen mp3 with Mp3blaster, etc.(I haven’t test mutt combination and mp3blaster on DeLi Linux 0.8).

Introduce the chinese environment configuration of X Window on DeLi Linux 0.8 below

(some content copy from the wiki page of DeLi Linux: Internationalization and native language support)

1, Set chinese language:

Select “zh_CN.UTF-8” when setup by delisetup, it should be there are two lines at the end of file: /etc/profile like below:

export LANG='zh_CN.UTF-8'
unicode_start

If you like english programs menu, you can change “zh_CN.UTF-8″ into “en_US.UTF-8″, Fcitx, a chinese input method will still work well under english environment, I will introduce it later. But, you must have chinese fonts in the system.

2, Add a good looking chinese font

Copy a chinese *.ttf font into a font dir, e.g., a WenQuanYi font : “/usr/share/fonts/wenquanyi/wqy-zenhei/wqy-zenhei.ttf” . Then executed” fc-cache -fv ” with root and non-root user.

Copy a chinese bitmap font into the fonts directory above with the same way ( because the firefox1.5 transplanted from DeLi Linux 0.7.2 which I will introduce later need bitmap font for good experence when view chinese page, the reason is firefox1.5 in DeLi 0.7.2 didn’t compile for xft font support), I select WenQuanYi Bitmap Song CJK Font here, I copy this bitmap font directory “wqy-bitmapfont” in ubuntu into directory “/usr/share/fonts/wenquanyi/”. In order to enable this font in firefox1.5, need insert some parameter like below into /etc/X11/xorg.conf:

Section "Files"
FontPath "/usr/share/fonts/wenquanyi/wqy-bitmapfont"
EndSection

3, Install a chinese input method

For example, a small and fast chinese input method software “fcitx“, compile it yourself, or install a ready-made binary package with command below:

pacman -U http://39file.googlepages.com/fcitx-3.1-1.pkg.tar.gz

directly.

Or, you can build a pacman package of fcitx with command “makepkg -c“, I borrowed the “PKGBUILD” script from archlinux: http://repos.archlinux.org/viewvc.cgi/fcitx/repos/extra-i686/PKGBUILD?revision=356&view=markup . I commented the line:”arch=(”i686” “x86_64”)” and the line “depends=(’libxft’ ‘libxpm’)”.

Then, add lines into “~/.xinitrc” before the last line, the last part of this file just like below:

# start some nice programs

export XMODIFIERS=”@im=fcitx”
export XIM=fcitx
export XIM_PROGRAM=fcitx
fcitx&
exec icewm-session

In this way, chinese input method “fcitx” will startup automatically when “startx“.
Additionally, if you use the english environment configured with command ” export LANG=’en_US.UTF-8′ ” like above, you need insert a line before execute fcitx (e.g., insert it before “export XMODIFIERS=”@im=fcitx” “):

export LC_CTYPE="zh_CN.UTF-8"

But, I found even I use fcitx on my Celeron 400 machine, it still isn’t too smoothly to input chinese under X Window (for example, it has an obvious delay when I switch to chinse inputing status by press “CTRL+Space” to start typing). I have ever tried to install such as Xcin + Crxvt, Chinput chinese input method but failed. So, if you can’t resolve this problem, and, you have a very old machine and need to input plenty of Chinese character, I suggest you configure the console chinese environment with the way above, you can get a fast inputting feeling ( I have felt this on my 486 machine, but, it has retired now :) ). In fact, it isn’t too difficult to master such a console working environment.

4, Change font size of GTK2 programs

The font size is a bit small in the GTK2 program. Create a file “~/.gtkrc-2.0“, here is an example file, it select “wenquanyi zen hei” with font size 12 as the default font of these GTK2 programs:

style "gtk-default-zh-cn" {
font_name = "wenquanyi zen hei 12"
}
class "GtkWidget" style "gtk-default-zh-cn"

5, Change font size of icewm

The font size of “icewm” is a bit small too. Copy “/usr/share/icewm/preferences” into “~/.icewm/“, and uncomment the lines of font set, e.g., uncomment the line “# MenuFontNameXft=”sans-serif:size=10:bold” “, and change size to “12” like this “ MenuFontNameXft=”sans-serif:size=12:bold” “, this will make the font size of icewm menu a bit bigger.

6, Install a web browser called “skipstone” with good chinese support

The web browser “netsurf” come with DeLi 0.8 can display simple web page ( include chinese page ), but cannot input chinese into its input box with “fcitx” chinese input method. Skipstone is almost a full-function web browser and have a good chinese support. First, execute “su” to become the root user, then execute “pacman -S skipstone” to install skipstone web browser.

But, skipstone is still too heavy for old computer. I have tested the ram footprint of web browsers below with the command ” pmap `pidof program name`|tail -1 “:

Open http://www.google.com/
dillo-i18n-0.8.6 27516K
dillo2 26616K
firefox-1.5 29656K

Open http://www.learndiary.com/
dillo-i18n-0.8.6 31516K
dillo2 28240K
firefox-1.5 36388K
skipstone1.0.0 51768K

So, I troduce how to transplant firefox1.5 in DeLi Linux 0.7.2 into DeLi Linux 0.8, please see the content of “some notes about transplanting firefox 1.5 in deli 0.7.2″ in page DeLi Linux 0.8 Software Installation for the detail method of tranplanting. Because the firefox1.5 in DeLi Linux 0.7.2 hasn’t add xft font support, it isn’t very nice to see chinese font web page, even it can’t display some Chinese characters. I resolved this by using chinese bitmap font (e.g., wenquanyi bitmap font). WenQuanYi Bitmap Song CJK Font has been installed above. Select “Edit”->”Preferences”->”Content” in the menu of firefox, then set the font to “wenquanyi-wenquanyi bitmap song-iso10646-1″ for chinese font and the font of “Other Languages”. Then you can use beautiful WenQuanYi bitmap font :) .

Dillo web browser is very fast even you use it at a very old computer if you only browser the pictures and text in the page( it has no javascript support, etc..). Dillo2 released at October, 2008, it uses FLTK graphics library, it should be faster than Dillo 0.8.x and use less resource. You can download the lastest dillo2.0 source at its homepage and download FLTK v2.0.x-r6483 (recommanded by dillo2.0) needed by dillo2 at here. According to the manual, compile and install them with default way, execute “dillo” in xtem start to surf internet. Copy “/usr/local/etc/dillorc” into directory “~/.dillo”, modify “vw_fontname” and “fw_fontname” to a chinese font, then it can display chinese.. Get help documents of dillo2 at here.

7, Some skills

1), Enable xterm chinese display
Xterm’s default font can’t display chinese fully. Press “CTRL” key, don’t loose it, and click right button of mouse on the xterm windows, it will show a pop menu, don’t loose right button of mouse yet, move the mouse arrow down and select “Large”, loose “CTRL” key and right button of mouse. It can display chinese fully now. Additionally, add an option ” -fa xx” when execute xterm then it can display chinese perfectly (e.g., xterm -fa w), it should be a font name after that “-fa”, but, whatever I input after “-fa” on DeLi Linux 0.8 it can display same chinese font, I can’t specify a specific chinese font. I don’t know the reason.

2), Abiword display and input chinese
Abiword can’t display chinese by default, after you open a chinese text, press CTRL+A select all text, then select a chinese font, the chinese text will be displayed correctly.
Before you input chinese, select a chinese font first.

3), Activate chinese input method on Gnumeric
Left click mouse on the fomula input box, press CTRL+SPACE, chinese input method of fcitx can be activated.

4), Start some X programs slowly
For example, it is very slow to start some X programs such as Xterm, Xcalc, Xfontsel, etc., and occupy almost 100% CPU time when start them. Execute “sudo sed -i -e ‘/GBK/,/^}/d’ /usr/share/X11/locale/zh_CN.UTF-8/XLC_LOCALE ” to resolve this problem, I was inspired by Install Wine on Ubuntu. It just delete the GBK font section in the file “/usr/share/X11/locale/zh_CN.UTF-8/XLC_LOCALE”. But, if you install WenQuanYi bitmap chinese font as above, it is no problem when start the X programs ahead without deleting GBK section in the file ahead, the reason should be WenQuanYi bitmap has included GBK font.

Ok, stop here about DeLi Linux chinese environment configuration, I will do some supplementing if there are any experience and lessons later. This is the last diary of this series. Welcome communicating. Good luck.


2 Comments

[...] This is the fourth diary of DeLi Linux Diaries Series, the previous is: DeLi Linux 0.8 Configuration; The next will be: DeLi Linux 0.8 Chinese Environment Configuration. [...]

[...] Configure the Chinese Environment On DeLi Linux 0.8, how to set a console environment support chinese with softwares: Zhcon + Screen + W3m + Vim, etc. [...]