ftc_image_node_done( FTC_ImageNode inode, FTC_Cache cache ) { if ( inode->glyph ) { FT_Done_Glyph( inode->glyph ); inode->glyph = NULL; } ftc_glyph_node_done( FTC_GLYPH_NODE( inode ), cache ); }
ftc_image_node_init( FTC_ImageNode inode, FTC_GlyphQuery gquery, FTC_Cache cache ) { FTC_ImageFamily ifam = FTC_IMAGE_FAMILY( gquery->query.family ); FT_Error error; FT_Face face; FT_Size size; /* initialize its inner fields */ ftc_glyph_node_init( FTC_GLYPH_NODE( inode ), gquery->gindex, FTC_GLYPH_FAMILY( ifam ) ); /* we will now load the glyph image */ error = FTC_Manager_Lookup_Size( FTC_FAMILY( ifam )->cache->manager, &ifam->type.font, &face, &size ); if ( !error ) { FT_UInt gindex = FTC_GLYPH_NODE_GINDEX( inode ); error = FT_Load_Glyph( face, gindex, ifam->type.flags ); if ( !error ) { if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP || face->glyph->format == FT_GLYPH_FORMAT_OUTLINE ) { /* ok, copy it */ FT_Glyph glyph; error = FT_Get_Glyph( face->glyph, &glyph ); if ( !error ) { inode->glyph = glyph; goto Exit; } } else error = FTC_Err_Invalid_Argument; } } /* in case of error */ ftc_glyph_node_done( FTC_GLYPH_NODE(inode), cache ); Exit: return error; }
ftc_sbit_node_done( FTC_SBitNode snode, FTC_Cache cache ) { FTC_SBit sbit = snode->sbits; FT_UInt count = FTC_GLYPH_NODE( snode )->item_count; FT_Memory memory = cache->memory; for ( ; count > 0; sbit++, count-- ) FT_FREE( sbit->buffer ); ftc_glyph_node_done( FTC_GLYPH_NODE( snode ), cache ); }