sub/osd: add osd-shaper and set it to simple by default

This is a change in default for libass with harfbuzz enabled, previously
it would choose the best available shaper.

Harfbuzz isn't really needed for mpv's OSD and it comes with a
significant performance penalty, so use simple instead
This commit is contained in:
llyyr
2025-04-16 23:58:02 +02:00
committed by Kacper Michajłow
parent efba6e7e5a
commit f24611980c
5 changed files with 8 additions and 0 deletions
@@ -3,3 +3,4 @@ add `--osd-glyph-limit`
add `--osd-bitmap-max-size`
add `--sub-glyph-limit`
add `--sub-bitmap-max-size`
add `--osd-shaper`
+4
View File
@@ -4814,6 +4814,10 @@ OSD
Set the delay for automatic pruning of events from memory in libass.
Disabled by default. See also ``--sub-ass-prune-delay``.
``--osd-shaper=<simple|complex>``
Set the text layout engine used by libass for the OSD. Default: simple.
See also ``--sub-shaper``
Screenshot
----------
+1
View File
@@ -414,6 +414,7 @@ const struct m_sub_options mp_osd_render_sub_opts = {
{"osd-prune-delay", OPT_DOUBLE(osd_ass_prune_delay), M_RANGE(-1.0, 10000.0)},
{"osd-glyph-limit", OPT_INT(osd_glyph_limit)},
{"osd-bitmap-max-size", OPT_INT(osd_bitmap_max_size)},
{"osd-shaper", OPT_CHOICE(osd_shaper, {"simple", 0}, {"complex", 1})},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
+1
View File
@@ -151,6 +151,7 @@ struct mp_osd_render_opts {
double osd_ass_prune_delay;
int osd_glyph_limit;
int osd_bitmap_max_size;
int osd_shaper;
};
typedef struct MPOpts {
+1
View File
@@ -128,6 +128,7 @@ static void create_ass_track(struct osd_state *osd, struct osd_object *obj,
track->WrapStyle = 1; // end-of-line wrapping instead of smart wrapping
track->Kerning = true;
track->ScaledBorderAndShadow = true;
ass_set_shaper(ass->render, opts->osd_shaper);
#if LIBASS_VERSION >= 0x01600010
ass_track_set_feature(track, ASS_FEATURE_WRAP_UNICODE, 1);
#endif