Well, sorry to say, but it was a hard piece of code, 
but it's done !!
As It's not obvious (at least...for me), 

The worse part is surely the two times pattern matching, 
one in XlfdParse and on in XfontMatch... 

So here it is...

If you could make it a function in directly in Xft, I could be happy not to have to 
maintain it, as it is too hard for me... 
(int this case surely filename and display should become parameters)

This could be a function that returns complete filename and path according to XLFD
{
        XftPattern          *match, *pat;
        XftResult       result;
        char            file[1048]; // will contains the filename 
        XftValue        v;
        XftResult       r;

        pat = XftXlfdParse (font_filename, False, False); 
        if (!pat)
          return NULL;
        match = XftFontMatch (GDK_DISPLAY(), 0, pat, &result);  
        if (!match || result != XftResultMatch)
          return NULL;
        XftPatternDestroy (pat);
         //     Using this function leads to segfaults if fonts wasn't there...
        //      XftPatternGetString (match, XFT_FILE, 0, filename); 
        //   so here its content, a little hacked
        // 
        r = XftPatternGet (match, XFT_FILE, 0, &v);
        if (r != XftResultMatch)
          return NULL;
        if (v.type != XftTypeString)
          return NULL;
        strcpy (file, v.u.s);
        XftPatternDestroy (match);
}

Now that I know how hard it is,
I want to thank you  for the GREAT and HARD work you made !!

regards,
Paul Cheyrou-lagreze.
_______________________________________________
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts

Reply via email to