env vars for font path, image and font cache and even font hintingt

SVN revision: 38914
This commit is contained in:
Carsten Haitzler 2009-02-03 10:27:52 +00:00
parent 40029378de
commit 77a09c957a
3 changed files with 71 additions and 7 deletions

View File

@ -78,6 +78,7 @@ elm_init(int argc, char **argv)
{
int i;
const char *elm_engine, *elm_scale, *elm_theme, *elm_prefix, *elm_data_dir;
const char *elm_font_hinting, *elm_font_path, *elm_image_cache, *elm_font_cache;
char buf[PATH_MAX];
eet_init();
@ -97,6 +98,10 @@ elm_init(int argc, char **argv)
elm_theme = getenv("ELM_THEME");
elm_prefix = getenv("ELM_PREFIX");
elm_data_dir = getenv("ELM_DATA_DIR");
elm_font_hinting = getenv("ELM_FONT_HINTING");
elm_font_path = getenv("ELM_FONT_PATH");
elm_image_cache = getenv("ELM_IMAGE_CACHE");
elm_font_cache = getenv("ELM_FONT_CACHE");
if (!_elm_data_dir)
{
@ -188,6 +193,10 @@ elm_init(int argc, char **argv)
_elm_config->thumbscroll_momentum_threshhold = 100.0;
_elm_config->thumbscroll_friction = 1.0;
_elm_config->scale = 1.0;
_elm_config->font_hinting = 2;
_elm_config->font_dirs = NULL;
_elm_config->image_cache = 4096;
_elm_config->font_cache = 512;
_elm_config->bgpixmap = 0;
_elm_config->compositing = 1;
@ -228,6 +237,53 @@ elm_init(int argc, char **argv)
else
_elm_theme_parse("default");
_elm_config->font_hinting = 2;
if (elm_font_hinting)
{
if (!strcasecmp(elm_font_hinting, "none"))
_elm_config->font_hinting = 0;
else if (!strcasecmp(elm_font_hinting, "auto"))
_elm_config->font_hinting = 1;
else if (!strcasecmp(elm_font_hinting, "bytecode"))
_elm_config->font_hinting = 2;
}
if (elm_font_path)
{
const char *p, *pp, *s;
char *buf;
buf = alloca(strlen(elm_font_path) + 1);
p = elm_font_path;
pp = p;
for (;;)
{
if ((*p == ':') || (*p == 0))
{
int len;
len = p - pp;
strncpy(buf, pp, len);
buf[len] = 0;
_elm_config->font_dirs = eina_list_append(_elm_config->font_dirs, buf);
if (*p == 0) break;
p++;
pp = p;
}
else
{
if (*p == 0) break;
p++;
}
}
}
if (elm_image_cache)
_elm_config->image_cache = atoi(elm_image_cache);
if (elm_font_cache)
_elm_config->font_cache = atoi(elm_font_cache);
/* FIXME: implement quickstart below */
/* if !quickstart return
* else

View File

@ -44,6 +44,10 @@ struct _Elm_Config
double scale;
int bgpixmap;
int compositing;
Eina_List *font_dirs;
int font_hinting;
int image_cache;
int font_cache;
};
#define ELM_NEW(t) calloc(1, sizeof(t))

View File

@ -246,6 +246,7 @@ EAPI Evas_Object *
elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
{
Elm_Win *win;
Eina_List *l;
win = ELM_NEW(Elm_Win);
switch (_elm_config->engine)
@ -309,13 +310,16 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
ecore_evas_name_class_set(win->ee, name, _elm_appname);
ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
// FIXME: use elm config for this
evas_image_cache_set(win->evas, 4096 * 1024);
evas_font_cache_set(win->evas, 512 * 1024);
evas_font_path_append(win->evas, "fonts");
// evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
// evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
// evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
evas_image_cache_set(win->evas, _elm_config->image_cache * 1024);
evas_font_cache_set(win->evas, _elm_config->font_cache * 1024);
for (l = _elm_config->font_dirs; l; l = l->next)
evas_font_path_append(win->evas, l->data);
if (_elm_config->font_hinting == 0)
evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
else if (_elm_config->font_hinting == 1)
evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
else if (_elm_config->font_hinting == 2)
evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
edje_frametime_set(1.0 / 60.0);
edje_scale_set(_elm_config->scale);