diff --git a/arguments.md b/arguments.md index 819d4a1..5fb807c 100644 --- a/arguments.md +++ b/arguments.md @@ -169,3 +169,13 @@ Show the score on triumph or hits instead of the total of each Default: False Action: store_true + +--- + +### mono + +Use a monospace font + +Default: False + +Action: store_true diff --git a/cromulant/args.py b/cromulant/args.py index 25255c2..da5cc77 100644 --- a/cromulant/args.py +++ b/cromulant/args.py @@ -27,6 +27,7 @@ class Args: slow_minutes: float = 0.0 argdoc: bool = False score: bool = False + mono: bool = False @staticmethod def prepare() -> None: @@ -58,6 +59,7 @@ class Args: "slow_minutes", "argdoc", "score", + "mono", ] for n_item in normals: diff --git a/cromulant/argspec.py b/cromulant/argspec.py index 466ea50..07e1015 100644 --- a/cromulant/argspec.py +++ b/cromulant/argspec.py @@ -172,3 +172,9 @@ class ArgSpec: action="store_true", info="Show the score on triumph or hits instead of the total of each", ) + + ArgSpec.add_argument( + "mono", + action="store_true", + info="Use a monospace font", + ) diff --git a/cromulant/config.py b/cromulant/config.py index ce3fa21..5b16cee 100644 --- a/cromulant/config.py +++ b/cromulant/config.py @@ -31,6 +31,7 @@ class Config: info_separator: str = " - " font_path: Path emoji_font_path: Path + mono_font_path: Path triumph_color: tuple[int, int, int] = (255, 255, 0) hit_color: tuple[int, int, int] = (255, 0, 77) triumph_icon: str = "😀" @@ -97,6 +98,7 @@ class Config: Config.terminated_image_path = Config.here / "img" / "terminated.jpg" Config.font_path = Config.here / "fonts" / "NotoSans-Regular.ttf" Config.emoji_font_path = Config.here / "fonts" / "NotoEmoji-Regular.ttf" + Config.mono_font_path = Config.here / "fonts" / "NotoSansMono-Regular.ttf" Config.song_path = Config.here / "audio" / "March of the Cyber Ants.mp3" Config.logo_path = Config.here / "img" / "logo_3.jpg" Config.arguments_path = Config.here / ".." / "arguments.md" diff --git a/cromulant/fonts/NotoSansMono-Regular.ttf b/cromulant/fonts/NotoSansMono-Regular.ttf new file mode 100644 index 0000000..c2bbb5a Binary files /dev/null and b/cromulant/fonts/NotoSansMono-Regular.ttf differ diff --git a/cromulant/window.py b/cromulant/window.py index 7d25525..f0d662a 100644 --- a/cromulant/window.py +++ b/cromulant/window.py @@ -118,6 +118,7 @@ class Window: info: QPushButton font: str emoji_font: str + mono_font: str player: QMediaPlayer audio: QAudioOutput filter: QLineEdit @@ -156,6 +157,7 @@ class Window: def set_style() -> None: font_id = QFontDatabase.addApplicationFont(str(Config.font_path)) emoji_font_id = QFontDatabase.addApplicationFont(str(Config.emoji_font_path)) + mono_font_id = QFontDatabase.addApplicationFont(str(Config.mono_font_path)) if font_id != -1: Window.font = QFontDatabase.applicationFontFamilies(font_id)[0] @@ -163,6 +165,9 @@ class Window: if emoji_font_id != -1: Window.emoji_font = QFontDatabase.applicationFontFamilies(emoji_font_id)[0] + if mono_font_id != -1: + Window.mono_font = QFontDatabase.applicationFontFamilies(mono_font_id)[0] + style = f""" QWidget {{ @@ -255,7 +260,11 @@ class Window: """.strip() Window.app.setStyleSheet(style) - Window.app.setFont(Window.font) + + if Args.mono: + Window.app.setFont(Window.mono_font) + else: + Window.app.setFont(Window.font) @staticmethod def add_buttons() -> None: