19 #include <grass/gis.h>
20 #include <grass/glocale.h>
21 #include <grass/fontcap.h>
29 return access(
name, R_OK) >= 0;
43 char name[GNAME_MAX], longname[GNAME_MAX],
path[GPATH_MAX], encoding[128];
46 if (sscanf(str,
"%[^|]|%[^|]|%d|%[^|]|%d|%[^|]|",
47 name, longname, &type,
path, &index, encoding) == 6) {
52 else if (sscanf(str,
"%[^|]|%[^|]|%d||%d|%[^|]|",
53 name, longname, &type, &index, encoding) == 5)
59 e->longname =
G_store(longname);
63 e->encoding =
G_store(encoding);
75 char *capfile,
file[GPATH_MAX];
79 struct GFONT_CAP *fonts =
NULL;
82 if ((capfile = getenv(
"GRASS_FONT_CAP"))) {
83 if ((fp = fopen(capfile,
"r")) ==
NULL)
84 G_warning(_(
"%s: Unable to read font definition file; use the default"),
94 while (fgets(buf,
sizeof(buf), fp) && !feof(fp)) {
105 fonts = G_realloc(fonts, (fonts_count + 1) *
sizeof(
struct GFONT_CAP));
106 fonts[fonts_count++] = cap;
112 fonts = G_realloc(fonts, (fonts_count + 1) *
sizeof(
struct GFONT_CAP));
113 fonts[fonts_count].name =
NULL;
114 fonts[fonts_count].path =
NULL;
131 for (i = 0;
ftcap[i].name; i++) {