From 999737f6579cfc7e7f5d390f17f7d35ff207ccce Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Mon, 22 Nov 2010 22:07:41 +0000 Subject: [PATCH] add missing edit method: edje_edit_font_path_get() SVN revision: 54836 --- legacy/edje/src/lib/Edje_Edit.h | 12 ++++++++++++ legacy/edje/src/lib/edje_edit.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/legacy/edje/src/lib/Edje_Edit.h b/legacy/edje/src/lib/Edje_Edit.h index c996d6a627..1ee7b4f74d 100644 --- a/legacy/edje/src/lib/Edje_Edit.h +++ b/legacy/edje/src/lib/Edje_Edit.h @@ -2316,6 +2316,18 @@ EAPI Eina_Bool edje_edit_font_add(Evas_Object *obj, const char *path, const char */ EAPI Eina_Bool edje_edit_font_del(Evas_Object *obj, const char* alias); +/** Get font path for a given font alias. + * + * Remember to free the string with edje_edit_string_free() + * + * @param obj Object being edited. + * @param alias The font alias. + * + * @return The path of the given font alias. + */ +EAPI const char *edje_edit_font_path_get(Evas_Object *obj, const char *alias); + + /** Get font name for a given part state. * * Remember to free the returned string using edje_edit_string_free(). diff --git a/legacy/edje/src/lib/edje_edit.c b/legacy/edje/src/lib/edje_edit.c index 7d641ea97e..249a9cb2c6 100644 --- a/legacy/edje/src/lib/edje_edit.c +++ b/legacy/edje/src/lib/edje_edit.c @@ -4317,6 +4317,34 @@ edje_edit_font_del(Evas_Object *obj, const char* alias) return EINA_TRUE; } +EAPI const char * +edje_edit_font_path_get(Evas_Object *obj, const char *alias) +{ + Eina_Iterator *it; + Edje_Font_Directory_Entry *f; + const char *str = NULL; + + eina_error_set(0); + + if (!alias) return NULL; + GET_ED_OR_RETURN(NULL); + + if (!ed->file || !ed->file->fonts) return NULL; + + it = eina_hash_iterator_data_new(ed->file->fonts); + if (!it) return NULL; + + EINA_ITERATOR_FOREACH(it, f) + if (!strcmp(f->entry, alias)) + { + str = f->file; + break; + } + + eina_iterator_free(it); + return eina_stringshare_add(str); +} + EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value) {