From 427fddb50d43aa21a90fc7356ee3cdd8a908df56 Mon Sep 17 00:00:00 2001 From: Tomi Korpipaa Date: Thu, 7 Oct 2021 09:01:38 +0300 Subject: Take negative leading into account Fixes: QT3DS-4231 Change-Id: Icd2d811c8926e09ce0a33861f7e7282514d8c5f8 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/runtimerender/Qt3DSDistanceFieldRenderer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/runtimerender/Qt3DSDistanceFieldRenderer.cpp b/src/runtimerender/Qt3DSDistanceFieldRenderer.cpp index 3986319..f673f2e 100644 --- a/src/runtimerender/Qt3DSDistanceFieldRenderer.cpp +++ b/src/runtimerender/Qt3DSDistanceFieldRenderer.cpp @@ -224,6 +224,13 @@ Q3DSDistanceFieldRenderer::buildGlyphsPerTexture(const SText &textInfo) width = qMin(maximumWidth, qMax(width, textWidth)); height += layout.engine()->lines[line.lineNumber()].height().toReal(); + // Windows seems to have leading taken into account already in descent, which is used + // to calculate height. Linux and Integrity do not, so we'll need to handle the + // negative leading here. On Windows the leading is not negative, as it has already + // been accounted for in the descent. + const QFixed leading = layout.engine()->lines[line.lineNumber()].leading; + if (leading < 0) + height += leading.toInt(); // Fast path for right elide if (textInfo.m_Elide == TextElide::ElideRight -- cgit v1.2.3