diff --git a/contrib/src/ass/0001-configure-add-Core-Text-and-DirectWrite-to-Libs.priv.patch b/contrib/src/ass/0001-configure-add-Core-Text-and-DirectWrite-to-Libs.priv.patch deleted file mode 100644 index 2ec444bc01904cdd163218c4014484066ed2a6b9..0000000000000000000000000000000000000000 --- a/contrib/src/ass/0001-configure-add-Core-Text-and-DirectWrite-to-Libs.priv.patch +++ /dev/null @@ -1,48 +0,0 @@ -From c0eefb7633ed21ebf8c030f7a870ff5e5005e821 Mon Sep 17 00:00:00 2001 -From: Oleg Oshmyan <chortos@inbox.lv> -Date: Sat, 18 Sep 2021 03:04:15 +0300 -Subject: [PATCH 3/4] configure: add Core Text and DirectWrite to Libs.private - -Fixes https://github.com/libass/libass/issues/211. ---- - configure.ac | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 345a445..97abea9 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -118,6 +118,7 @@ AS_IF([test "x$enable_coretext" != xno], [ - [[CTFontDescriptorCopyAttribute(NULL, kCTFontURLAttribute);]] - ) - ], [ -+ pkg_libs="$pkg_libs -framework ApplicationServices -framework CoreFoundation" - LIBS="$LIBS -framework ApplicationServices -framework CoreFoundation" - AC_DEFINE(CONFIG_CORETEXT, 1, [found CoreText in ApplicationServices framework]) - coretext=true -@@ -129,6 +130,7 @@ AS_IF([test "x$enable_coretext" != xno], [ - [[CTFontDescriptorCopyAttribute(NULL, kCTFontURLAttribute);]] - ) - ], [ -+ pkg_libs="$pkg_libs -framework CoreText -framework CoreFoundation" - LIBS="$LIBS -framework CoreText -framework CoreFoundation" - AC_DEFINE(CONFIG_CORETEXT, 1, [found CoreText framework]) - coretext=true -@@ -160,12 +162,14 @@ AS_IF([test "x$enable_directwrite" != xno], [ - ], [ - # WinRT/UWP/app build: GDI and LoadLibrary are - # unavailable, but DirectWrite is always present -+ pkg_libs="$pkg_libs -ldwrite" - LIBS="$LIBS -ldwrite" - AC_DEFINE(CONFIG_DIRECTWRITE, 1, [found DirectWrite (WinRT/UWP)]) - AC_MSG_RESULT([no]) - ], [ - # Win32/desktop build: GDI is always present; - # DirectWrite is optional but can be loaded via LoadLibrary -+ pkg_libs="$pkg_libs -lgdi32" - LIBS="$LIBS -lgdi32" - AC_DEFINE(CONFIG_DIRECTWRITE, 1, [found DirectWrite and GDI (Win32)]) - AC_MSG_RESULT([yes]) --- -2.27.0.windows.1 - diff --git a/contrib/src/ass/SHA512SUMS b/contrib/src/ass/SHA512SUMS index a7c89f170f3df8d0657b04a382e0acd5147b2776..cda21661c92c40204b2ded600c444150ad72e104 100644 --- a/contrib/src/ass/SHA512SUMS +++ b/contrib/src/ass/SHA512SUMS @@ -1 +1 @@ -3b8022ca500d4a9e19e9b7106e29d23d4bca20012619c829bc3e77437bcb3c7bd8364800f7daeb3f2d8400afc7bbcaab487c7b30c429d9aed70e37ce4cb265a2 libass-0.15.2.tar.gz +1d2fd02fb2669de7f38ecfa0fe79e3c89da93e09c3cf6bf7b7b811a4808a06fd702da27ba1d9223c9a8a943198e7961b06c808a07e17d6cc6ba2ce70fd802300 libass-0.16.0.tar.gz diff --git a/contrib/src/ass/ass-macosx.patch b/contrib/src/ass/ass-macosx.patch index d0c09a3281686b2e894d850cbcff6a1877083552..ff80674adb11ca0d4d49a9224a3de10b8b84a703 100644 --- a/contrib/src/ass/ass-macosx.patch +++ b/contrib/src/ass/ass-macosx.patch @@ -1,7 +1,7 @@ -From f26a12597c0a3a907bd30547daa35153ed3aa11c Mon Sep 17 00:00:00 2001 +From e20ef56993823cfdbf29825a686e7632285111c6 Mon Sep 17 00:00:00 2001 From: Naohiro Koriyama <nkoriyama@gmail.com> Date: Wed, 29 Aug 2012 16:44:16 +0200 -Subject: [PATCH 2/4] added fontconfig font search paths for OS X. +Subject: [PATCH] added fontconfig font search paths for OS X. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/contrib/src/ass/libass-freetype-fix.patch b/contrib/src/ass/libass-freetype-fix.patch deleted file mode 100644 index 16fab926ba93669937c5168f761ce9ae7c6c60f2..0000000000000000000000000000000000000000 --- a/contrib/src/ass/libass-freetype-fix.patch +++ /dev/null @@ -1,185 +0,0 @@ -From b7e8314560f03d252182c051df1f04175299118e Mon Sep 17 00:00:00 2001 -From: Oleg Oshmyan <chortos@inbox.lv> -Date: Mon, 20 Sep 2021 23:37:23 +0300 -Subject: [PATCH 1/4] Add strikeout/underline to ASS_Outline, not - FreeType-owned memory - -ass_strike_outline_glyph was realloc()ing memory that was -allocated by FreeType, not us. This isn't generally safe. -Indeed, FreeType recently switched to a different allocator -on Windows, so this code started crashing. - -To avoid this, move the ass_strike_outline_glyph call -after the FT_Outline -> ASS_Outline conversion. - -It's safer (less chance to exceed outline size limits) -and easier to work with ASS_Outline, anyway. - -Fixes the crash in https://github.com/mpv-player/mpv/issues/9227. ---- - libass/ass_font.c | 55 +++++++++++++++++++-------------------------- - libass/ass_font.h | 5 +++++ - libass/ass_render.c | 4 ++++ - 3 files changed, 32 insertions(+), 32 deletions(-) - -diff --git a/libass/ass_font.c b/libass/ass_font.c -index 221a7b4..46b7975 100644 ---- a/libass/ass_font.c -+++ b/libass/ass_font.c -@@ -357,29 +357,25 @@ void ass_font_get_asc_desc(ASS_Font *font, int face_index, - *desc = FT_MulFix(-face->descender, y_scale); - } - --static void add_line(FT_Outline *ol, int bear, int advance, int dir, int pos, int size) { -- FT_Vector points[4] = { -- {.x = bear, .y = pos + size}, -- {.x = advance, .y = pos + size}, -- {.x = advance, .y = pos - size}, -+static void add_line(ASS_Outline *ol, int bear, int advance, int dir, int pos, int size) { -+ ASS_Vector points[4] = { - {.x = bear, .y = pos - size}, -+ {.x = advance, .y = pos - size}, -+ {.x = advance, .y = pos + size}, -+ {.x = bear, .y = pos + size}, - }; - - if (dir == FT_ORIENTATION_TRUETYPE) { -- int i; -- for (i = 0; i < 4; i++) { -- ol->points[ol->n_points] = points[i]; -- ol->tags[ol->n_points++] = 1; -- } -+ for (int i = 0; i < 4; i++) -+ ol->points[ol->n_points++] = points[i]; - } else { -- int i; -- for (i = 3; i >= 0; i--) { -- ol->points[ol->n_points] = points[i]; -- ol->tags[ol->n_points++] = 1; -- } -+ for (int i = 3; i >= 0; i--) -+ ol->points[ol->n_points++] = points[i]; - } - -- ol->contours[ol->n_contours++] = ol->n_points - 1; -+ for (int i = 0; i < 4; i++) -+ ol->segments[ol->n_segments++] = OUTLINE_LINE_SEGMENT; -+ ol->segments[ol->n_segments - 1] |= OUTLINE_CONTOUR_END; - } - - /* -@@ -389,12 +385,13 @@ static void add_line(FT_Outline *ol, int bear, int advance, int dir, int pos, in - * being accurate. - * - */ --static int ass_strike_outline_glyph(FT_Face face, ASS_Font *font, -- FT_Glyph glyph, int under, int through) -+int ass_strike_outline_glyph(ASS_Font *font, int face_index, -+ FT_Glyph glyph, ASS_Outline *ol, -+ int under, int through) - { -+ FT_Face face = font->faces[face_index]; - TT_OS2 *os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2); - TT_Postscript *ps = FT_Get_Sfnt_Table(face, ft_sfnt_post); -- FT_Outline *ol = &((FT_OutlineGlyph) glyph)->outline; - int advance, y_scale, i, dir; - - if (!under && !through) -@@ -402,23 +399,20 @@ static int ass_strike_outline_glyph(FT_Face face, ASS_Font *font, - - // Grow outline - i = (under ? 4 : 0) + (through ? 4 : 0); -- if (ol->n_points > SHRT_MAX - i) -- return 0; -- if (!ASS_REALLOC_ARRAY(ol->points, ol->n_points + i)) -+ if (ol->n_points > SIZE_MAX - i) - return 0; -- if (!ASS_REALLOC_ARRAY(ol->tags, ol->n_points + i)) -+ if (ol->n_segments > SIZE_MAX - i) - return 0; -- i = !!under + !!through; -- if (ol->n_contours > SHRT_MAX - i) -+ if (!ASS_REALLOC_ARRAY(ol->points, ol->n_points + i)) - return 0; -- if (!ASS_REALLOC_ARRAY(ol->contours, ol->n_contours + i)) -+ if (!ASS_REALLOC_ARRAY(ol->segments, ol->n_segments + i)) - return 0; - - advance = d16_to_d6(glyph->advance.x); - y_scale = face->size->metrics.y_scale; - - // Reverse drawing direction for non-truetype fonts -- dir = FT_Outline_Get_Orientation(ol); -+ dir = FT_Outline_Get_Orientation(&((FT_OutlineGlyph) glyph)->outline); - - // Add points to the outline - if (under && ps) { -@@ -428,7 +422,7 @@ static int ass_strike_outline_glyph(FT_Face face, ASS_Font *font, - if (pos > 0 || size <= 0) - return 1; - -- add_line(ol, 0, advance, dir, pos, size); -+ add_line(ol, 0, advance, dir, -pos, size); - } - - if (through && os2) { -@@ -438,7 +432,7 @@ static int ass_strike_outline_glyph(FT_Face face, ASS_Font *font, - if (pos < 0 || size <= 0) - return 1; - -- add_line(ol, 0, advance, dir, pos, size); -+ add_line(ol, 0, advance, dir, -pos, size); - } - - return 0; -@@ -593,9 +587,6 @@ FT_Glyph ass_font_get_glyph(ASS_Font *font, int face_index, int index, - glyph->advance.x = face->glyph->linearVertAdvance; - } - -- ass_strike_outline_glyph(face, font, glyph, deco & DECO_UNDERLINE, -- deco & DECO_STRIKETHROUGH); -- - return glyph; - } - -diff --git a/libass/ass_font.h b/libass/ass_font.h -index 98ac1c8..57f832d 100644 ---- a/libass/ass_font.h -+++ b/libass/ass_font.h -@@ -30,6 +30,7 @@ typedef struct ass_font ASS_Font; - #include "ass_types.h" - #include "ass_fontselect.h" - #include "ass_cache.h" -+#include "ass_outline.h" - - #define VERTICAL_LOWER_BOUND 0x02f1 - -@@ -63,6 +64,10 @@ FT_Glyph ass_font_get_glyph(ASS_Font *font, int face_index, int index, - ASS_Hinting hinting, int deco); - void ass_font_clear(ASS_Font *font); - -+int ass_strike_outline_glyph(ASS_Font *font, int face_index, -+ FT_Glyph glyph, ASS_Outline *ol, -+ int under, int through); -+ - FT_Face ass_face_open(ASS_Library *lib, FT_Library ftlib, const char *path, - const char *postscript_name, int index); - FT_Face ass_face_stream(ASS_Library *lib, FT_Library ftlib, const char *name, -diff --git a/libass/ass_render.c b/libass/ass_render.c -index 0bf6676..0558066 100644 ---- a/libass/ass_render.c -+++ b/libass/ass_render.c -@@ -1173,6 +1173,10 @@ size_t ass_outline_construct(void *key, void *value, void *priv) - if (!outline_convert(&v->outline[0], src)) - return 1; - v->advance = d16_to_d6(glyph->advance.x); -+ ass_strike_outline_glyph(k->font, k->face_index, -+ glyph, &v->outline[0], -+ k->flags & DECO_UNDERLINE, -+ k->flags & DECO_STRIKETHROUGH); - FT_Done_Glyph(glyph); - ass_font_get_asc_desc(k->font, k->face_index, - &v->asc, &v->desc); --- -2.27.0.windows.1 - diff --git a/contrib/src/ass/rules.mak b/contrib/src/ass/rules.mak index 6472cb06baaaaa80a2da84370f99e38b2e5fe664..c0de89b8da3846f5585a28a056de0ecfbac7f958 100644 --- a/contrib/src/ass/rules.mak +++ b/contrib/src/ass/rules.mak @@ -1,5 +1,5 @@ # ASS -ASS_VERSION := 0.15.2 +ASS_VERSION := 0.16.0 ASS_URL := https://github.com/libass/libass/releases/download/$(ASS_VERSION)/libass-$(ASS_VERSION).tar.gz PKGS += ass @@ -36,13 +36,7 @@ $(TARBALLS)/libass-$(ASS_VERSION).tar.gz: libass: libass-$(ASS_VERSION).tar.gz .sum-ass $(UNPACK) - $(APPLY) $(SRC)/ass/libass-freetype-fix.patch $(APPLY) $(SRC)/ass/ass-macosx.patch - $(APPLY) $(SRC)/ass/0001-configure-add-Core-Text-and-DirectWrite-to-Libs.priv.patch -ifdef HAVE_WIN32 - $(APPLY) $(SRC)/ass/use-topendir.patch -endif - $(UPDATE_AUTOCONFIG) $(MOVE) DEPS_ass = freetype2 $(DEPS_freetype2) fribidi iconv $(DEPS_iconv) @@ -74,7 +68,6 @@ ASS_CFLAGS += -g endif .ass: libass - $(RECONF) cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) $(ASS_CFLAGS)" ./configure $(HOSTCONF) $(ASS_CONF) cd $< && $(MAKE) $(call pkg_static,"libass.pc") diff --git a/contrib/src/ass/use-topendir.patch b/contrib/src/ass/use-topendir.patch deleted file mode 100644 index c39f4fe232d5cd99e438ab688b9ddf8cb0c55cd9..0000000000000000000000000000000000000000 --- a/contrib/src/ass/use-topendir.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 3024055a3a7da6ebbf5b843420aa5bf47ef66d13 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr> -Date: Thu, 7 Apr 2016 14:59:34 +0200 -Subject: [PATCH 4/4] Use wopendir when possible - ---- - libass/ass_fontselect.c | 50 ++++++++++++++++++++++++++++++++++++----- - 1 file changed, 44 insertions(+), 6 deletions(-) - -diff --git a/libass/ass_fontselect.c b/libass/ass_fontselect.c -index b47c4bc..47a5d0b 100644 ---- a/libass/ass_fontselect.c -+++ b/libass/ass_fontselect.c -@@ -47,6 +47,9 @@ - #include "ass_font.h" - #include "ass_string.h" - -+#include <windows.h> -+#include <tchar.h> -+ - #define ABS(x) ((x) < 0 ? -(x) : (x)) - #define MAX_FULLNAME 100 - -@@ -166,21 +169,55 @@ static ASS_FontProviderFuncs ft_funcs = { - .destroy_font = destroy_font_ft, - }; - -+#ifdef _WIN32 -+static inline char *FromWide (const wchar_t *wide) -+{ -+ size_t len = WideCharToMultiByte (CP_UTF8, 0, wide, -1, NULL, 0, NULL, NULL); -+ if (len == 0) -+ return NULL; -+ -+ char *out = (char *)malloc (len); -+ -+ if (out) -+ WideCharToMultiByte (CP_UTF8, 0, wide, -1, out, len, NULL, NULL); -+ return out; -+} -+ -+static inline wchar_t *ToWide (const char *utf8) -+{ -+ int len = MultiByteToWideChar (CP_UTF8, 0, utf8, -1, NULL, 0); -+ if (len == 0) -+ return NULL; -+ -+ wchar_t *out = (wchar_t *)malloc (len * sizeof (wchar_t)); -+ -+ if (out) -+ MultiByteToWideChar (CP_UTF8, 0, utf8, -1, out, len); -+ return out; -+} -+#endif -+ - static void load_fonts_from_dir(ASS_Library *library, const char *dir) - { -- DIR *d = opendir(dir); -+ wchar_t *dirw = ToWide(dir); -+ _TDIR *d = _topendir(dirw); -+ free(dirw); - if (!d) - return; - size_t dirlen = strlen(dir); - size_t namemax = 0; - char *namebuf = NULL; - while (1) { -- struct dirent *entry = readdir(d); -+ struct _tdirent *entry = _treaddir(d); - if (!entry) - break; -+ char* d_name = FromWide(entry->d_name); - if (entry->d_name[0] == '.') -+ { -+ free(d_name); - continue; -- size_t namelen = dirlen + strlen(entry->d_name) + 2u; -+ } -+ size_t namelen = dirlen + strlen(d_name) + 2u; - if (namelen < 2 || namelen - 2 < dirlen) - continue; - if (namelen > namemax) { -@@ -190,17 +227,18 @@ static void load_fonts_from_dir(ASS_Library *library, const char *dir) - else - continue; - } -- snprintf(namebuf, namemax, "%s/%s", dir, entry->d_name); -+ _snprintf(namebuf, namemax, "%s/%s", dir, d_name); - size_t bufsize = 0; - ass_msg(library, MSGL_INFO, "Loading font file '%s'", namebuf); - void *data = read_file(library, namebuf, &bufsize); - if (data) { -- ass_add_font(library, entry->d_name, data, bufsize); -+ ass_add_font(library, d_name, data, bufsize); - free(data); - } -+ free(d_name); - } - free(namebuf); -- closedir(d); -+ _tclosedir(d); - } - - /** --- -2.27.0.windows.1 -