freetype
[Top][All Lists]
Advanced

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

[ft] Cannot load some, but not all glyph bitmaps, from a TT font


From: Sam Varshavchik
Subject: [ft] Cannot load some, but not all glyph bitmaps, from a TT font
Date: Thu, 10 May 2018 13:46:23 -0400

I'm using freetype 2.8 with the Emoji One font, which appears to come from https://github.com/eosrei/emojione-color-font and I'm seeing the following problem with some but not all characters when trying to get a bitmap for some of the font's glyphs.

Using fontconfig to retrieve FC_Charset for this font tells me the following:

charset=20 23 2a 30-39 a9 ae 200d 203c 2049 20e3 2122 2139 etc..

I can FT_LoadGlyph and FT_BitmapConvert the digits, U+0030 through U+0039 fine. But something goes sideways with U+0020 and U+200d. I see the following:

FT_Get_Char_index gives me 1 and 41 for these unicodes, so freetype finds these unicodes acceptable. Looks promising, but FT_Load_Glyph(FT_LOAD_RENDER) initially returned FT_Invalid_Size_Handle. I traced that to the following in ttgload.c:

   /* if FT_LOAD_NO_SCALE is not set, `ttmetrics' must be valid */
   if ( !( load_flags & FT_LOAD_NO_SCALE ) && !size->ttmetrics.valid )
   {
     error = FT_THROW( Invalid_Size_Handle );
     goto Exit;
   }

Ok, so I try again with FT_Load_Glyph(FT_LOAD_RENDER|FT_LOAD_NO_SCALE). That got me past that point, only to run into a roadblock with FT_Bitmap_Convert. Looking into FT_Face->glyph->bitmap after FT_Load_Glyph, it's all empty, rows and width is 0, pixel_mode is FT_PIXEL_MODE_NONE, there's nothing there.

Looked at the data structure closer, good glyphs' format seems to be FT_GLYPH_FORMAT_BITMAP, and the problematic glyphs' format seems to be FT_GLYPH_FORMAT_OUTLINE. Did some searches, found some long-ish examples that use FT_Outline_Render, but all that does, from the looks of it, is what FT_Render_Glyph() does. Not sure what's the problem with those glyphs, but not the other glyphs in the same font.

Attachment: pgpPcOJUW_IfW.pgp
Description: PGP signature


reply via email to

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