summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2025-05-05 21:27:04 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2025-05-05 21:27:04 -0700
commita3e810b9ab432eadf37d2a7c801182e6572d5ae4 (patch)
treef85477899dae9a5158f372ff4f103897cf907492 /main.lua
parent15fcafef23564e8e55523c2ac5a45b036aaeb0da (diff)
downloadmpv-iptv-menu-a3e810b9ab432eadf37d2a7c801182e6572d5ae4.tar.gz
mpv-iptv-menu-a3e810b9ab432eadf37d2a7c801182e6572d5ae4.tar.xz
support changing font size
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua9
1 files changed, 7 insertions, 2 deletions
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