fcft: font_from_name() no longer accepts a tllist

This commit is contained in:
Daniel Eklöf 2019-12-01 19:22:25 +01:00
parent 69dc53409e
commit e9fbb371df
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 20 additions and 26 deletions

23
main.c
View file

@ -63,21 +63,18 @@ term_shutdown_cb(void *data, int exit_code)
static bool static bool
initialize_fonts(const struct config *conf, struct font *fonts[4]) initialize_fonts(const struct config *conf, struct font *fonts[4])
{ {
font_list_t font_names = tll_init(); const size_t count = tll_length(conf->fonts);
const char *names[count];
size_t i = 0;
tll_foreach(conf->fonts, it) tll_foreach(conf->fonts, it)
tll_push_back(font_names, it->item); names[i++] = it->item;
if ((fonts[0] = font_from_name(font_names, "dpi=96")) == NULL || return (
(fonts[1] = font_from_name(font_names, "dpi=96:weight=bold")) == NULL || (fonts[0] = font_from_name(names, count, "dpi=96")) != NULL &&
(fonts[2] = font_from_name(font_names, "dpi=96:slant=italic")) == NULL || (fonts[1] = font_from_name(names, count, "dpi=96:weight=bold")) != NULL &&
(fonts[3] = font_from_name(font_names, "dpi=96:weight=bold:slant=italic")) == NULL) (fonts[2] = font_from_name(names, count, "dpi=96:slant=italic")) != NULL &&
{ (fonts[3] = font_from_name(names, count, "dpi=96:weight=bold:slant=italic")) != NULL);
tll_free(font_names);
return false;
}
tll_free(font_names);
return true;
} }
int int

View file

@ -368,21 +368,18 @@ initialize_render_workers(struct terminal *term)
static bool static bool
initialize_fonts(struct terminal *term, const struct config *conf) initialize_fonts(struct terminal *term, const struct config *conf)
{ {
font_list_t font_names = tll_init(); const size_t count = tll_length(conf->fonts);
const char *names[count];
size_t i = 0;
tll_foreach(conf->fonts, it) tll_foreach(conf->fonts, it)
tll_push_back(font_names, it->item); names[i++] = it->item;
if ((term->fonts[0] = font_from_name(font_names, "dpi=96")) == NULL || return (
(term->fonts[1] = font_from_name(font_names, "dpi=96:weight=bold")) == NULL || (term->fonts[0] = font_from_name(names, count, "dpi=96")) != NULL &&
(term->fonts[2] = font_from_name(font_names, "dpi=96:slant=italic")) == NULL || (term->fonts[1] = font_from_name(names, count, "dpi=96:weight=bold")) != NULL &&
(term->fonts[3] = font_from_name(font_names, "dpi=96:weight=bold:slant=italic")) == NULL) (term->fonts[2] = font_from_name(names, count, "dpi=96:slant=italic")) != NULL &&
{ (term->fonts[3] = font_from_name(names, count, "dpi=96:weight=bold:slant=italic")) != NULL);
tll_free(font_names);
return false;
}
tll_free(font_names);
return true;
} }
struct terminal * struct terminal *