Re-fmt and `.info()` the `.configure_to_dpi()` DPI calcs for now

dpi_scaling_round2
Tyler Goodlet 2025-12-17 11:42:44 -05:00
parent 47dbed1229
commit 6f9b7320e5
1 changed files with 12 additions and 9 deletions

View File

@ -184,22 +184,25 @@ class DpiAwareFont:
self._font_inches = inches
font_size = math.floor(inches * pdpi)
log.debug(
f"screen:{screen.name()}\n"
f"pDPI: {pdpi}, lDPI: {ldpi}, scale: {scale}\n"
f"\nOur best guess font size is {font_size}\n"
ftype: str = f'{type(self)!r}'
log.info(
f'screen: {screen.name()}\n'
f'pDPI: {pdpi!r}\n'
f'lDPI: {ldpi!r}\n'
f'scale: {scale!r}\n'
f'{ftype}._font_inches={self._font_inches!r}\n'
f'\n'
f"Our best guess for an auto-font-size is,\n"
f'font_size: {font_size!r}\n'
)
# apply the size
self._set_qfont_px_size(font_size)
def boundingRect(self, value: str) -> QtCore.QRectF:
screen = self.screen
if screen is None:
if (screen := self.screen) is None:
raise RuntimeError("You must call .configure_to_dpi() first!")
unscaled_br = self._qfm.boundingRect(value)
unscaled_br: QtCore.QRectF = self._qfm.boundingRect(value)
return QtCore.QRectF(
0,
0,