cleanup --font handling. Closes T2433
This commit is contained in:
parent
eb25dabf09
commit
0265c9bd88
|
@ -627,31 +627,27 @@ elm_main(int argc, char **argv)
|
||||||
|
|
||||||
if (font)
|
if (font)
|
||||||
{
|
{
|
||||||
if (strchr(font, '/'))
|
char *p = strchr(font, '/');
|
||||||
|
if (p)
|
||||||
{
|
{
|
||||||
char *fname = alloca(strlen(font) + 1);
|
int sz;
|
||||||
char *p;
|
char *fname = alloca(p - font + 1);
|
||||||
|
|
||||||
strcpy(fname, font);
|
strncpy(fname, font, p - font);
|
||||||
p = strrchr(fname, '/');
|
fname[p - font] = '\0';
|
||||||
if (p)
|
sz = atoi(p+1);
|
||||||
{
|
if (sz > 0) config->font.size = sz;
|
||||||
int sz;
|
eina_stringshare_replace(&(config->font.name), fname);
|
||||||
|
|
||||||
*p = 0;
|
|
||||||
p++;
|
|
||||||
sz = atoi(p);
|
|
||||||
if (sz > 0) config->font.size = sz;
|
|
||||||
eina_stringshare_replace(&(config->font.name), fname);
|
|
||||||
}
|
|
||||||
config->font.bitmap = 0;
|
config->font.bitmap = 0;
|
||||||
|
config->font_set = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[4096], *file;
|
char buf[4096], *file;
|
||||||
Eina_List *files;
|
Eina_List *files;
|
||||||
int n = strlen(font);
|
int n = strlen(font);
|
||||||
|
Eina_Bool found = EINA_FALSE;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/fonts", elm_app_data_dir_get());
|
snprintf(buf, sizeof(buf), "%s/fonts", elm_app_data_dir_get());
|
||||||
files = ecore_file_ls(buf);
|
files = ecore_file_ls(buf);
|
||||||
EINA_LIST_FREE(files, file)
|
EINA_LIST_FREE(files, file)
|
||||||
|
@ -663,10 +659,16 @@ elm_main(int argc, char **argv)
|
||||||
n = -1;
|
n = -1;
|
||||||
eina_stringshare_replace(&(config->font.name), file);
|
eina_stringshare_replace(&(config->font.name), file);
|
||||||
config->font.bitmap = 1;
|
config->font.bitmap = 1;
|
||||||
|
config->font_set = 1;
|
||||||
|
found = EINA_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(file);
|
free(file);
|
||||||
}
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
ERR("font '%s' not found in %s", font, buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
config->temporary = EINA_TRUE;
|
config->temporary = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue