Add dpi font scale getter
parent
9887b14518
commit
67721a5832
|
@ -56,7 +56,6 @@ class DpiAwareFont:
|
|||
self._qfont = QtGui.QFont(name)
|
||||
self._font_size: str = font_size
|
||||
self._qfm = QtGui.QFontMetrics(self._qfont)
|
||||
self._physical_dpi = None
|
||||
self._font_inches: float = None
|
||||
self._screen = None
|
||||
|
||||
|
@ -82,6 +81,10 @@ class DpiAwareFont:
|
|||
def font(self):
|
||||
return self._qfont
|
||||
|
||||
def scale(self) -> float:
|
||||
screen = self.screen
|
||||
return screen.logicalDotsPerInch() / screen.physicalDotsPerInch()
|
||||
|
||||
@property
|
||||
def px_size(self) -> int:
|
||||
return self._qfont.pixelSize()
|
||||
|
@ -114,7 +117,7 @@ class DpiAwareFont:
|
|||
# dpi is likely somewhat scaled down so use slightly larger font size
|
||||
if scale > 1 and self._font_size:
|
||||
# TODO: this denominator should probably be determined from
|
||||
# relative aspect rations or something?
|
||||
# relative aspect ratios or something?
|
||||
inches = inches * (1 / scale) * (1 + 6/16)
|
||||
dpi = mx_dpi
|
||||
|
||||
|
|
Loading…
Reference in New Issue