forked from old/legacy-imlib2
parent
cb1be843d7
commit
df05d35899
28
src/font.c
28
src/font.c
|
@ -168,9 +168,7 @@ __imlib_load_font(char *fontname)
|
|||
memcpy(name, fontname, j);
|
||||
name[j] = 0;
|
||||
/* find file if it exists */
|
||||
for (j = 0; (j < fpath_num) && (!file); j++)
|
||||
{
|
||||
tmp = malloc(strlen(fpath[j]) + 1 + strlen(name) + 4 + 1);
|
||||
tmp = malloc(strlen(name) + 4 + 1);
|
||||
if (!tmp)
|
||||
{
|
||||
free(name);
|
||||
|
@ -179,6 +177,29 @@ __imlib_load_font(char *fontname)
|
|||
sprintf(tmp, "%s.ttf", name);
|
||||
if (__imlib_FileIsFile(tmp))
|
||||
file = strdup(tmp);
|
||||
else
|
||||
{
|
||||
sprintf(tmp, "%s.TTF", name);
|
||||
if (__imlib_FileIsFile(tmp))
|
||||
file = strdup(tmp);
|
||||
else
|
||||
{
|
||||
sprintf(tmp, "%s", name);
|
||||
if (__imlib_FileIsFile(tmp))
|
||||
file = strdup(tmp);
|
||||
}
|
||||
}
|
||||
free(tmp);
|
||||
if (!file)
|
||||
{
|
||||
for (j = 0; (j < fpath_num) && (!file); j++)
|
||||
{
|
||||
tmp = malloc(strlen(fpath[j]) + 1 + strlen(name) + 4 + 1);
|
||||
if (!tmp)
|
||||
{
|
||||
free(name);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(tmp, "%s/%s.ttf", fpath[j], name);
|
||||
|
@ -199,6 +220,7 @@ __imlib_load_font(char *fontname)
|
|||
}
|
||||
free(tmp);
|
||||
}
|
||||
}
|
||||
free(name);
|
||||
/* didnt find a file? abort */
|
||||
if (!file)
|
||||
|
|
Loading…
Reference in New Issue