summaryrefslogtreecommitdiffstats
path: root/sub/ass_mp.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-15 17:38:48 +0100
committerwm4 <wm4@nowhere>2013-12-15 17:38:48 +0100
commit6dcebd91301179f4e59ce6cdfa5ba720043e99bc (patch)
treeab9cc98984e1ad30e422bb91fbe1a788dc93c55f /sub/ass_mp.c
parent78b5324eeefc2b8a235a8ea412283491ee009a1e (diff)
downloadmpv-6dcebd91301179f4e59ce6cdfa5ba720043e99bc.tar.bz2
mpv-6dcebd91301179f4e59ce6cdfa5ba720043e99bc.tar.xz
osd_libass: update styles when OSD changes PlayRes
The OSD style settings depend on the PlayRes, simply because all style values are implicitly scaled by the PlayResY in libass. Also, the OSC changes the PlayResY in certain situations, so something could go wrong. But not sure if this actually matters in practice.
Diffstat (limited to 'sub/ass_mp.c')
-rw-r--r--sub/ass_mp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 5ae85c0d06..44b59e34d5 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -43,9 +43,11 @@ void mp_ass_set_style(ASS_Style *style, double res_y,
const struct osd_style_opts *opts)
{
if (opts->font) {
- free(style->FontName);
- style->FontName = strdup(opts->font);
- style->treat_fontname_as_pattern = 1;
+ if (!style->FontName || strcmp(style->FontName, opts->font) != 0) {
+ free(style->FontName);
+ style->FontName = strdup(opts->font);
+ style->treat_fontname_as_pattern = 1;
+ }
}
// libass_font_size = FontSize * (window_height / res_y)