The original Sphere editor has a built-in image-to-RFN converter, but it's very Windows-only. I'd love to see it ported to more cross-platform code.
I'm sure my code would do it. In fact it does. It would even support 1-pixel borders.
var map =
[
"" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" ,
"" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" ,
" ", "!", "\"", "" , "$", "" , "" , "'", "(", ")", "" , "" , ",", "-", ".", "/",
"" , "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "" , "" , "" , "?",
"" , "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O",
"P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "" , "" , "" , "" , "_",
"" , "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
"p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
];
function game()
{
// if no border remove the 1, 1 the other 1, 1, and set it to width 128 rather than 129.
Strip("blank.rfn", "compiled.png", 1, 1, 129, 8, 8, 1, 1, map, "font.rfn");
}
Anyways, It can't handled variable width fonts though. I'll have to look into that, but that's a different algorithm entirely. This one works as well as it does because it assumes each character is the same width throughout, and so is pretty fast. The above mapping can be used for any fixed width font that was generated to an image by Sphere. It stops at the lowercase though so you'll have to append letters to it if you want to reach the rest (and fill in the blanks with any letters that might exist).