console.lua: update the max width calculation

This should not divide by scale_factor() because osd_w is already scaled
pixels.

Also add a TODO to fix --osd-margin-x's scaling.
This commit is contained in:
Guido Cella authored and sfan5 committed 2025-02-17 16:35:27 +00:00
1 parent 23b57e9f7f
commit 5c49e9b10d
1 file changed
+3 -1
+3 -1
View File
@@ -610,8 +610,10 @@ local function render()
-- Even with bottom-left anchoring,
-- libass/ass_render.c:ass_render_event() subtracts --osd-margin-x from
-- the maximum text width twice.
-- TODO: --osd-margin-x should scale with osd-width and PlayResX to make
-- the calculation accurate.
local width_max = math.floor(
(osd_w - x - mp.get_property_native('osd-margin-x') * 2 / scale_factor())
(osd_w - x - mp.get_property_native('osd-margin-x') * 2)
/ opts.font_size * get_font_hw_ratio())
local completions, rows = format_grid(completion_buffer, width_max, max_lines)