Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

Motif FAQ (Part 6 of 9)
Section - 217) Why does using XmStringDraw cause a BadFont error?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Airports ]


Top Document: Motif FAQ (Part 6 of 9)
Previous Document: 216) Why doesn't XmStringGetNextSegment() work properly?
Next Document: 218) How can I control color of individual strings to show status,
See reader questions & answers on this topic! - Help others by sharing your knowledge
[Last modified: Mar 96]

Answer: Thomas Berlage (berlage@gmdzi.gmd.de) wrote: 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"));

Another solution is available from "Harry's Motif Programming Corner", Harald
Albrecht, albrecht@igpm.rwth-aachen.de, who writes:

"It's somewhat longer but doesn't rely on a font named "fixed" installed on
your platform. Instead it takes a fontlist and then uses the first font listed
there. You'll find this source together with a short demo program (which
creates a DrawingArea and then paints some text in it) on: ftp.igpm.rwth-
aachen.de (134.130.161.30) in: /arc/pub/unix/motif/RenderXmString.tar.gz

There's also a html page available: Harry's Motif Programming Corner
http://www.igpm.rwth-aachen.de/~albrecht/motifcorner.html

Thanks to Harald Albrecht (albrecht@igpm.rwth-aachen.de).  URL corrected by
irca (irca@zip.cra.enel.it).

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: Motif FAQ (Part 6 of 9)
Previous Document: 216) Why doesn't XmStringGetNextSegment() work properly?
Next Document: 218) How can I control color of individual strings to show status,

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
kenton@rahul.net (Ken Lee)





Last Update March 27 2014 @ 02:11 PM