Non-Latin Characters Disply in the VIM for Win32

53 views
Skip to first unread message

Hilary Cheng

unread,
Nov 19, 2008, 4:03:25 AM11/19/08
to vim...@vim.org
Dear all,

  I am starting to use the VIM for Win32 which running at WinXP. As I configurated the vim to utf-8 (fileencodings, fenc, encoding, tenc) , config the fonts to ANSI Character Set with an Latin Font (Courier New). VIM will show the Non-Latin to Square Characters. It seems it is strange. Since WinXP will handle the Non-Latin Characters with Courier New. I have started to dig the source from svn and I found that ETO_IGNORELANGUAGE was set for ExtTextOutW in the vim7\src\gui_w32.c. When it set, All Non-Latin Characters will show Square. If This options has been removed, it will display Non-Latin Characters correctly. Is it necessary to use this options ?

Regards,

Hilary

Hilary

unread,
Nov 19, 2008, 6:10:09 AM11/19/08
to vim_dev

Tony Mechelynck

unread,
Nov 19, 2008, 10:30:21 AM11/19/08
to vim...@googlegroups.com

IIUC, ANSI character set (cANSI) means you _don't want_ non-Latin
glyphs. Set it to cDEFAULT instead(:set gfn=Courier_New:h13:cDEFAULT),
and all glyphs available in Courier New will be available to you
(including Cyrillic and Arabic, but I don't think it's got Chinese).


Best regards,
Tony.
--
Jenkinson's Law:
It won't work.

Hilary Cheng

unread,
Nov 19, 2008, 7:45:56 PM11/19/08
to vim...@googlegroups.com
Dear Tony,

  As I tested, it still cannot display the characters if I changed from ANSI_CHARSET to DEFAULT_CHARSET.

Regards,

Hilary

Tony Mechelynck

unread,
Nov 19, 2008, 10:39:22 PM11/19/08
to vim...@googlegroups.com

If you canged what from ANSI_CHARSET to DEFAULT_CHARSET ? AFAIK, gvim
doesn't use those values.

The language to use for the GUI font is set at runtime (typically in
your vimrc), not at compile-time (not in any *.c file), and as part of
the 'guifont' option. Try using

:set guifont=Courier_New:h13:cDEFAULT

in your vimrc. No _CHARSET part, which would make the value unrecognizable.


Best regards,
Tony.
--
A closed mouth gathers no foot.

Hilary Cheng

unread,
Nov 20, 2008, 12:24:21 AM11/20/08
to vim...@googlegroups.com
Dear Tony,

I use this configuration. still cannot get the characters correctly displayed if i don't delete the ETO_IGNORELANGUAGE statement. For the problem that I described, VIM cannot display the (chinese) characters correctly in the edit mode, not the vim menu.

Regards,

Hilary

Tony Mechelynck

unread,
Nov 20, 2008, 12:55:46 AM11/20/08
to vim...@googlegroups.com
On 20/11/08 06:24, Hilary Cheng wrote:
> Dear Tony,
>
> I use this configuration. still cannot get the characters correctly
> displayed if i don't delete the ETO_IGNORELANGUAGE statement. For the
> problem that I described, VIM cannot display the (chinese) characters
> correctly in the edit mode, not the vim menu.
>
> Regards,
>
> Hilary

I thought Courier New didn't include Chinese glyps. To display Chinese,
try some other font, such as MingLiU or SimSun.


Best regards,
Tony.
--
"Love is a snowmobile racing across the tundra and then suddenly it
flips over, pinning you underneath. At night, the ice weasels come."
-- Matt Groening

Hilary Cheng

unread,
Nov 20, 2008, 2:52:57 AM11/20/08
to vim...@googlegroups.com
Dear Tony,

  Actually, yes. But MingLiU English Character is not acceptable. Also, once I have removed the ETO_IGNORELANGUAGE. It can display both English Character (Font I selected like Courier New), and Chinese Character at the same time.

Regards,

Hilary

Bram Moolenaar

unread,
Nov 20, 2008, 5:32:06 AM11/20/08
to Hilary Cheng, vim...@googlegroups.com

Hilary Cheng wrote:

> Dear Tony,


> Actually, yes. But MingLiU English Character is not acceptable. Also, once
> I have removed the ETO_IGNORELANGUAGE. It can display both English Character
> (Font I selected like Courier New), and Chinese Character at the same time.

ETO_IGNORELANGUAGE language is used to avoid problems with right-to-left
languages. Perhaps we should only use it when actually drawing in
right-to-left mode? Problem is that this flag is undocumented.
What does it do when not in right-to-left mode?

--
This is an airconditioned room, do not open Windows.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Szabolcs

unread,
Nov 20, 2008, 6:07:57 AM11/20/08
to vim_dev

Most Windows programs, like Notepad, will use different fonts for
different types of characters.

Even if Notepad is set to use Courier New, it will use a different
font to display e.g. Chinese characters. Windows Vim does not do
this. It only uses the font that is specified in the options.
Courier New does not include any Chinese characters, so if you need
Chinese characters, you'll need to use a different font, e.g. MS
Mincho.

For some reason Windows does not use anti-aliasing for any of the
fonts that includes CJK characters, so with these fonts, even Latin
letters will be ugly ...

I wish Windows Vim could automatically select the proper font for
different types of characters, like most other Windows programs do ...
The Gnome version of Vim can already do this.

Will we ever get this feature in Windows Vim?

Tony Mechelynck

unread,
Nov 21, 2008, 2:24:41 AM11/21/08
to vim...@googlegroups.com

I don't know... Maybe just wait until (...if ever...) GTK2 (or at least
Pango) becomes available on native-Windows? ;-)


Best regards,
Tony.
--
The wind doth taste so bitter sweet,
Like Jaspar wine and sugar,
It must have blown through someone's feet,
Like those of Caspar Weinberger.
-- P. Opus

Ben Schmidt

unread,
Nov 21, 2008, 9:03:29 AM11/21/08
to vim...@googlegroups.com
> I don't know... Maybe just wait until (...if ever...) GTK2 (or at least
> Pango) becomes available on native-Windows? ;-)

It already is, isn't it? Hence Gimp, Gaim, etc. It would probably be a
challenge compiling a GTK+ native Vim, but it should be possible.

Smiles,

Ben.

Ben Schmidt

unread,
Nov 21, 2008, 9:10:50 AM11/21/08
to vim...@googlegroups.com
>> Actually, yes. But MingLiU English Character is not acceptable. Also, once
>> I have removed the ETO_IGNORELANGUAGE. It can display both English Character
>> (Font I selected like Courier New), and Chinese Character at the same time.
>
> ETO_IGNORELANGUAGE language is used to avoid problems with right-to-left
> languages. Perhaps we should only use it when actually drawing in
> right-to-left mode? Problem is that this flag is undocumented.

Mmm. I suspected this. My guess is that the flag basically turns it from
a smart 'render this text, doing whatever is necessary to get it to make
sense--pulling fonts from other characters and changing writing
directions where appropriate' mode that is focused on getting the
languages in the text onto the screen into a dumb 'render glpyhs from
this font in exactly this order' mode which is focused on giving the
programmer precise control over the rendering.

> What does it do when not in right-to-left mode?

I think it will cause problems then, too. As soon as you wish to render
glyphs that are a mixture of LTR and RTL, some bidi algorithm or
something will kick in, regardless of whether Vim is in rightleft mode
or not.

Ben.

Reply all
Reply to author
Forward
0 new messages