commit b8087df
hovercats
·
2026-05-10 09:22:49 +0000 UTC
parent d9d4159
repo/libass: drop
6 files changed,
+0,
-314
+0,
-17
1@@ -1,17 +0,0 @@
2-#!/bin/sh -e
3-
4-export DESTDIR="$1"
5-export PKG_CONFIG_PATH=/usr/lib/pkgconfig
6-
7-patch -p1 < 0001-remove-fribidi-dependency.patch
8-
9-muon setup \
10- -Dprefix=/usr \
11- -Dbuildtype=release \
12- -Db_colorout=never \
13- -Dfontconfig=enabled \
14- -Ddefault_library=both \
15- build
16-
17-samu -C build
18-muon -C build install
+0,
-2
1@@ -1,2 +0,0 @@
2-bfbcc2a97193eb5c2a6c54d07c508d42ff62387a8a9d8b3959d15b6115bca8b68b
3-3300ff620840e9778e725f645e0d8f510673eaf268ad1b10849ff181f2a836df8f
+0,
-3
1@@ -1,3 +0,0 @@
2-expat
3-fontconfig
4-freetype-harfbuzz
1@@ -1,289 +0,0 @@
2-From 8a5e6323577de0c0797429ae678038997f7247ec Mon Sep 17 00:00:00 2001
3-From: hovercats <hovercatswithlasereyes@protonmail.com>
4-Date: Tue, 30 Jul 2024 16:56:15 +0200
5-Subject: [PATCH] remove fribidi dependency
6-
7----
8- libass/ass_render.h | 3 +-
9- libass/ass_shaper.c | 135 +++-----------------------------------------
10- libass/ass_shaper.h | 9 +--
11- meson.build | 6 --
12- 4 files changed, 16 insertions(+), 137 deletions(-)
13-
14-diff --git a/libass/ass_render.h b/libass/ass_render.h
15-index 7a157ab..c8adf1d 100644
16---- a/libass/ass_render.h
17-+++ b/libass/ass_render.h
18-@@ -22,7 +22,6 @@
19-
20- #include <inttypes.h>
21- #include <stdbool.h>
22--#include <fribidi.h>
23- #include <ft2build.h>
24- #include FT_FREETYPE_H
25- #include FT_GLYPH_H
26-@@ -49,6 +48,8 @@
27- #define PARSED_FADE (1<<0)
28- #define PARSED_A (1<<1)
29-
30-+typedef uint32_t FriBidiChar;
31-+
32- typedef struct {
33- ASS_Image result;
34- CompositeHashValue *source;
35-diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c
36-index 86f2c66..e72a7d5 100644
37---- a/libass/ass_shaper.c
38-+++ b/libass/ass_shaper.c
39-@@ -87,8 +87,7 @@ struct ass_shaper_metrics_data {
40- */
41- void ass_shaper_info(ASS_Library *lib)
42- {
43-- ass_msg(lib, MSGL_INFO, "Shaper: FriBidi "
44-- FRIBIDI_VERSION " (SIMPLE)"
45-+ ass_msg(lib, MSGL_INFO, "Shaper: "
46- " HarfBuzz-ng %s (COMPLEX)", hb_version_string()
47- );
48- }
49-@@ -705,8 +704,7 @@ static bool shape_harfbuzz(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len)
50- lead_context, i - offset + 1);
51- }
52-
53-- props.direction = FRIBIDI_LEVEL_IS_RTL(level) ?
54-- HB_DIRECTION_RTL : HB_DIRECTION_LTR;
55-+ props.direction = HB_DIRECTION_LTR;
56- props.script = glyphs[offset].script;
57- props.language = hb_shaper_get_run_language(shaper, props.script);
58- hb_buffer_set_segment_properties(buf, &props);
59-@@ -774,35 +772,6 @@ void ass_shaper_determine_script(ASS_Shaper *shaper, GlyphInfo *glyphs,
60- }
61- }
62-
63--/**
64-- * \brief Shape event text with FriBidi. Does mirroring and simple
65-- * Arabic shaping.
66-- * \param len number of clusters
67-- */
68--static void shape_fribidi(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len)
69--{
70-- int i;
71-- FriBidiJoiningType *joins = calloc(len, sizeof(*joins));
72--
73-- // shape on codepoint level
74-- fribidi_get_joining_types(shaper->event_text, len, joins);
75-- fribidi_join_arabic(shaper->ctypes, len, shaper->emblevels, joins);
76-- fribidi_shape(FRIBIDI_FLAGS_DEFAULT | FRIBIDI_FLAGS_ARABIC,
77-- shaper->emblevels, len, joins, shaper->event_text);
78--
79-- // update indexes
80-- for (i = 0; i < len; i++) {
81-- GlyphInfo *info = glyphs + i;
82-- FT_Face face = info->font->faces[info->face_index];
83-- info->symbol = shaper->event_text[i];
84-- info->glyph_index = ass_font_index_magic(face, shaper->event_text[i]);
85-- if (info->glyph_index)
86-- info->glyph_index = FT_Get_Char_Index(face, info->glyph_index);
87-- }
88--
89-- free(joins);
90--}
91--
92- /**
93- * \brief Toggle kerning for HarfBuzz shaping.
94- * \param shaper shaper instance
95-@@ -895,7 +864,7 @@ void ass_shaper_set_base_direction(ASS_Shaper *shaper, FriBidiParType dir)
96- shaper->base_direction = dir;
97-
98- if (shaper->whole_text_layout != WHOLE_TEXT_LAYOUT_EXPLICIT)
99-- shaper->whole_text_layout = dir == FRIBIDI_PAR_ON ?
100-+ shaper->whole_text_layout = dir == 0 ?
101- WHOLE_TEXT_LAYOUT_IMPLICIT : WHOLE_TEXT_LAYOUT_OFF;
102- }
103-
104-@@ -935,7 +904,7 @@ void ass_shaper_set_whole_text_layout(ASS_Shaper *shaper, bool enable)
105- {
106- shaper->whole_text_layout = enable ?
107- WHOLE_TEXT_LAYOUT_EXPLICIT :
108-- shaper->base_direction == FRIBIDI_PAR_ON ?
109-+ shaper->base_direction == 0 ?
110- WHOLE_TEXT_LAYOUT_IMPLICIT : WHOLE_TEXT_LAYOUT_OFF;
111- }
112-
113-@@ -946,8 +915,7 @@ void ass_shaper_set_whole_text_layout(ASS_Shaper *shaper, bool enable)
114- */
115- bool ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info)
116- {
117-- int i, ret, last_break;
118-- FriBidiParType dir, *pdir;
119-+ int i;
120- GlyphInfo *glyphs = text_info->glyphs;
121- shaper->event_text = text_info->event_text;
122-
123-@@ -957,61 +925,7 @@ bool ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info)
124- for (i = 0; i < text_info->length; i++)
125- shaper->event_text[i] = glyphs[i].symbol;
126-
127-- fribidi_get_bidi_types(shaper->event_text,
128-- text_info->length, shaper->ctypes);
129--
130-- int n_pars = 1;
131-- for (i = 0; i < text_info->length - 1; i++)
132-- if (shaper->ctypes[i] == FRIBIDI_TYPE_BS)
133-- n_pars++;
134--
135-- if (!check_par_allocations(shaper, n_pars))
136-- return false;
137--
138--#ifdef USE_FRIBIDI_EX_API
139-- if (shaper->bidi_brackets) {
140-- fribidi_get_bracket_types(shaper->event_text,
141-- text_info->length, shaper->ctypes, shaper->btypes);
142-- }
143--#endif
144--
145-- // Get bidi embedding levels
146-- last_break = 0;
147-- pdir = shaper->pbase_dir;
148-- for (i = 0; i < text_info->length; i++) {
149-- // Embedding levels must be calculated one bidi "paragraph" at a time
150-- if (i == text_info->length - 1 ||
151-- shaper->ctypes[i] == FRIBIDI_TYPE_BS ||
152-- (!shaper->whole_text_layout &&
153-- (glyphs[i + 1].starts_new_run || glyphs[i].hspacing))) {
154-- dir = shaper->base_direction;
155--#ifdef USE_FRIBIDI_EX_API
156-- FriBidiBracketType *btypes = NULL;
157-- if (shaper->bidi_brackets)
158-- btypes = shaper->btypes + last_break;
159-- ret = fribidi_get_par_embedding_levels_ex(
160-- shaper->ctypes + last_break, btypes,
161-- i - last_break + 1, &dir, shaper->emblevels + last_break);
162--#else
163-- ret = fribidi_get_par_embedding_levels(shaper->ctypes + last_break,
164-- i - last_break + 1, &dir, shaper->emblevels + last_break);
165--#endif
166-- if (ret == 0)
167-- return false;
168-- last_break = i + 1;
169-- if (shaper->whole_text_layout)
170-- *pdir++ = dir;
171-- }
172-- }
173--
174-- switch (shaper->shaping_level) {
175-- case ASS_SHAPING_SIMPLE:
176-- shape_fribidi(shaper, glyphs, text_info->length);
177-- return true;
178-- case ASS_SHAPING_COMPLEX:
179-- default:
180-- return shape_harfbuzz(shaper, glyphs, text_info->length);
181-- }
182-+ return shape_harfbuzz(shaper, glyphs, text_info->length);
183- }
184-
185- /**
186-@@ -1025,7 +939,7 @@ ASS_Shaper *ass_shaper_new(Cache *metrics_cache, Cache *face_size_metrics_cache)
187- if (!shaper)
188- return NULL;
189-
190-- shaper->base_direction = FRIBIDI_PAR_ON;
191-+ shaper->base_direction = 0;
192-
193- if (!init_features(shaper))
194- goto error;
195-@@ -1087,38 +1001,12 @@ void ass_shaper_cleanup(ASS_Shaper *shaper, TextInfo *text_info)
196- */
197- FriBidiStrIndex *ass_shaper_reorder(ASS_Shaper *shaper, TextInfo *text_info)
198- {
199-- int i, ret;
200-+ int i;
201-
202- // Initialize reorder map
203- for (i = 0; i < text_info->length; i++)
204- shaper->cmap[i] = i;
205-
206-- // Create reorder map line-by-line or run-by-run
207-- int last_break = 0;
208-- FriBidiParType *pdir = shaper->whole_text_layout ?
209-- shaper->pbase_dir : &shaper->base_direction;
210-- GlyphInfo *glyphs = text_info->glyphs;
211-- for (i = 0; i < text_info->length; i++) {
212-- // Bidi "paragraph separators" may occur between line breaks:
213-- // U+001C..1E even with ASS_FEATURE_WRAP_UNICODE,
214-- // or U+000D, U+0085, U+2029 only without it
215-- if (i == text_info->length - 1 || glyphs[i + 1].linebreak ||
216-- shaper->ctypes[i] == FRIBIDI_TYPE_BS ||
217-- (!shaper->whole_text_layout &&
218-- (glyphs[i + 1].starts_new_run || glyphs[i].hspacing))) {
219-- ret = fribidi_reorder_line(0,
220-- shaper->ctypes, i - last_break + 1, last_break, *pdir,
221-- shaper->emblevels, NULL,
222-- shaper->cmap);
223-- if (ret == 0)
224-- return NULL;
225--
226-- last_break = i + 1;
227-- if (shaper->whole_text_layout && shaper->ctypes[i] == FRIBIDI_TYPE_BS)
228-- pdir++;
229-- }
230-- }
231--
232- return shaper->cmap;
233- }
234-
235-@@ -1136,10 +1024,5 @@ FriBidiStrIndex *ass_shaper_get_reorder_map(ASS_Shaper *shaper)
236- */
237- FriBidiParType ass_resolve_base_direction(int enc)
238- {
239-- switch (enc) {
240-- case -1:
241-- return FRIBIDI_PAR_ON;
242-- default:
243-- return FRIBIDI_PAR_LTR;
244-- }
245-+ return 0;
246- }
247-diff --git a/libass/ass_shaper.h b/libass/ass_shaper.h
248-index 06f868d..333252b 100644
249---- a/libass/ass_shaper.h
250-+++ b/libass/ass_shaper.h
251-@@ -21,14 +21,15 @@
252-
253- typedef struct ass_shaper ASS_Shaper;
254-
255--#include <fribidi.h>
256- #include <stdbool.h>
257- #include "ass_render.h"
258- #include "ass_cache.h"
259-
260--#if FRIBIDI_MAJOR_VERSION >= 1
261--#define USE_FRIBIDI_EX_API
262--#endif
263-+typedef uint32_t FriBidiChar;
264-+typedef uint32_t FriBidiCharType;
265-+typedef int FriBidiStrIndex;
266-+typedef int FriBidiParType;
267-+typedef signed char FriBidiLevel;
268-
269- void ass_shaper_info(ASS_Library *lib);
270- ASS_Shaper *ass_shaper_new(Cache *metrics_cache, Cache *face_size_metrics_cache);
271-diff --git a/meson.build b/meson.build
272-index 9eb7969..bc40a57 100644
273---- a/meson.build
274-+++ b/meson.build
275-@@ -87,12 +87,6 @@ deps += dependency(
276- default_options: ['harfbuzz=disabled'],
277- )
278-
279--deps += dependency(
280-- 'fribidi',
281-- version: '>= 0.19.1',
282-- default_options: ['docs=false', 'tests=false'],
283--)
284--
285- harfbuzz_options = [
286- 'tests=disabled',
287- 'cairo=disabled',
288---
289-2.45.1
290-
+0,
-2
1@@ -1,2 +0,0 @@
2-https://github.com/libass/libass/releases/download/0.17.3/libass-0.17.3.tar.xz
3-patches/0001-remove-fribidi-dependency.patch
+0,
-1
1@@ -1 +0,0 @@
2-0.17.3 4