summaryrefslogtreecommitdiff
path: root/osd.lua
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-01-13 23:07:11 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-01-13 23:07:11 -0800
commit16911601f7da38191c5c1fe900d615f8b860ca52 (patch)
tree4145a14267add2a30978672d782b31469dc250a6 /osd.lua
parent6e8190cfe1d8c6bb69e25f6fbc886e3126f5a06d (diff)
downloadmpv-iptv-menu-16911601f7da38191c5c1fe900d615f8b860ca52.tar.gz
mpv-iptv-menu-16911601f7da38191c5c1fe900d615f8b860ca52.tar.xz
use explicit y-positioning for each line
Diffstat (limited to 'osd.lua')
-rw-r--r--osd.lua17
1 files changed, 12 insertions, 5 deletions
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&}' ..