forked from enlightenment/efl
Evas bidi: Made fribidichar<->eina_unicode conversion a compile time test.
SVN revision: 59122
This commit is contained in:
parent
e5402b2eb2
commit
2e0bb38935
|
@ -231,6 +231,10 @@ esac
|
||||||
|
|
||||||
# Eina
|
# Eina
|
||||||
PKG_CHECK_MODULES([EINA], [eina >= 1.0.0])
|
PKG_CHECK_MODULES([EINA], [eina >= 1.0.0])
|
||||||
|
CPPFLAGS_SAVE="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$CPPFLAGS $EINA_CFLAGS"
|
||||||
|
AC_CHECK_SIZEOF(Eina_Unicode,, [#include <Eina.h>])
|
||||||
|
CPPFLAGS="$CPPFLAGS_SAVE"
|
||||||
|
|
||||||
# Freetype
|
# Freetype
|
||||||
PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 9.3.0])
|
PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 9.3.0])
|
||||||
|
@ -288,6 +292,10 @@ if test "x${want_fribidi}" = "xyes" -o "x${want_fribidi}" = "xauto" ; then
|
||||||
have_fribidi="yes"
|
have_fribidi="yes"
|
||||||
AC_DEFINE(HAVE_FRIBIDI, 1, [have fribidi support])
|
AC_DEFINE(HAVE_FRIBIDI, 1, [have fribidi support])
|
||||||
requirement_evas="fribidi ${requirement_evas}"
|
requirement_evas="fribidi ${requirement_evas}"
|
||||||
|
CPPFLAGS_SAVE="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$CPPFLAGS $FRIBIDI_CFLAGS"
|
||||||
|
AC_CHECK_SIZEOF(FriBidiChar,, [#include <fribidi/fribidi.h>])
|
||||||
|
CPPFLAGS="$CPPFLAGS_SAVE"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
if test "x$want_fribidi" = "xyes" -a "x$use_strict" = "xyes" ; then
|
if test "x$want_fribidi" = "xyes" -a "x$use_strict" = "xyes" ; then
|
||||||
|
|
|
@ -35,6 +35,11 @@
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
#if SIZEOF_FRIBIDICHAR != SIZEOF_EINA_UNICODE
|
||||||
|
# define EVAS_FRIBIDI_EINA_UNICODE_UNEQUAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EVAS_FRIBIDI_EINA_UNICODE_UNEQUAL
|
||||||
/* Convert bidichar to eina_unicode assume both are valid pointers */
|
/* Convert bidichar to eina_unicode assume both are valid pointers */
|
||||||
static Eina_Unicode *
|
static Eina_Unicode *
|
||||||
_evas_bidi_fribidichar_to_unicode(Eina_Unicode *dest, const FriBidiChar *src)
|
_evas_bidi_fribidichar_to_unicode(Eina_Unicode *dest, const FriBidiChar *src)
|
||||||
|
@ -58,6 +63,7 @@ _evas_bidi_unicode_to_fribidichar(FriBidiChar *dest, const Eina_Unicode *src)
|
||||||
*dest = 0;
|
*dest = 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
|
@ -104,18 +110,13 @@ evas_bidi_shape_string(Eina_Unicode *eina_ustr, const Evas_BiDi_Paragraph_Props
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
/* The size of fribidichar is different than eina_unicode, convert */
|
/* The size of fribidichar is different than eina_unicode, convert */
|
||||||
/*FIXME: Make this comparison at compile time and compile out
|
#ifdef EVAS_FRIBIDI_EINA_UNICODE_UNEQUAL
|
||||||
* unwanted code. - In all of this source file. (including the actual
|
|
||||||
* function declerations. */
|
|
||||||
if (sizeof(Eina_Unicode) != sizeof(FriBidiChar))
|
|
||||||
{
|
|
||||||
base_ustr = ustr = calloc(len + 1, sizeof(FriBidiChar));
|
base_ustr = ustr = calloc(len + 1, sizeof(FriBidiChar));
|
||||||
ustr = _evas_bidi_unicode_to_fribidichar(ustr, eina_ustr);
|
ustr = _evas_bidi_unicode_to_fribidichar(ustr, eina_ustr);
|
||||||
}
|
#else
|
||||||
else
|
(void) base_ustr;
|
||||||
{
|
|
||||||
ustr = (FriBidiChar *) eina_ustr;
|
ustr = (FriBidiChar *) eina_ustr;
|
||||||
}
|
#endif
|
||||||
|
|
||||||
|
|
||||||
EvasBiDiJoiningType *join_types = NULL;
|
EvasBiDiJoiningType *join_types = NULL;
|
||||||
|
@ -137,11 +138,10 @@ evas_bidi_shape_string(Eina_Unicode *eina_ustr, const Evas_BiDi_Paragraph_Props
|
||||||
if (join_types) free(join_types);
|
if (join_types) free(join_types);
|
||||||
|
|
||||||
/* Convert back */
|
/* Convert back */
|
||||||
if (sizeof(Eina_Unicode) != sizeof(FriBidiChar))
|
#ifdef EVAS_FRIBIDI_EINA_UNICODE_UNEQUAL
|
||||||
{
|
|
||||||
eina_ustr = _evas_bidi_fribidichar_to_unicode(eina_ustr, ustr);
|
eina_ustr = _evas_bidi_fribidichar_to_unicode(eina_ustr, ustr);
|
||||||
if (base_ustr) free(base_ustr);
|
if (base_ustr) free(base_ustr);
|
||||||
}
|
#endif
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,16 +237,13 @@ evas_bidi_paragraph_props_get(const Eina_Unicode *eina_ustr, size_t len,
|
||||||
|
|
||||||
len = eina_unicode_strlen(eina_ustr);
|
len = eina_unicode_strlen(eina_ustr);
|
||||||
/* The size of fribidichar s different than eina_unicode, convert */
|
/* The size of fribidichar s different than eina_unicode, convert */
|
||||||
if (sizeof(Eina_Unicode) != sizeof(FriBidiChar))
|
#ifdef EVAS_FRIBIDI_EINA_UNICODE_UNEQUAL
|
||||||
{
|
|
||||||
base_ustr = calloc(len + 1, sizeof(FriBidiChar));
|
base_ustr = calloc(len + 1, sizeof(FriBidiChar));
|
||||||
base_ustr = _evas_bidi_unicode_to_fribidichar(base_ustr, eina_ustr);
|
base_ustr = _evas_bidi_unicode_to_fribidichar(base_ustr, eina_ustr);
|
||||||
ustr = base_ustr;
|
ustr = base_ustr;
|
||||||
}
|
#else
|
||||||
else
|
|
||||||
{
|
|
||||||
ustr = (const FriBidiChar *) eina_ustr;
|
ustr = (const FriBidiChar *) eina_ustr;
|
||||||
}
|
#endif
|
||||||
|
|
||||||
bidi_props = evas_bidi_paragraph_props_new();
|
bidi_props = evas_bidi_paragraph_props_new();
|
||||||
|
|
||||||
|
@ -398,15 +395,12 @@ evas_bidi_props_reorder_line(Eina_Unicode *eina_ustr, size_t start, size_t len,
|
||||||
if (eina_ustr)
|
if (eina_ustr)
|
||||||
{
|
{
|
||||||
/* The size of fribidichar is different than eina_unicode, convert */
|
/* The size of fribidichar is different than eina_unicode, convert */
|
||||||
if (sizeof(Eina_Unicode) != sizeof(FriBidiChar))
|
#ifdef EVAS_FRIBIDI_EINA_UNICODE_UNEQUAL
|
||||||
{
|
|
||||||
base_ustr = ustr = calloc(len + 1, sizeof(FriBidiChar));
|
base_ustr = ustr = calloc(len + 1, sizeof(FriBidiChar));
|
||||||
ustr = _evas_bidi_unicode_to_fribidichar(ustr, eina_ustr);
|
ustr = _evas_bidi_unicode_to_fribidichar(ustr, eina_ustr);
|
||||||
}
|
#else
|
||||||
else
|
|
||||||
{
|
|
||||||
ustr = (FriBidiChar *) eina_ustr;
|
ustr = (FriBidiChar *) eina_ustr;
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -445,11 +439,10 @@ evas_bidi_props_reorder_line(Eina_Unicode *eina_ustr, size_t start, size_t len,
|
||||||
|
|
||||||
|
|
||||||
/* The size of fribidichar is different than eina_unicode, convert */
|
/* The size of fribidichar is different than eina_unicode, convert */
|
||||||
if (sizeof(Eina_Unicode) != sizeof(FriBidiChar))
|
#ifdef EVAS_FRIBIDI_EINA_UNICODE_UNEQUAL
|
||||||
{
|
|
||||||
_evas_bidi_fribidichar_to_unicode(eina_ustr, base_ustr);
|
_evas_bidi_fribidichar_to_unicode(eina_ustr, base_ustr);
|
||||||
free(base_ustr);
|
free(base_ustr);
|
||||||
}
|
#endif
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
/* ERROR HANDLING */
|
/* ERROR HANDLING */
|
||||||
error:
|
error:
|
||||||
|
|
|
@ -84,7 +84,6 @@ struct _Evas_BiDi_Props
|
||||||
|
|
||||||
#ifdef USE_FRIBIDI
|
#ifdef USE_FRIBIDI
|
||||||
|
|
||||||
|
|
||||||
#define EVAS_BIDI_PARAGRAPH_NEUTRAL FRIBIDI_PAR_ON
|
#define EVAS_BIDI_PARAGRAPH_NEUTRAL FRIBIDI_PAR_ON
|
||||||
#define EVAS_BIDI_PARAGRAPH_LTR FRIBIDI_PAR_LTR
|
#define EVAS_BIDI_PARAGRAPH_LTR FRIBIDI_PAR_LTR
|
||||||
#define EVAS_BIDI_PARAGRAPH_RTL FRIBIDI_PAR_RTL
|
#define EVAS_BIDI_PARAGRAPH_RTL FRIBIDI_PAR_RTL
|
||||||
|
|
Loading…
Reference in New Issue