[vlc-devel] [RFC PATCH] freetype: using Pango for text layout
Rémi Denis-Courmont
remi at remlab.net
Wed Jan 21 09:44:03 CET 2015
Le 2015-01-21 04:26, Salah-Eddin Shaban a écrit :
> ---
> configure.ac | 11 ++
> modules/text_renderer/freetype.c | 297
> +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 308 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index 516e9c7..214633f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -3117,6 +3117,8 @@ AC_ARG_ENABLE(fribidi,
> [ --enable-fribidi fribidi support (default auto)])
> AC_ARG_ENABLE(fontconfig,
> [ --enable-fontconfig fontconfig support (default auto)])
> +AC_ARG_ENABLE(pangoft,
> + [ --enable-pangoft pangoft support (default auto)])
Is there any point in using pangoft instead of rendering with pango
directly? other than less efforts to write the code, that is.
>
> AC_ARG_WITH([default-font],
> AS_HELP_STRING([--with-default-font=PATH],
> @@ -3175,6 +3177,15 @@ if test "${enable_freetype}" != "no"; then
> ],[AC_MSG_WARN([${FRIBIDI_PKG_ERRORS}. Bidirectional support
> will be disabled in FreeType.])])
> fi
>
> + dnl pangoft support
> + if test "${enable_pangoft}" != "no"; then
> + PKG_CHECK_MODULES(PANGOFT, pangoft2, [
> + VLC_ADD_CPPFLAGS([freetype], [${PANGOFT_CFLAGS}
> -DHAVE_PANGOFT])
> + VLC_ADD_LIBS([freetype], [${PANGOFT_LIBS}])
> + ],[AC_MSG_WARN([${PANGOFT_PKG_ERRORS}. Support for complex
> scripts (Arabic, Farsi, Thai, etc.) will be limited in FreeType.])])
> + fi
> +
> +
> ],[
> have_freetype=no
> AS_IF([test -n "${enable_freetype}"],[
> diff --git a/modules/text_renderer/freetype.c
> b/modules/text_renderer/freetype.c
> index 050ace6..cde3a37 100644
> --- a/modules/text_renderer/freetype.c
> +++ b/modules/text_renderer/freetype.c
> @@ -61,6 +61,13 @@
> # include <fribidi/fribidi.h>
> #endif
>
> +/* Complex Scripts */
> +#if defined(HAVE_PANGOFT)
> +# include <pango/pango.h>
> +# include <pango/pangoft2.h>
> +# include <glib.h>
> +#endif
> +
> /* apple stuff */
> #ifdef __APPLE__
> # include <TargetConditionals.h>
> @@ -138,6 +145,10 @@ static const char *const ppsz_sizes_text[] = {
> #define YUVP_LONGTEXT N_("This renders the font using \"paletized
> YUV\". " \
> "This option is only needed if you want to encode into DVB
> subtitles" )
>
> +#define PANGO_TEXT N_("Use Pango for text layout")
> +#define PANGO_LONGTEXT N_("Use Pango to layout the text. Required
> for " \
> + "complex scripts (Arabic, Thai, etc.)")
> +
> static const int pi_color_values[] = {
> 0x00000000, 0x00808080, 0x00C0C0C0, 0x00FFFFFF, 0x00800000,
> 0x00FF0000, 0x00FF00FF, 0x00FFFF00, 0x00808000, 0x00008000,
> 0x00008080,
> @@ -231,6 +242,10 @@ vlc_module_begin ()
>
> add_bool( "freetype-yuvp", false, YUVP_TEXT,
> YUVP_LONGTEXT, true )
> +#ifdef HAVE_PANGOFT
> + add_bool( "freetype-pango", false, PANGO_TEXT,
> + PANGO_LONGTEXT, true )
> +#endif
Hmm no. Even if you really want to use the FT2 back-end, the Pango code
needs to be a separate (binary) plugin. At the very least fribidi can be
dropped from the (direct) link dependencies then.
Sharing source code is possible, but may or may not be a good idea.
> set_capability( "text renderer", 100 )
> add_shortcut( "text" )
> set_callbacks( Create, Destroy )
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list