From 35653ef4b4e485bee6d15a4e0e158d49702e8533 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 6 Dec 2018 08:42:13 +0530 Subject: [PATCH] Linux: Fix a regression in the previous release that caused automatic selection of fonts when using aliases such as "monospace" to not work Fix #1209 --- docs/changelog.rst | 4 ++++ kitty/fonts/fontconfig.py | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index c0e5f6a9e..d5254c80f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -9,6 +9,10 @@ Changelog - Fix passing input via the pipe action to a program without a window not working. +- Linux: Fix a regression in the previous release that caused automatic + selection of fonts when using aliases such as "monospace" to not work + (:iss:`1209`) + 0.13.0 [2018-12-05] ------------------------------ diff --git a/kitty/fonts/fontconfig.py b/kitty/fonts/fontconfig.py index 5ef2912be..c6cbf3d35 100644 --- a/kitty/fonts/fontconfig.py +++ b/kitty/fonts/fontconfig.py @@ -72,6 +72,13 @@ def find_best_match(family, bold=False, italic=False, monospaced=True): if val: candidates = font_map[map_key].get(family_name_to_key(val)) if candidates: + if len(candidates) == 1: + # happens if the family name is an alias, so we search with + # the actual family name to see if we can find all the + # fonts in the family. + full_name_candidates = font_map['family_map'].get(family_name_to_key(candidates[0]['family'])) + if full_name_candidates and len(full_name_candidates) > 1: + candidates = full_name_candidates candidates.sort(key=score) return candidates[0]