To many inter-character space when display Simplified Chinese (zh_CN)

4 views
Skip to first unread message

Steven Woody

unread,
Dec 1, 2008, 9:16:23 PM12/1/08
to Vim
Hi,

I am running gvim to display/edit Simplified Chinese text when locale
was set to zh_CN.gbk. There are many space between Chinese
characters, this looks so urgly. But this does not happened for other
font-config program such as Xemacs and firefox. Does anyone know
where can I find help for this issue?

Thanks in advance.

-
narke

bill lam

unread,
Dec 2, 2008, 9:17:33 AM12/2/08
to vim...@googlegroups.com, Vim
No idea, mine just look ok. BTW you forgot to give details such as os
being used, fonts and a screenshot.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩242 王建 新嫁娘
三日入廚下 洗手作羹湯 未諳姑食性 先遣小姑嘗

bill lam

unread,
Dec 2, 2008, 9:17:33 AM12/2/08
to vim...@googlegroups.com, Vim

Steven Woody

unread,
Dec 2, 2008, 11:51:16 AM12/2/08
to vim...@googlegroups.com, Vim
On Tue, Dec 2, 2008 at 10:17 PM, bill lam <cbil...@gmail.com> wrote:
> No idea, mine just look ok. BTW you forgot to give details such as os
> being used, fonts and a screenshot.
>
> --
> regards,

OS is slackware 12.1; guifonts in gvim set to "Lucida Sans Typewriter
12", please find the attachment for the screenshot.

And, after read you email, I went to set the guifont to the Chinese
font simsun (新宋体 14). The result was interesting:
1. the extra inter-char space problem just disappeared;
2. the chinese characters look not so good, they are too thin to my eyes;
3. the English characters look urgly, please see my another
screenshot attached.

I am thinking why gvim can not handle fonts just as good as other
programs such firefox where the Chinse and English both look good and
acceptable.

Thanks in advance.

screenshot.tar.bz2

Dennis Benzinger

unread,
Dec 2, 2008, 12:34:33 PM12/2/08
to vim...@googlegroups.com
Hi Steven!

Am 02.12.2008 17:51, Steven Woody schrieb:
> [...]


> I am thinking why gvim can not handle fonts just as good as other
> programs such firefox where the Chinse and English both look good and
> acceptable.

> [...]

I don't know Chinese so I can't tell how the characters should look like
but here are some tips for choosing a font:

Did you use a monospaced font? You should use one with GVim (:help E236)

You can use :set guifont=* to get a dialog where you can choose a font
and get a preview of it.

Did you check which font is used by Firefox? Try setting the same font
in GVim. Perhaps Firefox works with English and Chinese because it is
using two different fonts. Then you'll have to choose if you want nice
Chinese or nice English characters in GVim.


HTH,
Dennis Benzinger

anhnmncb

unread,
Dec 2, 2008, 6:49:50 PM12/2/08
to vim...@googlegroups.com
Which gvim version do you use?

I have no problem with gtk2 version: here is relevent setting for me:

if has("gui_gtk2")
set guifont=Bitstream\ Vera\ Sans\ Mono\ 12,Fixed\ 12
set guifontwide=Microsoft\ Yahei\ 12,WenQuanYi\ Zen\ Hei\ 12
endif

You should adjust it for you.

Hope it helpful :)


--
Regards,
anhnmncb

Steven Woody

unread,
Dec 2, 2008, 11:24:13 PM12/2/08
to vim...@googlegroups.com

Yes, it does help! By set up the guifont and guifontwide
independently, both Chinse and English looks good! My gvim is version
7.1 and my current setting is

set guifont=Lucisa\ Sans\ Typewriter\ 12
set guifontwide=新宋体\ 14

Thank you so much!

Steven Woody

unread,
Dec 2, 2008, 11:26:51 PM12/2/08
to vim...@googlegroups.com

Though the problem have bee resolved, I still thank you Dennis. And,
I like to tell you, I can not tell what font the firefox is using,
because all it's font setting for Western and Chinese are all
Serif/Sans Serif. It seems, that is font-config who is playing in the
background to select fonts for firefox. But I don't know how this
works. Would anyone tell me?

Thanks.

bill lam

unread,
Dec 2, 2008, 11:51:23 PM12/2/08
to vim...@googlegroups.com
On Wed, 03 Dec 2008, Steven Woody wrote:
> Though the problem have bee resolved, I still thank you Dennis. And,
> I like to tell you, I can not tell what font the firefox is using,
> because all it's font setting for Western and Chinese are all
> Serif/Sans Serif. It seems, that is font-config who is playing in the
> background to select fonts for firefox. But I don't know how this
> works. Would anyone tell me?

You may try adding this to your ~/.fonts.conf
<match target="font">
<test name="family">
<string>SimSun</string>
<string>SimSun-18030</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>MingLiU</string>
<string>PMingLiU</string>
</test>
<edit binding="strong" mode="prepend" name="family">
<string>Tahoma</string>
<string>Arial</string>
<string>Verdana</string>
<string>DejaVu Sans</string>
<string>Bitstream Vera Sans</string>
</edit>
</match>

This will hopeful replace ugly english glyphs with your more familiar
fonts. But I'm not sure this will work for you because apparently
gnome use another config file.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

唐詩188 杜甫 宿府
清秋幕府井梧寒 獨宿江城蠟炬殘 永夜角聲悲自語 中天月色好誰看
風塵荏苒音書絕 關塞蕭條行陸難 已忍伶俜十年事 強移棲息一枝安

Tony Mechelynck

unread,
Dec 3, 2008, 11:13:15 AM12/3/08
to vim...@googlegroups.com

- Unlike Firefox, gvim uses a fixed-size character cell (which depends
on the 'guifont', but is constant all over the screen). It uses exactly
one cell for each "narrow" glyph (including all non-CJK glyphs) and
exactly two cells for each "wide" glyph (including Chinese characters).
Some characters are defined in Unicode as "ambiguous-width", for these
the 'ambiwidth' option comes into play.

- The Lucida Sans Typewriter font is a Latin font, not a Chinese,
Japanese or Korean font; it includes no CJK glyphs. If you try to
display Chinese characters with 'guifont' set to it, gvim (with GTK2
GUI) will try to borrow the appropriate CJK glyphs from other fonts,
with the ugly result you notice. (Better than displaying a hollow
rectangle or a question mark, but, as you can see, far from perfect.)

- If the SimSun font's CJK glyphs are too thin for you, try another CJK
font; I'm not sure which ones are installed on your computer so I can't
give you definitive advice here. I used to like MingLiU when I was on
Windows, and FZFangSong here on Linux, but it is much a question of
taste and your taste is not necessarily the same as mine.

- To see exactly which fonts Firefox uses for which language, you may
need to open the "Advanced" fonts dialog, by means of a button on the
"ordinary" fonts-and-colours preferences page. (Exactly how these
dialogs are called varies somewhat between versions of Firefox.)

- See also http://vim.wikia.org/wiki/Setting_the_font_in_the_GUI


Best regards,
Tony.
--
"There are those who claim that magic is like the tide; that it swells
and fades over the surface of the earth, collecting in concentrated
pools here and there, almost disappearing from other spots, leaving
them parched for wonder. There are also those who believe that if you
stick your fingers up your nose and blow, it will increase your
intelligence."
-- The Teachings of Ebenezum, Volume VII

Reply all
Reply to author
Forward
0 new messages