Getting nice fonts in gitk
Peter McCurdy, Monday, May 12th, 2008

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.
December 17th, 2008 at 09:46
Thanks for that, I’ve been looking for an elegant solution for while.
Regards,
Boris.
January 21st, 2009 at 09:26
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.
April 27th, 2009 at 15:32
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.
April 29th, 2009 at 16:27
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.
June 23rd, 2009 at 07:28
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
October 25th, 2009 at 18:59
Thanks a lot, `update-alternatives’ worked like a charm :)
November 6th, 2009 at 01:27
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.
December 14th, 2009 at 17:28
You sir, just stopped the bleeding on my eyes :) Thanks for the nice tip!
January 26th, 2010 at 18:03
[...] 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 [...]