Search code examples
cfreetype

FreeType Colour rendering FT_Load_Glyph returns "Unimplemented Feature"


I am trying to get coloured fonts working in freetype, unfortunately FT_Load_Glyph and FT_Render_Glyph return "unimplemented feature", Is there some sort of build configuration for freetype to allow coloured fonts? because i dont see anything wrong with the code. I am using the notocolouremoji font.


uint32_t FT_flags = NULL;
FT_Face face = ((FT_Face)font->face);

if (FT_HAS_COLOR(face))
{
    FT_flags |= FT_LOAD_COLOR;
}
else
{
    FT_flags |= FT_LOAD_DEFAULT;
}

if (FT_HAS_FIXED_SIZES(face)) 
{
    if ((err = FT_Select_Size(face, 0)) != 0)
    {
    }
}
else 
{
    if ((err = FT_Set_Char_Size(face, face->available_sizes[0].width, face->available_sizes[0].height, Utils.window.Extent.width, Utils.window.Extent.width)) != 0)
    {
    }
}
if ((err = FT_Load_Glyph(face, glyphindex, FT_flags)) != 0)
{
}
                
if ((err = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL)) != 0)
{
}

Solution

  • This can be achieved in the build settings. Build FreeType with FT_CONFIG_OPTION_USE_PNG option enabled.