diff --git a/docs/changelog.rst b/docs/changelog.rst index 289a5a195..c8a02c78d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -15,6 +15,9 @@ To update |kitty|, :doc:`follow the instructions `. - Allow specifying text formatting in :opt:`tab_title_template` (:iss:`3146`) +- Linux: Read :opt:`font_features` from the FontConfig database as well, so + that they can be configured in a single, central location (:pull:`3174`) + - Graphics protocol: Add support for giving individual image placements their own ids and for asking the terminal emulator to assign ids for images. Also allow suppressing responses from the terminal to commands. diff --git a/kitty/config_data.py b/kitty/config_data.py index 429c1272c..e0cba08a2 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -325,7 +325,8 @@ Note that this code is indexed by PostScript name, and not the font family. This allows you to define very precise feature settings; e.g. you can disable a feature in the italic font but not in the regular font. -By default they are derived automatically, by the OSes font system (linux only). +On Linux, these are read from the FontConfig database first and then this, +setting is applied, so they can be configured in a single, central place. To get the PostScript name for a font, use :code:`kitty + list-fonts --psnames`: diff --git a/kitty/fonts/core_text.py b/kitty/fonts/core_text.py index e61de74db..705caa1d5 100644 --- a/kitty/fonts/core_text.py +++ b/kitty/fonts/core_text.py @@ -52,7 +52,7 @@ def list_fonts() -> Generator[ListedFont, None, None]: def find_font_features(postscript_name: str) -> Tuple[str, ...]: """Not Implemented""" - return tuple() + return () def find_best_match(family: str, bold: bool = False, italic: bool = False) -> CoreTextFont: diff --git a/kitty/fonts/fontconfig.py b/kitty/fonts/fontconfig.py index 88c323788..619340232 100644 --- a/kitty/fonts/fontconfig.py +++ b/kitty/fonts/fontconfig.py @@ -74,8 +74,8 @@ def fc_match(family: str, bold: bool, italic: bool, spacing: int = FC_MONO) -> F def find_font_features(postscript_name: str) -> Tuple[str, ...]: pat = fc_match_postscript_name(postscript_name) - if 'postscript_name' not in pat or pat['postscript_name'] != postscript_name or 'fontfeatures' not in pat: - return tuple() + if pat.get('postscript_name') != postscript_name or 'fontfeatures' not in pat: + return () features = [] for feat in pat['fontfeatures']: