From 80270218cb9bda57afbb739fa22f7eb2f3a556ff Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 17 Nov 2012 20:56:45 +0100 Subject: osd: make the OSD and sub font more customizable Make more aspects of the OSD font customizable. This also affects the font used for unstyled subtitles (such as SRT), or when using the --no-ass option. This adds back some customizability that was lost with commit 74e7a1 (osd: use libass for OSD rendering). Removed options: --ass-border-color --ass-color --font --subfont --subfont-text-scale Added options: --osd-color --osd-border --osd-back-color --osd-shadow-color --osd-font --osd-font-size --osd-border-size --osd-margin-x --osd-margin-y --osd-shadow-offset --osd-spacing --sub-scale The font size is now specified in pixels as it would be rendered on a window with a height of 720 pixels. OSD and subtitles are always scaled with the window height, so specifying or expecting an absolute font size doesn't make sense. Such scaled pixel units are used to specify font border etc. as well. (Note: the font size is directly passed to libass. How the fonts are actually rasterized is outside of our control, but in theory ASS font sizes map to "script" pixels and then are scaled to screen size.) The default settings should be about the same, with slight difference due to rounding to the new scales. The OSD and subtitle fonts are not separately configurable. It has limited use and would double the number of newly added options, which would be more confusing than helpful. It could be easily added later, should the need arise. Other small details that change: - ASS_Style.Encoding is not set to -1 for subs anymore (assuming subs use VSFilter direction in -no-ass mode too) - use a different WrapStyle for OSD - ASS forced styles are not applied to OSD --- DOCS/man/en/changes.rst | 1 + DOCS/man/en/options.rst | 116 +++++++++++++++++++++++++++++++++++------------- core/cfg-mplayer.h | 10 ++--- core/command.c | 27 +---------- core/defaultopts.c | 2 +- core/mplayer.c | 2 +- core/options.h | 5 +-- sub/ass_mp.c | 76 ++++++++++++++++--------------- sub/ass_mp.h | 14 +++++- sub/osd_libass.c | 46 +++++++++---------- sub/sub.c | 45 +++++++++++++++++-- sub/sub.h | 23 ++++++++-- 12 files changed, 232 insertions(+), 135 deletions(-) diff --git a/DOCS/man/en/changes.rst b/DOCS/man/en/changes.rst index 8bd81c1832..2f012f7b1b 100644 --- a/DOCS/man/en/changes.rst +++ b/DOCS/man/en/changes.rst @@ -109,6 +109,7 @@ Command line switches -endpos --length --cursor-autohide-delay --cursor-autohide -sub-fuzziness --autosub-match + -subfont-text-scale --sub-scale =================================== =================================== input.conf and slave commands diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 44462ec863..3782dd2d31 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -118,20 +118,10 @@ text subtitles only, because ASS subtitles include their own styling information. ---ass-border-color= - Sets the border (outline) color for text subtitles. The color format is - RRGGBBAA. - --ass-bottom-margin= Adds a black band at the bottom of the frame. The SSA/ASS renderer can place subtitles there (with ``--ass-use-margins``). ---ass-color= - Sets the color for text subtitles. The color format is RRGGBBAA. - ---ass-font-scale= - Set the scale coefficient to be used for fonts in the SSA/ASS renderer. - --ass-force-style=<[Style.]Param=Value[,...]> Override some style or script info parameters. @@ -551,19 +541,6 @@ --flip Flip image upside-down. ---font= - Specify font to use for OSD and for subtitles that do not themselves - specify a particular font. See also ``--subfont``. With fontconfig enabled - the argument is a fontconfig pattern and the default is ``sans``. Without - fontconfig the argument is a filename and the default is - ``~/.mpv/subfont.ttf``. - - *EXAMPLE*: - - - ``--font=~/.mpv/arialuni.ttf`` (no fontconfig) - - ``--font='Bitstream Vera Sans'`` (usual case with fontconfig) - - ``--font='Bitstream Vera Sans:style=Bold'`` (usual case with fontconfig) - --force-window-position Forcefully move mpv's video output window to default location whenever there is a change in video parameters, video stream or file. This used to @@ -1234,6 +1211,89 @@ --osd-duration=