Re-fmt and `.info()` the `.configure_to_dpi()` DPI calcs for now
parent
47dbed1229
commit
6f9b7320e5
|
|
@ -184,22 +184,25 @@ class DpiAwareFont:
|
||||||
self._font_inches = inches
|
self._font_inches = inches
|
||||||
font_size = math.floor(inches * pdpi)
|
font_size = math.floor(inches * pdpi)
|
||||||
|
|
||||||
log.debug(
|
ftype: str = f'{type(self)!r}'
|
||||||
f"screen:{screen.name()}\n"
|
log.info(
|
||||||
f"pDPI: {pdpi}, lDPI: {ldpi}, scale: {scale}\n"
|
f'screen: {screen.name()}\n'
|
||||||
f"\nOur best guess font size is {font_size}\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
|
# apply the size
|
||||||
self._set_qfont_px_size(font_size)
|
self._set_qfont_px_size(font_size)
|
||||||
|
|
||||||
def boundingRect(self, value: str) -> QtCore.QRectF:
|
def boundingRect(self, value: str) -> QtCore.QRectF:
|
||||||
|
if (screen := self.screen) is None:
|
||||||
screen = self.screen
|
|
||||||
if screen is None:
|
|
||||||
raise RuntimeError("You must call .configure_to_dpi() first!")
|
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(
|
return QtCore.QRectF(
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue