If the DE (like windohz) already scales DPI, just use that scale for font size
parent
fc3c0741b8
commit
a0034e2948
|
@ -22,6 +22,7 @@ import math
|
||||||
|
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
from PyQt5 import QtCore, QtGui
|
from PyQt5 import QtCore, QtGui
|
||||||
|
from PyQt5.QtCore import Qt, QCoreApplication
|
||||||
from qdarkstyle import DarkPalette
|
from qdarkstyle import DarkPalette
|
||||||
|
|
||||||
from ..log import get_logger
|
from ..log import get_logger
|
||||||
|
@ -121,6 +122,16 @@ class DpiAwareFont:
|
||||||
dpi = mn_dpi
|
dpi = mn_dpi
|
||||||
|
|
||||||
mult = 1.0
|
mult = 1.0
|
||||||
|
|
||||||
|
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
|
# dpi is likely somewhat scaled down so use slightly larger font size
|
||||||
if scale >= 1.1 and self._font_size:
|
if scale >= 1.1 and self._font_size:
|
||||||
|
|
||||||
|
@ -142,7 +153,7 @@ class DpiAwareFont:
|
||||||
self._font_inches = inches
|
self._font_inches = inches
|
||||||
font_size = math.floor(inches * dpi)
|
font_size = math.floor(inches * dpi)
|
||||||
|
|
||||||
log.debug(
|
log.info(
|
||||||
f"screen:{screen.name()}\n"
|
f"screen:{screen.name()}\n"
|
||||||
f"pDPI: {pdpi}, lDPI: {ldpi}, scale: {scale}\n"
|
f"pDPI: {pdpi}, lDPI: {ldpi}, scale: {scale}\n"
|
||||||
f"\nOur best guess font size is {font_size}\n"
|
f"\nOur best guess font size is {font_size}\n"
|
||||||
|
|
Loading…
Reference in New Issue