Using modern fonts on MS-Windows, some texts drawn by GDI are very
nasty. See attached before-dirextx.png, it is that. Ken Takata and I
are working on this problem for the past few weeks, and have completed a
patch to resolve it. Attached patch-direct_write.diff is that.
In this patch, we use DirectX (DirectWrite) to draw texts. We
implemented it with dynamic loading, so it make disabled automatically
on MS-Windows old version which doesn't support DirectWrite (ex: XP).
See after-directx.png, it have more beautiful rendered glyph than
before-directx.png.
I hope this patch helps complex glyph users, not only Japanese.
Because of compatibility and drawing speed.
It is known that DirectWrite is slower than GDI on some environmemt.
Why += ?
> How about making "directx" a (first) value of a new generic 'guirender' option?!
It sounds good to make it generic.
But how about adding a new flag to 'guioptions'
Like this:
:set guioptions +=X
When writing this patch, I was in two mind about it,
between creating a new option and adding a new flag to 'guioptions'.
Best.
Ah, I understand.
> However, the patch does not work with bitmap fonts such as Courier - all
> the text just disappears. The code needs to check the font format to
> decide whether to use DirectX for font rendering.
Please tell me your 'guifont' setting, about this.
> set guifont=Courier:h10:cANSI
>
> This is on Windows 7 x64 Professional.
I can reproduce it, will investigate.
Thank you reporting it!
The definition of p_directx in options.h is wrong.
It was int pointer, must be int correctly.
I'll fix later.
How about recycle an existing 'antialias' option for this purpose.
It is an option for MacOSX to control font rendering.
I know this is not good idea, but there is a platform depended option already.
Why can't we recycle it?
# 'antialias' maybe added by me so long ago, and I forgot it entirely ;)
At last, I have worked on this issue, and attached an updated patch.
Please check it.
To enable DirectWrite, you should set an option 'renderingoptions', like this:
:set renopt=type:directx
Now, this option can take some sub parameters, like this:
:set renopt=type:directx,gamma:1.4,geom:0,mode=3
Please check options.txt about detail of sub parameters.
If you want to see some repository of this patch, please see here:
Best regards.
* Add document which describe enum values.
* Rename "mode" to "renmode".
* Add "taamode" for text antialising mode.
> there needs to be a call to SetTextAntialiasMode() to specify if
> grayscale or ClearType anti-aliasing should be done.
I have implemented this. But I don't know is it correct or not. If it
is not work as you expected, please check and fix source code and send a
patch.
> To avoid confusion how about renaming the mode option as geom (since
> it relates to geometry of rgb components of a pixel) and geom as
> positioning as it affects character layout.
I think we should not use a word "positioning" because Microsoft does
not used.
> It may be useful to document at least the modes.
Indeed. I have wrote enumeration keywords that help users be able to
learn with Microsoft's document, instead of writing detail descriptions
which are arranged by us.
Best.
I have one questions:
Which a patch did you use? patch-direct_write-r3d.diff?
Thanks.
Addtion:
Please tell me your settings (result of ":set").
Thank you reporting this!
I have fixed my patch about that. You can get it from here.
Thanks.
I and k-takata tried to reproduce your report on last week end.
But we cannot reproduce it.
To understand cause of your report, please try the binary which I
have compiled.
http://files.kaoriya.net/var/vim73-kaoriya-dw96e-20130401.zip
This archive include both of 32bit and 64bit version of gvim.
Ant it contains DirectWrite patch.
Best.
Please verify your installed font files: Consolas and NSimSun.
Check those hashes between OK and NG machine, or some method.
I doubt fonts are cause of this issue.
Best.
Please check your DPI of screen on your both machines, and tell me those.
Best.
Using DirectWrite seems to fix the following issue from the todo.txt:
> 8 Win32: Multi-byte characters are not displayed, even though the same font
> in Notepad can display them. (Srinath Avadhanula) Try with the
> UTF-8-demo.txt page with Andale Mono.
Regards,
Ken Takata