Font selection dialog in Motif

Font selection dialog in Motif

Post by jupe » Mon, 25 Dec 2006 17:37:49


I'm writing a motif app. The user must be able to select fonts for
extrusion. Is there a font selection dialog in Motif? I'm currently
using "XmFileSelectionBoxWidgetClass" and let the user to select the
font files directly, which is not very elegant solution.
 
 
 

Font selection dialog in Motif

Post by Gary Meers » Mon, 25 Dec 2006 20:35:07


I have not found a dialog for this, but have written an application that
you may find useful as a base to build your own. The source can be found
at http://www.yqcomputer.com/ ~tgmeer/showfonts.c. The Makefile is
stored as http://www.yqcomputer.com/ ~tgmeer/Makefile, and you will
also need
http://www.yqcomputer.com/ ~tgmeer/fallback.h for the complete program.
A color selection application can be found at
http://www.yqcomputer.com/ ~tgmeer/showcolors.c, using the same
fallback.h and a slightly modified Makefile. Hope that this helps.
--
Gary Meerschaert
Madison Heights, MI

Don't give up on your dreams.
Wait a bit and they'll give up on you
and you can start again without all of that guilt.

XXXX@XXXXX.COM

 
 
 

Font selection dialog in Motif

Post by jupe » Wed, 27 Dec 2006 17:37:27


Thanks Gary, for the source code! It would have taken me quite some
time to get this implemented from scratch.
 
 
 

Font selection dialog in Motif

Post by Fred Klein » Fri, 05 Jan 2007 00:48:10


If you are using Motif 2.2, there is an XmFontSelector widget,
similar to the ICS XiFontSelectionBox.

See FontS.h and FontSP.h
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project
 
 
 

Font selection dialog in Motif

Post by Chris Sore » Thu, 11 Jan 2007 11:37:17


That's a bit harsh hardcoding the path to xfd:

"/usr/openwin/bin/xfd -fn '%s' &",

If you change the line to:

"xfd -fn '%s' &",

it will use the PATH that the program inherits from the user's
environment.

(That's line 939 by the way).

Just a thought...
 
 
 

Font selection dialog in Motif

Post by Gary Meers » Thu, 11 Jan 2007 13:01:42


I agree that that would make it a bit more portable, but I have been
burned by users with odd paths, and so try to always specifically call
out programs. This also helps to avoid getting burned by Trojan horse
programs or strange aliases. A pre-processor branch would work to
specify different paths for different operating systems, like so:

#ifdef __sun
"/usr/openwin/bin/xfd -fn '%s' &",
#else
"/usr/X11/bin/xfd -fn '%s' &",
#endif

--
Gary Meerschaert
Madison Heights, MI

Don't give up on your dreams.
Wait a bit and they'll give up on you
and you can start again without all of that guilt.

XXXX@XXXXX.COM