[vim/vim] Optimize HiDPI Screen on GVim Windows (#1059)

546 views
Skip to first unread message

Liu Yixuan

unread,
Sep 12, 2016, 11:50:05 AM9/12/16
to vim/vim

Hello,
Imgur

OS: Windows 10 + DPI 200%
Vim Version: 8.0
It looks like bad, Gvim window is too small to click it.
HiDPI Device has been used more and more commonly all over the world. I Hope vim can pay more attention on it.

Thank you!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

K.Takata

unread,
Sep 12, 2016, 12:03:10 PM9/12/16
to vim/vim

If you enable DirectWrite (DirectX), gvim will be shown better.
See :help 'renderoptions'.

Christian Brabandt

unread,
Sep 14, 2016, 1:31:20 PM9/14/16
to vim/vim

Setting the renderoptions, doesn't make the window bigger, but should improve the readability of the font.

Unknown

unread,
Sep 14, 2016, 2:38:12 PM9/14/16
to vim/vim, vim-dev ML, Your activity
On Wednesday, September 14, 2016 at 1:31:20 PM UTC-4, Christian Brabandt wrote:
> Setting the renderoptions, doesn't make the window bigger, but should improve the readability of the font.
>
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub

Does directx work on the 32 bit version of windows.Adding this:

set encoding=utf-8
set rop=type:directx,gamma:1.0,contrast:0.5,level:1,geom:1,renmode:4,taamode:1

causes:

Blay263

unread,
Sep 14, 2016, 2:38:12 PM9/14/16
to vim_dev, v...@noreply.github.com, reply+00b1d198b29c23a367d57b2a44049b4fa78d5c4...@reply.github.com, vim-dev...@256bit.org
On Wednesday, September 14, 2016 at 1:31:20 PM UTC-4, Christian Brabandt wrote:
directx.png
directx1.png

Unknown

unread,
Sep 14, 2016, 2:41:42 PM9/14/16
to vim/vim, vim-dev ML, Comment

I am not sure, what you are seeing, probably some kind of this: dcpurton/regfont#1


You are receiving this because you commented.

Blay263

unread,
Sep 14, 2016, 3:19:38 PM9/14/16
to vim_dev, v...@noreply.github.com, vim-dev...@256bit.org, com...@noreply.github.com, reply+00b1d198272f19bb520d6c911be371d8b5499bb...@reply.github.com, nor...@googlegroups.com
Yep,was an issue with my font.Fixed thanks

vim-dev ML

unread,
Sep 14, 2016, 3:20:38 PM9/14/16
to vim/vim, vim-dev ML, Your activity
On Wednesday, September 14, 2016 at 2:41:42 PM UTC-4, nor...@googlegroups.com wrote:
> I am not sure, what you are seeing, probably some kind of this: dcpurton/regfont#1
>
>
> —
> You are receiving this because you commented.

> Reply to this email directly, view it on GitHub

Yep,was an issue with my font.Fixed thanks

K.Takata

unread,
Sep 14, 2016, 5:18:02 PM9/14/16
to vim/vim, vim-dev ML, Comment

Setting the renderoptions, doesn't make the window bigger, but should improve the readability of the font.

Our DirectWrite implementation does support High DPI and font scaling. If you look gui_dwrite.cpp, you will find the variables mDpiScaleX and mDpiScaleY which are used for scaling.
I think we need similar implementation for the traditional GDI renderer, but I don't have the motivation for it.

FYI, the current implementation doesn't support Per-Monitor DPI which is new in Windows 8.1. Maybe we should also support this.


You are receiving this because you commented.

K.Takata

unread,
Sep 14, 2016, 5:36:13 PM9/14/16
to vim/vim, vim-dev ML, Comment

I think we need similar implementation for the traditional GDI renderer, but I don't have the motivation for it.

Sorry, this is wrong. The traditional GDI renderer already supports font scaling.
The problem is the default font size. On my PC (scale: 150%), the default font size was 6.

@wbsdty331
You need to set the font size with 'guifont'.
E.g.:

:set gfn=FixedSys:h11

or

:set gfn=*   " You can also use the font dialog box to select the font.


You are receiving this because you commented.

dantmnf

unread,
Sep 15, 2016, 1:14:54 AM9/15/16
to vim/vim, vim-dev ML, Comment

The problem is the default font is Fixedsys 16px, which is a bitmap font.
Can we change it into an outline font?


You are receiving this because you commented.

Liu Yixuan

unread,
Sep 15, 2016, 1:21:25 AM9/15/16
to vim/vim, vim-dev ML, Comment

I hope:

English: Consolas
Chinese: Microsoft YaHei UI

DO NOT USE FixedSys


You are receiving this because you commented.

Christian Brabandt

unread,
Sep 15, 2016, 3:17:55 AM9/15/16
to vim/vim, vim-dev ML, Comment
@k-takata
would it be possible to fix dcpurton/regfont#1 for the directx
rendering?

thanks,
Christian


You are receiving this because you commented.

K.Takata

unread,
Sep 16, 2016, 9:25:58 PM9/16/16
to vim/vim, vim-dev ML, Comment

There are (at least?) two problems in the current implementation.

  1. The default font size is not scaled. Currently, the default font size is 12 pixels. This is 9 points on 100% DPI scaling, but it becomes 6 points on 150% DPI scaling. The font size should be scaled on a High DPI environment. The following patch fixes the problem: https://bitbucket.org/k_takata/vim-ktakata-mq/src/34233db2e8ff8ffededb250909dc0af6793d3d54/fix-highdpi.patch?fileviewer=file-view-default
  2. The default font is not a true type font. Currently, "Fixedsys" is used as the default. Because of this, sometimes unintended size of font is selected. (Of course the quality is worse than true type fonts.) The reason why FixedSys is the default might be that the font is the most portable fixed-pitch font on Windows. All versions and all languages of Windows must have FixedSys. It would be better if Vim can automatically select a true type font, but no good solutions for now.


You are receiving this because you commented.

K.Takata

unread,
Sep 16, 2016, 9:32:04 PM9/16/16
to vim/vim, vim-dev ML, Comment

@chrisbra
I haven't used regfont, but when I see the comments, I feel it difficult to fix.
I don't know is there any workaround for that CreateFontFromLOGFONT returns an error.


You are receiving this because you commented.

vim-dev ML

unread,
Sep 21, 2016, 4:24:56 AM9/21/16
to vim/vim, vim-dev ML, Your activity
K.Takata (Vim Github Repository) wrote:
>
> If you enable DirectWrite (DirectX), gvim will be shown better.
> See |:help 'renderoptions'|.
>
----
???
I get E149: Sorry, no help for renderoptions (8.0.6 64-bit).

Christian Brabandt

unread,
Sep 21, 2016, 4:42:41 AM9/21/16
to vim/vim, vim-dev ML, Comment
Am 2016-09-21 10:24, schrieb vim-dev ML:
> K.Takata (Vim Github Repository) wrote:
>>
>> If you enable DirectWrite (DirectX), gvim will be shown better.
>> See |:help 'renderoptions'|.
>>
> ----
> ???
> I get E149: Sorry, no help for renderoptions (8.0.6 64-bit).

you need to type literally :h 'renderoptions'
(including the single apostrophes)

Best,
Christian


You are receiving this because you commented.

boytom

unread,
Oct 11, 2016, 10:20:11 AM10/11/16
to vim/vim, vim-dev ML, Comment

@wbsdty331 Hi,我就直接用简体中文了。你说的问题,英文用Consolas,中文用Microsoft YaHei UI,可以用这种方式实现:
1:自己编译gvim,编译的时候定义宏FEAT_PROPORTIONAL_FONTS,这样会让gvim列举非等宽字体,你就能看到Microsoft YaHei UI了;
2:在gvimrc里添加配置:
set gfn=Consolas:h10 gfw=Microsoft\ YaHei\ UI:h10
不过我不建议你这么做,中英文不能对齐。我一直想做个补丁,实现Visual Studio 那样的效果,可是没有时间。


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

dantmnf

unread,
Oct 11, 2016, 10:25:19 AM10/11/16
to vim/vim, vim-dev ML, Comment

@boytom If DirectWrite is enabled, Consolas will fallback to Microsoft Yahei on Simplified Chinese system (maybe displaying language, the first of language list, non-Unicode locale and/or other), and Microsoft Yahei will be scaled to fit the grid.


You are receiving this because you commented.

boytom

unread,
Oct 12, 2016, 10:46:21 PM10/12/16
to vim/vim, vim-dev ML, Comment

@dantmnf 虽然比GDI好了很多,但不是很完美。汉字在一行中是对齐的,英语字母会上下跳跃(打开文件时,英语字母显示在偏上的位置,用Ctrl+L刷新一下,英语字母就下来了),g q的下边不能显示。

Liu Yixuan

unread,
Oct 13, 2016, 12:25:52 AM10/13/16
to vim/vim, vim-dev ML, Comment

@boytom 如果这样还不能解决的话我觉得只能上 MacType 单独渲染了


You are receiving this because you commented.

dantmnf

unread,
Oct 13, 2016, 12:36:12 AM10/13/16
to vim/vim, vim-dev ML, Comment

@boytom @wbsdty331 We can open a new issue to discuss it.


You are receiving this because you commented.

Christian Brabandt

unread,
Oct 13, 2016, 2:28:17 AM10/13/16
to vim/vim, vim-dev ML, Comment
Am 2016-10-13 06:25, schrieb Liu Yixuan:
> @boytom [1] 如果这样还不能解决的话我觉得只能上
> MacType 单独渲染了
>

Can you please write english? Thanks.


You are receiving this because you commented.

boytom

unread,
Oct 13, 2016, 9:56:08 PM10/13/16
to vim/vim, vim-dev ML, Comment

So sorry about my poor English. If DirectWrite is enabled and gfn is Consolas, ASCII character looks like superscript of Chinese character of the same line(align with top) when Consolas fallbacks to Microsoft YaHei. But when you press CTRL-L to clear and redraw the screen, ASCII character will fall down and align Chinese character with bottom.


You are receiving this because you commented.

j16180339887

unread,
Oct 20, 2016, 6:28:06 AM10/20/16
to vim/vim, vim-dev ML, Comment

Someone already made a font called "Microsoft YaHei Mono", you can google it.

set guifont=Microsoft\ YaHei\ Mono:h20


You are receiving this because you commented.

j16180339887

unread,
Oct 20, 2016, 6:36:57 AM10/20/16
to vim/vim, vim-dev ML, Comment


You are receiving this because you commented.

askvictor

unread,
Feb 19, 2017, 4:19:02 PM2/19/17
to vim/vim, vim-dev ML, Comment

Renderoptions and a sensible font make the editor and menu usable, but the icons are still tiny. Is there any way to embiggen them?

K.Takata

unread,
Feb 19, 2017, 5:19:39 PM2/19/17
to vim/vim, vim-dev ML, Comment

No, currently icons are not scaled.

Dave

unread,
Apr 16, 2017, 11:46:58 AM4/16/17
to vim/vim, vim-dev ML, Comment

@askvictor The Windows Creators update has resolved this. The icons are fairly big enough now.
img

To enable this, open the gvim.exe's properties:

img2

Christian Brabandt

unread,
Apr 16, 2017, 2:20:12 PM4/16/17
to vim/vim, vim-dev ML, Comment

so this issue can be closed now?

askvictor

unread,
Apr 16, 2017, 10:08:23 PM4/16/17
to vim/vim, vim-dev ML, Comment

@chrisbra any chance of detecting a hidpi environment and automatically making sane defaults?

Eric Work

unread,
May 7, 2017, 12:51:35 AM5/7/17
to vim/vim, vim-dev ML, Comment

I just wanted to add my 2 cents. I have Windows 10 Creators Update as well although I'm not sure that changes anything. I just installed gvim 8.0 today after updating Windows. I never tried gvim on this monitor before the update. I just added set guifont=Consolas:h10:cANSI:qDRAFT to _gvimrc and that was all I needed. I tried to use the compatibility options first as @D4D3VD4V3 mentioned but it didn't work as well. After reading :help rop as others mentioned I realized the problem was it was using GDI just because of the default font. Switching to Consolas was the only thing I actually needed to do to get a good HiDPI display. FYI, I have a Samsung 4k 28" display.

Liu Yixuan

unread,
Jun 6, 2017, 3:13:54 AM6/6/17
to vim/vim, vim-dev ML, Comment

Closed #1059.

Liu Yixuan

unread,
Jun 6, 2017, 3:13:56 AM6/6/17
to vim/vim, vim-dev ML, Comment

It looks like Windows 10 1703 solved this problem.
I will close this issue.

snoopyjc

unread,
Jul 12, 2019, 4:21:34 PM7/12/19
to vim/vim, vim-dev ML, Comment

After a recent W10 update, I am having the same problem. Not only is the font extremely tiny, but the icons are also itty-bitty!

Michael Bain

unread,
Jun 30, 2020, 3:31:26 AM6/30/20
to vim/vim, vim-dev ML, Comment

Yeah, I just hit this installing GVim 8.2 on Windows 10 Version 10.0.18362 Build 18362


You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or unsubscribe.

Red S

unread,
Mar 9, 2022, 1:32:21 AM3/9/22
to vim/vim, vim-dev ML, Comment

Hit this with Gvim 8.2, Windows 10 Home 21H1.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you commented.Message ID: <vim/vim/issues/1059/1062597562@github.com>

K.Takata

unread,
Mar 9, 2022, 2:50:45 AM3/9/22
to vim/vim, vim-dev ML, Comment

Vim supports PerMonitorV2 since 8.2.4109. The discussions in this issue is now outdated.
Please use a newer version than that.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you commented.Message ID: <vim/vim/issues/1059/1062642428@github.com>

Red S

unread,
Mar 9, 2022, 4:36:17 AM3/9/22
to vim/vim, vim-dev ML, Comment

@k-takata thanks for the pointer!

vim.org says:

The current stable version is gvim_8.2.2825.exe.
An alternative is the standard self-installing executable, currently version 8.2.2824.

Would you happen to know where I could get 8.2.4109 from? Thanks!


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you commented.Message ID: <vim/vim/issues/1059/1062729110@github.com>

Reply all
Reply to author
Forward
0 new messages