diff options
author | wm4 <wm4@nowhere> | 2013-01-04 16:10:17 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-01-05 14:11:56 +0100 |
commit | ca9c81b0d30d630a950a0d830fe8d98ab0131eef (patch) | |
tree | 3b64d4f54f0f1c2624662bc40504c3ca5b002959 | |
parent | e65778ca6caa3b539877e43471481aa8c2387ebe (diff) | |
download | mpv-ca9c81b0d30d630a950a0d830fe8d98ab0131eef.tar.bz2 mpv-ca9c81b0d30d630a950a0d830fe8d98ab0131eef.tar.xz |
sub: add --sub-text-* options to unstyled text subtitles font
Before this commit, the --osd-* options (like --osd-font-size etc.)
configured both the OSD and subtitle font. Make them separate, and add
--sub-text-* options (like --sub-text-size etc.). Now --osd-* affects
the OSD font only, and --sub-text-* unstyled text subtitles only.
-rw-r--r-- | DOCS/man/en/changes.rst | 3 | ||||
-rw-r--r-- | DOCS/man/en/options.rst | 62 | ||||
-rw-r--r-- | core/cfg-mplayer.h | 3 | ||||
-rw-r--r-- | core/options.h | 1 | ||||
-rw-r--r-- | sub/ass_mp.c | 2 | ||||
-rw-r--r-- | sub/osd_libass.c | 2 |
6 files changed, 40 insertions, 33 deletions
diff --git a/DOCS/man/en/changes.rst b/DOCS/man/en/changes.rst index b82bef5167..e8efef843f 100644 --- a/DOCS/man/en/changes.rst +++ b/DOCS/man/en/changes.rst @@ -110,6 +110,9 @@ Command line switches -endpos --length --cursor-autohide-delay --cursor-autohide -sub-fuzziness --autosub-match + -subfont --sub-text-font + -font --osd-font + -subfont-* --sub-text-*, --osd-* -subfont-text-scale --sub-scale -spugauss --sub-gauss -vobsub --sub (pass the .idx file) diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 0bf7ae60d4..9beb5a1a3d 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -1231,26 +1231,24 @@ search for video segments from other files, and will also ignore any chapter order specified for the main file. ---osd-back-color=<#RRGGBB> - See ``--osd-color``. Color used for OSD text background. +--osd-back-color=<#RRGGBB>, --sub-text-back-color=<#RRGGBB> + See ``--osd-color``. Color used for OSD/sub text background. ---osd-border-color=<#RRGGBB> - See ``--osd-color``. Color used for the OSD font border. +--osd-border-color=<#RRGGBB>, --sub-text-border-color=<#RRGGBB> + See ``--osd-color``. Color used for the OSD/sub font border. - *Note*: ignored when ``--osd-back-color`` is specified (or more - exactly: when that option is not set to completely transparent). + *NOTE*: ignored when ``--osd-back-color``/``--sub-text-back-color`` is + specified (or more exactly: when that option is not set to completely + transparent). ---osd-border-size=<size> - Size of the OSD font border in scaled pixels (see ``--osd-font-size`` for - details). A value of 0 disables borders. +--osd-border-size=<size>, --sub-text-border-size=<size> + Size of the OSD/sub font border in scaled pixels (see ``--osd-font-size`` + for details). A value of 0 disables borders. Default: 2.5. ---osd-color=<#RRGGBB|#AARRGGBB> - Specify the color used for OSD. This is also used for unstyled text - subtitles. This option (and most other ``--osd-`` options) are ignored - when ASS subtitles are rendered, unless the ``--no-ass`` option is - specified. +--osd-color=<#RRGGBB|#AARRGGBB>, --sub-text-color=<#RRGGBB|#AARRGGBB> + Specify the color used for OSD/unstyled text subtitles. The color is specified as a RGB hex triplet, and each 2-digit group expresses a color value in the range 0 (``00``) to 255 (`FF`). @@ -1268,19 +1266,21 @@ --osd-duration=<time> Set the duration of the OSD messages in ms (default: 1000). ---osd-font=<pattern> +--osd-font=<pattern>, --sub-text-font=<pattern> Specify font to use for OSD and for subtitles that do not themselves specify a particular font. The default is ``Sans``. - Typically ignored for ASS-subtitles. - *EXAMPLE*: - ``--osd-font='Bitstream Vera Sans'`` - ``--osd-font='Bitstream Vera Sans:style=Bold'`` (fontconfig pattern) ---osd-font-size=<size> - Specify the OSD font size. The unit is the size in scaled pixels at a + *NOTE*: the ``--sub-text-font`` option (and most other ``--sub-text-`` + options) are ignored when ASS-subtitles are rendered, unless the + ``--no-ass`` option is specified. + +--osd-font-size=<size>, --sub-text-font-size=<size> + Specify the OSD/sub font size. The unit is the size in scaled pixels at a window height of 720. The actual pixel size is scaled with the window height: if the window height is larger or smaller than 720, the actual size of the text increases or decreases as well. @@ -1298,8 +1298,8 @@ :2: volume + seek + timer + percentage :3: volume + seek + timer + percentage + total time ---osd-margin-x=<size> - Left and right screen margin for the OSD in scaled pixels (see +--osd-margin-x=<size>, --sub-text-margin-x=<size> + Left and right screen margin for the OSD/subs in scaled pixels (see ``--osd-font-size`` for details). This option specifies the distance of the OSD to the left, as well as at @@ -1307,8 +1307,8 @@ Default: 25. ---osd-margin-y=<size> - Top and bottom screen margin for the OSD in scaled pixels (see +--osd-margin-y=<size>, --sub-text-margin-y=<size> + Top and bottom screen margin for the OSD/subs in scaled pixels (see ``--osd-font-size`` for details). This option specifies the vertical margins of the OSD. This is also used @@ -1317,19 +1317,19 @@ Default: 10. ---osd-shadow-color=<#RRGGBB> - See ``--osd-color``. Color used for OSD text shadow. +--osd-shadow-color=<#RRGGBB>, --sub-text-shadow-color=<#RRGGBB> + See ``--osd-color``. Color used for OSD/sub text shadow. ---osd-shadow-offset=<size> - Displacement of the OSD text shadow in scaled pixels (see +--osd-shadow-offset=<size>, --sub-text-shadow-offset=<size> + Displacement of the OSD/sub text shadow in scaled pixels (see ``--osd-font-size`` for details). A value of 0 disables shadows. Default: 0. ---osd-spacing=<size> - Horizontal OSD font spacing in scaled pixels (see ``--osd-font-size`` for - details). This value is added to the normal letter spacing. Negative values - are allowed. +--osd-spacing=<size>, --sub-text-spacing=<size> + Horizontal OSD/sub font spacing in scaled pixels (see ``--osd-font-size`` + for details). This value is added to the normal letter spacing. Negative + values are allowed. Default: 0. diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h index 65ebdbb595..9121359b02 100644 --- a/core/cfg-mplayer.h +++ b/core/cfg-mplayer.h @@ -523,6 +523,9 @@ const m_option_t common_opts[] = { OPT_GENERAL("osd", osd_style, M_OPT_PREFIXED, .type = &m_option_type_subconfig_struct, .priv = (void*)&osd_style_conf), + OPT_GENERAL("sub-text", sub_text_style, M_OPT_PREFIXED, + .type = &m_option_type_subconfig_struct, + .priv = (void*)&osd_style_conf), {NULL, NULL, 0, 0, 0, 0, NULL} }; diff --git a/core/options.h b/core/options.h index a45c6d468f..fbeb94c042 100644 --- a/core/options.h +++ b/core/options.h @@ -114,6 +114,7 @@ typedef struct MPOpts { char **sub_paths; int sub_auto; struct osd_style_opts *osd_style; + struct osd_style_opts *sub_text_style; float sub_scale; float sub_gauss; int sub_gray; diff --git a/sub/ass_mp.c b/sub/ass_mp.c index 44f01ac186..ae069662c6 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -90,7 +90,7 @@ ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts) ASS_Style *style = track->styles + sid; style->Name = strdup("Default"); style->Alignment = 2; - mp_ass_set_style(style, opts->osd_style); + mp_ass_set_style(style, opts->sub_text_style); } if (opts->ass_style_override) diff --git a/sub/osd_libass.c b/sub/osd_libass.c index 749b46d6ae..b34292ce16 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -223,7 +223,7 @@ static void update_sub(struct osd_state *osd, struct osd_object *obj) if (!obj->osd_track) obj->osd_track = mp_ass_default_track(osd->osd_ass_library, osd->opts); - struct osd_style_opts font = *opts->osd_style; + struct osd_style_opts font = *opts->sub_text_style; font.font_size *= opts->sub_scale; ASS_Style *style = obj->osd_track->styles + obj->osd_track->default_style; |