mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-20 23:44:59 +02:00
IBM Plex Mono workaround is needed only under fontconfig
This commit is contained in:
@@ -81,15 +81,10 @@ def get_variable_data_for_face(d: Face) -> VariableData:
|
||||
def find_best_match_in_candidates(
|
||||
candidates: List[DescriptorVar], scorer: Scorer, is_medium_face: bool, ignore_face: Optional[DescriptorVar] = None
|
||||
) -> Optional[DescriptorVar]:
|
||||
if not candidates:
|
||||
return None
|
||||
if len(candidates) == 1 and not is_medium_face and candidates[0].get('family') == candidates[0].get('full_name'):
|
||||
# IBM Plex Mono does this, where the full name of the regular font
|
||||
# face is the same as its family name
|
||||
return None
|
||||
for x in scorer.sorted_candidates(candidates):
|
||||
if ignore_face is None or x != ignore_face:
|
||||
return x
|
||||
if candidates:
|
||||
for x in scorer.sorted_candidates(candidates):
|
||||
if ignore_face is None or x != ignore_face:
|
||||
return x
|
||||
return None
|
||||
|
||||
def pprint(*a: Any) -> None:
|
||||
|
||||
@@ -182,10 +182,10 @@ def find_best_match(
|
||||
m = font_map[which]
|
||||
cq = m.get(q, [])
|
||||
if cq:
|
||||
if which == 'full_map' and cq[0]['family'] == cq[0]['full_name']:
|
||||
continue # IBM Plex Mono has fullname of regular face == family_name under fontconfig
|
||||
exact_match = find_best_match_in_candidates(cq, scorer, is_medium_face, ignore_face=ignore_face)
|
||||
if exact_match:
|
||||
# dump_sorted_candidates(bold, italic, cq, scorer)
|
||||
assert exact_match['descriptor_type'] == 'fontconfig'
|
||||
return exact_match
|
||||
|
||||
# Use fc-match to see if we can find a monospaced font that matches family
|
||||
|
||||
Reference in New Issue
Block a user