On 31/07/14 20:50, Paul Moore wrote:
On 31 July 2014 19:38, Bram Moolenaar <b...@moolenaar.net> wrote:
Paul Moore wrote:
On Windows, Vim does not correctly display international characters.
To demonstrate this, create a file in UTF-8 encoding with the Unicode
characters \x5000 \x5001 \x5002 in it. These should display as Chinese
chacaters.
The question is: What version of Windows? Reading the comments it
appears the behavior changed at some point.
Sorry, this is Windows 7 64-bit.
From my personal experience, I don't think the behaviour has changed,
I was just used to Vim not ever displaying "unusual" characters
properly, but I saw them so infrequently that it didn't bother me and
I never dug into the exact details. But I recently encountered a file
with UTF8 test data in it that was difficult to follow because of the
rendering issue. It was a one-off problem, but annoying enough that I
looked at other editors (I couldn't convince myself that it was *just*
a rendering issue and I wasn't at risk of corrupting the data). I was
surprised to find that *every* other editor displayed the file
flawlessly.
There are plenty of Chinese Vim users, I'm sure they would have
complained loudly if Chinese characters don't show up.
If I understand the issue it is with display of characters which don't
have a glyph defined in the current font. Windows appears to have a
way of falling back to another font which does contain the glyphs if
needed, but the flag I disabled stops that fallback happening - hence
the bad display.
I guess Chinese users won't see an issue as I presume their fonts will
contain the necessary glyphs.
Paul
From what I read in the help, the only version of Vim which will try to
use a glyph from a different font if the font you specified doesn't have
the required glyph, is gvim with GTK2 GUI, which happens to be a Linux
version (and maybe a rarely-used Mac+X11 version).
Console Vim has of course no control over the fonts to be used: the
terminal does it all.
In all other gvim versions, including all Windows versions, you have to
specify the exact font(s) to be used, except that gvim is clever enough
to find the italic and/or bold fonts that go with a Regular font you
specify. There are several options for that.
- 'guifont' is usually set to a single font, though actually it can be a
comma-separated list. However, unlike what happens in CSS (where the
font-family comma-separated list will be scanned left to right for every
character, and the first font which has a glyph for that character will
be used), in gvim the list will be scanned only once, at GUI startup,
and the first font in the list which is installed on your computer will
be used.
- 'guifontset' requires +xfontset which is only available in Vim
compiled for X11 but without GTK2; it is not available on Windows so it
doesn't concern you.
- 'guifontwide' is a comma-separated list of double-wide fonts; like
'guifont' it is scanned only once and the first one installed will be
used for all double-wide characters, and on Windows with +multibyte_IME
(or +multibyte_ime/dyn with the necessary library present and found by
Vim) for IME. 'guifontwide' must be exactly the same height as
'guifont', and exactly twice as wide. If 'guifontwide' is empty gvim
will, if possible, use double-width glyphs from 'guifont', i.e. from the
same font providing single-width glyphs.
On Windows, I recommend to set the "language" attribute of 'guifont' to
cDEFAULT; IIUC that will search glyphs in all the language variants of
the specified font-family, rather than only in the single language
specified after :c in the 'guifont' value. See
http://vim.wikia.com/wiki/Setting_the_font_in_the_GUI for details.
Finally, some fonts have more variety of glyphs than others; even some
supposedly "Western" fonts have glyphs for non-Latin scripts. To find
them, use
:set guifont=*
then set the text input box near the bottom of the dialog to a line of
text containing some typical glyphs from all tye scripts you expect to
be using (but note, however, that gvim does not have the necessary
routines to handle properly the Brahmi-derived scripts (incl. nagari,
bengali, gujarati, etc.) from South Asia: for such scripts you will need
a different editor). Then click some font names in the font name list;
for some of them you may have to re-input the line of "typical
characters" to be displayed in that font. When you find one font which
"looks nice" to you, click OK; then as explained above and in the
mentioned wikia article, type
:set gfn=<Tab>
(where <Tab> means "hit the Tab key", assuming 'nocompatible' is set),
and edit the value to replace, for instance, :cANSI by :cDEFAULT; then
hit Enter. Once you have the font you want, ":set gfn=<Tab>" once more
will show you (with escaping backslashes if and where needed) the exact
command you should write into your vimrc to use this same font at every
run of gvim. (The vimrc is sourced quite some time before starting the
GUI, but you can set 'guifont' there and the value will be remembered.)
Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
137. You decide to stay in college for an additional year or two,
just so you can have the free Internet access.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.