#include <X11/cursorfont.h>

Cursor XCreateFontCursor(display, shape)
      Display *display;
      unsigned int shape;


display Specifies the connection to the X server.
shape Specifies the shape of the cursor.


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 font can be customized for the individual display type. The shape argument specifies which glyph of the standard fonts to use.

The hotspot comes from the information stored in the cursor font. The initial colors of a cursor are a black foreground and a white background (see XRecolorCursor()). For further information about cursor shapes, see "X Font Cursors".

XCreateFontCursor() can generate BadAlloc and BadValue errors.


BadAlloc The server failed to allocate the requested source or server memory.
BadValue Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error.

See also

XCreateGlyphCursor(), XCreatePixmapCursor(), XDefineCursor(), XLoadFont(), XRecolorCursor(), "Creating, Recoloring, and Freeing Cursors".
Christophe Tronche, ch@tronche.com