rkscv / danmaku

Danmaku plugin for mpv powered by dandanplay API
MIT License
13 stars 4 forks source link

Font size scaling using mpv's display-hidpi-scale property #3

Closed dyphire closed 4 months ago

dyphire commented 4 months ago

Currently, the font of the danmu is too small in fullscreen due to not using the display-hidpi-scale property of mpv to scale. windows: image Fullscreen: image

dyphire commented 4 months ago

The effect of correctly scaling the font size using the display-hidpi-scale attribute of mpv windows: image Fullscreen: image

rkscv commented 4 months ago

Should be fixed. Try v1.3.0. The shadow of the danmaku in your screenshot is not set by this plugin. Did you modify the source code? Or maybe your mpv configuration overwrites the default style.

dyphire commented 4 months ago

The shadow of the danmaku in your screenshot is not set by this plugin. Did you modify the source code? Or maybe your mpv configuration overwrites the default style.

just osd configuration overwrites the default style.

I realized that in addition to the display-hidpi-scale property you also need to set the values ​​of res_x and res_y correctly for libass to handle ass scaling correctly.

https://github.com/rkscv/danmaku/blob/1b6eb5e4fe27076391630a0cfc6a0f0898f16bfe/src/overlay.rs#L11-L12

You can refer to the implementation there: https://github.com/itKelis/MPV-Play-BiliBili-Comments/commit/e3e5930

Edit: I read the code again and found that the relevant processing already exists https://github.com/rkscv/danmaku/blob/1b6eb5e4fe27076391630a0cfc6a0f0898f16bfe/src/lib.rs#L149-L150

But it seems that applying new osd-width and osd-height values ​​for zooming is not re-read when the mpv window is switched to full screen, The danmaku become small when displayed fullscreen on a 4K screen.