diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-12-01 18:26:02 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-12-01 18:26:02 +0000 |
| commit | f15a2af0b8b0672b06cfcd6ae55ddd8164aa550e (patch) | |
| tree | 815a39d4c5adbfdf78ef5dc81b049ed545962e71 /main.c | |
| parent | meson: fcft: version must be 0.1.x (diff) | |
| parent | PKGBUILD: tllist is only a make dependency, bump fcft to 0.2.0 (diff) | |
Merge branch 'fcft-0.2.0'
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 23 |
1 files changed, 10 insertions, 13 deletions
@@ -63,21 +63,18 @@ term_shutdown_cb(void *data, int exit_code) static bool initialize_fonts(const struct config *conf, struct font *fonts[4]) { - font_list_t font_names = tll_init(); - tll_foreach(conf->fonts, it) - tll_push_back(font_names, it->item); + const size_t count = tll_length(conf->fonts); + const char *names[count]; - if ((fonts[0] = font_from_name(font_names, "dpi=96")) == NULL || - (fonts[1] = font_from_name(font_names, "dpi=96:weight=bold")) == NULL || - (fonts[2] = font_from_name(font_names, "dpi=96:slant=italic")) == NULL || - (fonts[3] = font_from_name(font_names, "dpi=96:weight=bold:slant=italic")) == NULL) - { - tll_free(font_names); - return false; - } + size_t i = 0; + tll_foreach(conf->fonts, it) + names[i++] = it->item; - tll_free(font_names); - return true; + return ( + (fonts[0] = font_from_name(names, count, "dpi=96")) != NULL && + (fonts[1] = font_from_name(names, count, "dpi=96:weight=bold")) != 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); } int |
