mirror of
https://codeberg.org/kiss-community/repo
synced 2024-12-21 23:00:06 -07:00
libass: Remove fribidi dependency
This commit is contained in:
parent
42e62c63a4
commit
8b5f266f1c
@ -1,8 +1,14 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
patch -p1 < no-fribidi.patch
|
||||
|
||||
sed -i 's/as_fn_error.*fribidi/: 0 "/' configure
|
||||
sed -i '/pkg_requires="fribidi >= .*/d' configure
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--enable-fontconfig
|
||||
--enable-fontconfig \
|
||||
--disable-harfbuzz
|
||||
|
||||
make
|
||||
make DESTDIR="$1" install
|
||||
|
@ -1 +1,2 @@
|
||||
881f2382af48aead75b7a0e02e65d88c5ebd369fe46bc77d9270a94aa8fd38a2 libass-0.14.0.tar.xz
|
||||
d2fc965cb68a80a0cec563a74fc05bccacbe0cd3e3f987ee2e6a9bac417491ab no-fribidi.patch
|
||||
|
@ -1,6 +1,5 @@
|
||||
expat
|
||||
fontconfig
|
||||
freetype-harfbuzz
|
||||
fribidi
|
||||
pkgconf make
|
||||
yasm make
|
||||
|
186
extra/libass/patches/no-fribidi.patch
Normal file
186
extra/libass/patches/no-fribidi.patch
Normal file
@ -0,0 +1,186 @@
|
||||
diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c
|
||||
index 657885b..d8c77ff 100644
|
||||
--- a/libass/ass_shaper.c
|
||||
+++ b/libass/ass_shaper.c
|
||||
@@ -44,9 +44,6 @@ struct ass_shaper {
|
||||
|
||||
// FriBidi log2vis
|
||||
int n_glyphs;
|
||||
- FriBidiChar *event_text;
|
||||
- FriBidiCharType *ctypes;
|
||||
- FriBidiLevel *emblevels;
|
||||
FriBidiStrIndex *cmap;
|
||||
FriBidiParType base_direction;
|
||||
|
||||
@@ -80,8 +77,7 @@ struct ass_shaper_font_data {
|
||||
*/
|
||||
void ass_shaper_info(ASS_Library *lib)
|
||||
{
|
||||
- ass_msg(lib, MSGL_INFO, "Shaper: FriBidi "
|
||||
- FRIBIDI_VERSION " (SIMPLE)"
|
||||
+ ass_msg(lib, MSGL_INFO, "Shaper:"
|
||||
#ifdef CONFIG_HARFBUZZ
|
||||
" HarfBuzz-ng %s (COMPLEX)", hb_version_string()
|
||||
#endif
|
||||
@@ -95,10 +91,7 @@ void ass_shaper_info(ASS_Library *lib)
|
||||
static bool check_allocations(ASS_Shaper *shaper, size_t new_size)
|
||||
{
|
||||
if (new_size > shaper->n_glyphs) {
|
||||
- if (!ASS_REALLOC_ARRAY(shaper->event_text, new_size) ||
|
||||
- !ASS_REALLOC_ARRAY(shaper->ctypes, new_size) ||
|
||||
- !ASS_REALLOC_ARRAY(shaper->emblevels, new_size) ||
|
||||
- !ASS_REALLOC_ARRAY(shaper->cmap, new_size))
|
||||
+ if (!ASS_REALLOC_ARRAY(shaper->cmap, new_size))
|
||||
return false;
|
||||
shaper->n_glyphs = new_size;
|
||||
}
|
||||
@@ -114,9 +107,6 @@ void ass_shaper_free(ASS_Shaper *shaper)
|
||||
ass_cache_done(shaper->metrics_cache);
|
||||
free(shaper->features);
|
||||
#endif
|
||||
- free(shaper->event_text);
|
||||
- free(shaper->ctypes);
|
||||
- free(shaper->emblevels);
|
||||
free(shaper->cmap);
|
||||
free(shaper);
|
||||
}
|
||||
@@ -688,33 +678,6 @@ void ass_shaper_determine_script(ASS_Shaper *shaper, GlyphInfo *glyphs,
|
||||
}
|
||||
#endif
|
||||
|
||||
-/**
|
||||
- * \brief Shape event text with FriBidi. Does mirroring and simple
|
||||
- * Arabic shaping.
|
||||
- * \param len number of clusters
|
||||
- */
|
||||
-static void shape_fribidi(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len)
|
||||
-{
|
||||
- int i;
|
||||
- FriBidiJoiningType *joins = calloc(sizeof(*joins), len);
|
||||
-
|
||||
- // shape on codepoint level
|
||||
- fribidi_get_joining_types(shaper->event_text, len, joins);
|
||||
- fribidi_join_arabic(shaper->ctypes, len, shaper->emblevels, joins);
|
||||
- fribidi_shape(FRIBIDI_FLAGS_DEFAULT | FRIBIDI_FLAGS_ARABIC,
|
||||
- shaper->emblevels, len, joins, shaper->event_text);
|
||||
-
|
||||
- // update indexes
|
||||
- for (i = 0; i < len; i++) {
|
||||
- GlyphInfo *info = glyphs + i;
|
||||
- FT_Face face = info->font->faces[info->face_index];
|
||||
- info->symbol = shaper->event_text[i];
|
||||
- info->glyph_index = FT_Get_Char_Index(face, ass_font_index_magic(face, shaper->event_text[i]));
|
||||
- }
|
||||
-
|
||||
- free(joins);
|
||||
-}
|
||||
-
|
||||
/**
|
||||
* \brief Toggle kerning for HarfBuzz shaping.
|
||||
* \param shaper shaper instance
|
||||
@@ -852,50 +815,7 @@ static void ass_shaper_skip_characters(TextInfo *text_info)
|
||||
*/
|
||||
int ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info)
|
||||
{
|
||||
- int i, ret, last_break;
|
||||
- FriBidiParType dir;
|
||||
- GlyphInfo *glyphs = text_info->glyphs;
|
||||
-
|
||||
- if (!check_allocations(shaper, text_info->length))
|
||||
- return -1;
|
||||
-
|
||||
- // Get bidi character types and embedding levels
|
||||
- last_break = 0;
|
||||
- for (i = 0; i < text_info->length; i++) {
|
||||
- shaper->event_text[i] = glyphs[i].symbol;
|
||||
- // embedding levels should be calculated paragraph by paragraph
|
||||
- if (glyphs[i].symbol == '\n' || i == text_info->length - 1) {
|
||||
- dir = shaper->base_direction;
|
||||
- fribidi_get_bidi_types(shaper->event_text + last_break,
|
||||
- i - last_break + 1, shaper->ctypes + last_break);
|
||||
- ret = fribidi_get_par_embedding_levels(shaper->ctypes + last_break,
|
||||
- i - last_break + 1, &dir, shaper->emblevels + last_break);
|
||||
- if (ret == 0)
|
||||
- return -1;
|
||||
- last_break = i + 1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- // add embedding levels to shape runs for final runs
|
||||
- for (i = 0; i < text_info->length; i++) {
|
||||
- glyphs[i].shape_run_id += shaper->emblevels[i];
|
||||
- }
|
||||
-
|
||||
-#ifdef CONFIG_HARFBUZZ
|
||||
- switch (shaper->shaping_level) {
|
||||
- case ASS_SHAPING_SIMPLE:
|
||||
- shape_fribidi(shaper, glyphs, text_info->length);
|
||||
- ass_shaper_skip_characters(text_info);
|
||||
- break;
|
||||
- case ASS_SHAPING_COMPLEX:
|
||||
- shape_harfbuzz(shaper, glyphs, text_info->length);
|
||||
- break;
|
||||
- }
|
||||
-#else
|
||||
- shape_fribidi(shaper, glyphs, text_info->length);
|
||||
- ass_shaper_skip_characters(text_info);
|
||||
-#endif
|
||||
-
|
||||
+ check_allocations(shaper, text_info->length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -909,7 +829,6 @@ ASS_Shaper *ass_shaper_new(size_t prealloc)
|
||||
if (!shaper)
|
||||
return NULL;
|
||||
|
||||
- shaper->base_direction = FRIBIDI_PAR_ON;
|
||||
if (!check_allocations(shaper, prealloc))
|
||||
goto error;
|
||||
|
||||
@@ -962,19 +881,6 @@ FriBidiStrIndex *ass_shaper_reorder(ASS_Shaper *shaper, TextInfo *text_info)
|
||||
for (i = 0; i < text_info->length; i++)
|
||||
shaper->cmap[i] = i;
|
||||
|
||||
- // Create reorder map line-by-line
|
||||
- for (i = 0; i < text_info->n_lines; i++) {
|
||||
- LineInfo *line = text_info->lines + i;
|
||||
- FriBidiParType dir = FRIBIDI_PAR_ON;
|
||||
-
|
||||
- ret = fribidi_reorder_line(0,
|
||||
- shaper->ctypes + line->offset, line->len, 0, dir,
|
||||
- shaper->emblevels + line->offset, NULL,
|
||||
- shaper->cmap + line->offset);
|
||||
- if (ret == 0)
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
return shaper->cmap;
|
||||
}
|
||||
|
||||
@@ -987,10 +893,5 @@ FriBidiStrIndex *ass_shaper_reorder(ASS_Shaper *shaper, TextInfo *text_info)
|
||||
*/
|
||||
FriBidiParType resolve_base_direction(int enc)
|
||||
{
|
||||
- switch (enc) {
|
||||
- case -1:
|
||||
- return FRIBIDI_PAR_ON;
|
||||
- default:
|
||||
- return FRIBIDI_PAR_LTR;
|
||||
- }
|
||||
+ return 0;
|
||||
}
|
||||
diff --git a/libass/ass_shaper.h b/libass/ass_shaper.h
|
||||
index f6404fe..69a7ea9 100644
|
||||
--- a/libass/ass_shaper.h
|
||||
+++ b/libass/ass_shaper.h
|
||||
@@ -21,7 +21,8 @@
|
||||
|
||||
typedef struct ass_shaper ASS_Shaper;
|
||||
|
||||
-#include <fribidi.h>
|
||||
+typedef int FriBidiParType;
|
||||
+typedef int FriBidiStrIndex;
|
||||
#include "ass_render.h"
|
||||
|
||||
void ass_shaper_info(ASS_Library *lib);
|
@ -1 +1,2 @@
|
||||
https://github.com/libass/libass/releases/download/0.14.0/libass-0.14.0.tar.xz
|
||||
patches/no-fribidi.patch
|
||||
|
Loading…
Reference in New Issue
Block a user