Eclipse has huge fonts over X-Windows.

When running Eclipse over X-Windows using Cygwin, the font sizes are significantly larger than running Eclipse locally. I am connecting to a RedHat box. When I go into the options of Eclipse, it shows the same font size on both local and XWin versions of Eclipse.

I saw one post that claimed that changing the appearance settings in Linux will help ( System -> Preferences -> Appearance). This post claimed the utility is at /usr/bin/gnome-appearance-properties. In RedHat, I had some success with gnome-font-properties. I still had to change the font sizes in Eclipse at Window|Preferences|General|Appearance|Colors and Fonts.

Here are the settings that seemed to look nice (taken from this post):

Application/Document/Desktop font: Liberation Sans, size 8
Window title font: Liberation Sans Bold, size 10
Fixed with font: Liberation Mono, 10

Font rendering: Best contrast (the others left weird artifacts, but mostly up to taste here I think)

Under details: Resolution: 99 dpi (to avoid the letters to get too close, need at least 1 px between them ;) Smoothing: Grayscale

Hinting: Full

I also found this post which will give better colors. But it does not work well as sometimes things get very hard to read.

In Ubuntu

I also found this post, which recommends creating a file in your home directory to override the default settings in Linux. Then, all of the other windows can stay large. Here’s how:

  • Create a file ~/.gtkrc-eclipse:
    style “eclipse” {
        font_name = “Sans Condensed 8”
    }
    class “GtkWidget” style “eclipse”
    
  • Launch eclipse with the GTK2_RC_FILES environment variable set to the path to ~/.gktrc-eclipse. Like so: env GTK2_RC_FILES=$GTK2_RC_FILES:~/.gtkrc-eclipse eclipse
  • It’s still necessary to change the font sizes in Window|Preferences|General|Appearance|Colors and Fonts.

RedHat

I was able to get a clean look in RedHat as well. I created a ~/.gtkrc-2.0 with the following:

style “gtkcompact”{
font_name=“Sans 8”
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButtonBox::child_min_width=0
GtkButtonBox::child_min_heigth=0
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
GtkMenu::vertical-padding=1
GtkMenuBar::internal_padding=0
GtkMenuItem::horizontal_padding=4
GtkOptionMenu::indicator_size=0
GtkOptionMenu::indicator_spacing=0
GtkPaned::handle_size=4
GtkRange::trough_border=0
GtkRange::stepper_spacing=0
GtkScale::value_spacing=0
GtkScrolledWindow::scrollbar_spacing=0
GtkExpander::expander_size=10
GtkExpander::expander_spacing=0
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
GtkTreeView::expander-size=8
GtkTreeView::fixed-height-mode=TRUE
GtkWidget::focus_padding=0
}
class “GtkWidget” style “gtkcompact”

It made it much cleaner. I did not have to set any environment variables or even restart X. It worked immediately after launching Eclipse again. This may work in other distros, but I haven’t tried.

References


366 Words

2011-01-13 11:06 +0000