Ugly fonts in Netbeans - How can i make it use the system font?

As has been stated in the comments, this is a problem with Java Swing apps on Linux. Swing does use Gnome's font smoothing settings (deactivated, greyscale or subpixel) - it disregards the hinting settings though. It always uses full hinting, and if you're running Ubuntu with little or no font hinting (as most people do since little hinting is the default setting) this will make the font appear significantly different than in other applications. SWT applications like Eclipse are fine, but if you like Netbeans this isn't gonna help you.

Caveat: For the following workaround I'm only talking about the editor font, because in an IDE that's what's important to me. You could also apply it to the menu fonts etc, but that might be a little over the top.

The only usable solution I found here : use Fontforge to edit your editor font of choice and remove all hinting information from the font itself, then save it as a new font and use that in Netbeans.

  1. sudo apt-get install fontforge
  2. Launch Fontforge
  3. Open your font of choice
  4. Ctrl+A or edit -> Select -> Select all to select all characters
  5. Hints ⇒ Clear instructions
  6. Ctrl+Shift+F or element -> font info to open the font info
  7. Rename font (e.g. to original name + '_nohints')
  8. Save edited font in the .fonts directory in your home, through file -> generate fonts, making sure to use a format that Ubuntu reads (see next step)
  9. Clear font cache fc-cache -rv - following its output to make sure your new font file was picked up (e.g. .sfd doesn't but .ttf does).
  10. Run Netbeans and use the font you created as editor font

No, not perfect and yes, a bit of a hassle, but still a world of difference. Hope that helps.


Add

--laf Nimbus -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd

or

-J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd --laf Metal

at the end of the default_options string in the file netbeans.config. You can find it in $NETBEANS_PATH/etc/ folder. Make your application font smaller from system preferences.

Source