From b7a1b36c4470544246ebb75d4fe25e8e7e0d9822 Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Sat, 12 Oct 2024 19:19:27 +0200 Subject: [PATCH] various: make --osd/sub-scale-by-window options only scale upwards These options keep text readable whether you use a small screen near you or a faraway large screen, but they make it unreadable in small windows, so change them to only scale upwards, i.e. when the window height is > 720. --- DOCS/man/options.rst | 14 +++++++------- DOCS/man/osc.rst | 2 +- DOCS/man/stats.rst | 3 ++- player/lua/osc.lua | 3 ++- player/lua/stats.lua | 3 ++- sub/osd_libass.c | 2 +- sub/sd_ass.c | 2 +- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 9ba83bf26e636..068b6a5d312d4 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -2425,9 +2425,9 @@ Subtitles rendering. Use with care, or use ``--sub-font-size`` instead. ``--sub-scale-by-window=`` - Whether to scale subtitles with the window size (default: yes). If this is - disabled while ``--sub-scale-with-window`` is set to yes, changing the window - size won't change the subtitle font size. + Whether to scale subtitles with the window height when it is taller than 720 + pixels (default: yes). If this is disabled while ``--sub-scale-with-window`` + is set to yes, changing the window size won't change the subtitle font size. Affects plain text subtitles only (or ASS if ``--sub-ass-override`` is set high enough). @@ -4585,10 +4585,10 @@ OSD OSD font size multiplier, multiplied with ``--osd-font-size`` value. ``--osd-scale-by-window=`` - Whether to scale the OSD with the window size (default: yes). If this is - disabled, ``--osd-font-size`` and other OSD options that use scaled pixels - are always in actual pixels. The effect is that changing the window size - won't change the OSD font size. + Whether to scale the OSD with the window height when it is taller than 720 + pixels (default: yes). If this is disabled, ``--osd-font-size`` and other + OSD options that use scaled pixels are always in actual pixels. The effect + is that changing the window size won't change the OSD font size. .. note:: diff --git a/DOCS/man/osc.rst b/DOCS/man/osc.rst index cdc30c7a1dcc2..54dc76f0f15f6 100644 --- a/DOCS/man/osc.rst +++ b/DOCS/man/osc.rst @@ -250,7 +250,7 @@ Configurable Options ``vidscale`` Default: auto - Scale the OSC with the video. + Scale the OSC with the window height when it is taller than 720 pixels. ``no`` tries to keep the OSC size constant as much as the window size allows. ``auto`` scales the OSC with the OSD, which is scaled with the window or kept at a constant size, depending on the ``--osd-scale-by-window`` option. diff --git a/DOCS/man/stats.rst b/DOCS/man/stats.rst index 4d22f36ff34f9..7f87a89ac26cf 100644 --- a/DOCS/man/stats.rst +++ b/DOCS/man/stats.rst @@ -214,7 +214,8 @@ Configurable Options ``vidscale`` Default: auto - Scale the text and graphs with the video. + Scale the text and graphs with the window height when it is taller than 720 + pixels. ``no`` tries to keep the sizes constant. ``auto`` scales the text and graphs with the OSD, which is scaled with the window or kept at a constant size, depending on the ``--osd-scale-by-window`` option. diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 4d4407af12137..f82620fb38c17 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -1873,7 +1873,8 @@ local function osc_init() end local scale_with_video - if user_opts.vidscale == "auto" then + if display_h <= 720 then + elseif user_opts.vidscale == "auto" then scale_with_video = mp.get_property_native("osd-scale-by-window") else scale_with_video = user_opts.vidscale == "yes" diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 814704a2ec56c..5fedac0cbfaf4 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -1527,7 +1527,8 @@ end local function update_scale(height) local scale_with_video - if o.vidscale == "auto" then + if height <= 720 then + elseif o.vidscale == "auto" then scale_with_video = mp.get_property_native("osd-scale-by-window") else scale_with_video = o.vidscale == "yes" diff --git a/sub/osd_libass.c b/sub/osd_libass.c index 3a462e27173f5..231243b3db7b2 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -256,7 +256,7 @@ static ASS_Style *prepare_osd_ass(struct osd_state *osd, struct osd_object *obj) double playresy = obj->ass.track->PlayResY; // Compensate for libass and mp_ass_set_style scaling the font etc. - if (!opts->osd_scale_by_window) + if (!opts->osd_scale_by_window || obj->vo_res.h < 720) playresy *= 720.0 / obj->vo_res.h; ASS_Style *style = get_style(&obj->ass, "OSD"); diff --git a/sub/sd_ass.c b/sub/sd_ass.c index 47b3109ec71a3..0ce768fd8552b 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -508,7 +508,7 @@ static void configure_ass(struct sd *sd, struct mp_osd_res *dim, if (converted || shared_opts->ass_style_override[sd->order] == ASS_STYLE_OVERRIDE_FORCE) { set_scale_with_window = opts->sub_scale_with_window; set_use_margins = opts->sub_use_margins; - set_scale_by_window = opts->sub_scale_by_window; + set_scale_by_window = opts->sub_scale_by_window && dim->h > 720; total_override = true; } else { set_scale_with_window = opts->ass_scale_with_window;