[vlc-commits] [Git][videolan/vlc][3.0.x] 4 commits: contrib: libass: refresh patchs with proper patches
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Thu May 19 20:28:02 UTC 2022
Rémi Denis-Courmont pushed to branch 3.0.x at VideoLAN / VLC
Commits:
76fe1dde by Steve Lhomme at 2022-05-19T19:33:13+00:00
contrib: libass: refresh patchs with proper patches
They apply cleanly on the 0.15.2 branch and with proper author/dates.
(cherry picked from commit 8f7ed03d5142c69d1865ba7b413454e3873257af)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
33aa7b1b by Steve Lhomme at 2022-05-19T19:33:13+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.
(cherry picked from commit 82ec67316f329ef4b76fe54d4e63ddc779a5f927) (edited)
edited:
- 3.0 didn't have the topendir patch
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
41a78b2c by Steve Lhomme at 2022-05-19T19:33:13+00:00
contrib: libass: remove macos fontconfig fix
fontconfig is not used in any darwin libass builds since 8a922414eb3bc08e5458371f7618dc7f5378caaf.
(cherry picked from commit b9b2be16de3db0cef5c1d00db44557c020632aaa)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
05e7b8b5 by Steve Lhomme at 2022-05-19T19:33:13+00:00
contrib: ass: only request directwrite when explicitely set
(cherry picked from commit 1438a950f7271091123c609dcfe762cf4ee8f944)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
6 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/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/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
@@ -41,10 +41,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
- $(UPDATE_AUTOCONFIG)
$(MOVE)
DEPS_ass = freetype2 $(DEPS_freetype2) fribidi iconv $(DEPS_iconv)
@@ -55,7 +51,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
@@ -76,7 +72,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/aefbee5bdb3e3bbab3d2c62d1036eb1f8fc8fd5b...05e7b8b5ead4899e3294c3bcdd7d83e2e6ac08df
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/aefbee5bdb3e3bbab3d2c62d1036eb1f8fc8fd5b...05e7b8b5ead4899e3294c3bcdd7d83e2e6ac08df
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