fix DpiAwareFont default size calculation
parent
9e82a46c0b
commit
4b6bd55df4
|
|
@ -182,7 +182,7 @@ class DpiAwareFont:
|
|||
# always going to hit that error in range mapping from inches:
|
||||
# float to px size: int.
|
||||
self._font_inches = inches
|
||||
font_size = math.floor(inches * dpi)
|
||||
font_size = math.floor(inches * pdpi)
|
||||
|
||||
log.debug(
|
||||
f"screen:{screen.name()}\n"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
from PyQt6 import QtGui
|
||||
from piker.ui._style import DpiAwareFont
|
||||
|
||||
class MockScreen:
|
||||
def physicalDotsPerInch(self):
|
||||
return 169 # example HiDPI
|
||||
def logicalDotsPerInch(self):
|
||||
return 96
|
||||
def name(self):
|
||||
return "MockScreen"
|
||||
|
||||
# create font instance
|
||||
font = DpiAwareFont()
|
||||
|
||||
# pass the mock screen to configure_to_dpi
|
||||
font.configure_to_dpi(screen=MockScreen())
|
||||
|
||||
print("Computed pixel size:", font.px_size)
|
||||
Loading…
Reference in New Issue