From a8ce74a784abc21de84be9c68046a14b2e56d6ab Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 15 Aug 2017 14:47:03 +1000 Subject: [PATCH] compensate for qt's integer scaling on windows fixes https://anki.tenderapp.com/discussions/beta-testing/687-high-resolution-display-scaling-issue --- aqt/webview.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/aqt/webview.py b/aqt/webview.py index 1f0641ac0..9561a2068 100644 --- a/aqt/webview.py +++ b/aqt/webview.py @@ -155,13 +155,21 @@ class AnkiWebView(QWebEngineView): if oldFocus: oldFocus.setFocus() - # need to do this manually for Linux as Qt doesn't automatically scale webview def zoomFactor(self): - if not isLin: + if isMac: return 1 screen = QApplication.desktop().screen() dpi = screen.logicalDpiX() - return max(1, dpi / 96.0) + factor = dpi / 96.0 + if isLin: + factor = max(1, factor) + return factor + # compensate for qt's integer scaling + # on windows + qtIntScale = 72/screen.physicalDpiX() + desiredScale = factor * qtIntScale + newFactor = desiredScale / qtIntScale + return newFactor def stdHtml(self, body, css=[], js=["jquery.js"], head=""): if isWin: