のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

freetype

    190   FT_CALLBACK_DEF( FT_Error )
    191   ftc_basic_family_load_glyph( FTC_Family  ftcfamily,
    192                                FT_UInt     gindex,
    193                                FTC_Cache   cache,
    194                                FT_Glyph   *aglyph )
    195   {
    196     FTC_BasicFamily  family = (FTC_BasicFamily)ftcfamily;
    197     FT_Error         error;
    198     FTC_Scaler       scaler = &family->attrs.scaler;
    199     FT_Face          face;
    200     FT_Size          size;
    201 
    202 
    203     /* we will now load the glyph image */
    204     error = FTC_Manager_LookupSize( cache->manager,
    205                                     scaler,
    206                                     &size );
    207     if ( !error )
    208     {
    209       face = size->face;
    210 
    211       error = FT_Load_Glyph( face, gindex, family->attrs.load_flags );
    212       if ( !error )
    213       {
    214         if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP  ||
    215              face->glyph->format == FT_GLYPH_FORMAT_OUTLINE )
    216         {
    217           /* ok, copy it */
    218           FT_Glyph  glyph;
    219 
    220 
                  // グリフの呼び出し
    221           error = FT_Get_Glyph( face->glyph, &glyph );
    222           if ( !error )
    223           {
    224             *aglyph = glyph;
    225             goto Exit;
    226           }
    227         }
    228         else
    229           error = FTC_Err_Invalid_Argument;
    230       }
    231     }
    232 
    233   Exit:
    234     return error;
    235   }
    270   FT_CALLBACK_TABLE_DEF
    271   const FTC_IFamilyClassRec  ftc_basic_image_family_class =
    272   {
    273     {
    274       sizeof ( FTC_BasicFamilyRec ),
    275       ftc_basic_family_compare,
    276       ftc_basic_family_init,
    277       0,                        /* FTC_MruNode_ResetFunc */
    278       0                         /* FTC_MruNode_DoneFunc  */
    279     },
            // 関数へのポインタ
    280     ftc_basic_family_load_glyph
    281   };

    284   FT_CALLBACK_TABLE_DEF
    285   const FTC_GCacheClassRec  ftc_basic_image_cache_class =
    286   {
    287     {
    288       ftc_inode_new,
    289       ftc_inode_weight,
    290       ftc_gnode_compare,
    291       ftc_basic_gnode_compare_faceid,
    292       ftc_inode_free,
    293 
    294       sizeof ( FTC_GCacheRec ),
    295       ftc_gcache_init,
    296       ftc_gcache_done
    297     },
             // クラスへのポインタ
    298     (FTC_MruListClass)&ftc_basic_image_family_class
    299   };
    300 

    304   FT_EXPORT_DEF( FT_Error )
    305   FTC_ImageCache_New( FTC_Manager      manager,
    306                       FTC_ImageCache  *acache )
    307   {
                                            //ポインタをセットする。  
    308     return FTC_GCache_New( manager, &ftc_basic_image_cache_class,
    309                            (FTC_GCache*)acache );
    310   }
    174   FT_LOCAL_DEF( FT_Error )
    175   FTC_GCache_New( FTC_Manager       manager,
    176                   FTC_GCacheClass   clazz,
    177                   FTC_GCache       *acache )
    178   {
                               // ラップしてる
    179     return FTC_Manager_RegisterCache( manager, (FTC_CacheClass)clazz,
    180                                       (FTC_Cache*)acache );
    181   }