5 #include <grass/glocale.h>
6 #include <grass/freetypecap.h>
13 fp = fopen(name,
"r");
23 char *capfile,
file[GPATH_MAX];
27 struct GFONT_CAP *fonts =
NULL;
30 if ((capfile =
getenv(
"GRASS_FONT_CAP"))) {
31 if ((fp = fopen(capfile,
"r")) ==
NULL)
32 G_warning(_(
"%s: Unable to read font definition file; use the default"),
37 if ((fp = fopen(file,
"r")) ==
NULL)
38 G_warning(_(
"%s: No font definition file"), file);
42 while (fgets(buf,
sizeof(buf), fp) && !feof(fp)) {
43 char name[GNAME_MAX], longname[GNAME_MAX],
44 path[GPATH_MAX], encoding[128];
52 if (sscanf(buf,
"%[^|]|%[^|]|%d|%[^|]|%d|%[^|]|",
53 name, longname, &type, path, &index, encoding)
60 fonts = (
struct GFONT_CAP *)G_realloc(fonts,
63 sizeof(
struct GFONT_CAP));
65 fonts[fonts_count].name =
G_store(name);
66 fonts[fonts_count].longname =
G_store(longname);
67 fonts[fonts_count].type =
type;
68 fonts[fonts_count].path =
G_store(path);
69 fonts[fonts_count].index = index;
70 fonts[fonts_count].encoding =
G_store(encoding);
77 fonts = (
struct GFONT_CAP *)G_realloc(fonts, (fonts_count + 1) *
78 sizeof(
struct GFONT_CAP));
79 fonts[fonts_count].name =
NULL;
80 fonts[fonts_count].path =
NULL;
92 for (i = 0; ftcap[i].name; i++) {
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
void G_free(void *buf)
Free allocated memory.
char * G_store(const char *s)
Copy string to allocated memory.
void free_freetypecap(struct GFONT_CAP *ftcap)
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
char * G_gisbase(void)
top level module directory
struct GFONT_CAP * parse_freetypecap(void)
int font_exists(const char *name)