diff options
| -rw-r--r-- | main.lua | 6 | ||||
| -rw-r--r-- | osd.lua | 17 |
2 files changed, 15 insertions, 8 deletions
@@ -565,7 +565,7 @@ local function open_epg_programme(prog, img_url) } if prog.desc then - options[#options+1] = {name = ' '} + options[#options+1] = {name = ''} for _, v in ipairs(util.wrap(prog.desc, 80)) do options[#options+1] = {name = v} end @@ -643,7 +643,7 @@ end local function add_info_set(options, set) if #set > 0 then - options[#options+1] = {name = ' '} + options[#options+1] = {name = ''} for _, v in ipairs(set) do options[#options+1] = v end @@ -664,7 +664,7 @@ local function open_option_title_info(title, info) local desc = util.strip_ne(info.description) or util.strip_ne(info.plot) if desc then - options[#options+1] = {name = ' '} + options[#options+1] = {name = ''} for _, v in ipairs(util.wrap(desc, 80)) do options[#options+1] = {name = v} end @@ -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&}' .. |
