Skip to content

Commit

Permalink
feat(Font): add set_family method
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Dec 6, 2021
1 parent 7c78172 commit c70a688
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions prettyqt/gui/font.py
Expand Up @@ -303,6 +303,18 @@ def get_style(self) -> StyleStr:
"""
return STYLE.inverse[self.style()]

def set_family(self, family: str, fallback: str | None = None):
"""Set the font family.
Args:
family: font family
fallback: fallback font family
"""
self.setFamily(family)
font_info = gui.FontInfo(self)
if fallback is not None and font_info.family() != family:
self.setFamily(fallback)


if __name__ == "__main__":
font = Font("Consolas")

0 comments on commit c70a688

Please sign in to comment.