[comp.windows.x] How do I load the cursor font AS A FONT?

moo@uts.amdahl.com (Chris Halpin) (11/17/90)

I'm posting this question for a friend of mine who is not
able to post from his site. Please reply here or to him:

    uunet!pbs.org!npri6!eric

Eric writes:

> I'm faced with creating my own text widget. (Actually, I intend to paint
> over an existing toolkit widget.) I need an I-beam marker for the
> insertion point. I found one in the standard cursor font. The question is:
> How do I load the cursor font AS A FONT? The name does not look like
> your standard X font name (just "CURSOR", not "-Cursor-ITC Blech-etc.")
> I'm afraid (although I haven't tried it yet) that if I look it up or
> load it, something will explode. Am I paranoid? Will the X layer know
> what I'm talking about? Yours truly & thanks in advance.
-- 

Chris Halpin
arpa: moo@uts.amdahl.com
uucp: ...!{ames,decwrl,uunet,pyramid,sun}!amdahl!moo

mouse@LARRY.MCRCIM.MCGILL.EDU (11/18/90)

> The question is: How do I load the cursor font AS A FONT?

XLoadFont, XLoadQueryFont, etc, just like any other font.

> The name does not look like your standard X font name (just "CURSOR",
> not "-Cursor-ITC Blech-etc.")

It may not be an XLFD font, but it's still a perfectly good font.

> I'm afraid (although I haven't tried it yet) that if I look it up or
> load it, something will explode.  Am I paranoid?

Yes.  If trying to load strange fonts names causes your server to blow
up, it's time to file a major bug report with whoever deals with bug
reports for your server (and start looking for alternate servers).

From the Xlib document:

	To create a cursor from a standard font, use XCreateFontCursor.
	
[description of XCreateFontCursor omitted]
	
	X provides a set of standard cursor shapes in a special font
	named cursor.  Applications are encouraged to use this
	interface for their cursors because [...].  The shape argument
	specifies which glyph of the standard fonts to use.  [...]  For
	further information about cursor shapes, see appendix B.

(Appendix B simply lists the names available and the corresponding
numeric values.)

In particular, notice that it promises that the cursor font is called
"cursor", so it shouldn't be too surprising to find exactly that....

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu