Created attachment 161873 [details] Demonstration of issue SUMMARY Standard page headings elide inappropriately with 8pt fonts. STEPS TO REPRODUCE 1. Set General font size in Fonts to 8pt. 2. Observe any Kirigami page heading OBSERVED RESULT Heading elides inappropriately in the middle, with clearly sufficient space not to. EXPECTED RESULT Heading wouldn't elide it runs out of space. SOFTWARE/OS VERSIONS KDE Plasma Version: 5.27.80 KDE Frameworks Version: 5.240.0 Qt Version: 6.5.2 Reproduced on Plasma 5 (plasma 5.27.8, kf 5.110.0, qt 5.15.10).
Created attachment 161887 [details] System Settings — white gap Not only that. It also resulted in amazing white stripe gap in System Settings sidebar. What an interesting font size it is.
Well, it's not a simple rounding error this time, it seems. I inspected one such title in GammaRay, and here are all its *width properties: globalToolBar -> ToolBarPageHeader -> … -> titleLoader -> DefaultPageTitleDelegate -> Heading - contentWidth: 34.453125 - implicitBackgroundWidth: 0 - implicitWidth: 38.984375 - paintedWidth: 34.453125 - width: 37 so for a string "Chips" which would normally take up 38.984375 px it displays "Chi…" that takes up 34.453125 px, and the whole thing is set to 37 px for whatever reason that doesn't match any of those previous values.
Apparently, TextMetrics is lying. It is inconsistent with implicit width reported by Text label, given the same font and the same string. It is a known bug, it seems: https://bugreports.qt.io/browse/QTBUG-85936 And they introduced FontMetrics::renderType property to fix it: https://codereview.qt-project.org/c/qt/qtdeclarative/+/376617 However, even when binding renderType, I don't get consistent results across FontMetrics and Heading label.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1280
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1281
Git commit effe300e70252bbe8baf941ee113ac70aa34f5dc by ivan tkachenko. Committed on 26/09/2023 at 15:03. Pushed by ratijas into branch 'master'. ToolBar: Attempts at fixing heading size for specific fonts Qt 6.3 introduced new property to fill the gap between Text/Label implicitWidth and TextMetrics width/advanceWidth: renderType. It was supposed to fix all the inconsistency issues with fonts like Noto Sans 8pt that causes our Kirigami headers to elide into oblivion. Unfortunately though, it does not seem to be enough, as TextMetrics still reports e.g. 36.40625 px for a "Chips" string for which a Heading would require 38.984375 px of space. But at least now we can say we've done everything we could on our side. See also: - https://bugreports.qt.io/browse/QTBUG-85936 - https://bugreports.qt.io/browse/QTBUG-83936 - https://bugreports.qt.io/browse/QTBUG-94023 M +2 -1 src/controls/private/DefaultPageTitleDelegate.qml https://invent.kde.org/frameworks/kirigami/-/commit/effe300e70252bbe8baf941ee113ac70aa34f5dc
Git commit 8c304c74159f3ed8b6bd93a8fdf59ab0d5033a08 by ivan tkachenko. Committed on 26/09/2023 at 17:00. Pushed by ratijas into branch 'master'. ToolBar: Fix eliding titles for specific fonts QtQuick/TextMetrics can not be trusted. Meanwhile, QtQuick.Text provides sane implicitWidth regardless of elided string (which in turn only affects paintedWidth & contentWidth). See also: - https://bugreports.qt.io/browse/QTBUG-85936 - https://bugreports.qt.io/browse/QTBUG-83936 - https://bugreports.qt.io/browse/QTBUG-94023 M +2 -10 src/controls/private/DefaultPageTitleDelegate.qml https://invent.kde.org/frameworks/kirigami/-/commit/8c304c74159f3ed8b6bd93a8fdf59ab0d5033a08
*** Bug 473334 has been marked as a duplicate of this bug. ***
*** Bug 485518 has been marked as a duplicate of this bug. ***