I need to render glyph with different outline color in monochrome. Example2 looks great (.../tutorial/example2.cpp) but seems that works only in anti-aliasing mode.
I wrote a solution that uses FT_Glyph_To_Bitmap and FT_Outline_Get_Bitmap but sometime doesn't works fine (for some glyph/font there isn't exact match from the outline and the fill bitmap) and sometime (for certain fonts/sizes) the output isn't so pretty.
Do you have any usefull suggestion?
Thanks,
Toni
a piece of code:
...
FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_MONO, 0, 0);
FT_BitmapGlyph bitmapGlyph = (FT_BitmapGlyph)glyph;
FT_Bitmap& bitmap = bitmapGlyph->bitmap;
int bl = bitmapGlyph->left;
pen_y = y - bitmapGlyph->top ;
pen_x = x + bitmapGlyph->left;
draw_mono_bitmap( &bitmap, pen_x, pen_y, drawColor);
...
FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP|FT_LOAD_TARGET_MONO);
FT_Glyph_Stroke( &glyph, myStroker, 0 );
FT_Outline *o = &reinterpret_cast<FT_OutlineGlyph>(glyph)->outline;
FT_Outline_Get_BBox (o, &outlineBBox);
FT_Bitmap bitmap_f;
<<setup the bitmap image>>
FT_Outline_Translate(o, -outlineBBox.xMin, -outlineBBoxx.yMin);
FT_Outline_Get_Bitmap(fHandler->library, o, &bitmap_f);
pen_y = y-(outlineBBox.yMin>>6);
pen_x = x + (outlineBBox.xMin>>6);
draw_mono_bitmap( &bitmap_f, pen_x, pen_y, outlineColor);