From a5ad24f7709e2ea252dd3038b8f508cbdfe45ac9 Mon Sep 17 00:00:00 2001 From: wattygetlood Date: Tue, 8 Feb 2022 09:41:20 -0500 Subject: [PATCH] Additionally apply DPI scaling to font size if detected --- piker/ui/_style.py | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/piker/ui/_style.py b/piker/ui/_style.py index d751efcb..21f003d8 100644 --- a/piker/ui/_style.py +++ b/piker/ui/_style.py @@ -123,28 +123,27 @@ class DpiAwareFont: mult = 1.0 + # No implicit DPI scaling was done by the DE so let's engage + # some hackery ad-hoc scaling shiat. + # dpi is likely somewhat scaled down so use slightly larger font size + if scale >= 1.1 and self._font_size: + + # no idea why + if 1.2 <= scale: + mult = 1.0375 + + if scale >= 1.5: + mult = 1.375 + + # TODO: this multiplier should probably be determined from + # relative aspect ratios or something? + inches *= mult + #inches = inches*2 if ( hasattr(Qt, 'AA_EnableHighDpiScaling') and QCoreApplication.testAttribute(Qt.AA_EnableHighDpiScaling) ): - inches *= scale - - # No implicit DPI scaling was done by the DE so let's engage - # some hackery ad-hoc scaling shiat. - else: - # dpi is likely somewhat scaled down so use slightly larger font size - if scale >= 1.1 and self._font_size: - - # no idea why - if 1.2 <= scale: - mult = 1.0375 - - if scale >= 1.5: - mult = 1.375 - - # TODO: this multiplier should probably be determined from - # relative aspect ratios or something? - inches *= mult + inches *= round(scale) # TODO: we might want to fiddle with incrementing font size by # +1 for the edge cases above. it seems doing it via scaling is