[vlc-commits] [Git][videolan/vlc][master] 5 commits: contrib: libass: remove unused patch

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun May 15 12:42:44 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
1224cf01 by Steve Lhomme at 2022-05-15T11:59:34+00:00
contrib: libass: remove unused patch

- - - - -
8f7ed03d by Steve Lhomme at 2022-05-15T11:59:34+00:00
contrib: libass: refresh patchs with proper patches

They apply cleanly on the 0.15.2 branch and with proper author/dates.

- - - - -
82ec6731 by Steve Lhomme at 2022-05-15T11:59:34+00:00
contrib: libass: update to 0.16.0

Some of the patches have been upstreamed. The wopendir fix is not needed
anymore as on Windows it now assumes the char* is UTF-8 and use it accordingly.

- - - - -
b9b2be16 by Steve Lhomme at 2022-05-15T11:59:34+00:00
contrib: libass: remove macos fontconfig fix

fontconfig is not used in any darwin libass builds since 8a922414eb3bc08e5458371f7618dc7f5378caaf.

- - - - -
1438a950 by Steve Lhomme at 2022-05-15T11:59:34+00:00
contrib: ass: only request directwrite when explicitely set

- - - - -


7 changed files:

- − contrib/src/ass/0001-configure-add-Core-Text-and-DirectWrite-to-Libs.priv.patch
- contrib/src/ass/SHA512SUMS
- − contrib/src/ass/ass-macosx.patch
- − contrib/src/ass/libass-freetype-fix.patch
- − contrib/src/ass/libass-no-tchar.patch
- contrib/src/ass/rules.mak
- − contrib/src/ass/use-topendir.patch


Changes:

=====================================
contrib/src/ass/0001-configure-add-Core-Text-and-DirectWrite-to-Libs.priv.patch deleted
=====================================
@@ -1,48 +0,0 @@
-From 643829edd8408ec37182a04040fe5a7bf54dccc3 Mon Sep 17 00:00:00 2001
-From: Oleg Oshmyan <chortos at inbox.lv>
-Date: Sat, 18 Sep 2021 03:04:15 +0300
-Subject: [PATCH] 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 89d5eb0..6ae78a1 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -126,6 +126,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
-@@ -137,6 +138,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
-@@ -171,12 +173,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.34.1
-


=====================================
contrib/src/ass/SHA512SUMS
=====================================
@@ -1 +1 @@
-3b8022ca500d4a9e19e9b7106e29d23d4bca20012619c829bc3e77437bcb3c7bd8364800f7daeb3f2d8400afc7bbcaab487c7b30c429d9aed70e37ce4cb265a2  libass-0.15.2.tar.gz
+1d2fd02fb2669de7f38ecfa0fe79e3c89da93e09c3cf6bf7b7b811a4808a06fd702da27ba1d9223c9a8a943198e7961b06c808a07e17d6cc6ba2ce70fd802300  libass-0.16.0.tar.gz


=====================================
contrib/src/ass/ass-macosx.patch deleted
=====================================
@@ -1,12 +0,0 @@
---- libass-0.13.0/libass/ass_fontconfig.c.orig	2015-10-06 16:03:01.104710780 +0200
-+++ libass-0.13.0/libass/ass_fontconfig.c	2015-10-06 16:03:00.216719387 +0200
-@@ -282,6 +282,9 @@
-                 "file found, using fallback.");
-         FcConfigDestroy(fc->config);
-         fc->config = FcInitLoadConfig();
-+        FcConfigAppFontAddDir(fc->config, "~/Library/Fonts");
-+        FcConfigAppFontAddDir(fc->config, "/Library/Fonts");
-+        FcConfigAppFontAddDir(fc->config, "/Network/Library/Fonts");
-     }
-     if (fc->config)
-         rc = FcConfigBuildFonts(fc->config);


=====================================
contrib/src/ass/libass-freetype-fix.patch deleted
=====================================
@@ -1,182 +0,0 @@
-From 0915955733bd236ecc44645ee968fb7a55ad5079 Mon Sep 17 00:00:00 2001
-From: Oleg Oshmyan <chortos at inbox.lv>
-Date: Mon, 20 Sep 2021 23:37:23 +0300
-Subject: [PATCH] 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 221a7b4a7..46b797598 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 98ac1c85b..57f832d67 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 59c54b923..5fcbe968b 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);


=====================================
contrib/src/ass/libass-no-tchar.patch deleted
=====================================
@@ -1,37 +0,0 @@
---- libass-0.15.2/libass/ass_fontselect.c.orig	2021-12-29 16:11:04.588615131 +0100
-+++ libass-0.15.2/libass/ass_fontselect.c	2021-12-29 16:13:00.276849748 +0100
-@@ -48,7 +48,6 @@
- #include "ass_string.h"
- 
- #include <windows.h>
--#include <tchar.h>
- 
- #define ABS(x) ((x) < 0 ? -(x) : (x))
- #define MAX_FULLNAME 100
-@@ -201,7 +200,7 @@
- {
-     DIR *d = opendir(dir);
-     wchar_t *dirw = ToWide(dir);
--    _TDIR *d = _topendir(dirw);
-+    _WDIR *d = _wopendir(dirw);
-     free(dirw);
-     if (!d)
-         return;
-@@ -209,7 +208,7 @@
-     size_t namemax = 0;
-     char *namebuf = NULL;
-     while (1) {
--        struct _tdirent *entry = _treaddir(d);
-+        struct _wdirent *entry = _wreaddir(d);
-         if (!entry)
-             break;
-         char* d_name = FromWide(entry->d_name);
-@@ -239,7 +238,7 @@
-         free(d_name);
-     }
-     free(namebuf);
--    _tclosedir(d);
-+    _wclosedir(d);
- }
- 
- /**


=====================================
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,14 +36,6 @@ $(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
-#	$(APPLY) $(SRC)/ass/libass-no-tchar.patch
-endif
-	$(UPDATE_AUTOCONFIG)
 	$(MOVE)
 
 DEPS_ass = freetype2 $(DEPS_freetype2) fribidi iconv $(DEPS_iconv)
@@ -54,7 +46,7 @@ else
 ASS_CONF += --disable-fontconfig --disable-require-system-font-provider
 endif
 
-ifneq ($(WITH_DWRITE), 0)
+ifeq ($(WITH_DWRITE), 1)
 ASS_CONF += --enable-directwrite
 endif
 
@@ -75,7 +67,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")


=====================================
contrib/src/ass/use-topendir.patch deleted
=====================================
@@ -1,93 +0,0 @@
---- a/libass/ass_fontselect.c.orig	2021-09-11 23:27:04.000000000 +0200
-+++ b/libass/ass_fontselect.c	2021-12-29 17:18:47.535670604 +0100
-@@ -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 @@
-     .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 @@
-             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);
- }
- 
- /**



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a925e7178cf8b75e76bba5c12eab903d6461d168...1438a950f7271091123c609dcfe762cf4ee8f944

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a925e7178cf8b75e76bba5c12eab903d6461d168...1438a950f7271091123c609dcfe762cf4ee8f944
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list