vtkFreeTypeTools expects bitmaps where pixel_mode==FT_PIXEL_MODE_GRAY but freetype sometimes returns mono bitmaps
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
With Calibri size 12, freetype returns bitmaps where pixel_mode==FT_PIXEL_MODE_MONO, which are rejected by vtkFreeTypeTools. I could get it to work by modifying the loop in vtkFreeTypeTools::RenderCharacter :
bool gray = bitmap->pixel_mode == FT_PIXEL_MODE_GRAY;
for (int j = 0; j < bitmap->rows; ++j)
{
int iB = 0, ib = 7;
for (int i = 0; i < bitmap->width; ++i)
{
unsigned char value;
if (gray)
{
value = glyphPtrRow[i];
}
else
{
value = 255 * (glyphPtrRow[iB] & 1 << ib);
if (ib == 0)
{
ib = 7;
++iB;
}
else
{
--ib;
}
}
then replace "*glyphPtr" with "value". Finally, later in the file, replace
if (bitmap->pixel_mode != ft_pixel_mode_grays)
with
if (bitmap->pixel_mode != ft_pixel_mode_grays && bitmap->pixel_mode != FT_PIXEL_MODE_MONO)