Hello,
I am trying to get the advance amount for a stroked glyph. I cannot find it
anywhere in the documentation. I have a code snippet below. Basically when I
do the algorithm, the advance amount is not accounting for the width of the
outline, so the next character's outline overlaps the previous character.
Any suggestions?
Thanks,
John
// set the stroker with a 3 pixel stroke
FT_Stroker_Set(stroker,
static_cast< FT_Fixed>( 3 * 0x40),
FT_STROKER_LINECAP_ROUND,
FT_STROKER_LINEJOIN_ROUND,
0);
FT_Glyph outlineGlyph = NULL;
// Load the glyph
FT_UInt glyphIndex = FT_Get_Char_Index( *face, chr );
FT_Load_Glyph( *face, glyphIndex, FT_LOAD_NO_BITMAP );
FT_Get_Glyph( (*face)->glyph,&outlineGlyph );
// stroke it
FT_Glyph_Stroke(&outlineGlyph, stroker, false );
// copy to bitmap
FT_Glyph_To_Bitmap(&outlineGlyph, FT_RENDER_MODE_NORMAL, NULL, true );
FT_BitmapGlyph outlineBitmap = (FT_BitmapGlyph)outlineGlyph;
// get metrics - chrDef is my own struct where I am storing per character
metrics
chrDef->m_bearingX = (*face)->glyph->metrics.horiBearingX>> 6;
chrDef->m_bearingY = (*face)->glyph->metrics.horiBearingY>> 6;
// ???? this advance does not account for extra width of outline in advance
chrDef->m_advance = (*face)->glyph->metrics.horiAdvance>> 6;
// I also tried this and got similar results
//chrDef->m_advance = outlineGlyph->advance.x>> 16;
FT_Glyph interiorGlyph = NULL;
FT_Load_Glyph( *face, glyphIndex, FT_LOAD_NO_BITMAP );
FT_Get_Glyph( (*face)->glyph,&interiorGlyph );
FT_Glyph_To_Bitmap(&interiorGlyph, FT_RENDER_MODE_NORMAL, NULL, true );