summaryrefslogtreecommitdiff
path: root/osd.lua
diff options
context:
space:
mode:
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&}' ..