From 334e5565c688c0a2a0172c9007e76dffaca238d8 Mon Sep 17 00:00:00 2001 From: Oneric Date: Sat, 13 Mar 2021 02:20:18 +0100 Subject: Add WRAP_UNICODE feature Setting this feature allows breaking lines according to the Unicode Line Breaking Algorithm and is incompatible with VSFilter. This is useful for non-ASS renderers utilising libass, especially for languages typically not using ASCII-spaces to separate words, but also to correctly break on punctuation even in languages that do. It does not allow breaking words apart, so line overflow might still occur. For this to work a new optional dependency on libunibrak is added. We assume FriBidi's and libunibreak's utf32/glyph type match. This is based on an earlier patch by GitHub user siikamiika. --- libass/ass_library.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libass/ass_library.c') diff --git a/libass/ass_library.c b/libass/ass_library.c index 745798e..42cabbd 100644 --- a/libass/ass_library.c +++ b/libass/ass_library.c @@ -24,6 +24,9 @@ #include #include #include +#ifdef CONFIG_UNIBREAK +#include +#endif #include "ass.h" #include "ass_library.h" @@ -44,6 +47,10 @@ ASS_Library *ass_library_init(void) ASS_Library* lib = calloc(1, sizeof(*lib)); if (lib) lib->msg_callback = ass_msg_handler; + #ifdef CONFIG_UNIBREAK + // libunibreak works without, but its docs suggest this improves performance + init_linebreak(); + #endif return lib; } -- cgit v1.2.3