Bug 306625

Summary: Asking KFontAction to only show smooth scalable fonts doesn't work
Product: [Unmaintained] kdelibs Reporter: Lasse Liehu <lasse.liehu>
Component: kdeuiAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: cfeck, kde
Priority: NOR    
Version: 4.9-Git   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 4.9.2
Sentry Crash Report:

Description Lasse Liehu 2012-09-11 18:19:06 UTC
KFontAction constructor can be given a fontListCriteria and based on that a list of items is set as the list of selectable items (KSelectAction::setItems), but KFontAction::createWidget creates a new KFontComboBox, which doesn't use this list and always includes all fonts.

Example:

KFontAction *action = new KFontAction(KFontChooser::SmoothScalableFonts, this);
QWidget *widget = action->requestWidget(this);
// widget shows a list of all fonts, including bitmap fonts

Reproducible: Always
Comment 1 Christoph Feck 2012-09-11 19:02:58 UTC
Can you check, what Qt's font database returns for said font (replace Helvetica with the font you believe is not smoothly scalable):

    QFontDatabase db;
    qDebug() << db.isSmoothlyScalable("Helvetica");

KFontChooser filters by this criterium.
Comment 2 Christoph Feck 2012-09-11 19:09:14 UTC
Forget what I wrote. I had long planned to add support for KFontChooser::FontListCriteria to KFontComboBox, but had been hold back by the "no new features in kdelibs" rule. Now that I have a valid bug, I can add it for 4.10.
Comment 3 Christoph Feck 2012-09-11 19:35:38 UTC
*** Bug 83212 has been marked as a duplicate of this bug. ***
Comment 4 Lasse Liehu 2012-09-11 19:39:42 UTC
*** Bug 305017 has been marked as a duplicate of this bug. ***
Comment 5 Christoph Feck 2012-09-11 20:47:31 UTC
Actually I still had the old diff lying around ... https://git.reviewboard.kde.org/r/106425/
Comment 6 Christoph Feck 2012-09-21 00:52:39 UTC
Git commit 5c677ceb397de9b40a050489d1890ac6c9be17d9 by Christoph Feck.
Committed on 21/09/2012 at 02:47.
Pushed by cfeck into branch 'KDE/4.9'.

Allow setting a custom font list in KFontComboBox

Required for KFontAction, which allows additional
filter criteria.

REVIEW: 106425

M  +14   -3    kdeui/fonts/kfontcombobox.cpp
M  +10   -0    kdeui/fonts/kfontcombobox.h

http://commits.kde.org/kdelibs/5c677ceb397de9b40a050489d1890ac6c9be17d9
Comment 7 Christoph Feck 2012-09-21 01:43:33 UTC
Git commit 2045b132080129af31d54eaa100b641393277d18 by Christoph Feck.
Committed on 21/09/2012 at 03:39.
Pushed by cfeck into branch 'KDE/4.9'.

Fix font list not respected by created KFontComboBox
FIXED-IN: 4.9.2

M  +1    -0    kdeui/actions/kfontaction.cpp

http://commits.kde.org/kdelibs/2045b132080129af31d54eaa100b641393277d18
Comment 8 Lasse Liehu 2012-09-21 13:12:36 UTC
Git commit 4e22beab48be0799389beb73c041053451fb2112 by Lasse Liehu.
Committed on 21/09/2012 at 14:55.
Pushed by lliehu into branch 'KDE/4.9'.

Replace the font list to use for completion instead of inserting it

Fixes bug when bitmap fonts were not shown in the dropdown, but
were still used for completion

M  +1    -1    kdeui/fonts/kfontcombobox.cpp

http://commits.kde.org/kdelibs/4e22beab48be0799389beb73c041053451fb2112