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

sub: add sub-scale-signs #15512

Merged
merged 1 commit into from
Jan 5, 2025
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/sub-scale-signs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add `--sub-scale-signs` to allow `--sub-scale` to also scale events detected to be signs by libass
6 changes: 6 additions & 0 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,12 @@ Subtitles
This affects ASS subtitles as well, and may lead to incorrect subtitle
rendering. Use with care, or use ``--sub-font-size`` instead.

``--sub-scale-signs=<yes|no>``
When set to yes, also apply ``--sub-scale`` to typesetting (or "signs").
When this is set to no, ``--sub-scale`` is only applied to dialogue. The
distinction between dialogue and typesetting is done on a best effort basis
and is not infallible (default: no).

``--sub-scale-by-window=<yes|no>``
Whether to scale subtitles with the window size (default: yes). If this is
disabled while ``--sub-scale-with-window`` is set to yes, changing the window
Expand Down
1 change: 1 addition & 0 deletions options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ const struct m_sub_options mp_subtitle_sub_opts = {
{"sub-gray", OPT_BOOL(sub_gray)},
{"sub-ass", OPT_BOOL(ass_enabled), .flags = UPDATE_SUB_HARD},
{"sub-scale", OPT_FLOAT(sub_scale), M_RANGE(0, 100)},
{"sub-scale-signs", OPT_BOOL(sub_scale_signs)},
{"sub-line-spacing", OPT_FLOAT(sub_line_spacing), M_RANGE(-1000, 1000)},
{"sub-ass-line-spacing", OPT_REPLACED("sub-line-spacing")},
{"sub-use-margins", OPT_BOOL(sub_use_margins)},
Expand Down
1 change: 1 addition & 0 deletions options/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ struct mp_subtitle_opts {
bool ass_scale_with_window;
struct osd_style_opts *sub_style;
float sub_scale;
bool sub_scale_signs;
float sub_gauss;
bool sub_gray;
bool ass_enabled;
Expand Down
8 changes: 5 additions & 3 deletions sub/sd_ass.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,13 +559,15 @@ static void configure_ass(struct sd *sd, struct mp_osd_res *dim,
set_force_flags |= ASS_OVERRIDE_BIT_FONT_NAME
| ASS_OVERRIDE_BIT_FONT_SIZE_FIELDS
| ASS_OVERRIDE_BIT_COLORS
| ASS_OVERRIDE_BIT_BORDER
| ASS_OVERRIDE_BIT_SELECTIVE_FONT_SCALE;
| ASS_OVERRIDE_BIT_BORDER;
if (!opts->sub_scale_signs)
set_force_flags |= ASS_OVERRIDE_BIT_SELECTIVE_FONT_SCALE;
#if LIBASS_VERSION >= 0x01703020
set_force_flags |= ASS_OVERRIDE_BIT_BLUR;
#endif
}
if (shared_opts->ass_style_override[sd->order] == ASS_STYLE_OVERRIDE_SCALE)
if (shared_opts->ass_style_override[sd->order] == ASS_STYLE_OVERRIDE_SCALE &&
!opts->sub_scale_signs)
set_force_flags |= ASS_OVERRIDE_BIT_SELECTIVE_FONT_SCALE;
if (converted)
set_force_flags |= ASS_OVERRIDE_BIT_ALIGNMENT;
Expand Down
Loading