forked from enlightenment/enlightenment
1. better chinese font - it screws up japanese though. grrr. lets talk about
language packsg where a lang pack can ship with/set up a font (add it to the list) and set up locale properly using ipc and a bit of code etc. - well eventually. SVN revision: 14433
This commit is contained in:
parent
9dbb997c8f
commit
0e19b0e71d
|
@ -171,6 +171,11 @@ e_config_init(void)
|
|||
{
|
||||
E_Font_Fallback* eff;
|
||||
|
||||
eff = E_NEW(E_Font_Fallback, 1);
|
||||
eff->name = strdup("New-Sung");
|
||||
e_config->font_fallbacks = evas_list_append(e_config->font_fallbacks,
|
||||
eff);
|
||||
|
||||
eff = E_NEW(E_Font_Fallback, 1);
|
||||
eff->name = strdup("Kochi-Gothic");
|
||||
e_config->font_fallbacks = evas_list_append(e_config->font_fallbacks,
|
||||
|
@ -185,6 +190,12 @@ e_config_init(void)
|
|||
{
|
||||
E_Font_Default* efd;
|
||||
|
||||
efd = E_NEW(E_Font_Fallback, 1);
|
||||
efd->text_class = strdup("default");
|
||||
efd->font = strdup("Vera");
|
||||
efd->size = 10;
|
||||
e_config->font_defaults = evas_list_append(e_config->font_defaults, efd);
|
||||
|
||||
efd = E_NEW(E_Font_Fallback, 1);
|
||||
efd->text_class = strdup("title_bar");
|
||||
efd->font = strdup("Vera");
|
||||
|
|
|
@ -126,8 +126,11 @@ e_error_message_manager_show(E_Manager *man, char *title, char *txt)
|
|||
{
|
||||
char *p;
|
||||
Evas_Coord y;
|
||||
char *fname;
|
||||
int fsize;
|
||||
|
||||
y = 16 + 64 + 16;
|
||||
fname = (char *)e_font_default_string_get("default", &fsize);
|
||||
for (p = newstr; p;)
|
||||
{
|
||||
char *pp;
|
||||
|
@ -136,7 +139,7 @@ e_error_message_manager_show(E_Manager *man, char *title, char *txt)
|
|||
if (pp) *pp = 0;
|
||||
o = evas_object_text_add(e);
|
||||
evas_object_color_set(o, 255, 255, 255, 128);
|
||||
evas_object_text_font_set(o, "Vera", 10);
|
||||
evas_object_text_font_set(o, fname, fsize);
|
||||
evas_object_text_text_set(o, p);
|
||||
evas_object_geometry_get(o, NULL, NULL, &tw, &th);
|
||||
evas_object_move(o, 16 + 1, y + 1);
|
||||
|
@ -145,7 +148,7 @@ e_error_message_manager_show(E_Manager *man, char *title, char *txt)
|
|||
|
||||
o = evas_object_text_add(e);
|
||||
evas_object_color_set(o, 0, 0, 0, 255);
|
||||
evas_object_text_font_set(o, "Vera", 10);
|
||||
evas_object_text_font_set(o, fname, fsize);
|
||||
evas_object_text_text_set(o, p);
|
||||
evas_object_geometry_get(o, NULL, NULL, &tw, &th);
|
||||
evas_object_move(o, 16, y);
|
||||
|
@ -244,6 +247,8 @@ e_error_message_manager_show(E_Manager *man, char *title, char *txt)
|
|||
char format[1024];
|
||||
Evas_Object *text;
|
||||
int x, y, w, h, nw, nh;
|
||||
char *fname;
|
||||
int fsize;
|
||||
|
||||
evas_object_move(o, 0, 0);
|
||||
evas_object_resize(o, error_w, error_h);
|
||||
|
@ -253,10 +258,10 @@ e_error_message_manager_show(E_Manager *man, char *title, char *txt)
|
|||
|
||||
edje_object_part_text_set(o, "title", title);
|
||||
|
||||
fname = (char *)e_font_default_string_get("default", &fsize);
|
||||
snprintf(format, sizeof(format),
|
||||
"source='%s' font='%s' size=%d wrap=word",
|
||||
e_theme_edje_file_get("base/theme/error", "error/main"),
|
||||
"fonts/Edje Vera", 10);
|
||||
"font='%s' size=%i wrap=word",
|
||||
fname, fsize);
|
||||
text = evas_object_textblock_add(e);
|
||||
evas_object_color_set(text, 0, 0, 0, 255);
|
||||
evas_object_textblock_format_insert(text, format);
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
static Evas_List *_e_font_font_dir_available_get (Evas_List * available_fonts, const char *font_dir);
|
||||
|
||||
static char _fn_buf[1024];
|
||||
|
||||
int
|
||||
e_font_init(void)
|
||||
{
|
||||
|
@ -27,17 +29,25 @@ e_font_shutdown(void)
|
|||
void
|
||||
e_font_apply(void)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
char buf[1024];
|
||||
Evas_List *next;
|
||||
E_Font_Fallback *eff;
|
||||
E_Font_Default *efd;
|
||||
int blen, len;
|
||||
|
||||
/* setup edje fallback list */
|
||||
blen = sizeof(buf) - 1;
|
||||
buf[blen] = 0;
|
||||
next = e_config->font_fallbacks;
|
||||
if (next)
|
||||
{
|
||||
eff = evas_list_data(next);
|
||||
strncpy(buf, eff->name, PATH_MAX - 1);
|
||||
len = strlen(eff->name);
|
||||
if (len < blen)
|
||||
{
|
||||
strcpy(buf, eff->name);
|
||||
blen -= len;
|
||||
}
|
||||
next = evas_list_next(next);
|
||||
}
|
||||
else
|
||||
|
@ -45,16 +55,27 @@ e_font_apply(void)
|
|||
edje_fontset_append_set(NULL);
|
||||
}
|
||||
|
||||
buf[0] = 0;
|
||||
while (next)
|
||||
{
|
||||
eff = evas_list_data(next);
|
||||
strcat(buf, ",");
|
||||
strcat(buf, eff->name);
|
||||
len = 1;
|
||||
if (len < blen)
|
||||
{
|
||||
strcat(buf, ",");
|
||||
blen -= len;
|
||||
}
|
||||
len = strlen(eff->name);
|
||||
if (len < blen)
|
||||
{
|
||||
strcat(buf, eff->name);
|
||||
blen -= len;
|
||||
}
|
||||
next = evas_list_next(next);
|
||||
}
|
||||
if (buf[0] != 0)
|
||||
edje_fontset_append_set(buf);
|
||||
{
|
||||
edje_fontset_append_set(buf);
|
||||
}
|
||||
|
||||
/* setup edje text classes */
|
||||
for (next = e_config->font_defaults; next; next = next->next)
|
||||
|
@ -196,7 +217,7 @@ e_font_default_set(const char *text_class, const char *font, int size)
|
|||
E_Font_Default *
|
||||
e_font_default_get(const char *text_class)
|
||||
{
|
||||
E_Font_Default *efd;
|
||||
E_Font_Default *efd, *defd = NULL;
|
||||
Evas_List *next;
|
||||
|
||||
/* search for the text class */
|
||||
|
@ -212,8 +233,12 @@ e_font_default_get(const char *text_class)
|
|||
e_config->font_defaults, efd);
|
||||
return efd;
|
||||
}
|
||||
if (!strcmp(efd->text_class, "default"))
|
||||
defd = efd;
|
||||
}
|
||||
return NULL;
|
||||
if (!defd)
|
||||
defd = efd;
|
||||
return defd;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -244,6 +269,53 @@ e_font_default_list(void)
|
|||
return e_config->font_defaults;
|
||||
}
|
||||
|
||||
const char *
|
||||
e_font_default_string_get(const char *text_class, int *size_ret)
|
||||
{
|
||||
E_Font_Default *efd;
|
||||
Evas_List *next;
|
||||
E_Font_Fallback *eff;
|
||||
int blen, len;
|
||||
|
||||
_fn_buf[0] = 0;
|
||||
efd = e_font_default_get(text_class);
|
||||
if (!efd)
|
||||
{
|
||||
if (size_ret) *size_ret = 0;
|
||||
return "";
|
||||
}
|
||||
blen = sizeof(_fn_buf) - 1;
|
||||
|
||||
len = strlen(efd->font);
|
||||
if (len < blen)
|
||||
{
|
||||
strcpy(_fn_buf, efd->font);
|
||||
blen -= len;
|
||||
}
|
||||
|
||||
next = e_config->font_fallbacks;
|
||||
while (next)
|
||||
{
|
||||
eff = evas_list_data(next);
|
||||
len = 1;
|
||||
if (len < blen)
|
||||
{
|
||||
strcat(_fn_buf, ",");
|
||||
blen -= len;
|
||||
}
|
||||
len = strlen(eff->name);
|
||||
if (len < blen)
|
||||
{
|
||||
strcat(_fn_buf, eff->name);
|
||||
blen -= len;
|
||||
}
|
||||
next = evas_list_next(next);
|
||||
}
|
||||
|
||||
if (size_ret) *size_ret = efd->size;
|
||||
return _fn_buf;
|
||||
}
|
||||
|
||||
static Evas_List *
|
||||
_e_font_font_dir_available_get(Evas_List * available_fonts, const char *font_dir)
|
||||
{
|
||||
|
|
|
@ -46,6 +46,7 @@ EAPI void e_font_default_set(const char * text_class, const char * font, int si
|
|||
EAPI E_Font_Default * e_font_default_get(const char * text_class);
|
||||
EAPI void e_font_default_remove(const char * text_class);
|
||||
EAPI Evas_List * e_font_default_list(void);
|
||||
EAPI const char *e_font_default_string_get(const char *text_class, int *size_ret);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue