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.
This commit is contained in:
wm4 2013-09-25 21:40:35 +02:00
parent 4e6751609e
commit 1e4f08c50c
3 changed files with 14 additions and 8 deletions

View File

@ -122,15 +122,20 @@
Using this option may lead to incorrect subtitle rendering.
``--ass-hinting=<type>``
``--ass-hinting=none|light|normal|native``
Set font hinting type. <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=<value>``
Set line spacing value for SSA/ASS renderer.

View File

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

View File

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