diff --git a/legacy/evas/configure.in b/legacy/evas/configure.in index 09c0f5dd4e..c015772709 100644 --- a/legacy/evas/configure.in +++ b/legacy/evas/configure.in @@ -1,8 +1,8 @@ -dnl Process this file with autoconf to produce a configure script. - # get rid of that stupid cache mechanism rm -f config.cache + + AC_INIT(configure.in) AC_CANONICAL_BUILD AC_CANONICAL_HOST @@ -498,11 +498,40 @@ if test "x$have_eet" = "xyes"; then [ have_eet="no" ] ) fi + +function vser () +{ + v=$1 + VSTART=`echo $v | awk -F_ '{printf("%s", $1);}'` + V1=`echo $VSTART | awk -F\. '{printf("%s", $1);}'` + V2=`echo $VSTART | awk -F\. '{printf("%s", $2);}'` + V3=`echo $VSTART | awk -F\. '{printf("%s", $3);}'` + V4="0" + VEND=`echo $v | awk -F_ '{printf("%s", $2);}'` + if test -n "$VEND"; then + V4=`echo $VEND | sed s/pre//` + fi + V3=$(( $V3 * 100 )); + V2=$(( $V2 * 10000 )); + V1=$(( $V1 * 1000000 )); + V=$(( $V4 + $V3 + $V2 + $V1 )); + echo $V +} + if test "x$have_eet" = "xyes"; then - AC_DEFINE(BUILD_LOADER_EET, 1, [EET Image Loader Support]) if [ test -z "$EET_CONFIG" ]; then EET_CONFIG="eet-config"; fi - eet_cflags=`$EET_CONFIG --cflags` - eet_libs=`$EET_CONFIG --libs` + V=`$EET_CONFIG --version` + VV=`vser $V` + VM="0.9.9" + VVM=`vser $VM` + if test $VV -lt $VVM; then + echo "Error. Eet is not at least "$VM". It is "$V". Disabling EET" + have_eet="no" + else + AC_DEFINE(BUILD_LOADER_EET, 1, [EET Image Loader Support]) + eet_cflags=`$EET_CONFIG --cflags` + eet_libs=`$EET_CONFIG --libs` + fi fi ####################################### @@ -567,10 +596,19 @@ if test "x$have_eet_fonts" = "xyes"; then ) fi if test "x$have_eet_fonts" = "xyes"; then - AC_DEFINE(BUILD_FONT_LOADER_EET, 1, [EET Font Loader Support]) if [ test -z "$EET_CONFIG" ]; then EET_CONFIG="eet-config"; fi - eet_cflags=`$EET_CONFIG --cflags` - eet_libs=`$EET_CONFIG --libs` + V=`$EET_CONFIG --version` + VV=`vser $V` + VM="0.9.9" + VVM=`vser $VM` + if test $VV -lt $VVM; then + echo "Error. Eet is not at least "$VM". It is "$V". Disabling EET" + have_eet="no" + else + AC_DEFINE(BUILD_FONT_LOADER_EET, 1, [EET Font Loader Support]) + eet_cflags=`$EET_CONFIG --cflags` + eet_libs=`$EET_CONFIG --libs` + fi fi ##################################################################### diff --git a/legacy/evas/src/lib/Evas.h b/legacy/evas/src/lib/Evas.h index 5aa15c7519..3d2ba9bf39 100644 --- a/legacy/evas/src/lib/Evas.h +++ b/legacy/evas/src/lib/Evas.h @@ -547,7 +547,22 @@ extern "C" { Evas_Bool evas_imaging_image_alpha_get (Evas_Imaging_Image *im); void evas_imaging_image_cache_set (int bytes); int evas_imaging_image_cache_get (void); - + + Evas_Imaging_Font *evas_imaging_font_load (const char *file, const char *key, int size); + void evas_imaging_font_free (Evas_Imaging_Font *fn); + int evas_imaging_font_ascent_get (Evas_Imaging_Font *fn); + int evas_imaging_font_descent_get (Evas_Imaging_Font *fn); + int evas_imaging_font_max_ascent_get (Evas_Imaging_Font *fn); + int evas_imaging_font_max_descent_get (Evas_Imaging_Font *fn); + int evas_imaging_font_line_advance_get (Evas_Imaging_Font *fn); + void evas_imaging_font_string_advance_get (Evas_Imaging_Font *fn, char *str, int *x, int *y); + void evas_imaging_font_string_size_query (Evas_Imaging_Font *fn, char *str, int *w, int *h); + int evas_imaging_font_string_inset_get (Evas_Imaging_Font *fn, char *str); + int evas_imaging_font_string_char_coords_get (Evas_Imaging_Font *fn, char *str, int pos, int *cx, int *cy, int *cw, int *ch); + int evas_imaging_font_string_char_at_coords_get (Evas_Imaging_Font *fn, char *str, int x, int y, int *cx, int *cy, int *cw, int *ch); + + void evas_imaging_font_cache_set (int bytes); + int evas_imaging_font_cache_get (void); #ifdef __cplusplus } diff --git a/legacy/evas/src/lib/engines/common/evas_image_load.c b/legacy/evas/src/lib/engines/common/evas_image_load.c index dbc37b8f1e..ed378301c2 100644 --- a/legacy/evas/src/lib/engines/common/evas_image_load.c +++ b/legacy/evas/src/lib/engines/common/evas_image_load.c @@ -17,7 +17,6 @@ #ifdef BUILD_LOADER_EET #include -#include #endif #ifdef BUILD_LOADER_EDB diff --git a/legacy/evas/src/lib/imaging/evas_imaging.c b/legacy/evas/src/lib/imaging/evas_imaging.c index 568c009944..8405ec0f83 100644 --- a/legacy/evas/src/lib/imaging/evas_imaging.c +++ b/legacy/evas/src/lib/imaging/evas_imaging.c @@ -3,6 +3,10 @@ #include "evas_common.h" #include "evas_private.h" +#ifdef BUILD_FONT_LOADER_EET +#include +#endif + Evas_Imaging_Image * evas_imaging_image_load(const char *file, const char *key) { @@ -61,3 +65,133 @@ evas_imaging_image_cache_get(void) return evas_common_image_get_cache(); } +Evas_Imaging_Font * +evas_imaging_font_load(const char *file, const char *key, int size) +{ + Evas_Imaging_Font *fn; + RGBA_Font *font; + + evas_common_cpu_init(); + evas_common_font_init(); + if (!file) file = ""; + if ((key) && (key[0] == 0)) key = NULL; +#ifdef BUILD_FONT_LOADER_EET + if (key) + { + char *tmp; + + tmp = evas_file_path_join(file, key); + if (tmp) + { + font = evas_common_font_load(tmp, size); + if (!font) + { + Eet_File *ef; + + ef = eet_open((char *)file, EET_FILE_MODE_READ); + if (ef) + { + void *fdata; + int fsize = 0; + + fdata = eet_read(ef, (char *)key, &fsize); + if ((fdata) && (fsize > 0)) + { + font = evas_common_font_memory_load(tmp, size, fdata, fsize); + free(fdata); + } + eet_close(ef); + } + } + free(tmp); + } + } + else +#endif + { + font = evas_common_font_load((char *)file, size); + } + fn = calloc(1, sizeof(RGBA_Font)); + if (!fn) return NULL; + fn->font = font; + return fn; +} + +void +evas_imaging_font_free(Evas_Imaging_Font *fn) +{ + evas_common_font_free(fn->font); + free(fn); +} + +int +evas_imaging_font_ascent_get(Evas_Imaging_Font *fn) +{ + return evas_common_font_ascent_get(fn->font); +} + +int +evas_imaging_font_descent_get(Evas_Imaging_Font *fn) +{ + return evas_common_font_descent_get(fn->font); +} + +int +evas_imaging_font_max_ascent_get(Evas_Imaging_Font *fn) +{ + return evas_common_font_max_ascent_get(fn->font); +} + +int +evas_imaging_font_max_descent_get(Evas_Imaging_Font *fn) +{ + return evas_common_font_max_descent_get(fn->font); +} + +int +evas_imaging_font_line_advance_get(Evas_Imaging_Font *fn) +{ + return evas_common_font_get_line_advance(fn->font); +} + +void +evas_imaging_font_string_advance_get(Evas_Imaging_Font *fn, char *str, int *x, int *y) +{ + return evas_common_font_query_advance(fn->font, str, x, y); +} + +void +evas_imaging_font_string_size_query(Evas_Imaging_Font *fn, char *str, int *w, int *h) +{ + return evas_common_font_query_size(fn->font, str, w, h); +} + +int +evas_imaging_font_string_inset_get(Evas_Imaging_Font *fn, char *str) +{ + return evas_common_font_query_inset(fn->font, str); +} + +int +evas_imaging_font_string_char_coords_get(Evas_Imaging_Font *fn, char *str, int pos, int *cx, int *cy, int *cw, int *ch) +{ + return evas_common_font_query_char_coords(fn->font, str, pos, cx, cy, cw, ch); +} + +int +evas_imaging_font_string_char_at_coords_get(Evas_Imaging_Font *fn, char *str, int x, int y, int *cx, int *cy, int *cw, int *ch) +{ + return evas_common_font_query_text_at_pos(fn->font, str, x, y, cx, cy, cw, ch); +} + +void +evas_imaging_font_cache_set(int bytes) +{ + evas_common_font_cache_set(bytes); +} + +int +evas_imaging_font_cache_get(void) +{ + return evas_common_font_cache_get(); +} diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h index 4dc34ca4a5..60b23b105b 100644 --- a/legacy/evas/src/lib/include/evas_private.h +++ b/legacy/evas/src/lib/include/evas_private.h @@ -629,7 +629,7 @@ struct _Evas_Imaging_Image RGBA_Image *image; }; -struct _Evas_Imaging_font +struct _Evas_Imaging_Font { RGBA_Font *font; };