Smaller font sizes for Netbeans on Linux

This article describes an approach to launch Netbeans on Linux with smaller and narrower font sizes.

Modern desktop environments like KDE or Gnome suggest larger font sizes to enhance screen readability. However, Netbeans users might not be willing to waste precious space on views around the source code that matters. Here are some alternatives one might consider.

This article originally appeared on https://techtavern.wordpress.com

1) To customize window manager and themes

The Gnome desktop provides nice dialogs to customize GTK+ and Gnome decorations and font sizes. The KDE desktop offers the QT-GTK binding that applies KDE design on GTK/Gnome applications. While simple, this alternative applies to Netbeans and all other application, which might not be your intention.

2) To adjust Netbeans options

On the Netbeans IDE menu, navigate through “Tools“->”Options“->”Fonts & Colors” to reach a dialog where one may adjust an assortment of editor aspects. Unfortunately, these options do not affect menus, dialogs or views, which in turn follow the Gnome theme settings.

3) To append the netbeans command line

According to a Netbeans FAQ, one may append the netbeans command line with this parameter: --fontsize <size>. However, this does not affect Netbeans anymore on recent Java VMs, which follow the Gnome theme, regardless of the font size parameter. Neither does it allow one to change the font itself.

4) To edit the netbeans.conf file line

Further, the Netbeans FAQ explains the possibility to edit the etc/netbeans.conf file to the add the –fontsize <size> parameter at the end of the netbeans_default_options property. As observed for the previous command line approach, it does not work anymore on recent Java VMs, which unconditionally follow the Gnome theme.

5) To work out your own Gnome theme

The less usual approach defines a Gnome theme solely for the Netbeans IDE and allows to customize every aspect of the GUI, including font and font size. To safe effort, it is possible to reuse an existing theme and override just the font and font size.

For example, in order to launch Netbeans with a theme modification based on ClearLooks, following command line would work:

GTK2_RC_FILES="/usr/share/themes/ClearLooks/gtk-2.0/gtkrc:/home/user/custom-gtkrc"
   /home/user/netbeans/bin/netbeans

This approach relies on a custom-gtkrc file that overrides some aspects from the ClearLooks theme, in particular, the font and font size. This custom-gtkrc file could look as the example that follows:

style "user-font" {
 font_name = "<strong>Dejavu Sans Condensed 9</strong>"
}
class "GtkWidget" style "user-font"
widget_class "*" style "user-font"

Not only does this customization reduce the font size to 9, but it also suggest a condensed variation of the font with narrower letters. But condensed variation is available only for some specific fonts.

Here are some screenshots:

Netbeans IDE with original font: Sans 12

Netbeans IDE with original font: Sans 12

Netbeans IDE with smaller and narrower font

Netbeans IDE with smaller and narrower font

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: