D27785: [Fonts KCM] Change setNearestExistingFonts() to set the fonts only when necessary

Ahmad Samir noreply at phabricator.kde.org
Mon Mar 2 15:38:15 GMT 2020


ahmadsamir created this revision.
ahmadsamir added reviewers: Plasma, davidedmundson.
Herald added a project: Plasma.
ahmadsamir requested review of this revision.

REVISION SUMMARY
  A "Regular" font will have an empty styleName e.g. "DejaVu Sans,12,-1,5,50,0,0,0,0,0"
  so that setBold(true) can work; we deliberately clear the styleName for
  "Regular"-like font styles when saving via KConfig, see: writeEntryGui()
  from kconfiggroupgui.cpp and https://phabricator.kde.org/D27735 for more
  gory details.
  
  Change nearestExistingFont() to return the same font it's been called on
  if the search result gives us the same font (same weight, same style), and
  interpret the case when the styleName is empty to mean it's using a
  "Regular"-like style if the font weight is QFont::Normal and the styleName
  is "Regular|Normal|Book|Roman".
  
  Change setNearestExistingFonts() to set the fonts only if nearestExistingFont()
  returns a different font.

TEST PLAN
  - Remove ",Regular|Normal|Book|Roman" from *font* entries in kdeglobals
  - Open the fonts kcm, notice that the Apply button is enabled even when you haven't changed anything
  - Apply the diff then try again, the Apply button should be disabled until you actually change something

REPOSITORY
  R119 Plasma Desktop

BRANCH
  l-fonts-kcm-nearest (branched from master)

REVISION DETAIL
  https://phabricator.kde.org/D27785

AFFECTED FILES
  kcms/fonts/fonts.cpp

To: ahmadsamir, #plasma, davidedmundson
Cc: plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200302/3547fa88/attachment.html>


More information about the Plasma-devel mailing list