XCreateFontCursor(3X) XCreateFontCursor(3X)NAME XCreateFontCursor, XCreatePixmapCursor, XCreateGlyphCursor - create pointers SYNOPSIS #include <X11/cursorfont.h> Cursor XCreateFontCursor (display, shape) Display *display; unsigned int shape; Cursor XCreatePixmapCursor(display, source, mask, foreground-color, background-color, x, y) Display *display; Pixmap source; Pixmap mask; XColor *foreground-color; XColor *background-color; unsigned int x,y; Cursor XCreateGlyphCursor (display, source-font, mask-font, source-char, mask-char, foreground-color, background-color) Display *display; Font source-font,mask-font; unsigned int source-char,mask-char; XColor *foreground-color; XColor *background-color; DESCRIPTION The XCreateFontCursor function creates a pointer from a standard font. Applications are encouraged to use this in- terface for their pointers because the font can be custom- ized 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 stan- dard font. The initial colors of a pointer are a black foreground and a white background (see XRecolorCursor). The XCreatePixmapCursor function creates a pointer and re- turns the associated pointer ID. The foreground and back- ground RGB values must be specified using foreground-color and background-color, even if the X server only has a Sta- ticGray or GrayScale screen. The foreground color is used for the pixels set to 1 in the source, and the background color is used for the pixels set to 0. Both source and mask, if specified, must have a depth of 1 (or a BadMatch error results) but can have any root. The mask argument de- fines the shape of the pointer. The pixels set to 1 in the mask define which source pixels are displayed, and the pix- els set to 0 define which pixels are ignored. If no mask is given, all pixels of the source are displayed. The mask, if November, 1990 1
XCreateFontCursor(3X) XCreateFontCursor(3X)present, must be the same size as the pixel map defined by the source argument, or a BadMatch error results. The hotspot must be a point within source, or a BadMatch error results. The components of the pointer can be transformed arbitrarily to meet display limitations. The pixel maps can be freed immediately if no further explicit references to them are to be made. Subsequent drawing in the source or mask pixel map has an undefined effect on the pointer. The X server might or might not make a copy of the pixel map. The XCreateGlyphCursor function is similar to XCreatePixmap- Cursor and creates a pointer from font glyphs. For XCreateGlyphCursor, however, the source and mask bitmaps are obtained from the specified font glyphs. The source-char must be a defined glyph in source-font, or a BadValue error results. If mask-font is given, mask-char must be a defined glyph in mask-font, or a BadValue error results. The mask-font and source-char are optional. The origins of the source-char and mask-char (if defined) glyphs are positioned coincidently and define the hotspot. The source-char and mask-char need not have the same bounding box metrics, and there is no restriction on the placement of the hotspot relative to the bounding boxes. If no mask-char is given, all pixels of the source are displayed. You can free the fonts immediately by calling XFreeFont if no furth- er explicit references to them are to be made. For 2-byte matrix fonts, the 16-bit value should be formed with the byte1 member in the most-significant byte and the byte2 member in the least-significant byte. Arguments These functions accept the following arguments: background-color Specifies the RGB values for the source background. display Specifies the connection to the X server. mask Specifies the pointer source bits to be displayed. You can also pass None. mask-char Specifies the glyph character for the mask. mask-font Specifies the font for the mask glyph. You can also pass None. source-char 2 November, 1990
XCreateFontCursor(3X) XCreateFontCursor(3X)Specifies the character glyph for the source. foreground-color Specifies the RGB values for the source foreground. source-font Specifies the font for the source glyph. shape Specifies the shape in which you want to create the standard pointer. source Specifies the shape of the source pointer. x, y Specify the x and y coordinates. ERRORS BadAlloc The server failed to allocate the requested resource or server memory. BadFont A value for a Font argument does not name a defined font. BadMatch An argument or pair of arguments has the correct type and range but fails to match in some other re- quired way. BadPixmap A value for a Pixmap argument does not name a de- fined pixel map. BadValue A numeric value falls outside the range of values accepted by the request. Unless a range is speci- fied 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. The XCreateFontCursor function can generate BadAlloc and BadValue errors. The XCreatePixmapCursor function can generate BadAlloc and BadPixmap errors. The XCreateGlyphCursor function can generate BadAlloc, BadFont, and BadValue errors. SEE ALSO XDefineCursor(3X), XRecolorCursor(3X)Xlib - C Language InterfaceNovember, 1990 3