XCreateGlyphCursor()XCreateGlyphCursor()NameXCreateGlyphCursor – create a cursor from font glyphs.
Synopsis
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 a connection to an X server; returned from
XOpenDisplay().
source_font
Specifies the font from which a character is to be used for
the cursor.
mask_font Specifies the mask font or None.
source_char
Specifies the index into the cursor shape font.
mask_char Specifies the index into the mask shape font. Optional;
specify 0 if not needed.
foreground_color
Specifies the red, green, and blue (RGB) values for the fore‐
ground.
background_color
Specifies the red, green, and blue (RGB) values for the back‐
ground.
Returns
The created cursor.
DescriptionXCreateGlyphCursor() is similar to XCreatePixmapCursor(), but the
source and mask bitmaps are obtained from separate font characters,
perhaps in separate fonts. The mask font and character are optional.
If mask_char is not specified, all pixels of the source are displayed.
The x offset for the hotspot of the created cursor is the left-bearing
for the source character, and the y offset is the ascent, each measured
from the upper-left corner of the bounding rectangle of the character.
The origins of the source and mask (if it is defined) characters are
positioned coincidently and define the hotspot. The source and mask
need not have the same bounding box metrics, and there is no restric‐
tion on the placement of the hotspot relative to the bounding boxes.
Note that source_char and mask_char are of type unsigned int, not of
type XChar2b. For two-byte matrix fonts, source_char and mask_char
should be formed with the byte1 member in the most significant byte and
the byte2 member in the least significant byte.
You can free the fonts with XFreeFont() if they are no longer needed
after creating the glyph cursor.
For more information on fonts and cursors, see Volume One, Chapter 6,
Drawing Graphics and Text.
Structures
typedef struct {
unsigned long pixel;
unsigned short red, green, blue;
char flags; /* DoRed, DoGreen, DoBlue */
char pad;
} XColor;
Errors
BadAlloc
BadFont
BadValue source_char not defined in source_font.
mask_char not defined in mask_font (if mask_font defined).
See AlsoXCreateFontCursor(), XCreatePixmapCursor(), XDefineCursor(), XFreeCur‐
sor(), XQueryBestCursor(), XQueryBestSize(), XRecolorCursor(), XUnde‐
fineCursor().
Xlib - Cursors XCreateGlyphCursor()