font: simplify configuration format; it's just a string now

This commit is contained in:
Daniel Eklöf 2019-01-20 09:51:44 +01:00
parent 314b43b4f0
commit b1453fd65e
2 changed files with 7 additions and 7 deletions

View file

@ -156,12 +156,13 @@ conf_verify_color(keychain_t *chain, const struct yml_node *node)
bool bool
conf_verify_font(keychain_t *chain, const struct yml_node *node) conf_verify_font(keychain_t *chain, const struct yml_node *node)
{ {
static const struct attr_info attrs[] = { if (!yml_is_scalar(node)) {
{"family", true, &conf_verify_string}, LOG_ERR("%s: font must be a fontconfig-formatted string",
{NULL, false, NULL}, conf_err_prefix(chain, node));
}; return false;
}
return conf_verify_dict(chain, node, attrs); return true;
} }
bool bool

View file

@ -67,8 +67,7 @@ conf_to_color(const struct yml_node *node)
struct font * struct font *
conf_to_font(const struct yml_node *node) conf_to_font(const struct yml_node *node)
{ {
const struct yml_node *family = yml_get_value(node, "family"); return font_new(yml_value_as_string(node));
return font_new(family != NULL ? yml_value_as_string(family) : "monospace");
} }
struct deco * struct deco *