[comp.windows.x] One down, one to go XListFontsWithInfo

swick@ATHENA.MIT.EDU (Ralph R. Swick) (06/17/89)

     Date:  15 Jun 89 23:26:41 GMT
     From:  edrc.cmu.edu!snl@pt.cs.cmu.edu  (Sean Levy)

                                               according to the
     Xlib manual (under XListFontsWithInfo, 6.5.1)

       "The information returned for each font is identical to what
        XLoadQueryFont would return, except that the per-character
        metrics are not returned."

     However, if I call XListFonts to get the names and then call XLoadFont
     on each name I get back, the id I get back never matches the id I have

The Xlib description is just a tad misleading.  The font ID is actually
assigned by Xlib - and only by a call to XLoadFont or XLoadQueryFont.
At the Protocol level, the statement is accurate; the Xlib description
plays a little too loose with the words.  XListFontsWithInfo does
not return a valid font id.

     Is XLoadFont re-loading the font and assigning a new ID to the
     re-loaded font?

In effect, yes.  There is no guarantee in Xlib that two calls to
XLoadFont or XLoadQueryFont with the same arguments will return
the same font id.  The MIT implementation, in fact, guarantees
that they will be different.

To answer your next question, no I can't think of any straight-forward,
guaranteed way to produce the font name knowing only a font id.