ahmadsamir created this revision. ahmadsamir added reviewers: Frameworks, dfaure, cfeck, bport. Herald added a project: Frameworks. ahmadsamir requested review of this revision.
REVISION SUMMARY styleIdentifier() tries to get the correct font style based on weight, style, and stretch; this "styleID" could be the same for different font styles in the same family, and it worked in most cases because "Regular"-like styles usually are ordered first in the family styles list from QFontDatabase. However this breaks for font families that provide many font styles, e.g. Noto Sans, where "SemiCondensed" comes first in the list. Make it more precise by adding the font "styleName" property to the "styleID" we concatenate, this makes it more precise. Also handle empty styleName font prop. (we strip it on purpose, see KConfigGroupGui::writeEntryGui() for more details), try to pick the correct one so that we highlight it in the font style list view. TEST PLAN kfontchooserdialogtest app, with the initial font set to "Noto Sans", before this change it'd select "SemiCondensed"; now it selects "Regular" as expected. BUG: 420287 FIXED-IN: 5.70 REPOSITORY R236 KWidgetsAddons BRANCH l-tightenStyleId (branched from master) REVISION DETAIL https://phabricator.kde.org/D28974 AFFECTED FILES src/kfontchooser.cpp tests/kfontchooserdialogtest.cpp To: ahmadsamir, #frameworks, dfaure, cfeck, bport Cc: ndavis, kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns