Skip to content

Commit

Permalink
osc.lua: add osc-tcspace script option
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rhendric authored and avih committed Jul 19, 2022
1 parent 5d12ebd commit 1bf8a0b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions player/lua/osc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 1bf8a0b

Please # to comment.