diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 5e2a5b8..28bd282 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -217,12 +217,16 @@ static void initFontUnlocked()
 {
     if (!QGuiApplicationPrivate::app_font) {
         if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
-            if (const QFont *font = theme->font(QPlatformTheme::SystemFont))
+            if (const QFont *font = theme->font(QPlatformTheme::SystemFont)) {
                 QGuiApplicationPrivate::app_font = new QFont(*font);
+                qDebug() << __FUNCTION__ << "theme" << *QGuiApplicationPrivate::app_font;
+            }
     }
-    if (!QGuiApplicationPrivate::app_font)
+    if (!QGuiApplicationPrivate::app_font) {
         QGuiApplicationPrivate::app_font =
             new QFont(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFont());
+        qDebug() << __FUNCTION__ << "FontDB defailt" << *QGuiApplicationPrivate::app_font;
+    }
 }
 
 static inline void clearFontUnlocked()
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index de586ac..ec5f06b 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -136,6 +136,7 @@ QDpi QHighDpiScaling::m_logicalDpi = QDpi(-1,-1); // The scaled logical DPI of t
 */
 void QHighDpiScaling::initHighDpiScaling()
 {
+    qDebug() << __FUNCTION__;
     if (QCoreApplication::testAttribute(Qt::AA_NoHighDpiScaling)) {
         m_factor = 1;
         m_active = false;
@@ -204,6 +205,7 @@ void QHighDpiScaling::updateHighDpiScaling()
     QPlatformScreen *primaryScreen = QGuiApplication::primaryScreen()->handle();
     qreal sf = screenSubfactor(primaryScreen);
     QDpi primaryDpi = primaryScreen->logicalDpi();
+    qDebug() << __FUNCTION__ << "updating m_logicalDpi=" << m_logicalDpi << primaryDpi;
     m_logicalDpi = QDpi(primaryDpi.first / sf, primaryDpi.second / sf);
 }
 
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index b6b5037..be664b6 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -66,6 +66,7 @@ QT_BEGIN_NAMESPACE
 QScreen::QScreen(QPlatformScreen *screen)
     : QObject(*new QScreenPrivate(), 0)
 {
+    qDebug(__FUNCTION__);
     Q_D(QScreen);
     d->setPlatformScreen(screen);
 }
@@ -249,9 +250,13 @@ qreal QScreen::logicalDotsPerInchX() const
 */
 qreal QScreen::logicalDotsPerInchY() const
 {
+    qDebug() << __FUNCTION__;
     Q_D(const QScreen);
-    if (QHighDpiScaling::isActive())
+    if (QHighDpiScaling::isActive()) {
+         qDebug() << __FUNCTION__ << "scaling, using: " << QHighDpiScaling::logicalDpi();
         return QHighDpiScaling::logicalDpi().second;
+    }
+    qDebug() <<  __FUNCTION__ << d->logicalDpi.second;
     return d->logicalDpi.second;
 }
 
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 89bd119..7473583 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -148,6 +148,7 @@ QWindow::QWindow(QScreen *targetScreen)
     : QObject(*new QWindowPrivate(), 0)
     , QSurface(QSurface::Window)
 {
+    qDebug(__FUNCTION__);
     Q_D(QWindow);
     d->connectToScreen(targetScreen ? targetScreen : QGuiApplication::primaryScreen());
     d->init();
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 796f223..d18ccb9 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -152,8 +152,11 @@ Q_GUI_EXPORT int qt_defaultDpiY()
     if (!qt_is_gui_used)
         return 75;
 
-    if (const QScreen *screen = QGuiApplication::primaryScreen())
-        return qRound(screen->logicalDotsPerInchY());
+    if (const QScreen *screen = QGuiApplication::primaryScreen()) {
+        int r = qRound(screen->logicalDotsPerInchY());
+        qDebug() << __FUNCTION__ << r;
+        return r;
+    }
 
     //PI has not been initialised, or it is being initialised. Give a default dpi
     return 100;
@@ -169,6 +172,7 @@ QFontPrivate::QFontPrivate()
       underline(false), overline(false), strikeOut(false), kerning(true),
       capital(0), letterSpacingIsAbsolute(false), scFont(0)
 {
+    qDebug() << __FUNCTION__ << dpi;
 }
 
 QFontPrivate::QFontPrivate(const QFontPrivate &other)
@@ -179,6 +183,7 @@ QFontPrivate::QFontPrivate(const QFontPrivate &other)
       letterSpacing(other.letterSpacing), wordSpacing(other.wordSpacing),
       scFont(other.scFont)
 {
+    qDebug() << __FUNCTION__  << "dpi=" << dpi;
     if (scFont && scFont != this)
         scFont->ref.ref();
 }
@@ -543,13 +548,19 @@ QFont::QFont(const QFont &font, QPaintDevice *pd)
 {
     Q_ASSERT(pd != 0);
     int dpi = pd->logicalDpiY();
+    qDebug() << __FUNCTION__ << font.family()
+             << "font.d->dpi" << font.d->dpi << "QPaintDevice::dpi=" << dpi << pd;
+    if (dpi < 0)
+        qDebug() << "NEG DPI";
     const int screen = 0;
     if (font.d->dpi != dpi || font.d->screen != screen ) {
         d = new QFontPrivate(*font.d);
         d->dpi = dpi;
+        qDebug() << __FUNCTION__ << "Assigning" << dpi;
         d->screen = screen;
     } else {
         d = font.d.data();
+        qDebug() << __FUNCTION__ << "copy font.d";
     }
 }
 
@@ -648,6 +659,8 @@ QFont::QFont(const QString &family, int pointSize, int weight, bool italic)
     d->request.pixelSize = -1;
     d->request.weight = weight;
     d->request.style = italic ? QFont::StyleItalic : QFont::StyleNormal;
+    qDebug() << __FUNCTION__ << family << "dpi=" << d->dpi
+             << "rm=" << hex << resolve_mask;
 }
 
 /*!
@@ -656,8 +669,10 @@ QFont::QFont(const QString &family, int pointSize, int weight, bool italic)
 QFont::QFont(const QFont &font)
     : d(font.d.data()), resolve_mask(font.resolve_mask)
 {
+    qDebug() << "COPY_CT" << *this << "dpi=" << d->dpi << "rhs_dpi="<<font.d.data()->dpi;
 }
 
+
 /*!
     Destroys the font object and frees all allocated resources.
 */
@@ -875,13 +890,16 @@ QFont::HintingPreference QFont::hintingPreference() const
 */
 void QFont::setPointSize(int pointSize)
 {
+    qDebug() << __FUNCTION__ << pointSize << "DPI=" << d->dpi;
     if (pointSize <= 0) {
         qWarning("QFont::setPointSize: Point size <= 0 (%d), must be greater than 0", pointSize);
         return;
     }
 
-    if ((resolve_mask & QFont::SizeResolved) && d->request.pointSize == qreal(pointSize))
+    if ((resolve_mask & QFont::SizeResolved) && d->request.pointSize == qreal(pointSize)) {
+         qDebug() << __FUNCTION__ << "RET";
         return;
+    }
 
     detach();
 
@@ -889,6 +907,7 @@ void QFont::setPointSize(int pointSize)
     d->request.pixelSize = -1;
 
     resolve_mask |= QFont::SizeResolved;
+    qDebug() << __FUNCTION__ << "<DPI=" << d->dpi;
 }
 
 /*!
@@ -900,6 +919,7 @@ void QFont::setPointSize(int pointSize)
 */
 void QFont::setPointSizeF(qreal pointSize)
 {
+    qDebug() << __FUNCTION__ << pointSize << "dpi=" << d->dpi;
     if (pointSize <= 0) {
         qWarning("QFont::setPointSizeF: Point size <= 0 (%f), must be greater than 0", pointSize);
         return;
@@ -909,11 +929,13 @@ void QFont::setPointSizeF(qreal pointSize)
         return;
 
     detach();
+    qDebug() << __FUNCTION__ << "detach, dpi=" << d->dpi;
 
     d->request.pointSize = pointSize;
     d->request.pixelSize = -1;
 
     resolve_mask |= QFont::SizeResolved;
+    qDebug() << __FUNCTION__ << "dpi=" << d->dpi;
 }
 
 /*!
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 8090812..616ddb0 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2662,6 +2662,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
     if (req.pixelSize == -1) {
         req.pixelSize = std::floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100;
         req.pixelSize = qRound(req.pixelSize);
+        qDebug() << __FUNCTION__ << "QFontPrivate::dpi=" << d->dpi;
     }
     if (req.pointSize < 0)
         req.pointSize = req.pixelSize*72.0/d->dpi;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 6b98c14..83e970a 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2323,14 +2323,18 @@ void QTextEngine::justify(const QScriptLine &line)
 void QScriptLine::setDefaultHeight(QTextEngine *eng)
 {
     QFont f;
+    qDebug() << __FUNCTION__ << "QFont" << f << "QFOnt::dpi=" << f.d->dpi;
     QFontEngine *e;
 
     if (eng->block.docHandle() && eng->block.docHandle()->layout()) {
         f = eng->block.charFormat().font();
         // Make sure we get the right dpi on printers
         QPaintDevice *pdev = eng->block.docHandle()->layout()->paintDevice();
-        if (pdev)
+qDebug() << __FUNCTION__ << "QPaintDevice=" << pdev;
+        if (pdev) {
+            qDebug() << __FUNCTION__ << "QPaintDevice::logDpi=" << pdev->logicalDpiX();
             f = QFont(f, pdev);
+        }
         e = f.d->engineForScript(QChar::Script_Common);
     } else {
         e = eng->fnt.d->engineForScript(QChar::Script_Common);
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 3b27964..09789a6 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1088,7 +1088,9 @@ QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *ha
     QFontEngine *fe = QWindowsFontDatabase::createEngine(fontDef,
                                                          QWindowsContext::instance()->defaultDPI(),
                                                          sharedFontData());
-    qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef << fe << handle;
+    qDebug() << __FUNCTION__ << "FONTDEF" << fontDef << fe << handle;
+    if (!fontDef.pixelSize)
+        qDebug("NUULLLL");
     return fe;
 }
 
@@ -1758,14 +1760,16 @@ QFont QWindowsFontDatabase::systemDefaultFont()
     // "MS Shell Dlg 2" is the correct system font >= Win2k
     if (systemFont.family() == QLatin1String("MS Shell Dlg"))
         systemFont.setFamily(QStringLiteral("MS Shell Dlg 2"));
-    qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont;
+    qDebug() << __FUNCTION__ << systemFont;
     return systemFont;
 }
 
 QFont QWindowsFontDatabase::LOGFONT_to_QFont(const LOGFONT& logFont, int verticalDPI_In)
 {
+    qDebug() << __FUNCTION__  << "verticalDPI_In=" << verticalDPI_In;
     if (verticalDPI_In <= 0)
         verticalDPI_In = verticalDPI();
+    qDebug() << __FUNCTION__  << "verticalDPI_In2=" << verticalDPI_In;
     QFont qFont(QString::fromWCharArray(logFont.lfFaceName));
     qFont.setItalic(logFont.lfItalic);
     if (logFont.lfWeight != FW_DONTCARE)
