diff options
author | Ryan Hendrickson <ryan.hendrickson@alum.mit.edu> | 2022-07-12 16:50:32 -0400 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2022-07-19 23:19:45 +0300 |
commit | ad5a1ac8733e6b4cf86e7b6d84c50ddf37ca62cd (patch) | |
tree | 7b445aaa7cfe77a6a7d872a134f01f0be418e7c7 | |
parent | ff25a8c65a1c6cf1e38a5e01a3ec47dbe2e65ab7 (diff) | |
download | mpv-ad5a1ac8733e6b4cf86e7b6d84c50ddf37ca62cd.tar.bz2 mpv-ad5a1ac8733e6b4cf86e7b6d84c50ddf37ca62cd.tar.xz |
osc.lua: add osc-tcspace script option
Generally, the hard-coded sizes used for the OSC elements are
comfortable regardless of the font used, but the timecode fields have
relatively many characters, and so are affected to a greater degree by
fonts with a wider or narrower average character width than expected.
This allow users to adjust the space reserved for the timecode fields to
compensate.
-rw-r--r-- | DOCS/man/osc.rst | 8 | ||||
-rw-r--r-- | player/lua/osc.lua | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/DOCS/man/osc.rst b/DOCS/man/osc.rst index 41f89b2e35..adcb52cbec 100644 --- a/DOCS/man/osc.rst +++ b/DOCS/man/osc.rst @@ -315,6 +315,14 @@ Configurable Options Display timecodes with milliseconds +``tcspace`` + Default: 100 (allowed: 50-200) + + Adjust space reserved for timecodes (current time and time remaining) in + the ``bottombar`` and ``topbar`` layouts. The timecode width depends on the + font, and with some fonts the spacing near the timecodes becomes too small. + Use values above 100 to increase that spacing, or below 100 to decrease it. + ``visibility`` Default: auto (auto hide/show on mouse move) diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 7a0da03971..fba6e881d7 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -43,6 +43,7 @@ local user_opts = { tooltipborder = 1, -- border of tooltip in bottom/topbar timetotal = false, -- display total time instead of remaining time? timems = false, -- display timecodes with milliseconds? + tcspace = 100, -- timecode spacing (compensate font size estimation) visibility = "auto", -- only used at init to set visibility_mode(...) boxmaxchars = 80, -- title crop threshold for box layout boxvideo = false, -- apply osc_param.video_margins to video @@ -1480,6 +1481,11 @@ function bar_layout(direction) local padY = 3 local buttonW = 27 local tcW = (state.tc_ms) and 170 or 110 + if user_opts.tcspace >= 50 and user_opts.tcspace <= 200 then + -- adjust our hardcoded font size estimation + tcW = tcW * user_opts.tcspace / 100 + end + local tsW = 90 local minW = (buttonW + padX)*5 + (tcW + padX)*4 + (tsW + padX)*2 |