Flip to using scaled hi DPI detected by Qt

status_bar
Tyler Goodlet 2021-06-03 08:53:12 -04:00
parent bb1c549d94
commit 193f4f945c
1 changed files with 7 additions and 5 deletions

View File

@ -32,8 +32,10 @@ log = get_logger(__name__)
# chart-wide fonts specified in inches # chart-wide fonts specified in inches
_font_sizes: Dict[str, Dict[str, float]] = { _font_sizes: Dict[str, Dict[str, float]] = {
'hi': { 'hi': {
'default': 0.0616, # 'default': 0.0616,
'small': 0.055, 'default': 0.0616 * 2,
# 'small': 0.055,
'small': 6/66 * (1 + 6/16),
}, },
'lo': { 'lo': {
'default': 6.5 / 64, 'default': 6.5 / 64,
@ -95,7 +97,7 @@ class DpiAwareFont:
# take the max since scaling can make things ugly in some cases # take the max since scaling can make things ugly in some cases
pdpi = screen.physicalDotsPerInch() pdpi = screen.physicalDotsPerInch()
ldpi = screen.logicalDotsPerInch() ldpi = screen.logicalDotsPerInch()
dpi = max(pdpi, ldpi) dpi = min(pdpi, ldpi)
# for low dpi scale everything down # for low dpi scale everything down
if dpi <= 97: if dpi <= 97:
@ -105,8 +107,8 @@ class DpiAwareFont:
font_size = math.floor(inches * dpi) font_size = math.floor(inches * dpi)
log.info( log.info(
f"\nscreen:{screen.name()} with DPI: {dpi}" f"\nscreen:{screen.name()} with pDPI: {pdpi}, lDPI: {ldpi}"
f"\nbest font size is {font_size}\n" f"\nbest font size is {font_size} for min dpi {dpi}\n"
) )
self._set_qfont_px_size(font_size) self._set_qfont_px_size(font_size)