commit 5141362

hovercats  ·  2024-07-30 14:48:36 +0000 UTC
parent e0d592f
libass: 0.17.3
6 files changed,  +68, -56
+8, -6
 1@@ -1,11 +1,13 @@
 2 #!/bin/sh -e
 3 
 4+export DESTDIR="$1"
 5+
 6 patch -p1 < 0001-remove-fribidi-dependency.patch
 7 
 8-./configure \
 9-    FRIBIDI_LIBS="  " \
10-    --prefix=/usr \
11-    --enable-fontconfig
12+meson setup \
13+	-Dprefix=/usr \
14+	-Dfontconfig=enabled \
15+	output
16 
17-make
18-make DESTDIR="$1" install
19+samu -C output
20+samu -C output install
+2, -2
1@@ -1,2 +1,2 @@
2-049a2b9b2ca7a34eff8bdadcd7485e6a75fcbfbafb04ac6aeefb77923b7b69c2b0
3-8fa8e4142d92d945f22a1bf0f1301840add2edd4447e0e944fd794db8593a15311
4+bfbcc2a97193eb5c2a6c54d07c508d42ff62387a8a9d8b3959d15b6115bca8b68b
5+3300ff620840e9778e725f645e0d8f510673eaf268ad1b10849ff181f2a836df8f
+1, -0
1@@ -1,4 +1,5 @@
2 expat
3 fontconfig
4 freetype-harfbuzz
5+meson   make
6 pkgconf make
+55, -46
  1@@ -1,38 +1,17 @@
  2-From a1f12e45424d4f6fce1e22a7f294c608f291ed1b Mon Sep 17 00:00:00 2001
  3+From 8a5e6323577de0c0797429ae678038997f7247ec Mon Sep 17 00:00:00 2001
  4 From: hovercats <hovercatswithlasereyes@protonmail.com>
  5-Date: Fri, 3 May 2024 18:16:44 +0200
  6+Date: Tue, 30 Jul 2024 16:56:15 +0200
  7 Subject: [PATCH] remove fribidi dependency
  8 
  9 ---
 10- configure           |   3 +-
 11  libass/ass_render.h |   3 +-
 12- libass/ass_shaper.c | 122 ++++----------------------------------------
 13- libass/ass_shaper.h |   9 ++--
 14- 4 files changed, 17 insertions(+), 120 deletions(-)
 15+ libass/ass_shaper.c | 135 +++-----------------------------------------
 16+ libass/ass_shaper.h |   9 +--
 17+ meson.build         |   6 --
 18+ 4 files changed, 16 insertions(+), 137 deletions(-)
 19 
 20-diff --git a/configure b/configure
 21-index 643f74e..a5ac16a 100755
 22---- a/configure
 23-+++ b/configure
 24-@@ -14185,7 +14185,7 @@ fi
 25- 	# Put the nasty error message in config.log where it belongs
 26- 	echo "$FRIBIDI_PKG_ERRORS" >&5
 27- 
 28--	as_fn_error $? "Package requirements (fribidi >= 0.19.1) were not met:
 29-+	: 0 " >= 0.19.1) were not met:
 30- 
 31- $FRIBIDI_PKG_ERRORS
 32- 
 33-@@ -14216,7 +14216,6 @@ else
 34-         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 35- printf "%s\n" "yes" >&6; }
 36- 
 37--    pkg_requires="fribidi >= 0.19.1, ${pkg_requires}"
 38-     CFLAGS="$CFLAGS $FRIBIDI_CFLAGS"
 39-     LIBS="$LIBS $FRIBIDI_LIBS"
 40- 
 41 diff --git a/libass/ass_render.h b/libass/ass_render.h
 42-index 581c131..0cb5458 100644
 43+index 7a157ab..c8adf1d 100644
 44 --- a/libass/ass_render.h
 45 +++ b/libass/ass_render.h
 46 @@ -22,7 +22,6 @@
 47@@ -53,10 +32,10 @@ index 581c131..0cb5458 100644
 48      ASS_Image result;
 49      CompositeHashValue *source;
 50 diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c
 51-index 77cf909..014b318 100644
 52+index 86f2c66..e72a7d5 100644
 53 --- a/libass/ass_shaper.c
 54 +++ b/libass/ass_shaper.c
 55-@@ -90,8 +90,7 @@ struct ass_shaper_font_data {
 56+@@ -87,8 +87,7 @@ struct ass_shaper_metrics_data {
 57   */
 58  void ass_shaper_info(ASS_Library *lib)
 59  {
 60@@ -66,7 +45,7 @@ index 77cf909..014b318 100644
 61              " HarfBuzz-ng %s (COMPLEX)", hb_version_string()
 62             );
 63  }
 64-@@ -722,8 +721,7 @@ static bool shape_harfbuzz(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len)
 65+@@ -705,8 +704,7 @@ static bool shape_harfbuzz(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len)
 66                      lead_context, i - offset + 1);
 67          }
 68  
 69@@ -76,7 +55,7 @@ index 77cf909..014b318 100644
 70          props.script = glyphs[offset].script;
 71          props.language  = hb_shaper_get_run_language(shaper, props.script);
 72          hb_buffer_set_segment_properties(buf, &props);
 73-@@ -791,35 +789,6 @@ void ass_shaper_determine_script(ASS_Shaper *shaper, GlyphInfo *glyphs,
 74+@@ -774,35 +772,6 @@ void ass_shaper_determine_script(ASS_Shaper *shaper, GlyphInfo *glyphs,
 75      }
 76  }
 77  
 78@@ -88,7 +67,7 @@ index 77cf909..014b318 100644
 79 -static void shape_fribidi(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len)
 80 -{
 81 -    int i;
 82--    FriBidiJoiningType *joins = calloc(sizeof(*joins), len);
 83+-    FriBidiJoiningType *joins = calloc(len, sizeof(*joins));
 84 -
 85 -    // shape on codepoint level
 86 -    fribidi_get_joining_types(shaper->event_text, len, joins);
 87@@ -112,7 +91,7 @@ index 77cf909..014b318 100644
 88  /**
 89   * \brief Toggle kerning for HarfBuzz shaping.
 90   * \param shaper shaper instance
 91-@@ -912,7 +881,7 @@ void ass_shaper_set_base_direction(ASS_Shaper *shaper, FriBidiParType dir)
 92+@@ -895,7 +864,7 @@ void ass_shaper_set_base_direction(ASS_Shaper *shaper, FriBidiParType dir)
 93      shaper->base_direction = dir;
 94  
 95      if (shaper->whole_text_layout != WHOLE_TEXT_LAYOUT_EXPLICIT)
 96@@ -121,7 +100,7 @@ index 77cf909..014b318 100644
 97              WHOLE_TEXT_LAYOUT_IMPLICIT : WHOLE_TEXT_LAYOUT_OFF;
 98  }
 99  
100-@@ -952,7 +921,7 @@ void ass_shaper_set_whole_text_layout(ASS_Shaper *shaper, bool enable)
101+@@ -935,7 +904,7 @@ void ass_shaper_set_whole_text_layout(ASS_Shaper *shaper, bool enable)
102  {
103      shaper->whole_text_layout = enable ?
104          WHOLE_TEXT_LAYOUT_EXPLICIT :
105@@ -130,7 +109,7 @@ index 77cf909..014b318 100644
106              WHOLE_TEXT_LAYOUT_IMPLICIT : WHOLE_TEXT_LAYOUT_OFF;
107  }
108  
109-@@ -963,8 +932,7 @@ void ass_shaper_set_whole_text_layout(ASS_Shaper *shaper, bool enable)
110+@@ -946,8 +915,7 @@ void ass_shaper_set_whole_text_layout(ASS_Shaper *shaper, bool enable)
111   */
112  bool ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info)
113  {
114@@ -140,13 +119,21 @@ index 77cf909..014b318 100644
115      GlyphInfo *glyphs = text_info->glyphs;
116      shaper->event_text = text_info->event_text;
117  
118-@@ -979,52 +947,7 @@ bool ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info)
119+@@ -957,61 +925,7 @@ bool ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info)
120      for (i = 0; i < text_info->length; i++)
121          shaper->event_text[i] = glyphs[i].symbol;
122  
123 -    fribidi_get_bidi_types(shaper->event_text,
124 -            text_info->length, shaper->ctypes);
125 -
126+-    int n_pars = 1;
127+-    for (i = 0; i < text_info->length - 1; i++)
128+-        if (shaper->ctypes[i] == FRIBIDI_TYPE_BS)
129+-            n_pars++;
130+-
131+-    if (!check_par_allocations(shaper, n_pars))
132+-        return false;
133+-
134 -#ifdef USE_FRIBIDI_EX_API
135 -    if (shaper->bidi_brackets) {
136 -        fribidi_get_bracket_types(shaper->event_text,
137@@ -158,8 +145,9 @@ index 77cf909..014b318 100644
138 -    last_break = 0;
139 -    pdir = shaper->pbase_dir;
140 -    for (i = 0; i < text_info->length; i++) {
141--        // embedding levels should be calculated paragraph by paragraph
142--        if (glyphs[i].symbol == '\n' || i == text_info->length - 1 ||
143+-        // Embedding levels must be calculated one bidi "paragraph" at a time
144+-        if (i == text_info->length - 1 ||
145+-                shaper->ctypes[i] == FRIBIDI_TYPE_BS ||
146 -                (!shaper->whole_text_layout &&
147 -                    (glyphs[i + 1].starts_new_run || glyphs[i].hspacing))) {
148 -            dir = shaper->base_direction;
149@@ -194,7 +182,7 @@ index 77cf909..014b318 100644
150  }
151  
152  /**
153-@@ -1038,7 +961,7 @@ ASS_Shaper *ass_shaper_new(Cache *metrics_cache)
154+@@ -1025,7 +939,7 @@ ASS_Shaper *ass_shaper_new(Cache *metrics_cache, Cache *face_size_metrics_cache)
155      if (!shaper)
156          return NULL;
157  
158@@ -203,7 +191,7 @@ index 77cf909..014b318 100644
159  
160      if (!init_features(shaper))
161          goto error;
162-@@ -1079,34 +1002,12 @@ void ass_shaper_cleanup(ASS_Shaper *shaper, TextInfo *text_info)
163+@@ -1087,38 +1001,12 @@ void ass_shaper_cleanup(ASS_Shaper *shaper, TextInfo *text_info)
164   */
165  FriBidiStrIndex *ass_shaper_reorder(ASS_Shaper *shaper, TextInfo *text_info)
166  {
167@@ -220,7 +208,11 @@ index 77cf909..014b318 100644
168 -        shaper->pbase_dir : &shaper->base_direction;
169 -    GlyphInfo *glyphs = text_info->glyphs;
170 -    for (i = 0; i < text_info->length; i++) {
171+-        // Bidi "paragraph separators" may occur between line breaks:
172+-        // U+001C..1E even with ASS_FEATURE_WRAP_UNICODE,
173+-        // or U+000D, U+0085, U+2029 only without it
174 -        if (i == text_info->length - 1 || glyphs[i + 1].linebreak ||
175+-                shaper->ctypes[i] == FRIBIDI_TYPE_BS ||
176 -                (!shaper->whole_text_layout &&
177 -                    (glyphs[i + 1].starts_new_run || glyphs[i].hspacing))) {
178 -            ret = fribidi_reorder_line(0,
179@@ -231,7 +223,7 @@ index 77cf909..014b318 100644
180 -                return NULL;
181 -
182 -            last_break = i + 1;
183--            if (shaper->whole_text_layout && glyphs[i].symbol == '\n')
184+-            if (shaper->whole_text_layout && shaper->ctypes[i] == FRIBIDI_TYPE_BS)
185 -                pdir++;
186 -        }
187 -    }
188@@ -239,7 +231,7 @@ index 77cf909..014b318 100644
189      return shaper->cmap;
190  }
191  
192-@@ -1124,10 +1025,5 @@ FriBidiStrIndex *ass_shaper_get_reorder_map(ASS_Shaper *shaper)
193+@@ -1136,10 +1024,5 @@ FriBidiStrIndex *ass_shaper_get_reorder_map(ASS_Shaper *shaper)
194   */
195  FriBidiParType ass_resolve_base_direction(int enc)
196  {
197@@ -252,7 +244,7 @@ index 77cf909..014b318 100644
198 +    return 0;
199  }
200 diff --git a/libass/ass_shaper.h b/libass/ass_shaper.h
201-index 819a3fd..3eef8d7 100644
202+index 06f868d..333252b 100644
203 --- a/libass/ass_shaper.h
204 +++ b/libass/ass_shaper.h
205 @@ -21,14 +21,15 @@
206@@ -274,7 +266,24 @@ index 819a3fd..3eef8d7 100644
207 +typedef signed char FriBidiLevel;
208  
209  void ass_shaper_info(ASS_Library *lib);
210- ASS_Shaper *ass_shaper_new(Cache *metrics_cache);
211+ ASS_Shaper *ass_shaper_new(Cache *metrics_cache, Cache *face_size_metrics_cache);
212+diff --git a/meson.build b/meson.build
213+index 9eb7969..bc40a57 100644
214+--- a/meson.build
215++++ b/meson.build
216+@@ -87,12 +87,6 @@ deps += dependency(
217+     default_options: ['harfbuzz=disabled'],
218+ )
219+ 
220+-deps += dependency(
221+-    'fribidi',
222+-    version: '>= 0.19.1',
223+-    default_options: ['docs=false', 'tests=false'],
224+-)
225+-
226+ harfbuzz_options = [
227+     'tests=disabled',
228+     'cairo=disabled',
229 -- 
230-2.44.0
231+2.45.1
232 
+1, -1
1@@ -1,2 +1,2 @@
2-https://github.com/libass/libass/releases/download/0.17.1/libass-0.17.1.tar.xz
3+https://github.com/libass/libass/releases/download/0.17.3/libass-0.17.3.tar.xz
4 patches/0001-remove-fribidi-dependency.patch
+1, -1
1@@ -1 +1 @@
2-0.17.1 1
3+0.17.3 1