如何确定X11加载的字体名称?

How to determine the X11 loaded font name?

如果我使用以下方式加载字体:

char *fName = (char *)"*-c-60-iso8859-1";
XFontStruct *font = XLoadQueryFont(disp, fName);

它可以是与通配符名称匹配的几种字体中的任何一种。 如何确定实际加载的全名?

[编辑] 更正了通配符名称以匹配几个:-c--m-,没有任何匹配。 [结束]

是字体的XA_FONT属性

#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char* argv[])
{
    Display* d = XOpenDisplay(0);
    if (!d)
    {
        fprintf (stderr, "Oops, can't open display\n");
        exit(EXIT_FAILURE);
    }

    while (*++argv)
    {
        XFontStruct* f = XLoadQueryFont(d, *argv);
        unsigned long ret;
        if (f == 0)
            printf ("XLoadQueryFont failed for %s!\n", *argv);
        else
        {
            if (!XGetFontProperty(f, XA_FONT, &ret))
                printf ("XGetFontProperty(%s, XA_FONT) failed!\n", *argv);
            else
                printf ("Full name for %s is %s\n", *argv, XGetAtomName(d, (Atom)ret));
        }
    }
    return 0;
}

运行:

$ ./prog r14 9x15bold foo
Full name for r14 is -Misc-Fixed-Medium-R-Normal--14-130-75-75-C-70-JISX0201.1976-0
Full name for 9x15bold is -Misc-Fixed-Bold-R-Normal--15-140-75-75-C-90-ISO8859-1
XLoadQueryFont failed for foo!