Alexander C. Gaber wrote:
Hi all,

I decided to use VIM 7.0 as a text editor under Windows, mainly because it 
allows me to use only my keyboard to edit files.

My problem is that I always work with UTF-8 or Unicode (codepage 1200) files 
and I have problems reading characters in other languages. I tried searching 
around and found the :set guifontwide command, but it seems I can't use any of 
the fonts from a base Windows install, or I haven't quite figured out how.

If you can suggest the most complete Unicode font (the used languages, I don't 
care about math symbols, but definitely care about *all* used languages today). 
I seriously switch through all languages in a week's worth and definitely three 
character sets a day, I'd hate having to change fonts based on what I need to 
edit right then.

Or, if I can use Windows fonts, please let me know how.

For information, I have all languages support installed on my Windows XP system, and I 
can see the needed characters if I open the files in other editors (i.e. Notepad). I 
tested VIM with the UTF8 HTML page saved as text 
(http://www.columbia.edu/kermit/utf8.html), and the default font "Fixedsys" 
doesn't display many of the characters correctly. I changed font around a bit and what I 
discovered is that the very few of the fonts I can choose have only a couple of languages 
supported (i.e. Western, Greek, Turkish, Central European and Cyrillic for Lucida 
Console). When I choose Lucida Console, the languages supported display fine, but not the 
others (i.e. Japanese, etc.)

Any help will be appreciated. Thanks in advance,

Alex



The following assumes that you have a version of gvim.exe with the Unicode capabilities compiled-in, i.e., ":echo has('multi_byte') " returns 1. (If it returns zero you need a different executable.)

I have tried a third-party font called "Code 2000" in the past: it has glyphs for the whole BMP (U+0000 to U+FFFF) IIUC, or at least for those codepoints where characters are defined; but they are ugly; and I don't think it is Vim-compatible anyway. If you still want to try it out, I guess Google is your friend.

In gvim under Windows I use MingLiU for CJK (Chinese-Japanese-Korean) and Courier_New for the rest (except that when editing only Latin-alphabet text I use Lucida_Console).

It is a known limitation of gvim that, although it allows you to edit any Unicode codepoint, all codepoints above U+FFFF will display a question mark. You can still use ga to display the codepoint in decimal, hex and octal, g8 to see the UTF-8 byte sequence (assuming, of course, that you have 'encoding' set to UTF-8), and enter any Unicode codepoint using (for instance) the keystrokes mentioned under ":help i_CTRL-V_digit".

Note that you can leave 'guifontwide' and 'guifontset' unset (even in gvim versions where they are defined) and use only 'guifont'. You can even mention several fonts in 'guifont' but they must have the same width, height, and ratios of lowercase body height, stem height and tail height to total height (i.e., the relative heights of x, p and d to the character cell height, as well as the width of all glyphs, must be the same among all those fonts) which isn't easy to guarantee.

You may want to use mappings, for example as follows:

        :map    <F6>      :set gfn=Courier_New:h9:cDEFAULT<CR>
        :map    <S-F6>    :set gfn=MingLiU:h16:cDEFAULT<CR>
        :imap   <F6>      <C-O>:set gfn=Courier_New:h9:cDEFAULT<CR>
        :imap   <S-F6>    <C-O>:set gfn=MingLiU:h16:cDEFAULT<CR>

Then hit Shift-F6 when editing sinograms, and F6 when editing other languages (I tested Courier_New with French, Russian and Arabic; and I'm confident that it will support a number of other languages too).

You can also choose fonts via a meny, using ":set guifont=*", or have Vim display the current value (exactly as it must be written in your vimrc or gvimrc) using ":set guifont=<Tab>". The latter also allows edit-in-place to tweak the current settings.


Best regards,
Tony.

Reply via email to