diff options
author | wm4 <wm4@nowhere> | 2012-10-13 21:09:34 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-10-14 22:28:51 +0200 |
commit | 0ff7dd992fb06fa8a5cba0a895717787a615e7bb (patch) | |
tree | 509815c039e30daafd75719c15c935e60d1a409a /sub | |
parent | 7d3efa894000bb7513152d2986ccbdef8b6f27ea (diff) | |
download | mpv-0ff7dd992fb06fa8a5cba0a895717787a615e7bb.tar.bz2 mpv-0ff7dd992fb06fa8a5cba0a895717787a615e7bb.tar.xz |
osd_libass: fix \n escapes
Apparently libass can't be made to not interpret "\n" as escape. That
means "\n" can't be printed literally. Use the same hack that was added
to mplayer2 when that project merged osd_libass.c: add an invisible
zero-width joiner character between "\" and "n". It seems U+FEFF is
deprecated, because it has been redefined as BOM mark. Use U+2060, which
seems to be the replacement.
Diffstat (limited to 'sub')
-rw-r--r-- | sub/osd_libass.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/sub/osd_libass.c b/sub/osd_libass.c index 9b0bbb01ab..de9f31b2cb 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -233,14 +233,6 @@ static char *mangle_ass(const char *in) { char *res = talloc_strdup(NULL, ""); while (*in) { - if (in[0] == '\\' && strchr("nNh{}", in[1])) { - // Undo escaping, e.g. \{ -> \\{ - // Note that e.g. \\j still must be emitted as \\j - // (libass only understands the escapes listed in the strchr args) - res = talloc_asprintf_append_buffer(res, "\\\\%c", in[1]); - in += 2; - continue; - } // As used by osd_get_function_sym(). if (in[0] == '\xFF') { res = talloc_strdup_append_buffer(res, ASS_USE_OSD_FONT); @@ -252,6 +244,9 @@ static char *mangle_ass(const char *in) if (*in == '{') res = talloc_strdup_append_buffer(res, "\\"); res = talloc_strndup_append_buffer(res, in, 1); + // Break ASS escapes with U+2060 WORD JOINER + if (*in == '\\') + append_utf8_buffer(res, 0x2060); in++; } return res; |