Hacker News new | past | comments | ask | show | jobs | submit login

I always code in a proportional font, but even there the typical operator character sequences like == don't collide or run together.

OTOH, perhaps because I use a proportional font, I would be curious to try one with operator ligatures. The interesting thing is that a ligature for !== wouldn't have to be three characters in width to preserve alignment, it could actually be the normal ā‰¢ glyph.

This suggests an experiment: I'm already using a modified version of Trebuchet MS (my favorite coding font, but the tilde sucks so I swapped one in from a different font), so I could probably add some ligatures like the one above using existing glyphs instead of having to draw them by hand. I will have to try it sometime!




Could you share a screenshot of your editor with Trebuchet? I would never think of it (or any other proportional font) as an adequate font for coding, so Iā€™m pretty curious to see what it looks like.


Sure, here's an example:

https://imgur.com/482puD4

If the text looks huge, it's because I took the screenshot on a high-DPI device with 200% scaling, sorry about that. Imagine it half the size and you will have a better idea of how it actually looks.

In any case, the point is that code like this just doesn't depend on monospacing. If you viewed the same code in a monospaced font, it would look pretty much the same except for the font choice.

The key is to not do column alignment tricks that assume a monospaced font, like this:

  doSomething(oneParam,
              anotherParam);
Instead, if you just do indentation like this, your code will look fine with any font:

  doSomething(
      oneParam,
      anotherParam
  );




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: