6 ms·
My concern for using a variable-width font is knowing how deeply indented I am at any point. With a fixed-width font, I can simply look up and see how many char
by Wilduck 15y ago
My concern for using a variable-width font is knowing how deeply indented I am at any point. With a fixed-width font, I can simply look up and see how many characters deeper I am compared to the previous line. I don't know how that would work with a variable-width font. I'd probably have to move my cursor back and forth, which would be a pain.
- evincarofautumn 15y agoI don’t understand what you mean—it doesn’t really matter how many characters or columns you’re indented, and can’t you discern depth visually in the same way regardless of typeface?
- Wilduck 15y agoIt does if you're using Python...
- evincarofautumn 15y agoNo, it doesn’t. Your indentation level matters, but provided your indentation is consistent, it doesn’t matter whether you use tabs or spaces, and the notion of “column” isn’t relevant to proportional-width fonts. If you’re worried about invalid indentation hiding from you, don’t use spaces for indentation with a proportional font—it doesn’t make sense anyway.
- pigs 15y agoPEP8 recommends spaces: http://www.python.org/dev/peps/pep-0008/ http://www.python.org/dev/peps/pep-0008/
- Wilduck 15y agoThat's understandable. I agree that tabs would work much better than spaces with a proportional font. However, in the case of Python PEP 8 states that you should use 4 spaces. Not doing so will make it very hard to collaborate with other devs. It's not that I think that proportional fonts couldn't work (even with python) It's just that I have concern about visually assessing indentation. Maybe it's time I try one and find out.
- vilya 15y agoIt matters more when you've got a statement broken over multiple lines. If you've got a function which takes a lot of arguments for example, lining them all up vertically can make the code a lot easier to read. This can be difficult or impossible to do with a proportional width font (and would almost certainly look very strange to anyone else looking at the code in a fixed-width font).
- Avshalom 15y agoWell I'm not sure that it's actually a problem in practice but with a W taking up two ' ' spaces I can imagine a scenario where you over correct and end up in the wrong level.
- muxxa 15y agoI've been using DejaVu Sans (proportional) for programming (including Python) for the last few months, and found it very easy to get used to. There are just a few glyphs that could be adjusted to line up better (closing braces in JS/PHP are a few px off), or in the case of quotation marks, two single quotes render the same as one double quote. I've started editing DejaVu (it's OSS) to correct these small number of issues, I don't think they are insurmountable.
- ori_b 15y agoSpaces or tabs have the same width within a font. Indentation at would work the same. You could even use tabs to line stuff up. Plan 9 uses a variable width font for their editor by default, and I never really noticed any significant differences for writing code in it.