Bug 540299 - Provide a easy way to change the Package Explorer font and font size without system font changing
Summary: Provide a easy way to change the Package Explorer font and font size without ...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.10   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.17 M1   Edit
Assignee: Andrew Obuchowicz CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy, usability
: 56558 (view as bug list)
Depends on:
Blocks: 563540 566404
  Show dependency tree
 
Reported: 2018-10-19 06:54 EDT by Igor Khlaponin CLA
Modified: 2020-08-26 06:57 EDT (History)
11 users (show)

See Also:


Attachments
MPartStack tree's using a different font-family (313.78 KB, image/png)
2020-06-10 22:26 EDT, Andrew Obuchowicz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Khlaponin CLA 2018-10-19 06:54:44 EDT
Eclipse wants to be an OS-native application and use the OS look and feel, so that is why Package Explorer, Navigator and other panels use the system font. But it can be extrimely difficult to use such a font size for someone with poor eyesight. It would be better to give the user a possibility to change the font such as for Text Editor or other parts of application without system font changing.

I faced with this issue on Windows 7/10, Ubuntu and CentOS. 
Found a lot of similar issues in Bugzilla, but, unfortunately, non of them was fixed.
Comment 1 Kris De Volder CLA 2019-12-19 14:59:03 EST
It would indeed be nice if Eclipse made it easier to change the font sizes, in particular for views like the package/project explorer.

It is a recurring frustration/question with many users and the answer to a simple question 'how do I make the font in the explorer bigger' doesn't really have a good answer.

See for example this SO question:

https://stackoverflow.com/questions/3124629/how-can-i-configure-the-font-size-for-the-tree-item-in-the-package-explorer-in-e

I've seen people struggle with this many times for a long time.

Most recently:

https://github.com/spring-projects/sts4/issues/219
Comment 2 Lars Vogel CLA 2019-12-19 15:11:53 EST
IIRC JFace treeviewer could use a font. If that is true we could add a "Tree and table base font" to the colors and fonts preference and start using this font for our trees.

Kris, WDYT?
Comment 3 Andrew Obuchowicz CLA 2019-12-19 15:15:23 EST
(In reply to Lars Vogel from comment #2)
> IIRC JFace treeviewer could use a font. If that is true we could add a "Tree
> and table base font" to the colors and fonts preference and start using this
> font for our trees.
> 

+1 for this idea (if it's possible)
Comment 4 Lars Vogel CLA 2019-12-19 15:17:51 EST
(In reply to Andrew Obuchowicz from comment #3)
> (In reply to Lars Vogel from comment #2)
> > IIRC JFace treeviewer could use a font. If that is true we could add a "Tree
> > and table base font" to the colors and fonts preference and start using this
> > font for our trees.
> > 
> 
> +1 for this idea (if it's possible)

I think treeviewers can do that. https://git.eclipse.org/c/platform/eclipse.platform.ui.git/plain/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet014TreeViewerNoMandatoryLabelProvider.java

Mickael is the master of the navigator framework (used for project explorer).
Comment 5 Eclipse Genie CLA 2019-12-19 15:36:23 EST
New Gerrit change created: https://git.eclipse.org/r/154839
Comment 6 Kris De Volder CLA 2019-12-19 16:41:14 EST
> Kris, WDYT?

I think that would be fantastic :-)
Comment 7 Lars Vogel CLA 2019-12-19 16:44:12 EST
(In reply to Kris De Volder from comment #6)
> > Kris, WDYT?
> 
> I think that would be fantastic :-)

I was hoping for some technical input but your enthusiasm is also great to get! :-)

Mickael, could you advice how to implement the font in the navigator?
Comment 8 Kris De Volder CLA 2019-12-19 16:51:35 EST
Perhaps not the technical input your were hoping for...

But I hope that the proposed preference will work for both package explorer (i.e. the older legacy one) as well as the more modern project explorer. It would be a shame if the preference only worked for one but not the other.
Comment 9 Mickael Istria CLA 2019-12-20 03:07:28 EST
(In reply to Lars Vogel from comment #4)
> Mickael is the master of the navigator framework (used for project explorer).

I'm more the servitor than the master honestly.

First, I'm not sure the Package Explorer does use the common navigator framework; and to be honest, I don't really care as I've repeated a few times that the Package Explorer should be deprecated in my opinion (bug 427897).

For the Project Explorer, the extensions are already allowed to pass a LabelProvider, and this label provider can totally implement ITableFontProvider already. And we do want to honor the font passed here with higher priority.
The issue is that the font has the size info, and it's not sure we can assume we can change the font size without breaking the extensions expectation (maybe size is different on purpose).
So the logic of changing the font size has to be also included in each existing ITableFontProvider. That would be achievable though: everytime getFont() is invoked, check the current font of the widget to adapt to it if necessary. Once all those ITableFontProvider are reacting to font size change on the widget, we can introduce a new command (or add a new one) to increase the widget font size.
The only remaining issue would be how this would be persisted? For editors, we know the fontId in the fontRegistry, so we can store that change. For a Tree or a TreeViewer or even a CommonViewer, I don't seea reference to a preference font in the store -maybe I missed it-, and the default one would be the system font which we don't want to change. We'd probably need a new entry in the fontRegistry for the common viewer, or maybe even all trees?
Comment 10 Kris De Volder CLA 2020-01-09 17:29:06 EST
> First, I'm not sure the Package Explorer does use the common navigator framework

I don't think it does, which is why I expressed concern about the proposed fix should work for it.

> I've repeated a few times that the Package Explorer should be deprecated in my opinion (bug 427897).

Even if it is deprecated it should work properly. If you don't want to maintain it (which I understand) then it should just be removed entirely (after making sure the 'new' replacement can really replace it). Anecdotally... I still use the package explorer and prefer it over project explorer because , the main reason... the 'Top Level Elements >> Workingset' works in package explorer but it seems to do nothing at all in project explorer. So... despite the latter being 'legacy' in some sense... it actually works better than the project explorer. But I suppose that is an issue that can probably be solved.
Comment 11 Mickael Istria CLA 2020-01-09 17:46:52 EST
(In reply to Kris De Volder from comment #10)
> Even if it is deprecated it should work properly. If you don't want to
> maintain it (which I understand) then it should just be removed entirely
> (after making sure the 'new' replacement can really replace it).

An intermediary step before removing it and that's included in my vision of deprecation is just to not add new features to the Package Explorer.

> Anecdotally... I still use the package explorer and prefer it over project
> explorer because , the main reason... the 'Top Level Elements >> Workingset'
> works in package explorer but it seems to do nothing at all in project
> explorer.

With Project Explorer, you additionally need after switching the Top Level Elements, to go into the "Select Working Sets" view menu and explicitly select all the working sets you want to see.
I agree it's not easy to grok, but it does work.
In any case, it's not really the topic of this bug, so if you want to track this story, please open a new bug.

> So... despite the latter being 'legacy' in some sense... it
> actually works better than the project explorer. But I suppose that is an
> issue that can probably be solved.

That's the topic of bug 427897. If you create a new ticket for the above, please mark it as a dependency of bug 427897.
Comment 12 Kris De Volder CLA 2020-01-09 18:41:07 EST
> In any case, it's not really the topic of this bug

Agreed. So I'll make a new ticket for it as sugested.

Back to the current bug...

As stated my preference would be that both Package and Project Explorer would obey the new font preference.

But I understand that may be an unrealistic or impractical request. So, in that case, if it were to work only for project explorer, then I'd say that this is definitely still better than doing nothing and maintaining the status quo, so I wouldn't want to stand in the way of fixing the project explorer by insisting that package explorer be fixed as well.

I beleave Michael is the best person to assess whether or not fixing package explorer is do-able and/or worth doing. So I'm happy to leave that decision entirely up to him.
Comment 13 Dani Megert CLA 2020-01-10 08:01:07 EST
(In reply to Igor Khlaponin from comment #0)
> Eclipse wants to be an OS-native application and use the OS look and feel,
> so that is why Package Explorer, Navigator and other panels use the system
> font. But it can be extrimely difficult to use such a font size for someone
> with poor eyesight.
How can you then read the same/OS font in other applications? If you can, then no need to fix this bug. If you can't, then obviously changing the OS font is the correct "fix".

I'm for WONTFIX here. We would end up with an IDE where most views will continue to use the OS font and some use the preference.
Comment 14 Lars Vogel CLA 2020-01-10 08:32:20 EST
(In reply to Kris De Volder from comment #12)
> > In any case, it's not really the topic of this bug
> 
> Agreed. So I'll make a new ticket for it as sugested.
> 
> Back to the current bug...
> 
> As stated my preference would be that both Package and Project Explorer
> would obey the new font preference.
> 
> But I understand that may be an unrealistic or impractical request. So, in
> that case, if it were to work only for project explorer, then I'd say that
> this is definitely still better than doing nothing and maintaining the
> status quo, so I wouldn't want to stand in the way of fixing the project
> explorer by insisting that package explorer be fixed as well.

+1 for fixing at least Project Explorer.
Comment 15 Dani Megert CLA 2020-01-23 10:43:54 EST
Please reply to comment 13.
Comment 16 Kris De Volder CLA 2020-01-23 12:30:33 EST
To your comment 13. You make a valid point. However not being able to read the font on my development machine is not the only reason I want to change. Anpther reason might be that I'm doing a demo at a conference and in such cases I tend to want to optimise the fonts in my Eclipse ui for that specific purpose on a somewhat temporary basis.

Please don't try to make excuses for not fixing this by picking at just one possible reason one user provided for wanting to change their font. Their are tons of reason for wanting to do this and the fact of the matter is... you do not want to make this deliberately harder to do.

Pretty much every other font in the Eclipse ui can be controlled from the preferences page at "Window >> Preferences >> General >> Appearance >> Colors and Fonts". As a user it is only natural that if I want to change the size of *any* font in the Eclipse ui... this is where I will go look to try and do that. Making an exception of the package/project exolorer as the *only* font I cannot change in that way just makes no sense to me from a usability point of view.

If you don't agree with that sentiment, I think all you have to do to get convinced is take a look through the SO post about the question on how to change that font and the mess of confusion that clearly exists around this seemingly simple and reasonable question.
Comment 17 Lars Vogel CLA 2020-01-23 12:36:57 EST
One additional data point:last Theia demo I have seen pointed out that Eclipse cannot increase the explorer font while Theia can.
Comment 18 Igor Khlaponin CLA 2020-01-23 13:02:28 EST
(In reply to Dani Megert from comment #13)
> (In reply to Igor Khlaponin from comment #0)
> > Eclipse wants to be an OS-native application and use the OS look and feel,
> > so that is why Package Explorer, Navigator and other panels use the system
> > font. But it can be extrimely difficult to use such a font size for someone
> > with poor eyesight.
> How can you then read the same/OS font in other applications? If you can,
> then no need to fix this bug. If you can't, then obviously changing the OS
> font is the correct "fix".
> 
> I'm for WONTFIX here. We would end up with an IDE where most views will
> continue to use the OS font and some use the preference.

Hello. I'm using Eclipse on different OS and they behaves in different ways in case of high resolution screens and fonts. For instance, I may change the font size for Ubuntu package explorer (Files) or for the terminal, but Eclipse is sill out of my control. If we take a glance on the Windows 10, I need to scale the whole environment to be able to change the Eclipse package explorer font. But I don't want to do that, as I like the default icons size. 

On the other hand, I spent 80% of my working time in the Eclipse or in the terminal, not in the OS GUI. Obviously, Eclipse should have instruments for customization.

If it may be fixed at least in Project Explorer, it would be nice. Thanks
Comment 19 Igor Khlaponin CLA 2020-01-23 13:08:16 EST
(In reply to Kris De Volder from comment #16)
> To your comment 13. You make a valid point. However not being able to read
> the font on my development machine is not the only reason I want to change.
> Anpther reason might be that I'm doing a demo at a conference and in such
> cases I tend to want to optimise the fonts in my Eclipse ui for that
> specific purpose on a somewhat temporary basis.
> 
> Please don't try to make excuses for not fixing this by picking at just one
> possible reason one user provided for wanting to change their font. Their
> are tons of reason for wanting to do this and the fact of the matter is...
> you do not want to make this deliberately harder to do.
> 
> Pretty much every other font in the Eclipse ui can be controlled from the
> preferences page at "Window >> Preferences >> General >> Appearance >>
> Colors and Fonts". As a user it is only natural that if I want to change the
> size of *any* font in the Eclipse ui... this is where I will go look to try
> and do that. Making an exception of the package/project exolorer as the
> *only* font I cannot change in that way just makes no sense to me from a
> usability point of view.
> 
> If you don't agree with that sentiment, I think all you have to do to get
> convinced is take a look through the SO post about the question on how to
> change that font and the mess of confusion that clearly exists around this
> seemingly simple and reasonable question.

Completely agree with this statement. User should have control over the application preferences no matter what goal he wants to achieve
Comment 20 Pierre-Yves Bigourdan CLA 2020-03-31 04:15:15 EDT
Changing the Package Explorer font and font size without system font changing is already half done by EGit: when you change "Uncommitted Change Font", all entries in the Package Explorer that have changes will use the user-defined font.
Comment 21 Andrew Obuchowicz CLA 2020-06-10 22:21:51 EDT
So, today I was messing with Eclipse CSS while working on my own theme.

I came across "font-family: '#org-eclipse-ui-workbench-TAB_TEXT_FONT';"

So I was curious and tried:

.MPartStack Tree {
    font-family: '#org-eclipse-ui-workbench-TAB_TEXT_FONT';
}

Then I changed the "part title" font in Preferences >> General >> Appearance >>
> Colors and Fonts, and made the size much bigger.

The result is that the project and package explorer font is now resized. However, other MPart views that use a Tree are also resized.

I'm not sure yet if there's a more specific CSS element I can use to have the font apply only to the Package & Project explorer. Help here would be appreciated.

The final solution could involve making a new font preference and setting the correct CSS element to use that font-family. I know this is a bit of a workaround, but it would allow users to change the project explorer font at runtime, and it fits the user story described by Kris De Volder.

If there's interest in my proposal, I can make a Gerrit for it :)
Comment 22 Andrew Obuchowicz CLA 2020-06-10 22:26:11 EDT
Created attachment 283225 [details]
MPartStack tree's using a different font-family

Note the outline view as well as the error log are also affected as I'm not using a CSS element that is specific enough to only affect the Project & Package explorer.
Comment 23 Andrew Obuchowicz CLA 2020-06-10 22:34:26 EDT
(In reply to Pierre-Yves B. from comment #20)
> Changing the Package Explorer font and font size without system font
> changing is already half done by EGit: when you change "Uncommitted Change
> Font", all entries in the Package Explorer that have changes will use the
> user-defined font.

This is an important observation.

Notice how, in the screenshot I posted (https://bugs.eclipse.org/bugs/attachment.cgi?id=283225) the "bin" folder in the bottom left has a different font being used. This must be caused by egit's font preference.
Comment 24 Mickael Istria CLA 2020-06-11 03:44:33 EDT
(In reply to Andrew Obuchowicz from comment #21)
> If there's interest in my proposal, I can make a Gerrit for it :)

Your proposal is not a workaround, it's a good solution IMO.
The same font used by most trees is a good thing as someone needing bigger fonts for one tree because of readability issues will probably enjoy the same solution on other trees (like editor font "leaks" in other places that are part of the same font hierarchy.
Please go for it.

(In reply to Andrew Obuchowicz from comment #23)
> Notice how, in the screenshot I posted
> (https://bugs.eclipse.org/bugs/attachment.cgi?id=283225) the "bin" folder in
> the bottom left has a different font being used. This must be caused by
> egit's font preference.

When this is reproducible easily inside Platform, let's open a bug to EGit. I think EGit should then make the "ignored change font" have the newly defined tree font as parent.

Note that the tree font would probably be desired as default font for tables as well.
Comment 25 Pierre-Yves Bigourdan CLA 2020-06-11 03:54:17 EDT
(In reply to Andrew Obuchowicz from comment #21)
> So, today I was messing with Eclipse CSS while working on my own theme.
> 
> I came across "font-family: '#org-eclipse-ui-workbench-TAB_TEXT_FONT';"
> 
> So I was curious and tried:
> 
> .MPartStack Tree {
>     font-family: '#org-eclipse-ui-workbench-TAB_TEXT_FONT';
> }
> 
> Then I changed the "part title" font in Preferences >> General >> Appearance
> >>
> > Colors and Fonts, and made the size much bigger.
> 
> The result is that the project and package explorer font is now resized.
> However, other MPart views that use a Tree are also resized.
> 
> I'm not sure yet if there's a more specific CSS element I can use to have
> the font apply only to the Package & Project explorer. Help here would be
> appreciated.

Something like this would work:
Composite#org-eclipse-ui-navigator-ProjectExplorer *
  font-family: '#org-eclipse-ui-workbench-TAB_TEXT_FONT';
}
Comment 26 Andrew Obuchowicz CLA 2020-06-11 13:48:15 EDT
(In reply to Mickael Istria from comment #24)
> (In reply to Andrew Obuchowicz from comment #21)
> > If there's interest in my proposal, I can make a Gerrit for it :)
> 
> Your proposal is not a workaround, it's a good solution IMO.
> The same font used by most trees is a good thing as someone needing bigger
> fonts for one tree because of readability issues will probably enjoy the
> same solution on other trees (like editor font "leaks" in other places that
> are part of the same font hierarchy.
> Please go for it.

Sounds good!
Comment 27 Andrew Obuchowicz CLA 2020-06-11 13:58:29 EDT
> Something like this would work:
> Composite#org-eclipse-ui-navigator-ProjectExplorer *
>   font-family: '#org-eclipse-ui-workbench-TAB_TEXT_FONT';
> }

I was unable to get this working but I'd like to get it working :) I'm still kind of inexperienced with all of the Eclipse-specific CSS features (although I'm learning more everyday!).
Comment 28 Pierre-Yves Bigourdan CLA 2020-06-11 14:33:26 EDT
(In reply to Andrew Obuchowicz from comment #27)
> > Something like this would work:
> > Composite#org-eclipse-ui-navigator-ProjectExplorer *
> >   font-family: '#org-eclipse-ui-workbench-TAB_TEXT_FONT';
> > }
> 
> I was unable to get this working but I'd like to get it working :) I'm still
> kind of inexperienced with all of the Eclipse-specific CSS features
> (although I'm learning more everyday!).

I missed out the '{' in the above snippet. Note that the star is important, and that this needs to be adapted for the Package Explorer.

I'm hoping to open-source my theme experiments soon, hopefully they will provide some inspiration and ideas :)
Comment 29 Eclipse Genie CLA 2020-06-11 14:42:54 EDT
New Gerrit change created: https://git.eclipse.org/r/164724
Comment 30 Andrew Obuchowicz CLA 2020-06-11 14:53:19 EDT
> I missed out the '{' in the above snippet. Note that the star is important,
> and that this needs to be adapted for the Package Explorer.

Ahh okay I wasn't sure if the star was accidentally typed instead of '{' - thank you!!


> I'm hoping to open-source my theme experiments soon, hopefully they will
> provide some inspiration and ideas :)

I look forward to this! They certainly will :)
Comment 31 Lars Vogel CLA 2020-06-18 06:33:35 EDT
*** Bug 447518 has been marked as a duplicate of this bug. ***
Comment 33 Eclipse Genie CLA 2020-06-19 10:11:00 EDT
New Gerrit change created: https://git.eclipse.org/r/165222
Comment 35 Andrew Obuchowicz CLA 2020-06-19 16:10:35 EDT
A new font preference in the Colors and Fonts preference page named "Tree and Table font for views" was added under the Views and Editor folders category. This font is now used for views unless the view overrides the default font.

Views such as the debug ui expression view and egit's uncommitted change font override this new preference. 

IMO a followup bug should be made for egit to only use the uncommitted change font if the user has set it. Otherwise, use the default font (which should be the "Tree and Table font for views").
Comment 36 Mickael Istria CLA 2020-06-19 18:28:04 EDT
Thanks a klot Lars & Andrew!
@Andrew: Can you please add a note about it in the n&n document?
Comment 37 Mickael Istria CLA 2020-06-22 11:30:25 EDT
Let's keep this open until the N&N entry is added, otherwise there are big chances we forget about it.
@Lars: I see you built a gif for that on Twitter. Do you want to also make the N&N note?
Comment 38 Lars Vogel CLA 2020-06-22 11:45:24 EDT
(In reply to Mickael Istria from comment #37)
> @Lars: I see you built a gif for that on Twitter. Do you want to also make
> the N&N note?

Would be nice if Andrew can do it.
Comment 39 Andrew Obuchowicz CLA 2020-06-22 11:46:15 EDT
I'll add a N&N :)
Comment 40 Lars Vogel CLA 2020-07-02 09:58:46 EDT
(In reply to Andrew Obuchowicz from comment #39)
> I'll add a N&N :)

Ping
Comment 41 Eclipse Genie CLA 2020-07-02 12:05:00 EDT
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/165754
Comment 43 Andrew Obuchowicz CLA 2020-08-10 19:50:56 EDT
*** Bug 56558 has been marked as a duplicate of this bug. ***