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
This commit is contained in:
Kovid Goyal 2018-12-06 08:42:13 +05:30
parent 36b3582825
commit 35653ef4b4
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 0 deletions

View File

@ -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]
------------------------------

View File

@ -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]