MantisBT - VTK
View Issue Details
0015335VTK(No Category)public2015-02-20 11:142016-08-12 09:55
Luc Habert 
Kitware Robot 
normalminorhave not tried
closedmoved 
 
 
TBD
incorrect functionality
0015335: vtkFreeTypeTools expects bitmaps where pixel_mode==FT_PIXEL_MODE_GRAY but freetype sometimes returns mono bitmaps
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)
No tags attached.
Issue History
2015-02-20 11:14Luc HabertNew Issue
2015-02-20 11:21Luc HabertNote Added: 0034268
2016-08-12 09:55Kitware RobotNote Added: 0037367
2016-08-12 09:55Kitware RobotStatusbacklog => closed
2016-08-12 09:55Kitware RobotResolutionopen => moved
2016-08-12 09:55Kitware RobotAssigned To => Kitware Robot

Notes
(0034268)
Luc Habert   
2015-02-20 11:21   
Actually, 255 * (glyphPtrRow[iB] & 1 << ib); was fairly stupid of mine. The correct version is

value = (glyphPtrRow[iB] & 1 << ib) ? 255 : 0;
(0037367)
Kitware Robot   
2016-08-12 09:55   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.