forked from enlightenment/efl
revert cedrics patch for font stuff - it breaks textblocks
SVN revision: 23681
This commit is contained in:
parent
7adf4ed4bd
commit
2f82204b7b
|
@ -63,32 +63,6 @@ _edje_file_coll_open(Edje_File *edf, Eet_File *ef, const char *coll)
|
||||||
return edc;
|
return edc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
_edje_font_hash (Edje_File *edf)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
if (edf->font_dir)
|
|
||||||
{
|
|
||||||
Evas_List *l;
|
|
||||||
for (l = edf->font_dir->entries; l; l = evas_list_next (l))
|
|
||||||
{
|
|
||||||
Edje_Font_Directory_Entry *fnt = l->data;
|
|
||||||
int length = strlen (fnt->entry) + 7;
|
|
||||||
char *tmp = alloca (length);
|
|
||||||
|
|
||||||
snprintf (tmp, length, "fonts/%s", fnt->entry);
|
|
||||||
fnt->path = evas_stringshare_add (tmp);
|
|
||||||
evas_stringshare_del (fnt->entry);
|
|
||||||
fnt->entry = fnt->path + 6;
|
|
||||||
edf->font_hash = evas_hash_direct_add (edf->font_hash, fnt->entry, fnt);
|
|
||||||
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Edje_File *
|
static Edje_File *
|
||||||
_edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
|
_edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
|
||||||
{
|
{
|
||||||
|
@ -129,19 +103,18 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co
|
||||||
|
|
||||||
_edje_textblock_style_parse_and_fix(edf);
|
_edje_textblock_style_parse_and_fix(edf);
|
||||||
|
|
||||||
if (coll)
|
if (!coll)
|
||||||
{
|
{
|
||||||
edc = _edje_file_coll_open(edf, ef, coll);
|
eet_close(ef);
|
||||||
if (!edc)
|
return edf;
|
||||||
{
|
|
||||||
*error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION;
|
|
||||||
}
|
|
||||||
if (edc_ret) *edc_ret = edc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
edf->font_hash = NULL;
|
|
||||||
|
|
||||||
_edje_font_hash (edf);
|
edc = _edje_file_coll_open(edf, ef, coll);
|
||||||
|
if (!edc)
|
||||||
|
{
|
||||||
|
*error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION;
|
||||||
|
}
|
||||||
|
if (edc_ret) *edc_ret = edc;
|
||||||
|
|
||||||
eet_close(ef);
|
eet_close(ef);
|
||||||
return edf;
|
return edf;
|
||||||
|
|
|
@ -592,14 +592,24 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
if (!text) text = "";
|
if (!text) text = "";
|
||||||
|
|
||||||
/* check if the font is embedded in the .eet */
|
/* check if the font is embedded in the .eet */
|
||||||
if (ed->file->font_hash)
|
/* FIXME: we should cache this result */
|
||||||
|
if (ed->file->font_dir)
|
||||||
{
|
{
|
||||||
Edje_Font_Directory_Entry *fnt = evas_hash_find (ed->file->font_hash, font);
|
Evas_List *l;
|
||||||
|
|
||||||
if (fnt)
|
for (l = ed->file->font_dir->entries; l; l = l->next)
|
||||||
{
|
{
|
||||||
font = fnt->path;
|
Edje_Font_Directory_Entry *fnt = l->data;
|
||||||
inlined_font = 1;
|
|
||||||
|
if ((fnt->entry) && (!strcmp(fnt->entry, font)))
|
||||||
|
{
|
||||||
|
strcpy(buf, "fonts/");
|
||||||
|
strncpy(buf + 6, font, sizeof(buf) - 7);
|
||||||
|
buf[sizeof(buf) - 1] = 0;
|
||||||
|
font = buf;
|
||||||
|
inlined_font = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
|
if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
|
||||||
|
|
|
@ -612,8 +612,7 @@ _edje_file_free(Edje_File *edf)
|
||||||
fe = edf->font_dir->entries->data;
|
fe = edf->font_dir->entries->data;
|
||||||
edf->font_dir->entries =
|
edf->font_dir->entries =
|
||||||
evas_list_remove(edf->font_dir->entries, fe);
|
evas_list_remove(edf->font_dir->entries, fe);
|
||||||
edf->font_hash = evas_hash_del (edf->font_hash, fe->entry, NULL);
|
if (fe->entry) evas_stringshare_del(fe->entry);
|
||||||
if (fe->path) evas_stringshare_del(fe->path);
|
|
||||||
free(fe);
|
free(fe);
|
||||||
}
|
}
|
||||||
free(edf->font_dir);
|
free(edf->font_dir);
|
||||||
|
|
|
@ -222,7 +222,6 @@ struct _Edje_File
|
||||||
int feature_ver;
|
int feature_ver;
|
||||||
|
|
||||||
Evas_Hash *collection_hash;
|
Evas_Hash *collection_hash;
|
||||||
Evas_Hash *font_hash;
|
|
||||||
Evas_List *collection_cache;
|
Evas_List *collection_cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -260,7 +259,6 @@ struct _Edje_Font_Directory
|
||||||
struct _Edje_Font_Directory_Entry
|
struct _Edje_Font_Directory_Entry
|
||||||
{
|
{
|
||||||
char *entry; /* the name of the font */
|
char *entry; /* the name of the font */
|
||||||
char *path;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -284,14 +284,24 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
||||||
if (!font) font = "";
|
if (!font) font = "";
|
||||||
|
|
||||||
/* check if the font is embedded in the .eet */
|
/* check if the font is embedded in the .eet */
|
||||||
if (ed->file->font_hash)
|
/* FIXME: we should cache this result */
|
||||||
|
if (ed->file->font_dir)
|
||||||
{
|
{
|
||||||
Edje_Font_Directory_Entry *fnt = evas_hash_find (ed->file->font_hash, font);
|
Evas_List *l;
|
||||||
|
|
||||||
if (fnt)
|
for (l = ed->file->font_dir->entries; l; l = l->next)
|
||||||
{
|
{
|
||||||
font = fnt->path;
|
Edje_Font_Directory_Entry *fnt = l->data;
|
||||||
inlined_font = 1;
|
|
||||||
|
if ((fnt->entry) && (!strcmp(fnt->entry, font)))
|
||||||
|
{
|
||||||
|
strcpy(font_buf, "fonts/");
|
||||||
|
strncpy(font_buf + 6, font, sizeof(font_buf) - 7);
|
||||||
|
font_buf[sizeof(font_buf) - 1] = 0;
|
||||||
|
font = font_buf;
|
||||||
|
inlined_font = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,17 @@
|
||||||
static int
|
static int
|
||||||
_edje_font_is_embedded(Edje_File *edf, char *font)
|
_edje_font_is_embedded(Edje_File *edf, char *font)
|
||||||
{
|
{
|
||||||
if (!edf->font_hash) return 0;
|
Evas_List *l;
|
||||||
|
|
||||||
Edje_Font_Directory_Entry *fnt = evas_hash_find (edf->font_hash, font);
|
|
||||||
|
|
||||||
if (fnt)
|
if (!edf->font_dir) return 0;
|
||||||
return 1;
|
for (l = edf->font_dir->entries; l; l = l->next)
|
||||||
|
{
|
||||||
return 0;
|
Edje_Font_Directory_Entry *fnt = l->data;
|
||||||
|
|
||||||
|
if ((fnt->entry) && (!strcmp(fnt->entry, font)))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
Loading…
Reference in New Issue