Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 上の gVim で powerline 用フォントが少しずれます。 #33

Open
melito00 opened this issue Aug 13, 2018 · 10 comments
Open
Assignees

Comments

@melito00
Copy link

Ubuntu 上の gVim で powerline 用フォントが少しずれます。

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 10 2018 21:31:58)
Included patches: 1-1453
Modified by [email protected]
Compiled by [email protected]
Huge version with GTK3 GUI.  Features included (+) or not (-):

iTerm2 から ssh 接続した時や, terminator 上では問題なく表示できますので、gVim の問題かもしれませんが報告します。
※ ターミナルソフトはどちらも ambiguous 文字を wide で扱うように設定済み

set ambiwidth=double
gvimwithcicafont

set ambiwidth=single
gvimwithcicafont-single

@miiton
Copy link
Owner

miiton commented Aug 13, 2018

微妙に隙間が開きますね😩
実はWindowsでも似た事象が発生するのですが、フォントサイズ変更しても発生しますか?

@miiton miiton self-assigned this Aug 13, 2018
@melito00
Copy link
Author

最初のものが set guifont=Cica\ Regular\ 14 です。
サイズによっては、隙間がなくなる替わりに、上が欠けてしまうようです。

set guifont=Cica\ Regular\ 16
gvimwithcica16

set guifont=Cica\ Regular\ 18
gvimwithcica18

set guifont=Cica\ Regular\ 20
gvimwithcica20

set guifont=Cica\ Regular\ 24
gvimwithcica24

@miiton
Copy link
Owner

miiton commented Aug 28, 2018

@melito00 そうですね、WindowsのgVimでも同様です。今の所直し方が判っておりません😫

@kagerouttepaso
Copy link

自分の環境でも発生します。(Windows 7, Gvim 8.1, render direct x)
何やらフォントサイズを3の倍数にしたときだけフォントズレが起きないようです。

@kagerouttepaso
Copy link

半角文字と全角文字の横幅比が正確に 1:2 にならないことが原因かもしれません。

shino.tumblr.com
http://oogatta.hatenadiary.jp/entry/20130816/1376621767
https://www.rs.tus.ac.jp/yyusa/ricty.html

@miiton
Copy link
Owner

miiton commented Nov 15, 2018

@kagerouttepaso おおお、知らなかった情報ありがとうございます!関係ありそうな気がしますね...🤔

@kagerouttepaso
Copy link

@miiton Cicaいつもめちゃめちゃ使わせてもらっています!

vim-jp/issues#262 (comment)

GVimの既知の問題のようですね。

@miiton
Copy link
Owner

miiton commented Nov 19, 2018

ありがとうございまーす!

そのIssueは関連するのか...な?ちょっと解らなかったです!

Powerlineのグリフは改めて見直したんですがズレは無かったです。

1.5の倍数で解消するなら回避策としては

set guifont=Cica:h13.5

などとしてもらう事ぐらいでしょうか...?

今手元のWindowsで再現しようとしたら再現できませんでした😫

@kagerouttepaso
Copy link

kagerouttepaso commented Nov 21, 2018

今日、WindowsのCygwin上でも同じ現象が確認できました。上のコメントは無視してください…
OSのPoint→Pixel変換で横Pixel数が割り切れないとき小数点以下が切り捨てられることで、1Pixel描画されない領域が出てくるのだと思います。

解決方は、Point→Pixel変換の際、2の倍数になる数字を指定することです。
これまで一般的だった96DPI環境下では、1.5の倍数でズレが消えると思います。
ただ、最近のOSではDPIを変更できるので1.5にすれば万事OKといかないかもです。
自分も時間がある時いくつかのDPI環境で動作を確認してみます。

説明が下手ですみません。自分用にメモしたもの下に貼っておきます。

文字を2:1で表示したいときは文字の高さが偶数でないと横幅が割り切れないため表示がずれる。
1Inch = 72Pointなので、Pixel数は下記の式で求まる。

Pixel = (Point / 72) * DPI

標準的なDPIは96DPIなので、Pixel数は下記で求まる。

Pixel = 1.333... * Point

このときPointが1.5nのとき、Pixel=2nとなるので表示のずれは起きない。

しかし、最近のOS(Windows 10など)のDPIは変更できるので、1.5nのときでもずれることはある?
例えば、Windows 10で文字の大きさを150%にしているときは、フォントサイズがn(任意の整数)の時ずれなくなる?

@kazuf3
Copy link

kazuf3 commented Jul 31, 2019

同じ問題かちょっとわからないですけど,別の環境2種でやってみました.
MinttyではPowerlineが綺麗です (が,u2699がおかしい…)
ConPTYではPowerlineが大きくズレてる(ambiguous width問題が残ってることが既知なので,その影響もあるかもしれない)

Mintty
image

ConPTY ( Windows Terminal Preview )
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants