<table><tr><td style="">rjvbb created this revision.<br />Restricted Application added a project: Plasma.<br />Restricted Application added a subscriber: plasma-devel.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D9070" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Applying the default, hardwired QFont::styleName to one of the standard fonts which then gets changed to a user-selected font can break expectations because of the way Qt handles such canonical stylenames, letting them override the effects of other QFont methods invoked subsequently. It can for instance become impossible to make the font bold afterwards: see <a href="https://bugs.kde.org/show_bug.cgi?id=378523" class="remarkup-link" target="_blank" rel="noreferrer">https://bugs.kde.org/show_bug.cgi?id=378523</a>, <a href="https://bugreports.qt.io/browse/QTBUG-63792" class="remarkup-link" target="_blank" rel="noreferrer">https://bugreports.qt.io/browse/QTBUG-63792</a> or <a href="https://bugs.kde.org/show_bug.cgi?id=387467" class="remarkup-link" target="_blank" rel="noreferrer">https://bugs.kde.org/show_bug.cgi?id=387467</a> .</p>

<p>This may be a Qt "feature" that's here to stay, sadly.</p>

<p>The change proposed here makes it possible (again) for users to prevent font weight rendering regressions by removing the stylename extension from configuration files manually as documented in several locations. This approach is useless when the KDE platform theme plugin then applies the default stylename, an issue that can be avoided by calling QFont::setStyleName() only when no user-specified font is available.</p>

<p>Evidently the manual intervention could be replaced with a change in the way font settings are stored; this would also require the current change.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Works as intended on Linux. An equivalent modification in my osx-integration fork of the platform theme plugin for Mac has the same effect (without it "Segoe UI Semi-bold" is no longer made bold where it should in dialogs).</p>

<p>I don't think there are possible side-effects:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">a stylename still gets set either if there is no user-selected font or if that selection includes a stylename extension</li>
<li class="remarkup-list-item">font specifications should still contain all the required information they always had; not applying a guessed stylename only means that no conflict can arise with the combined set of numeric style and weight attributes.</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R135 Integration for Qt applications in Plasma</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9070" rel="noreferrer">https://phabricator.kde.org/D9070</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/platformtheme/kfontsettingsdata.cpp</div></div></div><br /><div><strong>To: </strong>rjvbb<br /><strong>Cc: </strong>plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>