font: use font-config to load font

This allows us to a) move away from cairo's "toy" API, and b) let the
user specify font options in a single font "name" string:

  Serif:size=10:weight=bold:slant=italic

This also allows us to simplify the font code significantly (except
for the fontconfig parts...); the font no longer sets itself in a
cairo surface - font users do that; the font simply returns a
cairo_scaled_font_t.

Furthermore, font_clone() has now been simplified to basically just
refcount the scaled font. I.e. there's no need to run the full
constructor and lookup and instantiate the cairo scaled font again.
This commit is contained in:
Daniel Eklöf 2019-01-09 18:30:35 +01:00
parent b52bdf14b2
commit f6977417e0
7 changed files with 167 additions and 111 deletions

View file

@ -121,12 +121,7 @@ verify_font(keychain_t *chain, const struct yml_node *node)
return false;
}
if (strcmp(sub_key, "size") == 0 ||
strcmp(sub_key, "y_offset") == 0)
{
if (!verify_int(chain_push(chain, sub_key), it.value))
return false;
} else if (strcmp(sub_key, "family") == 0) {
if (strcmp(sub_key, "family") == 0) {
if (!verify_string(chain_push(chain, sub_key), it.value))
return false;
} else {