I like to have as many lines of source code visible on my notebook or desktop monitor. And I think I have found a good balance between font size and readability.
On the other side: I’m getting older and my eyes are not getting any better. At the same time I noticed that students start using these ‘high-resolution-retina-displays’. They are great, but result in tiny default system fonts, so I have a hard time to read the source code on their machines.
Another challenge I noticed are the high-resolution projectors in class rooms or conferences. They are not well suited to show source code or text files because of the tiny fonts. Starting with Eclipse Neon there is an awesome feature which I can use to dynamically increase and decrease the font size which solves that problem:
This article describes how to change the Eclipse editor font size ‘on the fly’. I’m using an Eclipse Neon based IDE (NXP MCUXpresso IDE) in the screenshots, but things are applicable for any Eclipse Neon based IDE or later.
The ‘text zoom feature’ is available out of the box with Eclipse Neon. Previously some extra plugins had to be installed which did not always work (at least in my experience).
General Eclipse Font Preferences
To change the font size as a workspace settings, there are several configuration items under Window > Preferences > General > Appearance > Colors and Fonts:
The above setting exists for a long time in Eclipse. But it is rather painful to get into this dialog to increase and decrease the font size.
To increase the font size or to zoom into the source text, starting with Eclipse Neon I use the <CTRL>+<+> shortcut (press the CTRL key in combination with the ‘+’ key). To zoom out and to decrease the font size use the ‘-‘ with <CTRL>+<->. The shortcut changes both the text size in the source editor view and in the console view.
💡 On Mac OS X, it is <CTRL>+<=> and <CTRL>+’-‘
Of course it can go even higher than that:
The zooming shortcuts can be configured in Window > Preferences > General > Keys:
Changing the font size is a very useful feature: I can zoom in and out with increasing and decreasing the font size which is very useful presenting source code with a projector. It only changes the font size of text editors, and not the font size of other items like menus or dialogs. Zooming is in Eclipse only available as a shortcut, and I wish there would be support for it using the mouse scroll wheel (e.g. CTRL + Mouse Wheel). Still, the keyboard shortcut is very useful.
What about pre-Neon Eclipse? There is the tarlog-plugins you could use.
Happy Zooming 🙂
- Eclipse Neon features: https://www.eclipse.org/eclipse/news/4.6/M4/#text-zoom-commands
- Video about how to install the tarlog-plugins (for non-Eclipse Neon): https://www.youtube.com/watch?v=-8ZY5Cm7eO0