8static int font_type = GFONT_STROKE;
11static void stroke_set(
const char *filename)
14 font_type = GFONT_STROKE;
17static void freetype_set(
const char *filename,
int index)
20 font_type = GFONT_FREETYPE;
23static void driver_set(
const char *
name)
26 font_type = GFONT_DRIVER;
37 encoding =
G_store(
"ISO-8859-1");
41static 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|", p->name, p->longname, p->type,
62 p->path, p->index, p->encoding);
74static void free_font_list(
char **fonts,
int count)
78 for (i = 0; i <
count; i++)
90 freetype_set(
name, 0);
94 for (i = 0;
ftcap[i].name; i++) {
95 struct GFONT_CAP *cap = &
ftcap[i];
97 if (strcmp(
name, cap->name) != 0)
102 freetype_set(cap->path, cap->index);
106 stroke_set(cap->name);
118 for (i = 0; i <
count; i++) {
119 struct GFONT_CAP cap;
124 if (cap.type != GFONT_DRIVER || strcmp(
name, cap.name) != 0)
127 driver_set(cap.name);
136 stroke_set(
"romans");
void G_free(void *buf)
Free allocated memory.
int G_debug(int level, const char *msg,...)
Print debugging message.
int font_exists(const char *)
Check if font exists.
int font_init_freetype(const char *, int)
int parse_fontcap_entry(struct GFONT_CAP *, const char *)
Parse fontcap entry.
int font_init(const char *)
void COM_Font_list(char ***list, int *count)
const char * font_get_encoding(void)
void COM_Set_encoding(const char *enc)
void COM_Set_font(const char *name)
void COM_Font_info(char ***list, int *count)
int G_is_absolute_path(const char *path)
Checks if a specified path looks like an absolute path on the host system.
char * G_store(const char *s)
Copy string to allocated memory.
void(* Font_info)(char ***, int *)
void(* Font_list)(char ***, int *)
void(* Set_font)(const char *)