Font size tweaks for low dpi
parent
36445363a0
commit
c18a37c75b
|
@ -18,6 +18,7 @@
|
||||||
Qt UI styling.
|
Qt UI styling.
|
||||||
"""
|
"""
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
import math
|
||||||
|
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
from PyQt5 import QtCore, QtGui
|
from PyQt5 import QtCore, QtGui
|
||||||
|
@ -27,10 +28,9 @@ from ..log import get_logger
|
||||||
|
|
||||||
log = get_logger(__name__)
|
log = get_logger(__name__)
|
||||||
|
|
||||||
# chart-wide font
|
# chart-wide fonts specified in inches
|
||||||
# font size 6px / 53 dpi (3x scaled down on 4k hidpi)
|
_default_font_inches_we_like = 0.0666
|
||||||
_default_font_inches_we_like = 6 / 53 # px / (px / inch) = inch
|
_down_2_font_inches_we_like = 6 / 96
|
||||||
_down_2_font_inches_we_like = 4 / 53
|
|
||||||
|
|
||||||
|
|
||||||
class DpiAwareFont:
|
class DpiAwareFont:
|
||||||
|
@ -66,8 +66,12 @@ class DpiAwareFont:
|
||||||
listed in the script in ``snippets/qt_screen_info.py``.
|
listed in the script in ``snippets/qt_screen_info.py``.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
dpi = screen.physicalDotsPerInch()
|
# take the max since scaling can make things ugly in some cases
|
||||||
font_size = round(self._iwl * dpi)
|
pdpi = screen.physicalDotsPerInch()
|
||||||
|
ldpi = screen.logicalDotsPerInch()
|
||||||
|
dpi = max(pdpi, ldpi)
|
||||||
|
|
||||||
|
font_size = math.floor(self._iwl * dpi)
|
||||||
log.info(
|
log.info(
|
||||||
f"\nscreen:{screen.name()} with DPI: {dpi}"
|
f"\nscreen:{screen.name()} with DPI: {dpi}"
|
||||||
f"\nbest font size is {font_size}\n"
|
f"\nbest font size is {font_size}\n"
|
||||||
|
|
Loading…
Reference in New Issue