-Use a program similar to Skorche's to output the ttf to a png and the metrics to a text file (or just as an array you can copy in your code).

-Apply a "style" or effect with photoshop. For stuff like vertical gradients it would be much much easier to have the whole font png on a single line, ending up with a pretty wide image... this shouldn't be a problem for SDL I hope.
Always for vertical gradients it would be good to have letters be drawn in the png with their vertical position as they would appear when actually written (not "standing" on the baseline).

-the applied style could make the fonts bigger, so you would have some parameter, to adjust this when loading back the png.

-A function to load back the fonts from the png and the metrics (in sdl surfaces?).

-A function to draw a string to a SDL surface (for use in a opengl texture)?
I'm not sure this is the way to go or it would be better to just make a texture for each character and then use multiple quads to write a string.

This could be a pretty cool and useful project if made as simple as possible, I'll see if I can write up something usable by the community. Of course if you've done this (or part of it) already and want to share feel free

I use a program from LMNOPC that generates a font sheet from any installed font. It takes a step of processing out of your app but adds a step to your pipeline. I prefer to just have that extra step in the pipeline for sake of simplicity. It's a Windows program but just to generate a few font sheets, it's easy enough to fire up Windows. It saves it as a BMP but you can convert it to whatever you like using your favorite program. It allows you to apply any color to the font and any color to the background. You can save it as any of a number of power-of-two sizes. It was created with bitmap font engines in mind. It's a great utility.

Yeah I'd mainly use bitmap fonts so you can style-color them with photoshop, so having a png or any other transparency enabled format would avoid you having to convert the white on black bmp to a transparency mask (not that it's much work) in photoshop (before applying the style), not a big deal. For that Skorche's code is just fine.

I've got a question, as for the font data to print out in order to subsequently recover the single glyphs from the full image, is it ok if I just make it printf "code" that will have to be copied by the user in a paricular function to load the font data i.e.

The original printf format should be pretty trivially parseable with scanf.

For iPhone ScribBall I wrote a Ruby script that spit out a vertex array declaration from the metrics file. I will not be doing this again nor would I recommend generating code to copy paste. It ended being about as much work and made it very tedious to make tweaks to the font.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

//If you use this please send me an email ( matteo@ragdollsoft.com )! It would be great to know someone is actually using this ;)

/*SBF is a tiny library for using bitmap fonts with SDL, SDL_image and SDL_ttf.
It currently supports only ASCII characters.

How to use:

1-OUTPUT THE TTF TO BMP: The SBF_output_font_data_and_bitmap(...) function, given a TTF_Font loaded with SDL_ttf, outputs the font sheet bitmap
( a long bitmap with all the fonts), along with a text file containing numerial data necessary to "recover" the font from
the bitmap and display it correctly.
Your truetype font and SDL_ttf are only needed for this part, once you have the BMP and the data file you dont those (or this function) anymore.

2-MODIFY THE FONT BMP: The main point of using a bitmap font is to apply cool effects to the font (you can do that with your favourite gfx application).
It is recommended that you save the file in PNG with alpha mask (transparency) so that the letters are opaque and all the rest is transparent.

3-MAKE A SBF_font VARIABLE: SBF_font is a struct containing all the stuff you need for using a bitmap font. Just declare it as a normal struct ie. "SBF_font myfont;"
Be careful not to declare it as a pointer i.e. "SBF_font* myfont" as it will remain uninitialized.

4-LOAD THE BITMAP FONT DATA: In point 1 you had outputted a text file witH the font data: load this data back in your SBF_font with SBF_read_font_data(&myfont, "fontdata.txt");

5-ADJUST THE DATA: You can change the data at runtime in order to make up for the small size changes in the letters you may have done in point 2. See function SBF_adjust_font(...)

6-LOAD THE BITMAP FONT BITMAPS: Now you can load the actual bitmap glyphs (characters) from your PNG in your SBF_font with SBF_load_glyphs(...)

7-DRAW THE TEXT: use SBF_draw_text(...) or SBF_text_on_new_surface(...);

8-CLEAN UP: SBF_free_font(myfont) when finished with the font

FAQ:

Q:why is my BMP a long line of characters and not a grid?
A:this way you can apply vertical gradient effects in gimp or photoshop which otherwise would end up wrong (the letters on the bottom of the bmp would be of a different color from those on the top)
Vertical gradients are a pretty common effect for text.

Q:my characters get cropped!
A:Fix this with SBF_adjust_font(...) i.e. add some thickness or some "shadow".
*/

/*outputs the font sheet bitmap, along with a text file containing numerial data necessary to "recover" the font from
the bitmap and display it correctly.
xpad and ypad are used to give some padding to the characters, needed if you have to apply effects to the font bitmap later.
Usually startnum should be 32, endnum 126 (those are the ascii codes for the first and last ascii characters)*/
void SBF_output_font_data_and_bitmap(TTF_Font *ttf_font, int xpad, int ypad, int startnum, int endnum, char* data_file_name, char* bitmap_file_name);

/* The following function can be used after modifying the font bitmap sheet, in order to correct for changes in the sizes of the letters.
i.e. if you add a 2 pixel border around each letter put 2 as thickness, if you add a shadow that goes to the left for 3 pixels, put leftshadow=3 etc.
Notice that "thickness" also increases the distance between the letters, while the shadow values keep the distance unchanged
Call this function only after you have called SBF_read_font_data(...) */
void SBF_adjust_font(SBF_font* font, int thickness, int rightshadow, int leftshadow, int upshadow, int downshadow);

/*This function is used to load the bitmap font's glyphs (i.e. the characters) from the image specified (should be png in order to handle transparency)
Call this function only after you have called SBF_read_font_data(...) (and SBF_adjust_font(...) if needed)*/
void SBF_load_glyphs(SBF_font* font, char* image_name);

/*This function is used to draw a string on an existing (and already allocated) SDL_Surface. y is the baseline y you want to use to draw your text on*/
/*if you just want to write on a new surface for use in an OpenGL texture, SBF_text_on_new_surface(...) is easier*/
/*the "backwards" parameter if nonzero tells to draw the text from the last letter to the fist (use if you have a shadow on the left)*/
void SBF_draw_text(SBF_font* font, SDL_Surface *surface, char* text, int x, int y, int backwards);

/*this function creates a SDL_Surface with the minimum size required to hold the text, and writes the text inside it*/
/*Returns the pointer to the surface. Remebemer to free with SDL_FreeSurface() when done with it*/
/*the "backwards" parameter if nonzero tells to draw the text from the last letter to the fist (use if you have a shadow on the left)*/
SDL_Surface* SBF_text_on_new_surface(SBF_font* font, char* text, int backwards);

/*This function is used to draw a char on an existing (and already allocated) SDL_Surface. y is the baseline y you want to use to draw your font on*/
/*you most likely want to use SBF_draw_text(...) or SBF_text_on_new_surface(...)*/
int SBF_draw_glyph(SBF_font* font, SDL_Surface *surface, char character,int x, int y);

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

/*After this you would usually want to open up your font bitmap with GIMP or Photoshop, convert it to a png with transparency mask (letters opaque, all the rest transparent),
then apply some cool filter like emboss, textures, gradients, shadows etc. Then save as "retouched_font.png" or something*/