100) Why does using XmStringDraw cause a Bad Font error?

[Last modified: May 93]

Answer: From Thomas Berlage (berlage@gmdzi.gmd.de): You could call this a bug
in Motif. You pass a GC to XmStringDraw, however, Motif wants to use the fonts
from the font list to draw the string.  Therefore it replaces the font of the
GC temporarily with some fonts of its own as specified in the font list. In
the end it tries to restore the old font of the GC. There comes the problem:

If a GC uses the default font, the client side GC structure does not have a
valid font id (that is the 0xffffffff you may see in the error message). Motif
tries to restore this invalid id at the end.

The workaround is: Before drawing with XmStringDraw, set the font id of the GC
to any valid font id, for example using

      XSetFont (display, gc, XLoadFont (display, "fixed"));
Go Back Up

Go To Previous

Go To Next