Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
403 results
Show changes
Commits on Source (5)
From 643829edd8408ec37182a04040fe5a7bf54dccc3 Mon Sep 17 00:00:00 2001
From: Oleg Oshmyan <chortos@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
3b8022ca500d4a9e19e9b7106e29d23d4bca20012619c829bc3e77437bcb3c7bd8364800f7daeb3f2d8400afc7bbcaab487c7b30c429d9aed70e37ce4cb265a2 libass-0.15.2.tar.gz
1d2fd02fb2669de7f38ecfa0fe79e3c89da93e09c3cf6bf7b7b811a4808a06fd702da27ba1d9223c9a8a943198e7961b06c808a07e17d6cc6ba2ce70fd802300 libass-0.16.0.tar.gz
--- 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);
From 0915955733bd236ecc44645ee968fb7a55ad5079 Mon Sep 17 00:00:00 2001
From: Oleg Oshmyan <chortos@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);
--- 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);
}
/**
# 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")
......
--- 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);
}
/**