Skip to content
Commit b5262299 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

[KFontChooser] Make styleIdentifier() more precise by adding font styleName

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

Reviewers: #frameworks, dfaure, cfeck, bport

Reviewed By: dfaure

Subscribers: ndavis, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28974
parent 56090c8f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment