diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index b992e8f55d..916ca8f9f5 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5849,6 +5849,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
     if (qt_show_painter_debug_output)
         printf("QPainter::drawText(), pos=[%.2f,%.2f], str='%s'\n", p.x(), p.y(), str.toLatin1().constData());
 #endif
+    qDebug() << ">QPainter::drawText> " << str;
 
     Q_D(QPainter);
 
@@ -5922,6 +5923,8 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
 
         x += gf.width;
     }
+
+    qDebug() << "<QPainter::drawText> " << str;
 }
 
 void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br)
@@ -6131,6 +6134,7 @@ void QPainter::drawText(const QRectF &r, int flags, const QString &str, QRectF *
 */
 void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption &o)
 {
+    qDebug() << "QPainter::drawText" << r << text  << combinedTransform();
 #ifdef QT_DEBUG_DRAW
     if (qt_show_painter_debug_output)
         printf("QPainter::drawText(), r=[%.2f,%.2f,%.2f,%.2f], str='%s'\n",
@@ -6397,6 +6401,8 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText
 #endif
 
     Q_Q(QPainter);
+    qDebug() << "QPainterPrivate::drawTextItem" << p << _ti.text() << "width=" << _ti.width()
+             << "combinedTransform=" << q->combinedTransform();
 
     if (!engine)
         return;
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index 2957b8d5c0..c1b8693419 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -951,6 +951,7 @@ void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *pain
                                            const QAbstractTextDocumentLayout::PaintContext &context,
                                            QTextFrame *frame) const
 {
+    qDebug() << "QTextDocumentLayoutPrivate::drawFrame";
     QTextFrameData *fd = data(frame);
     // #######
     if (fd->layoutDirty)
@@ -1217,6 +1218,7 @@ void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter
 void QTextDocumentLayoutPrivate::drawFlow(const QPointF &offset, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context,
                                           QTextFrame::Iterator it, const QList<QTextFrame *> &floats, QTextBlock *cursorBlockNeedingRepaint) const
 {
+    qDebug() << "QTextDocumentLayoutPrivate::drawFlow";
     Q_Q(const QTextDocumentLayout);
     const bool inRootFrame = (!it.atEnd() && it.parentFrame() && it.parentFrame()->parentFrame() == 0);
 
@@ -2865,6 +2867,7 @@ QTextDocumentLayout::QTextDocumentLayout(QTextDocument *doc)
 
 void QTextDocumentLayout::draw(QPainter *painter, const PaintContext &context)
 {
+    qDebug() << "QTextDocumentLayout::draw";
     Q_D(QTextDocumentLayout);
     QTextFrame *frame = d->document->rootFrame();
     QTextFrameData *fd = data(frame);
@@ -3115,7 +3118,7 @@ void QTextDocumentLayout::drawInlineObject(QPainter *p, const QRectF &rect, QTex
     if (frame && frame->frameFormat().position() != QTextFrameFormat::InFlow)
         return; // don't draw floating frames from inline objects here but in drawFlow instead
 
-//    qDebug() << "drawObject at" << r;
+    qDebug() << "drawObject at" << rect << "height=" << item.height();
     QAbstractTextDocumentLayout::drawInlineObject(p, rect, item, posInDocument, format);
 }
 
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 5e38311fa1..db45fe4d27 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2760,15 +2760,21 @@ void QScriptLine::setDefaultHeight(QTextEngine *eng)
 {
     QFont f;
     QFontEngine *e;
+    qDebug() << "QScriptLine::setDefaultHeight" << eng->block.text();
 
     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() << "QScriptLine::setDefaultHeight" << pdev->devType() << "dpi"<< pdev->logicalDpiX();        
+        else
+            qDebug() << "pdev=0";
         if (pdev)
             f = QFont(f, pdev);
         e = f.d->engineForScript(QChar::Script_Common);
     } else {
+        qDebug() << "QChar::Script_Common";
         e = eng->fnt.d->engineForScript(QChar::Script_Common);
     }
 
@@ -2778,6 +2784,8 @@ void QScriptLine::setDefaultHeight(QTextEngine *eng)
     leading = qMax(leading + ascent, other_leading + other_ascent) - qMax(ascent, other_ascent);
     ascent = qMax(ascent, other_ascent);
     descent = qMax(descent, other_descent);
+    qDebug() << "QScriptLine::setDefaultHeight:" << leading << ascent << descent;
+
 }
 
 QTextEngine::LayoutData::LayoutData()
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 6e824b2ed1..c660ff0df7 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2437,6 +2437,7 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
 */
 void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatRange *selection) const
 {
+    qDebug() << "QTextLine::draw";
 #ifndef QT_NO_RAWFONT
     // Not intended to work with rawfont
     Q_ASSERT(!eng->useRawFont);
@@ -2463,6 +2464,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
 
     QTextLineItemIterator iterator(eng, index, pos, selection);
     QFixed lineBase = line.base();
+    qDebug() << "lineBase=" << lineBase.toReal();
     eng->clearDecorations();
     eng->enableDelayDecorations();
 
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 37c631483a..e08e218014 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -1768,6 +1768,11 @@ void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRect
                             Qt::AspectRatioMode aspectRatioMode)
 {
     // ### Switch to using the recursive rendering algorithm instead.
+    int ldpi = painter->device()->logicalDpiX();
+    int pdpi = painter->device()->physicalDpiX();
+    qDebug() << "\nQGraphicsScene::render target="  <<  target << "source="
+             << source << aspectRatioMode
+             << "\nlogicalDpi=" << ldpi << "physicalDpi" << pdpi;
 
     // Default source rect = scene rect
     QRectF sourceRect = source;
@@ -1782,6 +1787,7 @@ void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRect
         else
             targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height());
     }
+    qDebug() << "source=" << sourceRect << "target=" <<  targetRect;
 
     // Find the ideal x / y scaling ratio to fit \a source into \a target.
     qreal xratio = targetRect.width() / sourceRect.width();
@@ -1817,6 +1823,7 @@ void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRect
                         .translate(targetRect.left(), targetRect.top())
                         .scale(xratio, yratio)
                         .translate(-sourceRect.left(), -sourceRect.top());
+    qDebug() << "painter->setWorldTransform=" << painterTransform;
     painter->setWorldTransform(painterTransform, true);
 
     // Generate the style options
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index d3203e180b..6b307f1462 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -3221,7 +3221,7 @@ QAbstractTextDocumentLayout::PaintContext QWidgetTextControl::getPaintContext(QW
     return ctx;
 }
 
-void QWidgetTextControl::drawContents(QPainter *p, const QRectF &rect, QWidget *widget)
+void QWidgetTextControl:: drawContents(QPainter *p, const QRectF &rect, QWidget *widget)
 {
     Q_D(QWidgetTextControl);
     p->save();
@@ -3230,6 +3230,14 @@ void QWidgetTextControl::drawContents(QPainter *p, const QRectF &rect, QWidget *
         p->setClipRect(rect, Qt::IntersectClip);
     ctx.clip = rect;
 
+    qDebug() << "QWidgetTextControl::" << __FUNCTION__
+             << "\n  " << p->font()
+                << "\n  transform=" << p->transform()
+                << "\n  deviceTransform=" << p->deviceTransform()
+                << "\n  combinedTransform=" << p->combinedTransform()
+                << "\n  dpi=" << p->device()->logicalDpiX()
+                << d->doc->toPlainText();
+
     d->doc->documentLayout()->draw(p, ctx);
     p->restore();
 }
