Support for <dir prefix="relative"> in "fonts.conf"
This commit is contained in:
parent
e04bfc651a
commit
7f1ab23292
1 changed files with 22 additions and 7 deletions
23
src/fonts.c
23
src/fonts.c
|
|
@ -30,6 +30,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include <libgen.h> /* for dirname() */
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <libintl.h>
|
||||
|
|
@ -1294,8 +1296,21 @@ char * * malloc_fontconfig_config_paths(int num_to_malloc, int * num_actually_ma
|
|||
}
|
||||
else if (fontconfig_prefix == FC_PREFIX_RELATIVE)
|
||||
{
|
||||
/* FIXME */
|
||||
printf("fonts.conf <dir prefix=\"relative\"> not supported yet!\n");
|
||||
char *fc_cfg_path_copy, *dname;
|
||||
|
||||
fc_cfg_path_copy = strdup(fontconfig_config_paths[i]);
|
||||
dname = dirname(fc_cfg_path_copy);
|
||||
snprintf(prefix_path, sizeof(prefix_path), "%s/", dname);
|
||||
free(fc_cfg_path_copy);
|
||||
/* Per dirname(3):
|
||||
These functions may return pointers to statically
|
||||
allocated memory which may be overwritten by
|
||||
subsequent calls. Alternatively, they may return a
|
||||
pointer to some part of path, so that the string
|
||||
referred to by path should not be modified or
|
||||
freed until the pointer returned by the function
|
||||
is no longer required.
|
||||
*/
|
||||
}
|
||||
|
||||
if (prefix_path[0] != '\0')
|
||||
|
|
@ -1303,8 +1318,8 @@ char * * malloc_fontconfig_config_paths(int num_to_malloc, int * num_actually_ma
|
|||
char * tmp_str;
|
||||
size_t len;
|
||||
|
||||
len = strlen(path_str) + strlen(prefix_path);
|
||||
tmp_str = (char *) malloc(sizeof(char *) * (len + 1));
|
||||
len = strlen(path_str) + strlen(prefix_path) + 1;
|
||||
tmp_str = (char *) malloc(sizeof(char *) * len);
|
||||
if (tmp_str != NULL)
|
||||
{
|
||||
snprintf(tmp_str, len, "%s%s", prefix_path, path_str);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue