mirror of
https://github.com/mpv-player/mpv
synced 2024-12-28 01:52:19 +00:00
osc: box: clip with ellipsis after too much stretching
This commit is contained in:
parent
ee000f2133
commit
9831d3ada6
@ -658,8 +658,15 @@ function render_elements(master_ass)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local maxchars = element.layout.button.maxchars
|
local maxchars = element.layout.button.maxchars
|
||||||
|
|
||||||
if not (maxchars == nil) and (#buttontext > maxchars) then
|
if not (maxchars == nil) and (#buttontext > maxchars) then
|
||||||
|
if (#buttontext > maxchars+20) then
|
||||||
|
while (#buttontext > maxchars+20) do
|
||||||
|
buttontext = buttontext:gsub(".[\128-\191]*$", "")
|
||||||
|
end
|
||||||
|
buttontext = buttontext .. "..."
|
||||||
|
end
|
||||||
|
local _, nchars2 = buttontext:gsub(".[\128-\191]*", "")
|
||||||
|
local stretch = (maxchars/#buttontext)*100
|
||||||
buttontext = string.format("{\\fscx%f}",
|
buttontext = string.format("{\\fscx%f}",
|
||||||
(maxchars/#buttontext)*100) .. buttontext
|
(maxchars/#buttontext)*100) .. buttontext
|
||||||
end
|
end
|
||||||
@ -944,7 +951,7 @@ layouts["box"] = function ()
|
|||||||
lo = add_layout("title")
|
lo = add_layout("title")
|
||||||
lo.geometry = {x = posX, y = titlerowY, an = 8, w = 496, h = 12}
|
lo.geometry = {x = posX, y = titlerowY, an = 8, w = 496, h = 12}
|
||||||
lo.style = osc_styles.vidtitle
|
lo.style = osc_styles.vidtitle
|
||||||
lo.button.maxchars = 90
|
lo.button.maxchars = 80
|
||||||
|
|
||||||
lo = add_layout("pl_prev")
|
lo = add_layout("pl_prev")
|
||||||
lo.geometry =
|
lo.geometry =
|
||||||
|
Loading…
Reference in New Issue
Block a user