如何在 Eclipse 的包资源管理器中为树项配置字体大小?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3124629/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I configure the font size for the tree item in the package explorer in Eclipse?
提问by michael
How can I configure the font size for the tree item in the package explorer/outline in Eclipse?
如何在 Eclipse 的包资源管理器/大纲中配置树项的字体大小?
Which item in Font under PreferencesI should change?
我应该更改首选项下字体中的哪个项目?
回答by Dan Halbert
In 2010, there was no way in Eclipse to change the font used for Package Explorer and other such views. You can only change the font for editor views. This is a policy decision on the part of the Eclipse developers (see, e.g., bugs 49548, 202091). (Grumble.) The font used is the one set by the general look-and-feel for whatever desktop you are using.
在 2010 年,Eclipse 无法更改用于包资源管理器和其他此类视图的字体。您只能更改编辑器视图的字体。这是 Eclipse 开发人员的政策决定(参见,例如,错误49548、202091)。(抱怨。)所使用的字体是您使用的任何桌面的一般外观设置的字体。
On Linux it is possible to override the system font when you invoke Eclipse. An excellent writeup of various possibilities is here, to which I owe this answer. I'll repeat one suggestion from there for posterity. Create a file named, say, gtkrc-eclipse:
在 Linux 上,可以在调用 Eclipse 时覆盖系统字体。这里有一篇关于各种可能性的优秀文章,我应该回答这个问题。我会为后代重复那里的一项建议。创建一个名为 gtkrc-eclipse 的文件:
style "eclipse" {
font_name = "Sans Condensed 8"
}
class "GtkWidget" style "eclipse"
Then set a certain environment variable when invoking eclipse:
然后在调用eclipse时设置一定的环境变量:
$ GTK2_RC_FILES=gtkrc-eclipse eclipse
回答by Rick Winscot
Does your Eclipse .ini file contain a reference to 'smallFonts?' On Mac you might see something like...
您的 Eclipse .ini 文件是否包含对“smallFonts”的引用?在 Mac 上,您可能会看到类似...
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dorg.eclipse.swt.internal.carbon.smallFonts
If you remove this line, you'll see the font size in various views fatten up.
如果删除此行,您将看到各种视图中的字体大小变大。
回答by Nathan Monteleone
On Windows 7, you can affect many of the Eclipse GUI fonts, including the Project Explorer by going to:
在 Windows 7 上,您可以通过以下方式影响许多 Eclipse GUI 字体,包括项目资源管理器:
Control Panel → Personalization→ Window Color and Appearance→ Advanced Appearance Settings
控制面板 →个性化→窗口颜色和外观→高级外观设置
Change the font size for "Message Box".
更改“消息框”的字体大小。
Of course this messes with the appearance of other stuff in your OS, but I've found that tolerable compared to squinting at the project explorer...
当然,这会与操作系统中其他内容的外观相混淆,但我发现与斜视项目资源管理器相比,这是可以忍受的......
回答by wambach
I just found all those answers for changing the tree view font size in Eclipse, tried several and finally got on the CSS class which reads quite more fashionable to me:
我刚刚找到了在 Eclipse 中更改树视图字体大小的所有答案,尝试了几个,最后得到了 CSS 类,它对我来说读起来更时尚:
The theme I'm using includes the "e4_basestyle.css" in eclipse/opt/plugins/platform/css
. There I added
我使用的主题包括 .css 文件中的“e4_basestyle.css” eclipse/opt/plugins/platform/css
。我在那里加了
.MPart Tree {
font-size: 10;
}
which works very fine with me (Eclipse v4.3-SR2 (Kepler) on Ubuntu).
这对我来说非常好(Ubuntu 上的 Eclipse v4.3-SR2 (Kepler))。
回答by vir us
Here is an option that works on my Windows7 machine suggested by Diego V: https://stackoverflow.com/a/15011440/1713920
这是Diego V建议的适用于我的 Windows7 机器的选项:https: //stackoverflow.com/a/15011440/1713920
On Juno you can adjust that font by CSS.
Lookup the files in eclipse\plugins\org.eclipse.platform_4.2.x.y\css for your current style sheet (probably e4_default_win7.css), and then just add the following rule:
#org-eclipse-jdt-ui-PackageExplorer Tree, #org-eclipse-ui-navigator-ProjectExplorer Tree { font-size: 10px; /* <-- Desired font size */ }
在 Juno 上,您可以通过 CSS 调整该字体。
在 eclipse\plugins\org.eclipse.platform_4.2.xy\css 中查找您当前样式表(可能是 e4_default_win7.css)中的文件,然后添加以下规则:
#org-eclipse-jdt-ui-PackageExplorer Tree, #org-eclipse-ui-navigator-ProjectExplorer Tree { font-size: 10px; /* <-- Desired font size */ }
回答by Diego Freniche
This answer applies to Mac OS X user. Tested with Mavericks (10.9.2) but should work in all versions.
此答案适用于 Mac OS X 用户。用 Mavericks (10.9.2) 测试过,但应该适用于所有版本。
As stated before in previous answers, to change the font size in package explorer you need to change system font size. The problem here is to do exactly this. My solution:
如前所述,要更改包资源管理器中的字体大小,您需要更改系统字体大小。这里的问题就是要做到这一点。我的解决方案:
- Download the free Tinker Toolutility and adjust font sizes.
- Restart Eclipse
- 下载免费的Tinker Tool实用程序并调整字体大小。
- 重启 Eclipse
The results:
结果:
Happy coding!
快乐编码!
回答by Vitalij
Go into eclipse/plugins/org.eclipse.ui.themes_1.1.0.v{HERE_SOME_DIGITS}\css
.
进入eclipse/plugins/org.eclipse.ui.themes_1.1.0.v{HERE_SOME_DIGITS}\css
.
Here you see your installed theme CSS files. Choose you theme, and add at the end of file (for example, e4_default_win7.css
):
在这里您可以看到已安装的主题 CSS 文件。选择您的主题,并在文件末尾添加(例如,e4_default_win7.css
):
#org-eclipse-jdt-ui-PackageExplorer Tree,
#org-eclipse-ui-navigator-ProjectExplorer Tree {
font-size: 10px; /* <-- Desired font size */
font: Consolas; /* <-- Font you want to have */
}
It was tested with Eclipse v4.4 (Luna) and Eclipse v4.5 (Mars) on Windows 7.
它在 Windows 7 上使用 Eclipse v4.4 (Luna) 和 Eclipse v4.5 (Mars) 进行了测试。
回答by Dylan
Eclipse v4.5(Mars) using the built-in dark theme on Linux.
Eclipse v4.5(Mars) 在 Linux 上使用内置的深色主题。
eclipse/plugins/org.eclipse.ui.themes_1.1.0.v20150511-0913/css/dark/e4-dark_globalstyle.css
eclipse/plugins/org.eclipse.ui.themes_1.1.0.v20150511-0913/css/dark/e4-dark_globalstyle.css
Around line 204, you can add your chosen font size:
在第 204 行左右,您可以添加您选择的字体大小:
background-color: #2F2F2F;
color: #CCC;
font-size: 8;
回答by Li Ying
FYI:
供参考:
From Eclipse v4.4 (Luna):
从 Eclipse v4.4 (Luna):
It looks like the CSS files are no longer in the old folder:
看起来 CSS 文件不再在旧文件夹中:
eclipse/plugins/org.eclipse.platform_4.x.x.vy/css
They are moved to the new folder:
它们被移动到新文件夹:
eclipse/plugins/org.eclipse.ui.themes_x.x.x.vxxxxx/css
And you must select a theme to apply it, in the menu
您必须在菜单中选择一个主题才能应用它
Windows→ Preferences→ General→ Appearance
Windows→首选项→常规→外观
回答by indoballer
As someone has already mentioned previously, modifying the "e4_basestyle.css" file worked for me on Eclipse v4.3 (Kepler) and Windows 8.
正如之前有人已经提到的,修改“e4_basestyle.css”文件在 Eclipse v4.3 (Kepler) 和 Windows 8 上对我有用。
Also, I find that you must also change the text size/style under
另外,我发现您还必须更改下的文本大小/样式
Preferences→ Team→ Git→ LabelDecorations
首选项→团队→ Git→ LabelDecorations
or
或者
Preferences→ Appearance→ ColorsAndFonts, under the Git section.
首选项→外观→ ColorsAndFonts,在 Git 部分下。
to make sure that text size/colors for uncommitted files are in sync with your changes. This is of course if you initialise your project as a repository.
确保未提交文件的文本大小/颜色与您的更改同步。这当然是如果您将项目初始化为存储库。