Blog

Getting nice fonts in gitk

Peter McCurdy, Monday, May 12th, 2008

A comparison of gitk's fonts using Tk 8.4 and 8.5
If you use git (and you should), you may have noticed that gitk’s fonts generally look bad. Some of them aren’t too terrible, but a few, such as the menu bar font on my machine, are really bad. Stupendously awful. Like they’ve been run through a blender. You get the idea. None of them are all that great, anyway. Newer versions of gitk at least let you pick larger fonts, to save you from the default squint-o-vision settings, but that just makes them large and ugly instead of small and ugly.

The sad thing is, it’s not even gitk’s fault. gitk is written in Tcl/Tk, which, despite being somewhat underrated as a language, has some very questionable font handling in the toolkit. However, there is hope: the recently-released Tk 8.5 finally brings some antialiased fonts to the table. To my eyes, the antialiasing is actually somewhat overdone, but that’s nitpicking; the overall improvement is staggering. So just get yourself a copy of Tk 8.5, and you’re off to the races.

Ah. Unless you’re using Ubuntu. While the new Ubuntu 8.04 has Tk 8.5 available for installation, they’ve restricted gitk to explicitly ask for Tk 8.4. So, to get yourself nice fonts in gitk on Ubuntu 8.04:

  • Install Tk 8.5: sudo aptitude install tk8.5
  • Open /usr/bin/gitk in a text editor.
  • On the third line, change “wish8.4″ to “wish8.5″

Presto, nicer-looking fonts. You can see the difference in the image up top, where I superimposed the old and new toolkit versions. Needless to say, Tk 8.5 is on the left.

Update, 2009-11-21: According to the (very helpful – thanks guys!) comments, in more recent versions of Ubuntu, and presumably Debian as well, the solution is a bit easier. Once you install tk8.5, just run sudo update-alternatives –config wish and pick /usr/bin/wish8.5 from the list.

9 Responses to “Getting nice fonts in gitk”

  1. Boris commented:

    Thanks for that, I’ve been looking for an elegant solution for while.

    Regards,
    Boris.

  2. Sam Stokes commented:

    Thanks for this – gitk is much easier on the eyes now!

    Incidentally, another way to solve the issue is to upgrade to Ubuntu 8.10, whose version of gitk is newer.

  3. David Holmer commented:

    This seems to have “broken” again when I upgraded from Ubuntu 8.10 to Ubuntu 9.04. gitk uses “wish” by default which now maps back to wish8.4. I fixed this by changing the /usr/bin/wish-default link to point at wish8.5 instead of wish8.4 and I got much nicer fonts again.

  4. Andrew Carter commented:

    Easier fix on 9.04:

    sudo apt-get install tk8.5
    sudo update-alternatives –config wish
    –> select /usr/bin/wish8.5

    Fonts look good again.

  5. Radek commented:

    You’ve saved my life (eyes) :-)

    Thank you very, very much. The ugliness of gitk / git gui drove me mad in my Ubuntu.

    Cheers,
    Radek

  6. Philip Belemezov commented:

    Thanks a lot, `update-alternatives’ worked like a charm :)

  7. PorcelainMouse commented:

    Wow, thanks!

    Looked great for me *until* Ubuntu Karmic Koala 9.10. I’d never seen such ugly font rendering and I’ve used tcl/tk before. ‘update-alternatives’ also worked as advertised for me. Switched it to wish8.5 and gitk came back to life.

  8. Emmanuel commented:

    You sir, just stopped the bleeding on my eyes :) Thanks for the nice tip!

  9. linkhalde › making gitk with Ubuntu 9.10 usable commented:

    [...] found the solution for this in a blog entry of the Navarra Group. All you have to do is sudo aptitude install tk8.5 and sudo update-alternatives –config wish [...]

Leave a Reply