Skip to content

Commit

Permalink
console.lua: update the max width calculation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
guidocella committed Jan 19, 2025
1 parent c438732 commit 8a0cdce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion player/lua/console.lua
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,10 @@ local function update()
-- 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 suggestions, rows = format_table(suggestion_buffer, width_max, max_lines)
Expand Down

0 comments on commit 8a0cdce

Please sign in to comment.