diff --git a/assets/fonts/Inter-Bold.ttf b/assets/fonts/Inter-Bold.ttf new file mode 100644 index 0000000..15e908f Binary files /dev/null and b/assets/fonts/Inter-Bold.ttf differ diff --git a/assets/fonts/Inter-Regular.ttf b/assets/fonts/Inter-Regular.ttf new file mode 100644 index 0000000..c544be4 Binary files /dev/null and b/assets/fonts/Inter-Regular.ttf differ diff --git a/assets/fonts/MapleMono-Regular.ttf b/assets/fonts/MapleMono-Regular.ttf new file mode 100644 index 0000000..b3deb40 Binary files /dev/null and b/assets/fonts/MapleMono-Regular.ttf differ diff --git a/scripts/tasks/download_fonts.py b/scripts/tasks/download_fonts.py new file mode 100644 index 0000000..e8cf167 --- /dev/null +++ b/scripts/tasks/download_fonts.py @@ -0,0 +1,21 @@ +import urllib.request +import os +import ssl +import zipfile +import io + +ssl._create_default_https_context = ssl._create_unverified_context + +inter_url = "https://github.com/rsms/inter/releases/download/v4.0/Inter-4.0.zip" +print(f"Downloading Inter from {inter_url}") +try: + req = urllib.request.Request(inter_url, headers={'User-Agent': 'Mozilla/5.0'}) + with urllib.request.urlopen(req) as response: + with zipfile.ZipFile(io.BytesIO(response.read())) as z: + for info in z.infolist(): + if info.filename.endswith("Inter-Regular.ttf") or info.filename.endswith("Inter-Bold.ttf"): + info.filename = os.path.basename(info.filename) + z.extract(info, "assets/fonts/") + print(f"Extracted {info.filename}") +except Exception as e: + print(f"Failed to get Inter: {e}") diff --git a/src/gui_2.py b/src/gui_2.py index c62af10..e59594d 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -2754,7 +2754,15 @@ class App: def _load_fonts(self) -> None: font_path, font_size = theme.get_font_loading_params() if font_path and Path(font_path).exists(): - hello_imgui.load_font(font_path, font_size) + self.main_font = hello_imgui.load_font_ttf_with_font_awesome_icons(font_path, font_size) + else: + self.main_font = None + + mono_path = Path("assets/fonts/MapleMono-Regular.ttf") + if mono_path.exists(): + self.mono_font = hello_imgui.load_font(str(mono_path), font_size) + else: + self.mono_font = None def _post_init(self) -> None: theme.apply_current() diff --git a/src/theme_2.py b/src/theme_2.py index e1c596b..bbe72b6 100644 --- a/src/theme_2.py +++ b/src/theme_2.py @@ -241,7 +241,7 @@ def load_from_config(config: dict) -> None: global _current_font_path, _current_font_size, _current_scale, _current_palette t = config.get("theme", {}) _current_palette = t.get("palette", "ImGui Dark") - _current_font_path = t.get("font_path", "") + _current_font_path = t.get("font_path", "assets/fonts/Inter-Regular.ttf") _current_font_size = float(t.get("font_size", 16.0)) _current_scale = float(t.get("scale", 1.0)) # Don't apply here — imgui context may not exist yet.