Hacker News new | ask | show | jobs
by PeterisP 4334 days ago
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.

1 comments

Fonts do it because outside of code there is just always a space character inserted before every parenthesis. Adding additional space inside the parenthesis character would just increase that space, something that is not desirable.
The topic is developer-oriented specialized fonts - so there is no such thing as 'outside of code', and in a monospaced font no space can be added since the width is fixed - so my question was about shifting the parenthesis towards the 'inside' within that width.
I was just giving a historic explanation as to why no one might have thought of that. (By the way, good modern fonts actually do a lot in terms of automatically adjusting the spacing of individual letters, and popular layout tools like InDesign offer algorithmic alternatives to whatever the font comes with by default. In proportional fonts “Te” will typically be closer together than “Th” – if you output those fonts with the right program. So fudging with spacing in some automated fashion is not out of the question.)

However, even in code it is desirable to not add extra space to parenthesis, since “foo (bar” is certainly no less common than “foo(bar”. Basically, the font would have to automatically adjust depending on whether or not a space is in front of it to treat both of those cases appropriately. (I think that’s possible with current font formats, so there is likely no technological hurdle to this.) However, that might not be desirable since it might make “foo (bar” and “foo(bar” easier to confuse.

even in code 'foo (bar' is as common as 'foo(bar' and because parens tend to be narrow -as opposed to W or M- moving it one direction or the other would leave a -taste vary but- weird looking gap of white space. It would also through off visual alignment in columns, which is basically the only argument monospaced fonts have going for them.