I am using Eclipse for Java programming but lines in the editor look too close together.
我使用Eclipse进行Java编程,但编辑器中的行看起来太近了。
I want to change the amount spacing/gap between lines. Is there an option in Eclipse that I can use to do this?
我想改变线之间的间距/间隙。我可以使用Eclipse中的选项来执行此操作吗?
7 个解决方案
#1
I've cloned and installed the font from
我克隆并安装了字体
https://github.com/andreberg/Meslo-Font
and made it my IDE editor font for Eclipse. Line spacing is much better now!
并使其成为Eclipse的IDE编辑器字体。线间距现在好多了!
#2
After trying various alternative fonts, I've took original Consolas
and increased line height in font editor, installed resulting ConsolasHigh
font package into system and set it as default in Eclipse editor:
在尝试了各种替代字体之后,我在字体编辑器中使用了原始的Consolas并增加了行高,将得到的ConsolasHigh字体包安装到系统中并在Eclipse编辑器中将其设置为默认值:
Check out: https://github.com/Salauyou/Consolas-High-Line
退房:https://github.com/Salauyou/Consolas-High-Line
#3
You could configure a formatter (Preferences | Java | Code Style) to inject extra empty lines. Otherwise, you might be able to find a font (Preferences | General | Appearance | Colors and Fonts) with a lot of built-in whitespace. On Windows, I like 'consolas'--it's not particularly whitespace-y but it is a nice mono-spaced, readable font.
您可以配置格式化程序(Preferences | Java | Code Style)以注入额外的空行。否则,您可能会找到具有大量内置空格的字体(“首选项”|“常规”|“外观”|“颜色和字体”)。在Windows上,我喜欢'consolas' - 它不是特别的空白 - 但它是一个很好的单声道可读字体。
#4
Create your own bitmap font that uses all of the rows at the top of the font. It does work, and seems to save about up to 4 rows of pixels in a 17 point font. I did it as follows:
创建自己的位图字体,使用字体顶部的所有行。它确实有效,并且似乎可以在17磅字体中保存最多4行像素。我做了如下:
- install otf2bdf
- go to font folder, presumably in root terminal
- Clone your favorite font (presumably a truetype font) using otf2bdf to the size you want it
- install fontforge
- edit the font so that it uses all of the rows above the line for the capital letters
- typically there are about 3 lines of pixels that are left blank and that is why there is so much space between rows
- should you wish you can also uses some of the rows below the line but I think these are typically used for lower case letters like y which drop below the line (not so important when programming)
通常有大约3行像素留空,这就是行之间有太多空间的原因
如果你希望你也可以使用线下面的一些行,但我认为这些通常用于小写字母,如y,它们在线下方(编程时不那么重要)
- install the font by:
- saving it into one of the font folders such as /usr/local/share/fonts
- updating the font chache In a root terminal with fc-cache -f -v
将其保存到其中一个字体文件夹中,例如/ usr / local / share / fonts
更新字体chache在具有fc-cache -f -v的根终端中
- use the new font
转到font文件夹,大概是在root终端
使用otf2bdf将您喜爱的字体(可能是truetype字体)克隆到您想要的大小
编辑字体,以便它使用大写字母行上方的所有行通常有大约3行像素留空,这就是为什么行之间有这么多空间你应该也可以使用一些线下面的行但我认为这些通常用于像y这样的小写字母,它们在线下面(编程时不那么重要)
安装字体:将其保存到其中一个字体文件夹,如/ usr / local / share / fonts更新字体chache在根终端中使用fc-cache -f -v
使用新字体
安装otf2bdf转到字体文件夹,大概在root终端使用otf2bdf克隆你最喜欢的字体(大概是truetype字体)你想要它安装fontforge编辑字体的大小,以便它使用行上方的所有行通常为大写字母大约有3行像素是空白的,这就是为什么行之间有太多空间你应该也可以使用行下面的一些行,但我认为这些通常用于像y这样的小写字母。下降到线下(编程时不那么重要)安装字体:将其保存到其中一个字体文件夹中,例如/ usr / local / share / fonts更新字体chache在根终端中使用fc-cache -f -v使用新字体
#5
With respect to my response above, I can now provide more detail as to how to create the font, along with suggestions for creating a nicer font (starting with a truetype font):
关于我上面的回答,我现在可以提供有关如何创建字体的更多细节,以及创建更好字体的建议(以truetype字体开头):
- Pick a truetype font you wish to use (I used an arial font)
- Downloaded and install fontforge
- Start fontforge and open the font file; I used a root terminal so that I could be sure to save the file in protected font folder
- Select all the characters (Edit/Select/Select All)
- Element Font Info PS Names
- Specify names - I called it ArialMTVerticallyTighter; make sure you change all of the names on this tab or it may use the new font instead of the old font where you don't want it to
- Element transformations transform
- origin glyph origin
- scale uniformly 120 %
(more will be too big, use less if you want more spacing between lines)
元素转换转换
起源字形起源
均匀刻度为120%(如果你想在线之间留出更多间距,则会更大,使用更少)
- Element General 1792 256 2048 Scale -142 150
- OS/2 Metrics
- Turn off is offset all over tab and t
- Turn on really use typo metrics
- 1792 512 1792 -512 0 1792 -512 0
关闭是在tab和t上的偏移量
打开真的使用拼写指标
1792 512 1792 -512 0 1792 -512 0
- File Generate Fonts - true type - into font folder - use new font name
- File save (in case you screwed up so you can go back) to new name
- Open new font file (in nautilus) with font viewer (by double clicking)
- Install it
- Start Eclipse
- Set it as font in eclipse
(window>preference>general>appearance>java editor>text font to new font)
选择你想要使用的truetype字体(我使用arial字体)
下载并安装fontforge
启动fontforge并打开字体文件;我使用了根终端,以便我可以确保将文件保存在受保护的字体文件夹中
选择所有字符(编辑/选择/全选)
元素字体信息PS名称
指定名称 - 我称之为ArialMTVerticallyTighter;确保您更改此选项卡上的所有名称,或者它可能使用新字体而不是旧字体,您不希望它转换为元素转换原始字形原点比例均匀120%(更多将使用更少,使用更少如果你想要更多的线间距)
元素一般1792 256 2048比例-142 150
OS / 2指标关闭是全部偏移标签和t打开真的使用错字指标1792 512 1792 -512 0 1792 -512 0
文件生成字体 - 真实类型 - 进入字体文件夹 - 使用新的字体名称
文件保存(如果您搞砸了以便可以返回)到新名称
使用字体查看器打开新的字体文件(在nautilus中)(通过双击)
在eclipse中将其设置为字体(窗口>首选项>常规>外观> java编辑器>文本字体为新字体)
Remember that the font size you see in eclipse for a particular setting e.g. 9 actually corresponds to about an 11 point font with less space between the lines
请记住,您在eclipse中看到的特定设置的字体大小,例如9实际上对应于大约11点的字体,线之间的空间较小
#6
#7
you could put overly high characters in some comment somewhere, try "|ÄÁg$ÑĈђךןﭼژçÅẤДАБψ". As soon as Eclipse sees this in a file, it'll increase the line-separation for the whole file to properly display thos characters.
你可以在某处发表一些评论中过高的字符,试试“|ÄÁg$ÑĈђךççẤẤ只要Eclipse在文件中看到它,它就会增加整个文件的行分隔,以正确显示这些字符。
#1
I've cloned and installed the font from
我克隆并安装了字体
https://github.com/andreberg/Meslo-Font
and made it my IDE editor font for Eclipse. Line spacing is much better now!
并使其成为Eclipse的IDE编辑器字体。线间距现在好多了!
#2
After trying various alternative fonts, I've took original Consolas
and increased line height in font editor, installed resulting ConsolasHigh
font package into system and set it as default in Eclipse editor:
在尝试了各种替代字体之后,我在字体编辑器中使用了原始的Consolas并增加了行高,将得到的ConsolasHigh字体包安装到系统中并在Eclipse编辑器中将其设置为默认值:
Check out: https://github.com/Salauyou/Consolas-High-Line
退房:https://github.com/Salauyou/Consolas-High-Line
#3
You could configure a formatter (Preferences | Java | Code Style) to inject extra empty lines. Otherwise, you might be able to find a font (Preferences | General | Appearance | Colors and Fonts) with a lot of built-in whitespace. On Windows, I like 'consolas'--it's not particularly whitespace-y but it is a nice mono-spaced, readable font.
您可以配置格式化程序(Preferences | Java | Code Style)以注入额外的空行。否则,您可能会找到具有大量内置空格的字体(“首选项”|“常规”|“外观”|“颜色和字体”)。在Windows上,我喜欢'consolas' - 它不是特别的空白 - 但它是一个很好的单声道可读字体。
#4
Create your own bitmap font that uses all of the rows at the top of the font. It does work, and seems to save about up to 4 rows of pixels in a 17 point font. I did it as follows:
创建自己的位图字体,使用字体顶部的所有行。它确实有效,并且似乎可以在17磅字体中保存最多4行像素。我做了如下:
- install otf2bdf
- go to font folder, presumably in root terminal
- Clone your favorite font (presumably a truetype font) using otf2bdf to the size you want it
- install fontforge
- edit the font so that it uses all of the rows above the line for the capital letters
- typically there are about 3 lines of pixels that are left blank and that is why there is so much space between rows
- should you wish you can also uses some of the rows below the line but I think these are typically used for lower case letters like y which drop below the line (not so important when programming)
通常有大约3行像素留空,这就是行之间有太多空间的原因
如果你希望你也可以使用线下面的一些行,但我认为这些通常用于小写字母,如y,它们在线下方(编程时不那么重要)
- install the font by:
- saving it into one of the font folders such as /usr/local/share/fonts
- updating the font chache In a root terminal with fc-cache -f -v
将其保存到其中一个字体文件夹中,例如/ usr / local / share / fonts
更新字体chache在具有fc-cache -f -v的根终端中
- use the new font
转到font文件夹,大概是在root终端
使用otf2bdf将您喜爱的字体(可能是truetype字体)克隆到您想要的大小
编辑字体,以便它使用大写字母行上方的所有行通常有大约3行像素留空,这就是为什么行之间有这么多空间你应该也可以使用一些线下面的行但我认为这些通常用于像y这样的小写字母,它们在线下面(编程时不那么重要)
安装字体:将其保存到其中一个字体文件夹,如/ usr / local / share / fonts更新字体chache在根终端中使用fc-cache -f -v
使用新字体
安装otf2bdf转到字体文件夹,大概在root终端使用otf2bdf克隆你最喜欢的字体(大概是truetype字体)你想要它安装fontforge编辑字体的大小,以便它使用行上方的所有行通常为大写字母大约有3行像素是空白的,这就是为什么行之间有太多空间你应该也可以使用行下面的一些行,但我认为这些通常用于像y这样的小写字母。下降到线下(编程时不那么重要)安装字体:将其保存到其中一个字体文件夹中,例如/ usr / local / share / fonts更新字体chache在根终端中使用fc-cache -f -v使用新字体
#5
With respect to my response above, I can now provide more detail as to how to create the font, along with suggestions for creating a nicer font (starting with a truetype font):
关于我上面的回答,我现在可以提供有关如何创建字体的更多细节,以及创建更好字体的建议(以truetype字体开头):
- Pick a truetype font you wish to use (I used an arial font)
- Downloaded and install fontforge
- Start fontforge and open the font file; I used a root terminal so that I could be sure to save the file in protected font folder
- Select all the characters (Edit/Select/Select All)
- Element Font Info PS Names
- Specify names - I called it ArialMTVerticallyTighter; make sure you change all of the names on this tab or it may use the new font instead of the old font where you don't want it to
- Element transformations transform
- origin glyph origin
- scale uniformly 120 %
(more will be too big, use less if you want more spacing between lines)
元素转换转换
起源字形起源
均匀刻度为120%(如果你想在线之间留出更多间距,则会更大,使用更少)
- Element General 1792 256 2048 Scale -142 150
- OS/2 Metrics
- Turn off is offset all over tab and t
- Turn on really use typo metrics
- 1792 512 1792 -512 0 1792 -512 0
关闭是在tab和t上的偏移量
打开真的使用拼写指标
1792 512 1792 -512 0 1792 -512 0
- File Generate Fonts - true type - into font folder - use new font name
- File save (in case you screwed up so you can go back) to new name
- Open new font file (in nautilus) with font viewer (by double clicking)
- Install it
- Start Eclipse
- Set it as font in eclipse
(window>preference>general>appearance>java editor>text font to new font)
选择你想要使用的truetype字体(我使用arial字体)
下载并安装fontforge
启动fontforge并打开字体文件;我使用了根终端,以便我可以确保将文件保存在受保护的字体文件夹中
选择所有字符(编辑/选择/全选)
元素字体信息PS名称
指定名称 - 我称之为ArialMTVerticallyTighter;确保您更改此选项卡上的所有名称,或者它可能使用新字体而不是旧字体,您不希望它转换为元素转换原始字形原点比例均匀120%(更多将使用更少,使用更少如果你想要更多的线间距)
元素一般1792 256 2048比例-142 150
OS / 2指标关闭是全部偏移标签和t打开真的使用错字指标1792 512 1792 -512 0 1792 -512 0
文件生成字体 - 真实类型 - 进入字体文件夹 - 使用新的字体名称
文件保存(如果您搞砸了以便可以返回)到新名称
使用字体查看器打开新的字体文件(在nautilus中)(通过双击)
在eclipse中将其设置为字体(窗口>首选项>常规>外观> java编辑器>文本字体为新字体)
Remember that the font size you see in eclipse for a particular setting e.g. 9 actually corresponds to about an 11 point font with less space between the lines
请记住,您在eclipse中看到的特定设置的字体大小,例如9实际上对应于大约11点的字体,线之间的空间较小
#6
On linux with gtk you can also play with a .gtkrc file. See here and here as examples.
在使用gtk的linux上,您还可以使用.gtkrc文件。在这里和这里作为例子。
Of course this doesn't help anything on windows :)
当然这对Windows上没有任何帮助:)
#7
you could put overly high characters in some comment somewhere, try "|ÄÁg$ÑĈђךןﭼژçÅẤДАБψ". As soon as Eclipse sees this in a file, it'll increase the line-separation for the whole file to properly display thos characters.
你可以在某处发表一些评论中过高的字符,试试“|ÄÁg$ÑĈђךççẤẤ只要Eclipse在文件中看到它,它就会增加整个文件的行分隔,以正确显示这些字符。