From 16911601f7da38191c5c1fe900d615f8b860ca52 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 13 Jan 2026 23:07:11 -0800 Subject: use explicit y-positioning for each line --- osd.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'osd.lua') diff --git a/osd.lua b/osd.lua index d54362c..451f2a9 100644 --- a/osd.lua +++ b/osd.lua @@ -363,7 +363,7 @@ function mt:redraw(state) for i = 1, state.depth do out[#out+1] = self:menu_title(state.menus[i]) end - out[#out+1] = ' ' -- space character for correct line height + out[#out+1] = '' local menu = state:menu() @@ -404,14 +404,21 @@ function mt:redraw(state) out_max[#out_max+1] = self:option_icons(opt, info) .. str end + local buf = {} + -- each line uses a new ASS event with explicit positioning. otherwise, + -- lines with nonstandard height break things. -- \q2 disables line wrapping local pre = '{\\q2\\fs' .. config.font_size .. - '\\pos(' .. self.padding .. ',' .. self.padding .. ')}' - self.fg.data = pre .. table.concat(out, '\\N') + '\\pos(' .. self.padding .. ',%s)}' + for i, v in ipairs(out) do + local offset = self.padding + ((i - 1) * config.font_size) + buf[#buf+1] = pre:format(offset) .. v + end if img then - self.fg.data = self.fg.data .. '\n{\\alpha&HFF&}' .. - pre .. table.concat(out_max, '\\N') + buf[#buf+1] = '{\\alpha&HFF&}' .. pre:format(0) .. + table.concat(out_max, '\\N') end + self.fg.data = table.concat(buf, '\n') self.bg.data = '{\\pos(0,0)\\alpha&H' .. config.bg_alpha .. '&\\c&H&}' .. -- cgit v1.2.3-70-g09d2