brain_deer.presentation.typography

Cross-platform font stacks and pixel-based font construction.

Qt reports logical DPI as 72 on macOS but 96 on Windows and ~96-100 on Linux, so a point size resolves to a different pixel height on each platform (QFont("Arial", 12) measures 12px on macOS, 16px on Windows, 17px on a 100dpi Linux screen). BrainDeer’s stylesheets size text in px, which is DPI-invariant, so any point-sized widget drifts away from its stylesheet-sized neighbours off macOS.

Everything here sizes in pixels to stay in the stylesheets’ unit. Both QSS px and QFont.setPixelSize are device-independent pixels and scale together under AA_EnableHighDpiScaling, so this is DPI-invariant without giving up HiDPI support.

Functions

ui_font_family(→ str)

Return the first installed UI family, or "" to let Qt choose.

mono_font_family(→ str)

Return the first installed monospace family, or the generic alias.

ui_font(→ PyQt5.QtGui.QFont)

Build a UI font of px device-independent pixels.

mono_font(→ PyQt5.QtGui.QFont)

Build a monospace font of px device-independent pixels.

qss_ui_family(→ str)

UI stack as a stylesheet font-family value.

qss_mono_family(→ str)

Monospace stack as a stylesheet font-family value.

Module Contents

brain_deer.presentation.typography.ui_font_family() → str

Return the first installed UI family, or “” to let Qt choose.

brain_deer.presentation.typography.mono_font_family() → str

Return the first installed monospace family, or the generic alias.

brain_deer.presentation.typography.ui_font(px: int, weight: int = QFont.Normal) → PyQt5.QtGui.QFont

Build a UI font of px device-independent pixels.

brain_deer.presentation.typography.mono_font(px: int, weight: int = QFont.Normal) → PyQt5.QtGui.QFont

Build a monospace font of px device-independent pixels.

brain_deer.presentation.typography.qss_ui_family() → str

UI stack as a stylesheet font-family value.

brain_deer.presentation.typography.qss_mono_family() → str

Monospace stack as a stylesheet font-family value.