From 85f816e42d65872cc0be7ba1da6355694e39cd78 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 29 Oct 2018 20:01:05 +0100 Subject: [PATCH] broken implementation of Qt::AlignBottom fixed --- src/nodes/QskPlainTextRenderer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/nodes/QskPlainTextRenderer.cpp b/src/nodes/QskPlainTextRenderer.cpp index 6659b773..4f18b0af 100644 --- a/src/nodes/QskPlainTextRenderer.cpp +++ b/src/nodes/QskPlainTextRenderer.cpp @@ -181,12 +181,21 @@ void QskPlainTextRenderer::updateNode( const QString& text, const qreal textHeight = qskLayoutText( &layout, rect.width(), options ); layout.endLayout(); - qreal yBaseline = QFontMetricsF( font ).ascent(); + const qreal y0 = QFontMetricsF( font ).ascent(); + + qreal yBaseline = y0; if ( alignment & Qt::AlignVCenter ) { yBaseline += ( rect.height() - textHeight ) * 0.5; + } + else if ( alignment & Qt::AlignBottom ) + { + yBaseline += rect.height() - textHeight; + } + if ( yBaseline != y0 ) + { /* We need to have a stable algo for rounding the text base line, so that texts don't start wobbling, when processing transitions