Enlightenment CVS committal Author : shorne Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/lib/canvas Modified Files: evas_font_dir.c evas_object_text.c Log Message: Add API for getting the available fonts =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_font_dir.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- evas_font_dir.c 22 Apr 2006 11:08:01 -0000 1.21 +++ evas_font_dir.c 30 Apr 2006 11:39:44 -0000 1.22 @@ -364,6 +364,78 @@ hinting); } +Evas_List * +evas_font_dir_available_list(Evas *evas) +{ + Evas_List *l; + Evas_List *ll; + Evas_List *available = NULL; + +#ifdef HAVE_FONTCONFIG + /* Add font config fonts */ + FcPattern *p; + FcFontSet *set; + FcObjectSet *os; + int i; + + p = FcPatternCreate(); + os = FcObjectSetBuild(FC_FAMILY, FC_STYLE, NULL); + + if (p && os) set = FcFontList(NULL, p, os); + + if (p) FcPatternDestroy(p); + if (os) FcObjectSetDestroy(os); + + if (set) + { + for (i = 0; i < set->nfont; i++) + { + char * font; + + font = FcNameUnparse(set->fonts[i]); + available = evas_list_append(available, evas_stringshare_add(font)); + free(font); + } + + FcFontSetDestroy(set); + } +#endif + + /* Add fonts in evas font_path*/ + if (!evas->font_path) + return available; + + for (l = evas->font_path; l; l = l->next) + { + Evas_Font_Dir *fd; + + fd = evas_hash_find(font_dirs, (char *)l->data); + fd = object_text_font_cache_dir_update((char *)l->data, fd); + if (fd && fd->aliases) + { + for (ll = fd->aliases; ll; ll = ll->next) + { + Evas_Font_Alias *fa; + + fa = ll->data; + available = evas_list_append(available, evas_stringshare_add((char *)fa->alias)); + } + } + } + + return available; +} + +void +evas_font_dir_available_list_free(Evas_List *available) +{ + while (available) + { + evas_stringshare_del(available->data); + available = evas_list_remove(available, available->data); + } +} + /* private stuff */ static Evas_Bool font_cache_dir_free(Evas_Hash *hash, const char *key, void *data, void *fdata) =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_object_text.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -3 -r1.55 -r1.56 --- evas_object_text.c 19 Mar 2006 04:29:57 -0000 1.55 +++ evas_object_text.c 30 Apr 2006 11:39:44 -0000 1.56 @@ -1101,6 +1101,38 @@ * FIXME: To be fixed. * */ +EAPI Evas_List * +evas_font_available_list(Evas *e) +{ + MAGIC_CHECK(e, Evas, MAGIC_EVAS); + return NULL; + MAGIC_CHECK_END(); + + return evas_font_dir_available_list(e); +} + +/** + * To be documented. + * + * FIXME: To be fixed. + * + */ +EAPI void +evas_font_available_list_free(Evas *e, Evas_List *available) +{ + MAGIC_CHECK(e, Evas, MAGIC_EVAS); + return; + MAGIC_CHECK_END(); + + return evas_font_dir_available_list_free(available); +} + +/** + * To be documented. + * + * FIXME: To be fixed. + * + */ EAPI int evas_string_char_next_get(const char *str, int pos, int *decoded) { ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs