More ...

This also seems to depend on the font file. If I load Calibri (num_fixed_sizes 
== 6) then I get back a bitmap with certain sizes, but if I use SansSerif 
(num_fixed_sizes ==  0), I always get back a FT_PIXEL_MODE_GRAY. Also, if I set 
num_fixed_sizes in Calibri to 0, then it also always returns a 
FT_PIXEL_MODE_GRAY, so for the moment, I am good

JLM


When I set the char size to certain values, I get back a bitmap instead of a 
grayscale image and many of the values in the slot struct make no sense.

How can I force the system to always return a bitmap with the pixel_mode of 
FT_PIXEL_MODE_GRAY  ?


  for ( n = 0; n < text.length(); n++ )
  {
                char c = text.at(n);
                FT_Set_Transform( font, NULL, &pen );
                FT_UInt index = FT_Get_Char_Index(font, c);
                if ( index == 0 ) {
                                ZLOG_CRIT("char " << c << " index is zero");
                                continue;
                }
                error = FT_Load_Glyph(font, index, FT_LOAD_RENDER | 
FT_RENDER_MODE_NORMAL );
                if ( error ) {
                                  ZLOG_CRIT("error " << error << " loading char 
" << c );
                                continue;
                }
                slot = font->glyph;
                if (c != ' ' ) draw_char( &slot->bitmap, slot->bitmap_left, 
m_height - slot->bitmap_top, color);
                pen.x += slot->advance.x;
 }

_______________________________________________
Freetype mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype

Reply via email to