# HG changeset patch # User reimar # Date 1323616419 0 # Node ID 575ad51cc9966b727edc06588a8ef87661c4d8da # Parent 946ecaf41dc16861668b3965ea1d897227a2ed84 Allow compiling libass without fribidi again. diff -r 946ecaf41dc1 -r 575ad51cc996 configure --- a/configure Sun Dec 11 14:54:56 2011 +0000 +++ b/configure Sun Dec 11 15:13:39 2011 +0000 @@ -5963,8 +5963,8 @@ echocheck "SSA/ASS support" -# libass depends on FreeType and FriBiDi -if test "$_freetype" = no || test "$_fribidi" = no ; then +# libass depends on FreeType +if test "$_freetype" = no ; then _ass=no ass_internal=no res_comment="FreeType and FriBiDi support needed" diff -r 946ecaf41dc1 -r 575ad51cc996 libass/ass_shaper.c --- a/libass/ass_shaper.c Sun Dec 11 14:54:56 2011 +0000 +++ b/libass/ass_shaper.c Sun Dec 11 15:13:39 2011 +0000 @@ -18,7 +18,9 @@ #include "config.h" +#ifdef CONFIG_FRIBIDI #include +#endif #include "ass_shaper.h" #include "ass_render.h" @@ -43,9 +45,11 @@ // FriBidi log2vis int n_glyphs; +#ifdef CONFIG_FRIBIDI FriBidiChar *event_text; FriBidiCharType *ctypes; FriBidiLevel *emblevels; +#endif FriBidiStrIndex *cmap; FriBidiParType base_direction; @@ -79,8 +83,10 @@ */ void ass_shaper_info(ASS_Library *lib) { - ass_msg(lib, MSGL_V, "Shaper: FriBidi " - FRIBIDI_VERSION " (SIMPLE)" + ass_msg(lib, MSGL_V, "Shaper:" +#ifdef CONFIG_FRIBIDI + " FriBidi " FRIBIDI_VERSION " (SIMPLE)" +#endif #ifdef CONFIG_HARFBUZZ " HarfBuzz-ng %s (COMPLEX)", hb_version_string() #endif @@ -94,9 +100,11 @@ static void check_allocations(ASS_Shaper *shaper, size_t new_size) { if (new_size > shaper->n_glyphs) { +#ifdef CONFIG_FRIBIDI shaper->event_text = realloc(shaper->event_text, sizeof(FriBidiChar) * new_size); shaper->ctypes = realloc(shaper->ctypes, sizeof(FriBidiCharType) * new_size); shaper->emblevels = realloc(shaper->emblevels, sizeof(FriBidiLevel) * new_size); +#endif shaper->cmap = realloc(shaper->cmap, sizeof(FriBidiStrIndex) * new_size); } } @@ -110,9 +118,11 @@ ass_cache_done(shaper->metrics_cache); free(shaper->features); #endif +#ifdef CONFIG_FRIBIDI free(shaper->event_text); free(shaper->ctypes); free(shaper->emblevels); +#endif free(shaper->cmap); free(shaper); } @@ -493,6 +503,7 @@ } #endif +#ifdef CONFIG_FRIBIDI /** * \brief Shape event text with FriBidi. Does mirroring and simple * Arabic shaping. @@ -519,6 +530,7 @@ free(joins); } +#endif /** * \brief Toggle kerning for HarfBuzz shaping. @@ -595,6 +607,9 @@ */ void ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info) { +#ifndef CONFIG_FRIBIDI + check_allocations(shaper, text_info->length); +#else int i, last_break; FriBidiParType dir; GlyphInfo *glyphs = text_info->glyphs; @@ -645,6 +660,7 @@ glyphs[i].skip++; } } +#endif } /** @@ -655,7 +671,9 @@ { ASS_Shaper *shaper = calloc(sizeof(*shaper), 1); +#ifdef CONFIG_FRIBIDI shaper->base_direction = FRIBIDI_PAR_ON; +#endif check_allocations(shaper, prealloc); #ifdef CONFIG_HARFBUZZ @@ -697,6 +715,7 @@ for (i = 0; i < text_info->length; i++) shaper->cmap[i] = i; +#ifdef CONFIG_FRIBIDI // Create reorder map line-by-line for (i = 0; i < text_info->n_lines; i++) { LineInfo *line = text_info->lines + i; @@ -708,6 +727,7 @@ shaper->emblevels + line->offset, NULL, shaper->cmap + line->offset); } +#endif return shaper->cmap; } @@ -721,6 +741,7 @@ */ FriBidiParType resolve_base_direction(int enc) { +#ifdef CONFIG_FRIBIDI switch (enc) { case 1: return FRIBIDI_PAR_ON; @@ -730,4 +751,7 @@ default: return FRIBIDI_PAR_LTR; } +#else + return 0; +#endif } diff -r 946ecaf41dc1 -r 575ad51cc996 libass/ass_shaper.h --- a/libass/ass_shaper.h Sun Dec 11 14:54:56 2011 +0000 +++ b/libass/ass_shaper.h Sun Dec 11 15:13:39 2011 +0000 @@ -21,7 +21,12 @@ #include "config.h" +#ifdef CONFIG_FRIBIDI #include +#else +typedef int FriBidiParType; +typedef int FriBidiStrIndex; +#endif #include "ass_render.h" void ass_shaper_info(ASS_Library *lib);