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¶
|
Return the first installed UI family, or "" to let Qt choose. |
|
Return the first installed monospace family, or the generic alias. |
|
Build a UI font of px device-independent pixels. |
|
Build a monospace font of px device-independent pixels. |
|
UI stack as a stylesheet |
|
Monospace stack as a stylesheet |
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.