forked from enlightenment/efl
Use right key to find stuff in the eet file. By Fidencio
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. SVN revision: 51095
This commit is contained in:
parent
ccc497b492
commit
8b2e29dc75
|
@ -216,7 +216,7 @@ output(void)
|
||||||
ERR("Cannot create image object for save.");
|
ERR("Cannot create image object for save.");
|
||||||
exit(-1);
|
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);
|
evas_object_image_file_set(im, file_in, buf);
|
||||||
snprintf(out, sizeof(out), "%s/%s", outdir, ei->entry);
|
snprintf(out, sizeof(out), "%s/%s", outdir, ei->entry);
|
||||||
printf("Output Image: %s\n", out);
|
printf("Output Image: %s\n", out);
|
||||||
|
@ -279,17 +279,19 @@ output(void)
|
||||||
if (sf->file) fputs(sf->file, f);
|
if (sf->file) fputs(sf->file, f);
|
||||||
fclose(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;
|
void *font;
|
||||||
int fontsize;
|
int fontsize;
|
||||||
char out[4096];
|
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);
|
font = eet_read(ef, out, &fontsize);
|
||||||
if (font)
|
if (font)
|
||||||
{
|
{
|
||||||
|
@ -321,6 +323,7 @@ output(void)
|
||||||
free(font);
|
free(font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
eina_iterator_free(it);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
char out[4096];
|
char out[4096];
|
||||||
|
|
|
@ -3946,6 +3946,7 @@ EAPI Eina_Bool
|
||||||
edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
|
edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
|
||||||
{
|
{
|
||||||
char entry[PATH_MAX];
|
char entry[PATH_MAX];
|
||||||
|
char *new_path;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
Edje_Font_Directory_Entry *fnt;
|
Edje_Font_Directory_Entry *fnt;
|
||||||
|
|
||||||
|
@ -3959,13 +3960,26 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
|
||||||
if (!ed->path) return EINA_FALSE;
|
if (!ed->path) return EINA_FALSE;
|
||||||
|
|
||||||
/* Alias */
|
/* Alias */
|
||||||
if (!alias)
|
if (alias)
|
||||||
|
{
|
||||||
|
if ((new_path = strrchr(path, '/'))) new_path ++;
|
||||||
|
else new_path = (char *)path;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if ((alias = strrchr(path, '/'))) alias ++;
|
if ((alias = strrchr(path, '/'))) alias ++;
|
||||||
else alias = (char *)path;
|
else alias = (char *)path;
|
||||||
|
new_path = (char *)alias;
|
||||||
}
|
}
|
||||||
snprintf(entry, sizeof(entry), "edje/fonts/%s", 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 */
|
/* Check if exists */
|
||||||
fnt = eina_hash_find(ed->file->fonts, alias);
|
fnt = eina_hash_find(ed->file->fonts, alias);
|
||||||
if (fnt)
|
if (fnt)
|
||||||
|
@ -3978,6 +3992,7 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
|
||||||
ERR("Unable to alloc font entry part \"%s\"", alias);
|
ERR("Unable to alloc font entry part \"%s\"", alias);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
fnt->file = eina_stringshare_add(new_path);
|
||||||
fnt->entry = eina_stringshare_add(alias);
|
fnt->entry = eina_stringshare_add(alias);
|
||||||
|
|
||||||
eina_hash_direct_add(ed->file->fonts, fnt->entry, fnt);
|
eina_hash_direct_add(ed->file->fonts, fnt->entry, fnt);
|
||||||
|
|
|
@ -2163,7 +2163,7 @@ _edje_lua_image_set_file(lua_State *L)
|
||||||
Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mImage);
|
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));
|
int id = edje_edit_image_id_get(obj->ed->obj, luaL_checkstring(L, 2));
|
||||||
char buf[256];
|
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);
|
evas_object_image_file_set(obj->eo, obj->ed->path, buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue