rhysd/neovim-component

Canvas rendered at low-res on HiDPI displays

Closed this issue ยท 17 comments

choco commented

Hello, on HiDPI displays, like Apple retina displays the canvas is rendered at low resolution. When creating the canvas you should take into account the the devicePixelRatio to determine height and width and then properly scale when drawing onto it.

rhysd commented

You're right. I forgot device pixel ratio...

Although I don't have retina display Mac, I think <neovim-editor> shows very small fonts (right?). Default font size is 12px hence it shows 6px font because device pixel ratio is 2.

I'll fix this.

rhysd commented

@choco

If you can, screenshot is very helpful for me.

choco commented

It isn't rendered smaller, just with a lower resolution.
Here's a screenshot with neovim in terminal:
screen shot 2015-12-30 at 15 39 00

and neovim in NyaoVim:
screen shot 2015-12-30 at 15 38 54

As you can see NyaoVim looks a lot more pixelated

EDIT: As you can see I have another issue in rendering the status line and tabline, but I'll open another issue for that

rhysd commented

Oh, I got it. It seems that <canvas> requires twice size as its element size.

http://www.html5rocks.com/en/tutorials/canvas/hidpi/

Thanks!

Can confirm the above. I have an HiDPI screen on linux I would be more than happy to test bugfixes on.

rhysd commented

I tried a bit but there are many fix points. It may take more time to fix this...

I reckon this is the only issue stopping me from trialling NyaoVim full time!

rhysd commented

I started to use MacBook Pro Early 2015 today and got the same blocker :trollface:

rhysd commented

I fixed this issue in HEAD as below.

  • before

2016-01-07 9 25 17

- **after**

2016-01-07 9 25 59

At least in my environment (OS X 10.11.1, MacBook Pro Early 2015), it works well. Could anyone also check HEAD?

$ git clone https://github.com/rhysd/neovim-component.git
$ cd ./neovim-component
$ npm run dep
$ npm run example

After that, I'll check in NyaoVim and bump up version.

Here's what I get when follow the above script:

screen shot 2016-01-07 at 15 09 59

I get the same as @johnhamelink .

rhysd commented

@johnhamelink @metalelf0

Ah, sorry, build directory was not created automatically ๐Ÿ˜–
I fixed it in b5790f2.

@rhysd I still needed to run npm run build before npm run example worked, but it does now work and it looks great ๐Ÿ‘

rhysd commented

Au, you're right, correct commands are below.

$ git clone https://github.com/rhysd/neovim-component.git
$ cd ./neovim-component
$ npm run dep
$ npm run build
$ npm run example

Thank you for confirming.

choco commented

Works great here :D

rhysd commented

@choco ๐Ÿ‘

rhysd commented

I'll close this because I released NyaoVim 0.0.10 including this fix.
Thank you, everyone!