3 ms·
If like me you really like aligning your code proportional fonts are not exactly pleasant to use. I sometimes go out of my way (within reason) to have variables
by simias 9y ago
If like me you really like aligning your code proportional fonts are not exactly pleasant to use. I sometimes go out of my way (within reason) to have variables with the same number of letters so that I can align them nicely. A bane of my existence is that "width" and "height" don't have the same number of letters.
An example from some lua code I'm working on at the moment:
local hi = buffer:bitfield(4, 4)
local lo = buffer:bitfield(12, 4)
return bit32.bor(bit32.lshift(hi, 4), lo)
I find that aligning things not only looks better but also makes the differences more obvious. Same code with a proportional font:
local hi = buffer:bitfield(4, 4)
local lo = buffer:bitfield(12, 4)
return bit32.bor(bit32.lshift(hi, 4), lo)
It's not a deal breaker (and the offset is small in this case) but I much prefer the monospaced version. Obviously it might also be "Stockholm syndrome" after decades of coding with a monospaced font, I can't say I've really given proportional fonts their chance.
Also many proportional fonts make it hard to distinguish between Il1 or O0, but I guess you could design a proportional font that doesn't have this issue. What font do you use yourself?
- arnsholt 9y agoThe Il1 problem is primarily a problem with sans-serif fonts. In my work SmallTalk text is set in Arial in the default image, but I've set up my development image to use Cambria instead which is really quite nice. The inability to do vertical alignment outside of the left edge of the line is a bit annoying, but honestly I don't miss it that much. If you have enough code that you really, really need to do that, I find it's a code smell indicating that something likely needs to be broken into smaller pieces anyways.
- edejong 9y agoI'm normally using Optima when working on Retina displays (because of serif typeface). Screenshot [1] of some old project for solving Project Euler problems (no solutions can be found in the screenshot). [1] http://imgur.com/a/JiYhD http://imgur.com/a/JiYhD