Where did you get that font sheet? If it was generated by BMFont or similar, you will need a metadata file that was generated with the sheet that lists glyph positions and dimensions. If you manually created the sheet, you have to solve them manually.
Strings can be rendered by creating quads and assigning UV coordinates from the sheet metadata. Here's a string renderer from my engine:
// Characters are read from font metadata and stored in an array indexed by their code.
struct Character
{
Character() :
x( 0 )
, y( 0 )
, width( 0 )
, height( 0 )
, xOffset( 0 )
, yOffset( 0 )
, xAdvance( 0 ) {}
float x, y;
float width, height;
float xOffset, yOffset;
float xAdvance;
};
std::vector< Vec3uv > Fonter::CreateGeometry( const std::string& text, float x, float y, float scale ) const
{
std::vector< Vec3uv > quad( text.size() * 6 );
float accumX = 0;
for (std::size_t c = 0; c < text.size(); ++c)
{
if ((int)text[ c ] < 0)
{
continue;
}
const Character& ch = m->chars[ (int)text[ c ] ];
float offx = x + ch.xOffset * scale + accumX * scale;
float offy = y + ch.yOffset * scale;
accumX += ch.xAdvance;
float u0 = ch.x / m->fontTexture->Width();
float u1 = (ch.x + ch.width) / m->fontTexture->Width();
float v0 = (ch.y + ch.height) / m->fontTexture->Height();
float v1 = (ch.y) / m->fontTexture->Height();
const float z = 0;
// Upper triangle.
quad[ c * 6 + 0 ] = RenderQueue::Vec3uv( offx, offy, z, u0, v1 );
quad[ c * 6 + 1 ] = RenderQueue::Vec3uv( offx + ch.width * scale, offy, z, u1, v1 );
quad[ c * 6 + 2 ] = RenderQueue::Vec3uv( offx, offy + ch.height * scale, z, u0, v0 );
// Lower triangle.
quad[ c * 6 + 3 ] = RenderQueue::Vec3uv( offx + ch.width * scale, offy, z, u1, v1 );
quad[ c * 6 + 4 ] = RenderQueue::Vec3uv( offx + ch.width * scale, offy + ch.height * scale, z, u1, v0 );
quad[ c * 6 + 5 ] = RenderQueue::Vec3uv( offx, offy + ch.height * scale, z, u0, v0 );
}
return quad;
}