[KConfigGui] Clear styleName font property for Regular font sytles

Authored by ahmadsamir on Feb 28 2020, 6:26 PM.

Description

[KConfigGui] Clear styleName font property for Regular font sytles

Summary:
If the styleName property is set for a QFont, using setBold(true) would
lead to Qt using an "emboldended"/synthetic font style instead of using
the bold style provided by the font itself (usually as a standalone font
file), the former looks ugly (IIUC, Freetype emboldens fonts as a last
resort for fonts that don't provide a bold style at all).

Accoring to upstream[1] the styleName property is useful for fonts with
fancy style names, and also it shouldn't be set if it's not needed; and
indeed using styleName with e.g. "Regular" doesn't make sense, as there
is no "Regular Bold" style AFAICS.

Checking for "Regular|Normal|Book|Roman" is based on examining the font
styles provided by the font packages available on OpenSuse Tumbleweed ATM,
(I didn't include some of the weird/non-common ones e.g. I've seen "Roma"
and "Rounded"). Some statistics about the "Regular"-like font styles from
my testing:
Regular: 2486
Normal: 66
Book: 20
Roman: 13

For more details see:
[1] https://bugreports.qt.io/browse/QTBUG-63792
https://bugs.kde.org/show_bug.cgi?id=378523

BUG: 378523

FIXED-IN: 5.68

Test Plan:
All unit tests still pass.

Changing the fonts via e.g. the fonts KCM doesn't append the font sytleName,
to the relevant font config entry, if the "Regular" style or co. is used.

A simple test, look at the current dir name in the Dolphin url bar with
and without ",Regular" appended to the font= entry (assuming you're using
Noto Sans or DejaVu Sans as the styleName varies from font to font).

Reviewers: Frameworks, dfaure, davidedmundson, cfeck, ervin

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D27735

Details

Committed
ahmadsamirMar 2 2020, 10:51 AM
Reviewer
dfaure
Differential Revision
D27735: [KConfigGui] Clear styleName font property for Regular font sytles
Parents
R237:f98feb169813: fix min/max entries with dpointer
Branches
Unknown
Tags
Unknown