freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] does the face cache really work ?


From: Anstinus Anstinus
Subject: [ft-devel] does the face cache really work ?
Date: Wed, 01 Jun 2005 11:15:07 +0000

I find that the function ftc_face_node_compare() use " return FT_BOOL( node->face_id == face_id );" to determine whether a node exists in the MRU list.

But the face_id is just a pointer, then if I write the following code, it will not work as I expect:

************* code begin **************
typedef struct

{

        const char * file_path;

} My_FaceID_Rec, *My_FaceID;

...


FT_Face ftFace1, ftFace2;

My_FaceID_Rec faceID;

faceID.file_path = "font1.ttf";
FTC_Manager_LookupFace(GetCacheManager(), (FTC_FaceID) &faceID, &ftFace1);
faceID.file_path = "font2.ttf";
FTC_Manager_LookupFace(GetCacheManager(), (FTC_FaceID) &faceID, &ftFace2);

************* code end **************

The ftFace1 and ftFace2 will have the same value!

If I use malloc() to create My_FaceID_Rec, the face_id in each node will have different values, that is to say, each time I lookup a face, the cache will create a new node for me!.

The situation is that each My_FaceID_Rec object is associated with a face in cache. Then if I want to make the face cache run properly, I have to cache the My_FaceID_Rec objects at first!

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.com/





reply via email to

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