25 lines
757 B
Python
25 lines
757 B
Python
"""Font loader - registers bundled Quicksand and Open Sans with Qt."""
|
|
import os
|
|
from PyQt6.QtGui import QFontDatabase
|
|
|
|
_ASSETS_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "assets", "fonts")
|
|
|
|
_FONT_FILES = [
|
|
"Quicksand-Regular.ttf",
|
|
"Quicksand-Medium.ttf",
|
|
"Quicksand-SemiBold.ttf",
|
|
"Quicksand-Bold.ttf",
|
|
"OpenSans-Regular.ttf",
|
|
"OpenSans-SemiBold.ttf",
|
|
"OpenSans-Bold.ttf",
|
|
]
|
|
|
|
|
|
def load_fonts() -> None:
|
|
"""Register all bundled fonts with QFontDatabase. Call once after QApplication is created."""
|
|
fonts_dir = os.path.normpath(_ASSETS_DIR)
|
|
for filename in _FONT_FILES:
|
|
path = os.path.join(fonts_dir, filename)
|
|
if os.path.exists(path):
|
|
QFontDatabase.addApplicationFont(path)
|