8 static int font_type = GFONT_STROKE;
11 static void stroke_set(
const char *filename)
14 font_type = GFONT_STROKE;
17 static void freetype_set(
const char *filename,
int index)
20 font_type = GFONT_FREETYPE;
23 static void driver_set(
const char *
name)
26 font_type = GFONT_DRIVER;
37 encoding =
G_store(
"ISO-8859-1");
41 static void font_list(
char ***
list,
int *
count,
int verbose)
47 for (i = 0;
ftcap[i].name; i++)
51 G_debug(2,
"font_list: num_fonts=%d", num_fonts);
52 fonts = G_malloc(num_fonts *
sizeof(
const char *));
54 for (i = 0; i < num_fonts; i++) {
55 struct GFONT_CAP *p = &
ftcap[i];
57 G_debug(4,
"font: %d (%s)", i, p->name);
61 sprintf(buf,
"%s|%s|%d|%s|%d|%s|",
62 p->name, p->longname, p->type,
63 p->path, p->index, p->encoding);
75 static void free_font_list(
char **fonts,
int count)
79 for (i = 0; i <
count; i++)
91 freetype_set(name, 0);
95 for (i = 0;
ftcap[i].name; i++) {
96 struct GFONT_CAP *cap = &
ftcap[i];
98 if (strcmp(name, cap->name) != 0)
103 freetype_set(cap->path, cap->index);
107 stroke_set(cap->name);
120 for (i = 0; i <
count; i++) {
121 struct GFONT_CAP cap;
126 if (cap.type != GFONT_DRIVER || strcmp(name, cap.name) != 0)
129 driver_set(cap.name);
134 free_font_list(list, count);
138 stroke_set(
"romans");
151 font_list(list, count, 0);
158 font_list(list, count, 1);
int font_exists(const char *)
Check if font exists.
int font_init(const char *)
char * G_store(const char *s)
Copy string to allocated memory.
const char * font_get_encoding(void)
void COM_Font_list(char ***list, int *count)
void COM_Set_encoding(const char *enc)
int font_init_freetype(const char *, int)
int G_debug(int level, const char *msg,...)
Print debugging message.
void COM_Font_info(char ***list, int *count)
void(* Font_list)(char ***, int *)
void COM_Set_font(const char *name)
void(* Font_info)(char ***, int *)
int parse_fontcap_entry(struct GFONT_CAP *, const char *)
Parse fontcap entry.
int G_is_absolute_path(const char *path)
Checks if a specified path looks like an absolute path on the host system.
void(* Set_font)(const char *)
void G_free(void *buf)
Free allocated memory.