summaryrefslogtreecommitdiff
path: root/sub/osd_libass.c
diff options
context:
space:
mode:
authorJames Cowgill <jcowgill@debian.org>2018-01-14 19:29:55 +0000
committerJames Cowgill <jcowgill@debian.org>2018-01-14 19:29:55 +0000
commiteeeb829fddefd9f4312cd57eb2bd2b26b7e860a2 (patch)
tree870ae2fe0c96d6fa1e41f24562de10f33442ae13 /sub/osd_libass.c
parent4b6da7ffc977eb0ab985119acec5abdf8b4248a4 (diff)
New upstream version 0.28.0
Diffstat (limited to 'sub/osd_libass.c')
-rw-r--r--sub/osd_libass.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index 046007d..28a16d6 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -190,6 +190,7 @@ void osd_get_function_sym(char *buffer, size_t buffer_size, int osd_function)
static void mangle_ass(bstr *dst, const char *in)
{
+ const char *start = in;
bool escape_ass = true;
while (*in) {
// As used by osd_get_function_sym().
@@ -207,6 +208,12 @@ static void mangle_ass(bstr *dst, const char *in)
}
if (escape_ass && *in == '{')
bstr_xappend(NULL, dst, bstr0("\\"));
+ // Libass will strip leading whitespace
+ if (in[0] == ' ' && (in == start || in[-1] == '\n')) {
+ bstr_xappend(NULL, dst, bstr0("\\h"));
+ in += 1;
+ continue;
+ }
bstr_xappend(NULL, dst, (bstr){(char *)in, 1});
// Break ASS escapes with U+2060 WORD JOINER
if (escape_ass && *in == '\\')