summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-09-25 22:11:39 +0200
committerwm4 <wm4@nowhere>2019-09-25 22:11:48 +0200
commitff2aed2b56e43665e2b10acf06fa107877799bec (patch)
tree611cff3c42652220b554f41a7a7958f64bc698df /sub
parentbbf6e103b44007165d3116315e62ba2cb43fc391 (diff)
downloadmpv-ff2aed2b56e43665e2b10acf06fa107877799bec.tar.bz2
mpv-ff2aed2b56e43665e2b10acf06fa107877799bec.tar.xz
sub: make font provider user-selectable
libass had an API to configure this since 2013. mpv always used ASS_FONTPROVIDER_AUTODETECT, because usually there's little reason to use anything else. The intention of the now added option is to allow users to disable use of system fonts. I didn't consider it worth the trouble to add the coretext and directwrite enum items from ASS_DefaultFontProvider. The "auto" choice will have the same effect if they're available. Also, the part of the code which defines the option does not necessarily have libass available (it's still optional!), so defining all enum items as choices is icky. I still added fontconfig, since that may be nice to emulate a nostalgic 2010 feeling of mpv freezing on fontconfig. The option for OSD is even less useful. (But you get it for free, and why pass up a chance to add yet another useless option?) This is not quite what was requested in #6947, but as close as it gets.
Diffstat (limited to 'sub')
-rw-r--r--sub/ass_mp.c8
-rw-r--r--sub/osd.c2
-rw-r--r--sub/osd.h1
3 files changed, 10 insertions, 1 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 34e05a230c..bb003a3edd 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -96,8 +96,14 @@ void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts,
if (default_font && !mp_path_exists(default_font))
default_font = NULL;
+ int font_provider = ASS_FONTPROVIDER_AUTODETECT;
+ if (opts->font_provider == 1)
+ font_provider = ASS_FONTPROVIDER_NONE;
+ if (opts->font_provider == 2)
+ font_provider = ASS_FONTPROVIDER_FONTCONFIG;
+
mp_verbose(log, "Setting up fonts...\n");
- ass_set_fonts(priv, default_font, opts->font, 1, config, 1);
+ ass_set_fonts(priv, default_font, opts->font, font_provider, config, 1);
mp_verbose(log, "Done.\n");
talloc_free(tmp);
diff --git a/sub/osd.c b/sub/osd.c
index 495aa45e3a..c480e19cb2 100644
--- a/sub/osd.c
+++ b/sub/osd.c
@@ -64,6 +64,8 @@ static const m_option_t style_opts[] = {
OPT_FLAG("italic", italic, 0),
OPT_CHOICE("justify", justify, 0,
({"auto", 0}, {"left", 1}, {"center", 2}, {"right", 3})),
+ OPT_CHOICE("font-provider", font_provider, 0,
+ ({"auto", 0}, {"none", 1}, {"fontconfig", 2})),
{0}
};
diff --git a/sub/osd.h b/sub/osd.h
index 114ab4a8f1..660a828767 100644
--- a/sub/osd.h
+++ b/sub/osd.h
@@ -137,6 +137,7 @@ struct osd_style_opts {
int bold;
int italic;
int justify;
+ int font_provider;
};
extern const struct m_sub_options osd_style_conf;