Store filename for the fonts when adding eith Edje_Edit. By Fidencio
Use the hash in edje_file to dump fonts with edje_decc, avoiding the
need for the fontmap, which should probably be taken out entirely later.
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@51095
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
ERR("Cannot create image object for save.");
exit(-1);
}
- snprintf(buf, sizeof(buf), "images/%i", ei->id);
+ snprintf(buf, sizeof(buf), "edje/images/%i", ei->id);
evas_object_image_file_set(im, file_in, buf);
snprintf(out, sizeof(out), "%s/%s", outdir, ei->entry);
printf("Output Image: %s\n", out);
if (sf->file) fputs(sf->file, f);
fclose(f);
}
- if (fontlist)
+ if (edje_file->fonts)
{
- Font *fn;
+ Edje_Font_Directory_Entry *fn;
+ Eina_Iterator *it;
- EINA_LIST_FOREACH(fontlist->list, l, fn)
+ it = eina_hash_iterator_data_new(edje_file->fonts);
+ EINA_ITERATOR_FOREACH(it, fn)
{
void *font;
int fontsize;
char out[4096];
- snprintf(out, sizeof(out), "fonts/%s", fn->name);
+ snprintf(out, sizeof(out), "edje/fonts/%s", fn->entry);
font = eet_read(ef, out, &fontsize);
if (font)
{
free(font);
}
}
+ eina_iterator_free(it);
}
{
char out[4096];
edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
{
char entry[PATH_MAX];
+ char *new_path;
struct stat st;
Edje_Font_Directory_Entry *fnt;
if (!ed->path) return EINA_FALSE;
/* Alias */
- if (!alias)
+ if (alias)
+ {
+ if ((new_path = strrchr(path, '/'))) new_path ++;
+ else new_path = (char *)path;
+ }
+ else
{
if ((alias = strrchr(path, '/'))) alias ++;
else alias = (char *)path;
+ new_path = (char *)alias;
}
snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
+ /* Initializing a new font hash, if no exist */
+ if (!ed->file->fonts)
+ {
+ ed->file->fonts = eina_hash_string_small_new(NULL);
+ if (!ed->file->fonts) return EINA_FALSE;
+ }
+
/* Check if exists */
fnt = eina_hash_find(ed->file->fonts, alias);
if (fnt)
ERR("Unable to alloc font entry part \"%s\"", alias);
return EINA_FALSE;
}
+ fnt->file = eina_stringshare_add(new_path);
fnt->entry = eina_stringshare_add(alias);
eina_hash_direct_add(ed->file->fonts, fnt->entry, fnt);
Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mImage);
int id = edje_edit_image_id_get(obj->ed->obj, luaL_checkstring(L, 2));
char buf[256];
- sprintf(buf, "images/%i", id);
+ sprintf(buf, "edje/images/%i", id);
evas_object_image_file_set(obj->eo, obj->ed->path, buf);
return 0;
}