Re: About FcFreeTypeQueryFace()

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

 



I have a FT_Face and I want to get the filename of the file it is
loaded from. I know that this FT_Face is loaded from one of the font
in the fontconfig database, so I try to create an FcPattern from and
FT_Face and do a match. I hope this is exactly what the code do.

On Thu, Jan 21, 2010 at 2:06 AM, Behdad Esfahbod <behdad@xxxxxxxxxx> wrote:
> 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@xxxxxxxxxxxxxxxxxxxxx
>> http://lists.freedesktop.org/mailman/listinfo/fontconfig
>>
>
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig


[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux