mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-12 19:49:32 +02:00
Show the postscript variations name prefix when listing fonts
This commit is contained in:
@@ -31,7 +31,7 @@ class NamedStyle(TypedDict):
|
||||
class VariableData(TypedDict):
|
||||
axes: Tuple[VariableAxis, ...]
|
||||
named_styles: Tuple[NamedStyle, ...]
|
||||
|
||||
variations_postscript_name_prefix: str
|
||||
|
||||
|
||||
class FontFeature:
|
||||
|
||||
@@ -51,11 +51,11 @@ def create_font_map(all_fonts: Tuple[FontConfigPattern, ...]) -> FontMap:
|
||||
@lru_cache()
|
||||
def all_fonts_map(monospaced: bool = True) -> FontMap:
|
||||
if monospaced:
|
||||
ans = fc_list(FC_DUAL) + fc_list(FC_MONO)
|
||||
ans = fc_list(spacing=FC_DUAL) + fc_list(spacing=FC_MONO)
|
||||
else:
|
||||
# allow non-monospaced and bitmapped fonts as these are used for
|
||||
# symbol_map
|
||||
ans = fc_list(-1, True)
|
||||
ans = fc_list(allow_bitmapped_fonts=True)
|
||||
return create_font_map(ans)
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ def create_family_groups(monospaced: bool = True) -> Dict[str, List[ListedFont]]
|
||||
|
||||
def show_variable(f: ListedFont, psnames: bool) -> None:
|
||||
vd = get_variable_data_for_descriptor(f)
|
||||
p = italic(f['family'])
|
||||
p = italic(vd['variations_postscript_name_prefix'] or f['family'])
|
||||
p = f"{p} {variable_font_label('Variable font')}"
|
||||
print(indented(p))
|
||||
print(indented(variable_font_label('Axes of variation'), level=2))
|
||||
|
||||
@@ -849,7 +849,7 @@ get_variable_data(Face *self, PyObject *a UNUSED) {
|
||||
if (!s) return NULL;
|
||||
PyTuple_SET_ITEM(axes, i, s);
|
||||
}
|
||||
return Py_BuildValue("{sO sO}", "axes", axes, "named_styles", named_styles);
|
||||
return Py_BuildValue("{sO sO sN}", "axes", axes, "named_styles", named_styles, "variations_postscript_name_prefix", _get_best_name(self, 25));
|
||||
}
|
||||
|
||||
StringCanvas
|
||||
|
||||
Reference in New Issue
Block a user