Font tracking/kerning


#1

I found this post in the old forums that mentions kerning but other than that I haven’t seen any way to modify the tracking (spacing between letters) of text in TextureFont.

I’m only displaying a short sentence at a time so I’m open to hacky things if there’s a way to grab each character’s size and narrow it by fixed amount. I’m just not seeing how the pieces of TextureFont fit together to do that.


#2

I realized I needed to be subtracting a bit more for each character in the string:

std::string str( "Flying" );
auto glyphs = mTextureFont->getGlyphPlacements( str );
for ( size_t i = 0; i < glyphs.size(); ++i ) {
	glyphs[i].second.x -= i * 5;
}
mTextureFont->drawGlyphs( glyphs, vec2( 50, 50 ) );