XCreateGlyphCursor

Syntax

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;

Arguments

display Specifies the connection to the X server.
source_font Specifies the font for the source glyph.
mask_font Specifies the font for the mask glyph or None .
source_char Specifies the character glyph for the source.
mask_char Specifies the glyph character for the mask.
foreground_color Specifies the RGB values for the foreground of the source.
background_color Specifies the RGB values for the background of the source.

Description

The XCreateGlyphCursor() function is similar to XCreatePixmapCursor() except that 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 character 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 further 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.

XCreateGlyphCursor() can generate BadAlloc , BadFont , and BadValue errors.

Diagnostics

BadAlloc The server failed to allocate the requested source or server memory.
BadFont A value for a font argument does not name a defined font (or, in some cases, GContext).
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

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