From a3e810b9ab432eadf37d2a7c801182e6572d5ae4 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 5 May 2025 21:27:04 -0700 Subject: support changing font size --- main.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index 30f716e..71e313c 100644 --- a/main.lua +++ b/main.lua @@ -3,8 +3,11 @@ local utils = require('mp.utils') local script_dir = mp.get_script_directory() local stream_prefix = mp.get_opt('iptv_menu.stream_prefix') +-- font size is in units of osd height, which is scaled to 720 +local font_size = 20 local osd = mp.create_osd_overlay('ass-events') -local osd_lines = 23 +local osd_lines = math.floor((720 / font_size) + 0.5) - 1 +local osd_padding = math.floor((720 - (osd_lines * font_size)) / 2) local key_bindings = {} local categories = {} @@ -74,7 +77,9 @@ local function update_osd() out[#out+1] = str end - osd.data = '{\\q2}' .. table.concat(out, '\\N') + -- \q2 disables line wrapping + osd.data = '{\\q2}{\\fs' .. font_size .. '}{\\pos(' .. osd_padding .. + ',' .. osd_padding .. '}' .. table.concat(out, '\\N') osd:update() end -- cgit v1.2.3-70-g09d2