LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Chinese Input in Slackware 12, which WM? (https://www.linuxquestions.org/questions/slackware-14/chinese-input-in-slackware-12-which-wm-592076/)

Alien_Hominid 10-17-2007 02:53 PM

Imho, stable e17 will win easily.

BCarey 10-17-2007 05:13 PM

Quote:

Originally Posted by reikyv (Post 2927528)
Hi there,

Hope this can help you:
http://www.systemscrafter.com/imho/archives/4

I am a Slackware newbie too, but a regular Red Hat user. I have no problem to read Chinese character with a default installation (using Slackware 12.0 now), and with the guide from the URL above, you should be able to input Chinese character.

Good luck!

I have tried this a few times in the past, and tried again with this link. I always get to the point where I can build it, install it and run it (by which I mean I see processes running and get the applet) but can't seem to invoke it. By which I mean I press Ctrl-Space and nothing happens. Am I missing something?

Brian

reikyv 10-18-2007 12:36 AM

Hi,

Basically, this is what I did:
1) Download scim-1.4.7.tar.gz and scim-pinyin-0.5.91.tar.gz from http://www.scim-im.org/downloads/
2) untar, ./configure, make, make install
3) ldconfig
4) vi /etc/gtk-2.0/gtk.immodules
search: "xim" "X Input Method" "gtk20" "/usr/share/locale" "ko:ja:th:zh"
replace: "xim" "X Input Method" "gtk20" "/usr/share/locale" "ko:ja:th:zh:en"
5) vi /etc/profile.d/lang.sh
search: export LANG=en_US
replace: export LANG=en_US.UTF-8
6) vi /etc/X11/xinit/xinitrc.xfce (I am using XFCE, so if you are using another WM, you need to use the specific xinitrc), add following lines before: XRESOURCES=""
export XMODIFIERS="@im=SCIM"
export GTK_IM_MODULE=xim
export QT_IM_MODULE=xim
/usr/local/bin/scim -d

P/S: During the installation of my Slackware 12.0, I install all packages.

Su-Shee 10-18-2007 03:37 AM

I also use scim as input method which works perfectly fine with any window manager you like.

I prefer to combine scim with anything gtk-based, because all applications based on gtk/pango can receive a Unicode character with a keyboard shortcut (ctrl-shift-u<code point>) - which means to type just two or three hanzi, I don't start scim, I just type the code points. (If I know them. ;)

Reikvy, that's basically what I've got as a configuration - xim is not the same as "scim".

export LC_CTYPE="de_DE.utf-8"
export LC_COLLATE="de_DE.utf-8"
export LANG=en_US.utf-8
export LC_PAPER="de_DE.utf-8"
export XMODIFIERS="@im=SCIM"
export XIM_PROGRAM="scim -d"
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim
scim -f socket -ns socket -d
scim -f x11 -s socket -c socket -d

In addition to some minor stuff for mutt, vim and less to properly display any kinds of Unicode characters.

You don't have to boot KDE or Gnome to work with Hanzi, then - just open applications like Abiword (just an example) within a proper Unicode environment. If you actually want to change a single application into chinese entirely (including menus and stuff), start it with "LANG=zh_CN.utf-8 abiword &" - to stick with this example.

I usally just type foreign stuff, but stick with english messages and menus and so on.

reikyv 10-18-2007 04:30 AM

Hi Su-Shee,

Thanks for the information, I will try and see. :-p

BCarey 10-18-2007 04:13 PM

I'm happy to eat my words. I rebooted (something I rarely do) and now it works!

Brian

Bruce Hill 10-18-2007 05:22 PM

How do the fonts look for Chinese with that method? Do they display bold properly, also? How do the English fonts look?

reikyv 10-18-2007 09:20 PM

Hi,

Have a look yourself:

1) chinese website

2) enlighs website

So, you can see that the chinese character rendered in my machine still not that 'pretty' enough, I don't have time to dig into this, there're tonnes of other interesting stuff to do. At least, I feel that I just need to be able to read chinese character, and doesn't matter whether the font looks ugly or not. :-p

Piaculum 10-18-2007 11:35 PM

I'm glad I'm not the only one trying to do this!

Bruce, I meant to get that info up here yesterday but to be honest it took me a while to figure out how to get the output of the lspci into a file. (like I said, completely new to all of this.)

Even after figuring that out, I had to get my external hard drive mounted so that I could get the file onto that drive (had to learn mnt, fstab, etc.) I know these things are second hand to everyone else, but it's a lot to learn.

Where I stand now though is...

- I downloaded the tar (tarball?...same thing?) file from www.intellinuxwireless.org after finding that Intel has linux drivers for my wireless card (it's an Intel PRO/Wireless 3945ABG)

- After learning how to untar something, I untarred(?) it and attempted to "make" it (soooo much to learn). I got an error message saying that my kernel needed the mac80211 subsystem found at the same website, so i dl'ed that and it's currently sitting on my external hard drive.

So, right now I'm reading through the install file to try to figure out how to build this into my kernel. I think it's probably pretty easy but switching between windows and slack just for a network connection is beginning to be a drag. Once I get Flux working (for the life of me I can't get my refresh/sync rates correct - have to call MPC today to try to get the information) and a live wireless connection I will be in a much better position to deal with everything.

I'll let you know in a bit how things are working out today.

-Matt W.

Piaculum 10-19-2007 11:21 PM

Reposted this in a new thread.

Bruce Hill 11-03-2007 02:31 AM

HOW-TO setup Chinese font display and input in Slackware-12.0
 
This is a rough draft of what will be a tutorial about Chinese display and input for Slackware-12.0:

HOW-TO setup Chinese font display and input in Slackware-12.0

This HOW-TO explains how to make Slackware-12.0 display good looking Chinese
fonts, both normal and bold; sharp, clear English fonts; and Chinese input.
All files and packages necessary for this HOW-TO can be downloaded from:
http://www.slackware.com/~alien/sas/

===INSTRUCTIONS FOR CHINESE FONTS===

NB: Follow these steps in this order ...

1. Create a file named "10-myfonts.conf" under "/etc/fonts/conf.avail/".
This is the fontconfig configuration file for your new font setup.
Rather than creating a new file on your system, you can cp 10-myfonts.conf
to "/etc/fonts/conf.avail/" then you need to symlink it to "/etc/fonts/conf.d/"
which you can do with this command as root:
Code:

ln -s /etc/fonts/conf.avail/10-myfonts.conf /etc/fonts/conf.d/
2. You will need some fonts with proper glyphs for good display. The best ones come
from Microsoft. Eric Hameleer's has setup a corefonts.SlackBuild which you can use
to get and install these fonts. In this HOW-TO we will use Tahoma as the choice for
the English font. If you prefer a different font, try what's available on your system.
For this HOW-TO you will need SimSun.ttf for Chinese fonts.

3. Copy the needed fonts to "/usr/share/fonts/TTF/". Then change the permissions by
issuing "chmod 644 /usr/share/fonts/TTF/*ttf". Next you'll need to run the following
commands as root in the "/usr/share/fonts/TTF/" directory:
Code:

mkfontscale
mkfontdir
fc-cache

4. Mount your "slackware-12.0-install-d3.iso" or the DVD. There are two packages in
"kdei" we need to install. If "/mnt/cdrom/" is your mount point, issue as root:
Code:

installpkg /mnt/cdrom/slackware/kdei/*zh_CN*.tgz
That should install kde-i18n-zh_CN and koffice-l10n-zh_CN.
(If you're interested, I also have a Chinese build of Open Office available that
works great for Chinese and English. The latest stable Chinese source was 2.1.1,
and there's also an English OOo package with the 2.3.0 source. Email me for them.)

5. Next we need new Slackware packages for "freetype and libXft".
Pat V. rebuilt the libXft package and put it in Slackware -current for testing, so
you can download it from here or your local mirror, and install it with the command:
Code:

upgradepkg libXft-2.1.12-i486-2.tgz
6. We need to rebuild freetype with the bytecode interpreter enabled. Here are the steps:
From the Slackware source (../slackware-12.0/source/l/freetype/) get all those
files and put them in one directory. Then you can edit "freetype.SlackBuild" and
uncomment (remove the # from in front of) line 50:
Code:

#zcat $CWD/freetype.bytecode.interpreter.diff.gz | patch -p1 --verbose || exit 1
and also uncomment line 57:
Code:

#zcat $CWD/freetype.subpixel.rendering.diff.gz | patch -p1 --verbose || exit 1
and also give it a different version number in line 7, where the file says:
Code:

BUILD=${BUILD:-3}
give it another number, such as 4. Now save the file and run as root:
Code:

sh freetype.SlackBuild --cleanup
which will build a new freetype package with the bytecode interpreter enabled, and sub-pixel
hinting. (Latest testing shows the stock FreeType package might be okay after installing the
new libXft, so try that before you rebuild FreeType.)
NB: You can get the latest source and rebuild FreeType yourself if you prefer, but IMO a
Slackware package built with an official Slackware SlackBuild script is best; so
even if you elect to use the latest freetype source, use the Slackware SlackBuild.
After it's built, you can look in /tmp/ for the new Slackpackage and install it as
usual, but use
Code:

upgradepkg <packagename>
rather than installpkg.

7. For Chinese input, you will need scim, scim-tables, and scim-pinyin. You can either
build them yourself, download them from http://www.slackware.com/~alien/sas/ or
build them using the SlackBuilds from that repository. These are new packages for
Slackware, so you can install them all using "installpkg <packagename>".

8. Now we need to setup the language selections. Edit "/etc/profile.d/lang.sh" like this:
Code:

# en_US is the Slackware default locale:
    # export LANG=en_US
export LANG=zh_CN.gb2312
export XMODIFIERS="@im=SCIM"
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim
export G_BROKEN_FILENAMES=1

9. Reboot ... and configure your system.

10. Open the KDE control center, and select Appearance & Themes > Fonts
Choose "Adjust All Fonts" and under "Requested Font" put a check mark in Font and
then choose "Tahoma". Select OK and then change "Use anti-aliasing" to Disabled,
then change "Force fonts DPI" to "96 DPI". Select "Apply" then from the File menu
select Quit. Now shutdown your X server, and then issue "startx" again.

11. For Konsole I selected "Lucida Console, regular, 10". Choose one that you like.

12. For System-wide configuration of Gtk apps, add a file named "gtkrc" to /etc/gtk-2.0/
with this text:
Code:

gtk-font-name = "Tahoma 9"
If you only want to do this for one user, add the file .gtkrc-2.0 to /home/<user>/
and put the text in it. In theory, you could change the Gtk font for each user on
the system. You may select another font if you don't like Tahoma.

13. For web browsing we choose Mozilla Firefox. It's fonts need to be changed, so open
Firefox and choose "Edit > Preferences > Content" and in "Fonts & Colors" choose
"Advanced" and select some fonts. I have:
Code:

Fonts for:  Simplified Chinese
Proportional:  Sans-serif          Size: 12
Serif:        Tahoma
Sans-serif:    Vahoma
Proportional:  Tahoma              Size: 12
Minimum font size:  12
Allow pages to choose their own fonts, instead of my selections above (remove the check mark)
Character Encoding
Default Character Encoding: Chinese Simplified (GB2312)


You should how have sharp looking Chinese fonts - able to display bold, also. The
English fonts should also look good. You might change some of my font selections to
suit your taste.

The app SCIM (Smart Common Input Method) is started when you boot your computer. You
only need to press "Ctrl+Space" to switch from English to Chinese input. There is a SCIM
setup menu you can read by right-clicking on the SCIM keyboard icon in the system tray.
I've deselected all the languages and input methods except Chinese Simplified. If you can't
read the Chinese to do that, perhaps this screenshot will suffice.

If you have any questions about this guide, please post them in this thread. If the OP
has an objection to using his thread, we'll edit this post and move the guide.

Once this has a few days to filter through the userbase, I'll write and submit a tutorial
for moderator approval in the Tutorials section.

The screenshots included at http://www.slackware.com/~alien/sas/screenshots/ should speak
for themselves.




NB: Special thanks to Eric Hameleer's (Alien Bob) and LeiDan for help in getting this far.

AceofSpades19 11-03-2007 02:37 AM

you should make an lq wiki article on that

Bruce Hill 11-03-2007 02:48 AM

Quote:

Originally Posted by AceofSpades19 (Post 2946572)
you should make an lq wiki article on that

Will submit something, but first I'd like some folks to test the instructions and
see if it hoses their systems. It was all written in vim while doing it, without
much sleep.

If it passes the forum test, it will be in a nice, easy to read format.

reikyv 11-03-2007 03:28 AM

Hi, thanks for the how-to.

Anyway I didn't follow the guide exactly, but just extract part of it (because I am able to read and input Chinese already) - copy the simhei and simsun from Windows\Fonts to /usr/share/fonts/TTF/ and run those commands.

Bruce Hill 11-04-2007 06:09 PM

Piaculum,

I tested SCIM and the fonts of this tutorial with Fluxbox, and it works. My test machine does not have a good looking, properly configured Fluxbox. For my first few years with Slackware I ran Flux, but switched to KDE because it seemed easier for guys coming from Windoze to Slackware. I build and repair computers, and must deliver something that is pretty much intuitive for someone coming from the darkside. KDE is much more so than Fluxbox.

However, I'm about to setup a desktop with Fluxbox for testing, and to enjoy a window manager that does not suck up all my resources like KDE.


All times are GMT -5. The time now is 12:20 AM.