How can I change line height / line spacing in Eclipse?

I am using Eclipse for Java programming but lines in the editor look too close together.

I want to change the amount spacing/gap between lines. Is there an option in Eclipse that I can use to do this?

-------------Problems Reply------------

I've cloned and installed the font from

and made it my IDE editor font for Eclipse. Line spacing is much better now!

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.

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:

  • 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)
    • 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
    • use the new font

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):

  • 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)
  • 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
  • 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)

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

On linux with gtk you can also play with a .gtkrc file. See here and here as examples.

Of course this doesn't help anything on windows :)

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.

Category:eclipse Views:2 Time:2009-06-18

Related post

  • Setting the Line Height/ Line Spacing in an NSTextView 2009-12-24

    How would I set the Line Height or Line Spacing in an NSTextView (i.e. how tall each line is, or how much space is between each line)? --------------Solutions------------- Use the - (void)setDefaultParagraphStyle:(NSParagraphStyle *)paragraphStyle me

  • Set line height in Html to make the html looks like a office word when has different font sizes 2011-07-05

    How to set the line height in ONE html tag <p>, when this <p> have two different font sizes? If I set the <p style="line-height:120%"> .... </p>, then the whole <p> will only have one line height. But I hope it will beha

  • Change line-spacing / line height in Eclipse IDE 2011-10-11

    I know this has been already posted but quite time ago, so I ask again in case something changed: is there a way to set line-spacing / line-height in Eclipse text editor? The default settings doesn't seem to me very readable - see the difference: (ge

  • sIFR - line height issue in Firefox 3 only? 2009-03-17

    I'm trying to use sIFR to create a tag cloud effect for a homepage I'm working on. There are 4 lines of text, with various font sizes and font colours within each line. I suspect sIFR purists would say this creates too many movie clips to be safe, bu

  • br line-height in safari and chrome leaving gap 2009-06-09

    In my HTML I have a div and inside the div I have different vertical spacing between lines of text. I achieve this by using breaks and defining the height, i.e. <br /><br class="height5" /> or height2 or height10 or whatever. In my styles

  • What is line-height:1? 2009-06-16

    It is a question about the appointment of line-height. I began study of css. line-height: Examples appointing 20px or a unit are often found. It is sometimes line-height: There are 1 and a thing without a unit, but what kind of meaning does this beco

  • What is the purpose of line-height, and what does white-space:nowrap do? 2009-06-24

    what's line-height supposed to do since there is already an attribute called font-size? And what does it mean when we specify something like: white-space:nowrap; --------------Solutions------------- The line-height property allows you to set the heig

  • How do I set the line height of a FormattedText 2009-10-13

    I am building a text-to-image generator that takes a text, a font, a max width and some other parameters and generates an image from this. It will be used as a custom server control in a web site to generate headlines. I allready have a component lik

  • Is there a way to set min-line-height on inline element in CSS? 2009-11-16

    I have some inline links with icon showing on the left (padding + bacground), but when the font is too small, the image doesn't fit in line height and gets cropped on top and bottom. Is there any way to prevent it from happening, without use of javas

  • Win32 DrawText line height 2009-11-18

    I'm calling the Win32 DrawText function to output some text into a device context. The text is long and wraps nicely onto a second line. The problem is I need to decrease the space between lines a bit (I guess decrease the line height?). Any ideas on

  • CSS Line-Height Guide 2010-02-14

    I remember reading a style guide explaining what the proper line-height should be for each element. I can't find it on google. I would appreciate it if anyone could link me to such a guide, or perhaps explain it in an answer. Thanks! Edit: SORRY, ple

  • How to set PDF paragraph or font line-height with iTextSharp? 2010-04-13

    How can I change the line-height of a PDF font or paragraph using iTextSharp? --------------Solutions------------- Line spacing in terms of typography is called leading. If you can use line spacing, you can use Paragraph.Leading or Paragraph.LeadingM

  • Where we should declare font size, line height and font-family to body, before css reset or after? 2010-06-22

    For example if i'm using eric meyer reset and i have to apply this style to body. body { font: 100%/1.5 "Helvetica Neue", Helvetica, Tahoma, Arial, sans-serif;*/ } should i keep this before reset css or after? html, body, div, span, applet, object, i

  • Vertically centering text in a list item with line-height but not 100% width 2010-07-28

    Whats the best approach to vertically center text in a li but restrict the text to less than 100% of the li width - in this case, setting the line-height on the li causes the wrapped text to have a massive line spacing (which of course with line-heig

  • Set line height in UITextView 2010-09-21

    I'm already pretty sure that it can't be done with any public API, but I still want to ask: Is there any way to change the line height in a UITextView? Would be enough to do it statically, no need to change it at runtime. The problem is that the defa

  • small line-heights rendering incorrectly in MS Outlook 2010-10-06

    From doing a little research I've found that MS Outlook will not render line-height in an HTML email at anything less than 16px. This is a bit of a problem as I really need it a fair amount smaller. Does anyone know of a fix for this?? --------------

  • align block elements on top when using line-height 2010-11-03

    If I give a line-height to a block element like h1 it adds the space above and below the each text line, that means the element does not begin on the same top position. What if I just want a spacing below each line? I know that vertical-align does on

  • Why control padding with line-height? 2010-12-13

    I was browsing this page over at meyerweb: and I noticed something curious about the way the padding in the header is created: h1 {margin: 0; padding: 1em 0.25em 0; font: bold 2.5em Arial, sans-serif;

  • Line height in Xcode 2011-02-27

    Does anyone know how to increase the distance between the lines in the Xcode? I mean in the actual code. Even when I change the font and font sizes in the Xcode preferences still the code lines are too close together and it is very annoying. Thanks i

Copyright (C), All Rights Reserved.

processed in 0.119 (s). 11 q(s)