Is there a C++ library that takes a string and a font file and returns the pixel representation of that string using that font? For example, I wrote a short PHP script that draws a single letter using Courier and then pulls out the individual pixels:
I can convert that to an array of color intensity codes and use it, but it means I need to hardcode every character I want to use, in every font, and I lose things like ligatures and intelligent kerning that only come up when multiple characters are drawn together. Is there a way in C++ to just do this directly, given the TTF file for the font I want to use? I’m using Linux, so I can’t depend on Windows API functions like GetGlyphOutline

There’s C library that can be used to do the same thing. It is called Freetype2. It is relatively easy to use. If you want to keep things portable and relatively lightweight, using Freetype2 is the way to do it. On linux system it is probably already installed.
Also, cross-platform GUI toolkit normally provide some kind of “font” class that can be used to do what you want. For example, in Qt 4 you could use QFont to draw text on Qimage and then extract individual pixels, plus operatign systems (ones that have concept of “font”) normally provide some kind of font manipulation API as well.