freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Freetype] Getting black bitmaps - why?


From: Paul Miller
Subject: [Freetype] Getting black bitmaps - why?
Date: Wed, 21 Nov 2001 11:04:39 -0600

This is very frustrating. I've pretty much duplicated most of what the ftgl library does to make texture-based glyphs, but all I get is black bitmaps for the characters. Here is basically what I'm doing (after opening the face):

   long point_size = 72;
   long resolution = 72;
   ::FT_Set_Char_Size( _face, 0L, point_size * 64, resolution, resolution );

   // code is a unicode character - the letters "A" through "Z" for my test
   FT_UInt glyph_index = ::FT_Get_Char_Index( _face, code );
   FT_Error error = ::FT_Load_Glyph( _face, glyph_index, FT_LOAD_NO_HINTING );

   FT_Glyph glyph;
   error = ::FT_Get_Glyph( _face->glyph, &glyph );

   error = ::FT_Glyph_To_Bitmap( &glyph, ft_render_mode_normal, 0, 1 );
   if ( error != 0 || glyph->format != ft_glyph_format_bitmap )
      return;   /// +++ ERROR +++

   FT_BitmapGlyph bmg = (FT_BitmapGlyph)glyph;
   const FT_Bitmap *src = &bmg->bitmap;

   // copy the bitmap over
   for ( int y = 0; y < src->rows; y++ ) {
      const unsigned char *src_buf = ( src->buffer + ( y * src->pitch ) );
      unsigned char *dest = dest_image.getRow( x_offset, y_offset + y );
      ::memcpy( dest, src_buf, src->width );
   }
   ::FT_Done_Glyph( glyph );

None of these functions returns an error, and the "black box" that is filled looks like it has the correct size, but there is no glyph in there.

Any ideas?

Am I missing some magical "FT_PLEASE_RENDER_I_MEAN_IT" flag?


--
Paul T. Miller | VP of Engineering, Profound Effects, Inc. | http://www.profoundeffects.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]