From 1e4f08c50cc5e3abb61c95903a270c8e281d2e5b Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 25 Sep 2013 21:40:35 +0200 Subject: [PATCH] options: make --ass-hinting a choice, instead of using magic numbers options.c still doesn't use the constants defined by the libass headers, but it's still better than exposing those to the user directly. --- DOCS/man/en/options.rst | 17 +++++++++++------ mpvcore/options.c | 3 ++- sub/ass_mp.c | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 8b26e7f448..d6282015fd 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -122,15 +122,20 @@ Using this option may lead to incorrect subtitle rendering. -``--ass-hinting=`` +``--ass-hinting=none|light|normal|native`` Set font hinting type. can be: - :0: no hinting - :1: FreeType autohinter, light mode - :2: FreeType autohinter, normal mode - :3: font native hinter + :none: no hinting (default) + :light: FreeType autohinter, light mode + :normal: FreeType autohinter, normal mode + :native: font native hinter - The default value is 0 (no hinting). + .. admonition:: Warning + + Enabling hinting can lead to mispositioned text (in situations it's + supposed to match up with video background), or reduce the smoothness + of animations with some badly authored ASS scripts. It is recommended + to not use this option, unless really needed. ``--ass-line-spacing=`` Set line spacing value for SSA/ASS renderer. diff --git a/mpvcore/options.c b/mpvcore/options.c index 79d91c1b04..521b30e7d4 100644 --- a/mpvcore/options.c +++ b/mpvcore/options.c @@ -538,7 +538,8 @@ const m_option_t mp_opts[] = { OPT_FLAG("embeddedfonts", use_embedded_fonts, 0), OPT_STRINGLIST("ass-force-style", ass_force_style_list, 0), OPT_STRING("ass-styles", ass_styles_file, 0), - OPT_INTRANGE("ass-hinting", ass_hinting, 0, 0, 7), + OPT_CHOICE("ass-hinting", ass_hinting, 0, + ({"none", 0}, {"light", 1}, {"normal", 2}, {"native", 3})), OPT_CHOICE("ass-style-override", ass_style_override, 0, ({"no", 0}, {"yes", 1})), OPT_FLAG("osd-bar", osd_bar_visible, 0), diff --git a/sub/ass_mp.c b/sub/ass_mp.c index 01b4ebff2f..7af3926058 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -132,7 +132,7 @@ void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, #endif set_line_spacing = opts->ass_line_spacing; set_font_scale = opts->sub_scale; - set_hinting = opts->ass_hinting & 3; // +4 was for no hinting if scaled + set_hinting = opts->ass_hinting; } ass_set_use_margins(priv, set_use_margins);