The return value of QFontMetricsF::boundingRect and tightBoundingRect are incorrect when using the new DirectWrite font engine. The X and Y origins are both wrong, as is the height. The width is correct.
To see the problem, build and run the attached test app. Observe that the bounding rectangle is correct without DirectWrite. Then switch on the 'DirectWrite' checkbox and see that the bounding rectangle moves.
The error seems to be in QFontEngineDirectWrite::boundingBox(glyph_t g). This currently returns like this:
return glyph_metrics_t(-leftSideBearing, -verticalOriginY,
width, m_ascent + m_descent,
but should be
QFixed height = advanceHeight - topSideBearing - bottomSideBearing;
return glyph_metrics_t(leftSideBearing, -verticalOriginY + topSideBearing,
where topSideBearing and bottomSideBearing are extracted from the DWRITE_GLYPH_METRICS structure just like the other variables. The documentation at http://msdn.microsoft.com/en-us/library/windows/desktop/dd368084(v=VS.85).aspx gives the relationship between these metrics and explains why the original code in Qt 4.8 isn't quite right - the leftSideBearing is negative if the black box extends to the left of the layout box, and the vertical origin is the top of the layout box, not the black box.