It's a bird, it's a plane, it's

Everything here is my opinion. I do not speak for your employer.
January 2009
February 2009

2009-01-03 »

Set your gamma correctly

I have frequently been annoyed by the weird-looking anti-aliasing results with freetype fonts under Linux, especially when you're using white-on-black instead of black-on-white. The culprit is gamma, a complicated topic that's (unfortunately) complicated to sort out in Linux.

(Incidentally, MacOS X has a really really good and easy monitor calibration tool that solves this whole class of problem elegantly.)

So here's what you need to know:

  • Find a good gamma calibration diagram. The one I link to here is complicated, but helpful.

  • Instructions all seem to say "set your monitor's contrast to maximum and then adjust the brightness," but this advice doesn't seem to work on all monitors, particularly LCDs. This is probably because LCD monitors don't actually adjust brightness and contrast in the same way as CRTs do. So anyway, yes, you have to fiddle with contrast too, not just brightness.

  • Use the "xgamma" command-line tool (it comes with X nowadays, specifically the xbase-clients package in Debian), combined with your monitor's contrast and brightness settings, to make all the squares - and the splits within each square - as visible as you can.

  • Note that people seem to claim that gamma levels around 1.8-2.2 are supposed to be right. This wasn't true for me; around 1.0 is the only range that didn't make things look totally insane. (1.0 is also the default for X.org's server, so this probably makes sense.) Perhaps X's gamma number is different from the one used by everyone else.

  • In my experience with LCDs, the high range (rightmost columns) is the trickiest to get right. It's also the most important for modern "Web 2.0" web browsing, where they use a lot of minimally contrasting backgrounds for things like alternating row colours. So pay special attention to the bottom-right.

  • You can put an xgamma command in your ~/.xsession file to make it run every time on startup. Reputedly Gnome and KDE also have gamma tools, but I'm not sure exactly how they work.

Like magic, once you've made these settings correctly, colours in your X display - particularly anti-aliased fonts - stop looking like total crap. Enjoy.

I'm CEO at Tailscale, where we make network problems disappear.

Why would you follow me on twitter? Use RSS.

apenwarr on gmail.com