sub: add sub-scale-signs

Allows --sub-scale to alow scale typesetting
This commit is contained in:
llyyr
2024-12-14 00:46:04 +05:30
committed by Kacper Michajłow
parent 996e58a738
commit baecbb12fa
5 changed files with 14 additions and 3 deletions

View File

@@ -0,0 +1 @@
add `--sub-scale-signs` to allow `--sub-scale` to also scale events detected to be signs by libass

View File

@@ -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

View File

@@ -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)},

View File

@@ -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;

View File

@@ -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;