ChatGPT解决这个技术问题 Extra ChatGPT

How can I change font size in Eclipse for ALL text editors?

I had to do a presentation yesterday, and as part of the presentation, I used Eclipse to show some code. Many of my coworkers in the room could not read the text and asked me to increase the size of the text for ALL files, not just Java files or XML files.

But it wasn't immediately obvious from the available options how to do this. I went to menu Window → Preferences and typed font in the search input. This filtered the options to General → Appearance → Colors and Fonts. From here, I could see an option to change the font in Java files, but I didn't know how to change the font globally.

I'm using Eclipse v4.3 Service Release 1 (Kepler) on Windows.

This is similar to Stack Overflow question How can I change font size in Eclipse for Java text editors?.


C
Community

This is what we figured out, and this is also found in this answer and also this answer (I'll quote):

Go to Preferences → General → Appearance → Colors and Fonts, expand the "Basic" folder and select "Text Font" and change that to whatever size you like.

Pretty simple!

https://i.stack.imgur.com/NEEBr.png


Does not work. Nothing happens when you click apply after changing that.
It is working after testing it. There is probably an issue with Eclipse if it don't works.
M
Md. Abu Nafee Ibna Zahid

The answer by @Jake works fine on the editor. To also change the font size of the global Eclipse GUI, I have added the follows:

*{font-size:8;} 

in the file:

ECLIPSE_HOME/plugins/org.eclipse.ui.themes_*/css/e4_default_gtk.css

worked for me. This is explained here: How to change eclipse font sizes


First link (“How to set font and colors of Eclipse UI”) is dead
This basically works but a font-size without a unit is invalid in my opinion.
That seems to work. However, if you do that, eclipse as of Oxygen will ignore font settings made in the Appearance dialog. Meaning, that the dialog will still preview the font setting, but the target component (eg. java text editor) will not use it.
G
Guillaume Langlois

Eclipse provides a handy shortcut to shortcut for what is well explained in Jake Toronto answer (only by 2 points increments/decrements though).

On MacOS:

Increase by 2 points: command + "+"

Decrease by 2 points: command + "-"

On Windows/Fedora:

Increase by 2 points: CTRL + "+"

Decrease by 2 points: CTRL + "-"


I am using Windows Eclipse for CPP. To increase the font [CTRL + "+"] doesn't work but [CTRL + SHIFT + "+"] works.
s
sirmagid

Go to Preferences → General → Appearance → Colors and Fonts, expand the "Basic" folder and select "Text Font" and change that to whatever size you like.

this video help you


P
Peter Mortensen

The answer by @George worked fine, but if it doesn't work on the file he referred to, then you might try applying the same modification on another file from the same folder: e4_basestyle.css.

For me it worked this way (my version of the Eclipse SDK is 4.2.2).


N
Navin Israni

For XML or HTML Files, you can select the "Structured Text Editors" option instead of "Basic" in the path given by Jake Toronto's answer.


P
Peter Mortensen

Just for reference, if anyone change font settings from Preferences → General → Appearance → *Colors and Fonts**, but it wouldn't work...

In my case, it caused by the Eclipse color theme. Just uninstall it.


T
Topani

Open Eclipse Preferences In left menu select "General>Appearance>Colors and Fonts" In the resulting window under the Java node select "Java Editor Text Font" Notice button "Edit Defalt..." is now enabled, click it Choose your preferred font settings and click OK

Now you will notice that all editor fonts have changed to your selected default (if they were set to the default to begin with). Also you can now change any editor back to this setting by selecting the editor font setting and clicking "Go to Default"