D29155: [Fonts KCM] Remove redundant nearestExistingFont()

Ahmad Samir noreply at phabricator.kde.org
Fri Apr 24 16:30:51 BST 2020


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

REVISION SUMMARY
  It seems that nearestExistingFont() gets the same result of
  `fc-match font-name`, which is basically the sans serif default font
  on the system; this seems redundant as KFontChooser will fallback to
  selecting the first font family in the list if the initial font it
  was called with doesn't exist _and_ KFontChooser always puts "Sans Serif",
  "Serif" and "Monospace" at the top of the list.
  
  Removing nearestExistingFont() solves the issue in bug 420287 as
  the font it returns will have the styleName property set, after we
  went to so much trouble to clear that property so that setBold() can
  work.
  
  CCBUG: 420287

TEST PLAN
  Before the patch:
  
  - In kdeglobals [General] set: fixed=Blah Mono,12,-1,5,50,0,0,0,0,0 toolBarFont=Bogus Serif,12,-1,5,50,0,0,0,0,0
  - Load the fonts KCM, and open the font dialog for Fixed and Toolbar, in both cases the default "sans serif" font on the system is selected, in my case it's "DejaVu Sans"
  
  Apply the patch and repeat, the "Sans Serif" entry is selected, which is
  an alias to "DejaVu Sans" on my system.

REPOSITORY
  R119 Plasma Desktop

BRANCH
  l-setnearest (branched from master)

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

AFFECTED FILES
  kcms/fonts/fonts.cpp

To: ahmadsamir, #plasma, bport
Cc: plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, 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/20200424/b3f243d0/attachment.html>


More information about the Plasma-devel mailing list