[Fontconfig] About FcFreeTypeQueryFace()
Behdad Esfahbod
behdad at behdad.org
Wed Jan 20 10:06:11 PST 2010
Maybe you can explain what you are trying to achieve?
The face index can be accessed using face->face_index. There's no way to get
the filename from the face.
behdad
On 01/20/2010 11:27 AM, Nestal Wan wrote:
> Hi,
>
> I am new to FontConfig. I have a FT_Face and I want to get the
> filename and font index from it. I found FcFreeTypeQueryFace() should
> be useful. However, what should I put in the second and third
> argument? I don't quite understand what is mean by "used solely as
> data for pattern elements" as mentioned in the man page. I tried to
> put NULL and zero but the call fails. If I put something non-zero, the
> call success:
>
> // something non-null
> FcChar8 abc[1] ;
>
> FcBlanks *b = FcBlanksCreate() ;
> FcPattern *p = FcFreeTypeQueryFace( face, abc, 0, b ) ;
>
> FcChar8 *filename2 ;
> FcResult result ;
> FcPattern *matched = FcFontMatch( 0, p, &result);
>
> if (FcPatternGetString (matched, FC_FILE, 0, &filename2) != FcResultMatch)
> std::cout << "oops" << std::endl ;
>
> int id ;
> if (FcPatternGetInteger (matched, FC_INDEX, 0, &id) != FcResultMatch)
> std::cout << "oops2" << std::endl ;
>
> std::cout << "file is " << filename2 << " " << id << std::endl ;
>
> It actually works. I want to ask if it is OK to put some dummy
> non-null pointer to the function?
>
> Thanks in advance.
>
> Nestal
> _______________________________________________
> Fontconfig mailing list
> Fontconfig at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/fontconfig
>
More information about the Fontconfig
mailing list