Fixed-width Font Widened on Bold
By Weijun on Mar 16, 2011
It seems there is an extra space before the "// ok" comment on line 52 which makes the comments non-aligned. So I removed it. But then when I read the diff, it shows:
@@ -49,7 +49,7 @@ \* Constructs an AS-REQ message. \*/ // Can be null? has default? - public KrbAsReq(EncryptionKey pakey, // ok + public KrbAsReq(EncryptionKey pakey, // ok KDCOptions options, // ok, new KDCOptions() PrincipalName cname, // NO and must have realm PrincipalName sname, // ok, krgtgt@CREALMBad, so they were aligned, but after my change, they are not.
I am really confused by this. Is there anything wrong with the hg repository? or the diff command? or my console? Or, is there a hidden TAB character? I checked and checked but nothing seems wrong.
Finally I have to count the spaces one by one. Good heavens! It turns out that the font used in NetBeans — Lucida Sans Typewriter — has different widths between normal and bold typefaces.
Isn't this ridiculous? A fixed-width font's width should be fixed whenever it's shown in normal, or bold, or italic. I believe all modern IDEs use these styles to show different types of source tokens.
Anyway, I changed the font to the simple "monospaced" and everything looks normal now. Maybe the Lucida Sans Typewriter font is not fixed-width at all, it just looks like one.