wezterm-font: fix exact match of full font name

Don't short circuit on just the family portion of the name;
if the criteria don't match there, we should fall back to
test against the full font name.

closes: https://github.com/wez/wezterm/issues/341
This commit is contained in:
Wez Furlong committed 2020-11-23 15:01:19 -08:00
1 parent d4d3e70a9b
commit 65ac2269dd
1 file changed
+9 -8
+9 -8
View File
@@ -542,16 +542,17 @@ pub fn font_info_matches(attr: &FontAttributes, names: &Names) -> bool {
// this is a pretty rough approximation
if attr.family == *fam {
match names.sub_family.as_ref().map(String::as_str) {
Some("Italic") if attr.italic && !attr.bold => true,
Some("Bold") if attr.bold && !attr.italic => true,
Some("Bold Italic") if attr.bold && attr.italic => true,
Some("Medium") | Some("Regular") | None if !attr.italic && !attr.bold => true,
_ => false,
Some("Italic") if attr.italic && !attr.bold => return true,
Some("Bold") if attr.bold && !attr.italic => return true,
Some("Bold Italic") if attr.bold && attr.italic => return true,
Some("Medium") | Some("Regular") | None if !attr.italic && !attr.bold => {
return true
}
_ => {}
}
} else {
false
}
} else if attr.family == names.full_name && !attr.bold && !attr.italic {
}
if attr.family == names.full_name && !attr.bold && !attr.italic {
true
} else {
false