Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Screenshot:

Screenshot

I probably need to change something in theme gtkrc file, but I can't find what needs to be changed so that I reduce font size by one unit

Just for reference, I found similar question on SO (although it's about Ubuntu 11.10): How to change the highlight color in autocomplete box in Eclipse, which shows that even Eclipse is using this from system setting, but to be more confusing font there is smaller (like I want it to be)

share|improve this question
    
What app you are using? –  desgua Jan 1 '12 at 21:21
    
it's global setting - on screenshot it's Geany –  zetah Jan 1 '12 at 21:35
    
If you change Geany's font size by CTRL + mouse wheel, the size of the font size in the autocomplete dropbox also changes. Do you want to be able to change independently from the font size of the editor? –  lumbric Jan 2 '12 at 18:39
    
As said it's not about Geany, it's system setting and it's same in SciTE or other editors. I want autocomplete dropbox with smaller font then regular text, if possible. Like calltips, but it seems to me that calltips are customizable by editors while autocomplete is system set –  zetah Jan 2 '12 at 20:55

1 Answer 1

up vote 6 down vote accepted
+100

I don't believe it's possible with a gtkrc modification.

Even if you add this code to the end of your gtkrc:

style "fontchangetest" {
    font_name = "Sans 20"
}

class "GtkWidget" style "fontchangetest"

Restart Geany (or any GTK2 application for that matter) and a lot of the UI widgets will take this property, however the actual code editor and autocomplete list will retain the font designated by Geany.

However, let's check out the source code:

apt-get source geany
cd geany-0.20

The font for the autocomplete box is defined in scintilla/ScintillaBase.cxx, line 264:

ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);

The SetFont function is only used for the autocomplete listbox (verified with 'ack SetFont'), so no harm in changing it.

Open up scintilla/PlatGTK.cxx, navigate to line 2029. You'll see this code:

void ListBoxX::SetFont(Font &scint_font) {
    // Only do for Pango font as there have been crashes for GDK fonts
    if (Created() && PFont(scint_font)->pfd) {
        // Current font is Pango font
        gtk_widget_modify_font(PWidget(list), PFont(scint_font)->pfd);
    }
}

Replace it with:

void ListBoxX::SetFont(Font &scint_font) {
    // Only do for Pango font as there have been crashes for GDK fonts
    if (Created() && PFont(scint_font)->pfd) {
        // Current font is Pango font
        PangoFontDescription* pf = pango_font_description_from_string("Sans 6");
        gtk_widget_modify_font(PWidget(list), pf);
    }
}

Obviously you can change the 'Sans 6' to be whatever font and size you like. This is a very hacky solution, however I don't know C/C++ so perhaps there's a more elegant way to do it.

Then you can either:

./configure && make && sudo make install

To do a quick compile and install (would seriously advise removing the existing geany package first though)

Or the more correct way:

sudo aptitude install build-essential devscripts ubuntu-dev-tools \
debhelper dh-make diff patch cdbs quilt gnupg fakeroot lintian \
pbuilder piuparts intltool chrpath

debuild
cd ..
sudo dpkg -i geany_0.20-1.1ubuntu1_amd64.deb

To build a new package including the changes and then install it.

share|improve this answer
    
WOW... great answer, thanks. So all my editors show same autocomplete box because they all use same Scintilla component. Rebuilding SciTE for example is fine solution, I wanted to add other custom patch anyway –  zetah Jan 5 '12 at 9:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.