Following the first tutorial example with FT_Render_Glyph to render into slot and then bitwise-or into the image buffer, I get proper kerning. However, when I follow the deferred rendering example in the tutorial page that uses FT_Glyph_To_Bitmap, I don't get proper kerning anymore.
I have verified that the precomputed 'pen' positions are still correct, but they don't seem to be respected by the FT_Glyph_To_Bitmap function. In my first pass over the glyphs, if I make a call FT_Render_Glyph, then a later call to FT_Glyph_To_Bitmap will work properly...but this means I've rendered every glyph redundantly. Anyone know what's going on?
Here's my code:
//load all the glyphs without rendering... unsigned count = 0;
for ( int n = 0; n < text.size(); n++ ) { // convert character code to glyph index glyph_index = FT_Get_Char_Index( face, text[n] );
// load glyph image into the slot without rendering int error = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
if ( error ) continue; // ignore errors, jump to next glyph
//if we dont do this here, then when we render later, there is way too much white space // not sure WHY this fixes it...but should be able to remove the double-render.
// seems we can't save this render because it goes directly into a temporary slot? error = FT_Render_Glyph( face->glyph, FT_RENDER_MODE_NORMAL ); if ( error ) continue; // ignore errors, jump to next glyph
// extract glyph image and store it in our table error = FT_Get_Glyph( face->glyph, &glyphs[count] ); if ( error ) continue; // ignore errors, jump to next glyph