Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stats.lua: calculate sizes like --osd-*-size options #15216

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DOCS/interface-changes/stats-sizes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`stats-font_size`, `stats-border_size`, `stats-shadow_x_offset`, `stats-shadow_y_offset` and `stats-plot_bg_border_width` script-opt values result in 2.5 times smaller sizes in order to have the same sizes as the values of equivalent OSD options like `--osd-font-size`. If you customized these sizes, multiply them by 2.5 to get the previous sizes.
6 changes: 3 additions & 3 deletions DOCS/man/stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Configurable Options
text. Currently, monospaced digits are sufficient.

``font_size``
Default: 8
Default: 20
kasper93 marked this conversation as resolved.
Show resolved Hide resolved

Font size used to render text.

Expand All @@ -165,7 +165,7 @@ Configurable Options
Color of the text.

``border_size``
Default: 0.8
Default: 2

Size of border drawn around the font.

Expand Down Expand Up @@ -202,7 +202,7 @@ Configurable Options
Border color used for drawing graphs.

``plot_bg_border_width``
Default: 0.5
Default: 1.25

Border width used for drawing graphs.

Expand Down
11 changes: 6 additions & 5 deletions player/lua/stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ local o = {
plot_bg_border_color = "0000FF",
plot_bg_color = "262626",
plot_color = "FFFFFF",
plot_bg_border_width = 0.5,
plot_bg_border_width = 1.25,

-- Text style
font = "",
font_mono = "monospace", -- monospaced digits are sufficient
font_size = 8,
font_size = 20,
font_color = "",
border_size = 0.8,
border_size = 2,
border_color = "",
shadow_x_offset = 0.0,
shadow_y_offset = 0.0,
Expand Down Expand Up @@ -1485,9 +1485,10 @@ local function update_scale(osd_height)
end

-- Calculate scaled metrics.
local scale = 1
-- Make font_size=n the same size as --osd-font-size=n.
local scale = 288 / 720
if not scale_with_video and osd_height > 0 then
scale = 720 / osd_height
scale = 288 / osd_height
end
font_size = o.font_size * scale
border_size = o.border_size * scale
Expand Down
Loading