Live data from Hacker News

Input: Fonts for Code

input.fontbureau.com

1–10 of 44 posts

Re: Input: Fonts for Code

#5
post #3
post #2

Totally subjective opinion, but yet to see something beat Consolas.

I actually prefer Ubuntu Mono over Consolas or Inconsolata but fonts are a very subjective thing. :)

Ubuntu mono always seemed a bit crowded to me, it was my default before I got my hands on Consolas. With infinality freetype it looks really beautiful too.

Re: Input: Fonts for Code

#8
This is some truly amazing work. Love the option to change the built-in line spacing.

(I’m a monospace addict, and I always switch between Source Code Pro, M+ 1m, and others. What I don’t like about M+ 1m is that it’s narrow, and the line-spacing in the web font is too small.)

Re: Input: Fonts for Code

#9
Maybe this is the place to ask about my pet peeve - why do fonts, including specialized coding fonts, position parenthesis with both sides equally?

I mean, it seems that for readability it would be better to emphasize the fact that they're asymmetrical - when looking at "foo(bar)baz" , it would be better if the parens would be a pixel or so closer to their inner contents; but currently "foo(bar" on most fonts looks as if the paren is merging with the initial text.

The same would apply for foo[bar]baz and foo{bar}baz.

Re: Input: Fonts for Code

#10
Wow, I never thought I would see proportional fonts specifically designed for coding. I've coded almost exclusively in proportional fonts for over ten years. The font I use the most is Georgia. It makes code easier to read and more pleasing to the eye, just like any other text.

Besides personal preference, I think there are two main reasons people avoid proportional fonts: column alignment and two-space indents.

Two-space indents are an unfortunate trend in coding styles, because they practically mandate the use of a monospaced font to see the indentation. I use tabs for indentation, which let each developer adjust the visual indentation to suit their own eyes. Four-space indents are OK too.

I would love to see programmer's editors provide a way to control the amount of visual indentation that each leading space represents.

Column alignment of course is not possible with proportional fonts, but that's an easy problem to solve: don't do it. Instead of this:

  void DoSomethingWithStuff(SomeReallyFancyTypeName thing,
                            string                  name
                            int                     count,
                            bool                    condition);
Write this:

  void DoSomethingWithStuff(
      SomeReallyFancyTypeName thing,
      string name
      int count,
      bool condition
  );
While you lose the advantage of seeing all the parameter names lined up, it becomes much easier to visually associate each name with its type. My eyes tend to wander when I have to scan across a wide horizontal gap to match things up.

This style also leads to much shorter line lengths as can be seen here, and it's easier to maintain: You don't have to realign things when you change the length of the function name or one of the type names, or when you add a parameter with a longer name than the ones you have already.

A case where column alignment is more useful is ASCII art in comments. I've experimented with using a monospaced font for comments and proportional for code, which solves that problem nicely. But I don't use ASCII art much myself, so I went back to proportional for everything.

I'm looking forward to trying out these fonts!

Post reply on HN