Bug 285162

Summary: not possible to set font type / size of CMake help
Product: [Applications] kdevelop Reporter: Gerhard <gstengel>
Component: Documentation viewerAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: wishlist CC: igorkuo
Priority: NOR Keywords: junior-jobs
Version: 4.2.3   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.2
Sentry Crash Report:
Attachments: Small font size in QtHelp
Small font size in Man Page
Small font size in CMake [help]
Patch, which adds zooming to standarddocumentationview.

Description Gerhard 2011-10-28 09:06:06 UTC
Version:           4.2.3 (using KDE 4.7.2) 
OS:                Linux

The CMake help topic entries are shown with some font with serifs even though I've set all fonts to use something without serifs in the kcontrol center's font module. Furthermore, it's not possible to influence the font size (it's too small on my system).

Reproducible: Always

Steps to Reproduce:
Try to set the font and font size of CMake help

Actual Results:  
not possible

Expected Results:  
Some font offered in the kcontrol center's font module should be used.

The man page and Qt documentation use a different font which is possible to influence.
Comment 1 Kevin Funk 2012-12-21 00:46:59 UTC
Screenshot please? The CMake help entries are in some Monospace font for me.
Comment 2 Igor Kushnir 2014-01-21 17:50:34 UTC
KDevelop version: 4.6.0;
KDE version: 4.12.0;
OS: Manjaro GNU / Linux.

I have configured large fonts (11-12) in all settings that I could find:
 XFCE settings (my DE);
 qtconfig-qt4;
 KDE System Settings;
 KDE Help Center.

But I still have very small fonts in Documentation Tool View:
 QtHelp, Man Page, CMake - all fonts are different, but the common thing is small font size.

It would be great if these fonts could be configured in KDevelop or at least if some system fonts were used.

Attached 3 screenshots.
Comment 3 Igor Kushnir 2014-01-21 17:51:31 UTC
Created attachment 84778 [details]
Small font size in QtHelp
Comment 4 Igor Kushnir 2014-01-21 17:53:19 UTC
Created attachment 84779 [details]
Small font size in Man Page
Comment 5 Igor Kushnir 2014-01-21 17:53:55 UTC
Created attachment 84780 [details]
Small font size in CMake [help]
Comment 6 Kevin Funk 2014-03-26 13:33:25 UTC
*** Bug 332619 has been marked as a duplicate of this bug. ***
Comment 7 Kevin Funk 2014-03-26 13:34:21 UTC
Patches welcome!
Comment 8 Igor Kushnir 2014-03-26 22:10:27 UTC
I have just implemented zooming in documentation viewer (patch attached).
It is very simple but has several shortcomings:
1) zoom factor is not saved between kdevelop launches;
2) shortcuts for zooming are not configurable (Ctrl+Meta+'+', Ctrl+Meta+'-');
3) shortcuts work only if documentation view has focus.

I don't think that there is an easy way to overcome these shortcomings in all documentation views because all views inherit IDocumentation, which provides only QWidget* and not QWebView*.
kdevplatform/interfaces/idocumentation.h contains the following:
class KDEVPLATFORMINTERFACES_EXPORT IDocumentation : public QObject, public KSharedObject { ...
 virtual QWidget* documentationWidget(DocumentationFindWidget* findWidget, QWidget* parent=0) = 0;
... }

Let me know if I have missed something and there is an easy way to improve this patch.
Thanks.
Comment 9 Igor Kushnir 2014-03-26 22:11:28 UTC
Created attachment 85775 [details]
Patch, which adds zooming to standarddocumentationview.
Comment 10 Igor Kushnir 2014-03-27 05:56:01 UTC
I've found a way to overcome beforementioned shortcomings but I'm not sure if my approach is acceptable. The idea is to use global object for communication with the application and all StandardDocumentationView instances. This will allow to send signals to all StandardDocumentationView instances and thus enable using application actions (zoom shortcuts would not depend on focus) and application settings (store zoom factor and configurable shortcuts).

namespace KDevelop
{
/// Mediator between the application and all StandardDocumentationView instances.
class KDEVPLATFORMDOCUMENTATION_EXPORT StandardDocumentationController : public QObject
{
    Q_OBJECT
public:
    /// Must be locked before access to any method.
    static QMutex s_mutex;
    static StandardDocumentationController & instance();
    // ...
public slots:
    // ...
signals:
    // ...
private:
    StandardDocumentationController();
    ~StandardDocumentationController();
    qreal m_zoomFactor;
    // ...
};
}

Is this a good idea?
Comment 11 Kevin Funk 2016-01-06 19:43:23 UTC
@Igor: Still wanna work on this? 

Suggestion: Make it a lot more like Qt Assistant
- Add zoom-in and zoom-out buttons to the documentation tool view
- Allow to zoom in and out via ctrl + mouse wheel

Still makes up a nice junior job, so if anyone wants to take this, go ahead!
Comment 12 Igor Kushnir 2016-01-09 19:00:39 UTC
Implemented and created review requests:
https://git.reviewboard.kde.org/r/126685/
https://git.reviewboard.kde.org/r/126686/
Comment 13 Anton Anikin 2016-10-11 15:13:07 UTC
Git commit 94cdff8b2203f0452afc8aae418f60e30059e674 by Anton Anikin.
Committed on 11/10/2016 at 15:12.
Pushed by antonanikin into branch '5.0'.

Fix Bug 285162: adjust documentation view font settings by values taken from system settings (DE)

Summary:
The patch sets Sans Serif font as default for documentation view.
Font settings are adjusted to system setting (DE):

* Sans Serif font (we assume that is the default system font).
* Monospace font.
* Sizes for all fonts.

Only Serif font family setting is taken from fontconfig (system settings for such font is missing).

Test Plan:
Tested with master branch.

{F346398}

Reviewers: #kdevelop, apol, brauch

Reviewed By: #kdevelop, apol, brauch

Subscribers: brauch, cordlandwehr, apol, kdevelop-devel

Differential Revision: https://phabricator.kde.org/D2902

M  +17   -0    documentation/standarddocumentationview.cpp

http://commits.kde.org/kdevplatform/94cdff8b2203f0452afc8aae418f60e30059e674