7

gVim seems to have problems displaying text in Tamil (and possibly other Indic languages), even when the font supports it. For eg., here's some text in Emacs and the same text in gVim (both under Windows):

In Emacs

In Vim

Both use the exact same font here (Dejavu Sans Mono, 13). But within Vim, the characters are all overlapping with each other to the point of unreadability, whereas emacs seems to have no problem displaying it.

To make the problem clear, here's a single word from the text, first in emacs: clear text in emacs, and then in Vim unreadable in Vim.

I've tried many other Unicode monospace fonts available, and the result is the same: other editors display the Tamil glyphs without an issue, while Vim's are the same overlapping mess every time.

Is this type of rendering problems a known issue, and are there any fixes or workaround available? I'd prefer to continue editing in Vim for Tamil texts too, if it is at all possible.

Sundar R
  • 751
  • 1
  • 5
  • 12
  • 1
    What is the result of the following commands: :verbose set guifontwide? :verbose set guifontset? Also do you recall ever installing fonts for Tamil script on your computer? (I ask because DejaVuSansMono doesn't appear to include any glyphs for Tamil so I'm wondering if gVim is performing font substitution. – Rich Apr 10 '18 at 12:03
  • guifontwide is empty, and I get E519: Option not supported: guifontset? when I try the second command. I have a bunch of fonts for Tamil script installed, for eg. there's the default Latha included with Windows, in addition I have Lohit Tamil and Vijaya, and most recently I installed GNU Unifont which includes glyphs for Tamil (verified these by looking at the Tamil Unicode subrange of these fonts in Windows charmap). I tried setting these as the guifontwide, but I get 'Invalid wide font' error, and I don't know fonts enough to understand what would be a valid wide font. – Sundar R Apr 10 '18 at 13:47
  • What happens if you set one of those as your guifont? – Rich Apr 10 '18 at 14:21
  • I just get an E596: Invalid font. There's more evidence for the font substitution theory though: I restarted my computer in the mean time (for the first time after installing Unifont), and the Tamil glyph rendering inside Vim is relatively noticeably better now, even though I haven't changed the actual font Vim is supposed to use. My guess is that the font used for font substitution has automatically changed since a new one became available. Is there any way to find out what the font substitution process is doing, and perhaps customize the font options used for substitution? – Sundar R Apr 11 '18 at 07:16
  • Unifont's page says the font files "contain dimension and spacing information for each glyph in a font. Some font rendering engines ignore this glyph information that the font file provides. This is especially true of rendering engines designed to handle monospace fonts. Unifont will not display all glyphs correctly with such software." I'm guessing this is what is happening here. Being able to specify a higher width on the substituting font would help with making the rendering better. (A monospaced Tamil font would help more, but I haven't found one.) – Sundar R Apr 11 '18 at 08:05
  • As far as I'm aware, Vim can render glyphs so that they span a single column, or two. I'm no expert, but if it now looks like it's now doing that, then that might be as good as you can get, unless you're willing to try something like this. – Rich Apr 11 '18 at 08:25
  • Thanks @Rich. It looks like Vim is doing that with the glyphs, but then squeezing the line into a smaller space as if it was uniformly made of single-column glyphs, creating a Zalgo-text effect. (When I write a line made of only single-column glyphs - using a select few Tamil characters - most of the rendering issues disappear.) I saw the linked thread, but using Evil mode in emacs or creating a monospace Tamil font myself is probably easier and more feasible. Thanks for your help here, and for the term "font substitution" which explained some things and got me closer to the root of the issue. – Sundar R Apr 11 '18 at 10:04

0 Answers0