You are not logged in.

#1 2011-07-23 11:44:29

xiliyi
Member
Registered: 2011-05-14
Posts: 57

[SOLVED] make Chinese characters readable in terminal

Hi forums,

I searched the board but couldn't find a solution to my question: a lot of people asked on how to get a utf-8 console or how to input Chinese in console, but I am past these steps.

I use Xmonad and urxvt with unicode support. ibus is installed correctly, apart from the fact that I have to manually start it via ibus-setup every time I reboot and want to input Chinese.
Chinese input in firefox and such applications works flawlessly, it even works in urxvt. But the characters are all garbled. They are the correct characters, I can copy & paste them to e.g. a firefox window and clearly read them. Likewise, I can use ibus to write characters directly in terminal or copy characters from documents etc. to the terminal.
But the characters in terminal are plain unreadable, although simple characters (with few strokes, like "一") can be recognized.

Please help me sort this out, I'm sure it's actually very simple :)

Thanks!

Last edited by xiliyi (2011-07-24 12:10:39)

Offline

#2 2011-07-23 12:18:17

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [SOLVED] make Chinese characters readable in terminal

You need to install a Chinese font for the Chinese characters to render. Search using `pacman -Ss 'Chinese.*font'`. The wqy-* fonts are pretty good, including aur/wqy-microhei.

After installing the font, you need to configure the X resources:

URxvt.font: <your primary font here>,xft:WenQuanYi Micro Hei Mono:antialias=true

Edit
On a second thought, you must have installed *some* font that covers Chinese, otherwise your browser will not render those characters.

Last edited by lolilolicon (2011-07-23 12:23:18)


This silver ladybug at line 28...

Offline

#3 2011-07-23 12:56:06

xiliyi
Member
Registered: 2011-05-14
Posts: 57

Re: [SOLVED] make Chinese characters readable in terminal

Sorry, I forgot to mention I already installed all the fonts from the CJK part of the font article in the wiki (https://wiki.archlinux.org/index.php/Fo … Vietnamese). I also have urxvt configured using this font.
The problem is, the characters ARE displayed, they are just like... as if they were shrunk or rumpled or crumpled, with strokes missing, as if there was not enough space!

Offline

#4 2011-07-23 13:03:53

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [SOLVED] make Chinese characters readable in terminal

Post your relevant settings (Xdefaults), and maybe a screenshot?


This silver ladybug at line 28...

Offline

#5 2011-07-23 14:10:11

xiliyi
Member
Registered: 2011-05-14
Posts: 57

Re: [SOLVED] make Chinese characters readable in terminal

I had some misspellings in the file before, now Chinese characters are displayed correctly with this .Xdefaults:

URxvt.saveLines: 1000
URxvt.scrollBar: false
URxvt.foreground: white
URxvt.background: black
URxvt.letterSpace: -1
URxvt.secondaryScroll: true
URxvt.font: -isas-song ti-medium-r-normal--24-240-72-72-c-240-gb2312.1980-0
#URxvt.font: xft:ttf-arphic-ukai:pixelsize=8
URxvt.urlLauncher: firefox
URxvt.tabbed.saveLines: 1000
URxvt.tabbed.scrollBar: false
URxvt.tabbed.tabbar-fg: 3
URxvt.tabbed.tabbar-bg: 0
URxvt.tabbed.tab-fg: 0
URxvt.tabbed.tab-bg: 1
URxvt.tabbed.secondaryScroll: true
URxvt.tabbed.font: -isas-song ti-medium-r-normal--24-240-72-72-c-240-gb2312.1980-0
#URxvt.tabbed.font: xft:ttf-arphic-ukai:pixelsize=8
URxvt.tabbed.urlLauncher: firefox
URxvt.perl-ext-common: default,matcher
URxvt.matcher.button: 1
URxvt.matcher.pattern.1: \\bwww\\.[\\w-]\\.[\\w./?&@#-]*[\\w/-]
URxvt.inputMethod: ibus
URxvt.preeditType: OnTheSpot,None

The lines #-ed out are what I used before.
Problem is, this font does not display üäöèé etc correctly. They are displayed, but the cursor seems to be off position by half a letter.

Offline

#6 2011-07-23 14:35:10

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [SOLVED] make Chinese characters readable in terminal

OK, here you don't use "#" for comments, but "!". See the X Resources wiki page.

I've never seen that behavior, but with the following it works for me:

URxvt.font: -nil-profont-medium-r-normal--11-110-72-72-c-60-iso8859-1,xft:WenQuanYi Micro Hei Mono:style=Regular:pixelsize=11:antialias=true

This way, üäöèé are all displayed in profont, and Chinese characters in the WenQuanYi font.


This silver ladybug at line 28...

Offline

#7 2011-07-23 15:16:56

xiliyi
Member
Registered: 2011-05-14
Posts: 57

Re: [SOLVED] make Chinese characters readable in terminal

Thanks for the input. I tried your line: The font size is ridiculously small on my screens smile
But apart from that, Chinese isn't displayed properly, same problem I described above. I use the aur version of rxvt with unicode support and Chinese character patch. This may be the reason for a very wide gap between letters. But I like this font and everything looks fine apart from the gap. See the .Xdefaults and a sreenshot.

URxvt.saveLines: 1000
URxvt.scrollBar: false
URxvt.foreground: white
URxvt.background: black
URxvt.secondaryScroll: true
URxvt.font: xft:ttf-arphic-ukai:size=8
URxvt.urlLauncher: firefox
URxvt.tabbed.saveLines: 1000
URxvt.tabbed.scrollBar: false
URxvt.tabbed.tabbar-fg: 3
URxvt.tabbed.tabbar-bg: 0
URxvt.tabbed.tab-fg: 0
URxvt.tabbed.tab-bg: 1
URxvt.tabbed.secondaryScroll: true
URxvt.tabbed.font:ttf-arphic-ukai:size=8
URxvt.tabbed.urlLauncher: firefox
URxvt.perl-ext-common: default,matcher
URxvt.matcher.button: 1
URxvt.matcher.pattern.1: \\bwww\\.[\\w-]\\.[\\w./?&@#-]*[\\w/-]
URxvt.inputMethod: ibus
URxvt.preeditType: OnTheSpot,None

Oh, and defining font size via size= or pixelsize= does not work…

j73n249m.png

Last edited by xiliyi (2011-07-23 15:19:26)

Offline

#8 2011-07-23 18:32:01

xiliyi
Member
Registered: 2011-05-14
Posts: 57

Re: [SOLVED] make Chinese characters readable in terminal

Okay, solved this :-)

I found these two lines which fit my needs perfectly:

URxvt.font:xft:DejaVu Sans Mono:pixelsize=12:antialias=false,xft:WenQuanYi Bitmap Song:pixelsize=12:antialias=false
URxvt.boldFont:xft:DejaVu Sans Mono:pixelsize=12:style=Bold:antialias=false,xft:WenQuanYi Bitmap Song:pixelsize=12:style=Bold:antialias=false

Thank you for your help!

Offline

#9 2011-07-24 02:03:42

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [SOLVED] make Chinese characters readable in terminal

xiliyi wrote:

Thanks for the input. I tried your line: The font size is ridiculously small on my screens smile

Yup, ridiculously small here too. Urxvt somehow sucks at rendering it actually. I tried the same font combinations in firefox using CSS and they rendered very nicdly at 12px.
I don't use a bigger font because I rarely use wide characters in the terminals, and I prefer a small font for ascii.

xiliyi wrote:

I found these two lines which fit my needs perfectly

恭喜 big_smile
You may want to edit your original post and mark it as [SOLVED].
Cheers.

Last edited by lolilolicon (2011-07-24 02:05:10)


This silver ladybug at line 28...

Offline

Board footer

Powered by FluxBB