Fixed-width Font Widened on Bold

So here is a screenshot of a JDK source file I am working on now, in NetBeans:

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@CREALM
Bad, 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.

Comments:

Why use Lucida Sans Typewriter? Isn't it possible to bundle DejaVu into JRE/JDK instead of those ugly old fonts?

Posted by Helbrass on March 16, 2011 at 11:50 AM CST #

Sounds like a bug in NetBeans; please file it! Probably depends on the platform you run Java on.

Posted by Jesse Glick on March 24, 2011 at 03:03 PM CST #

Setting the Default font to 'Bitstream Vera Sans Mono' in Netbeans 7.2 solved the problem for me.

Setup: Ubuntu 12.04, Oracle-JDK 1.7, Netbeans 7.2

http://www.slicewise.net/index.php?id=93

Posted by thomas303 on October 06, 2012 at 09:05 PM CST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

This blog has a comments managing system that requires me to approve each comment manually. Please do not re-post and I will reply it (if I have an answer) when I get pinged.

Search

Top Tags
Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today