1XCreateFontCursor(3) XLIB FUNCTIONS XCreateFontCursor(3)
2
3
4
6 XCreateFontCursor, XCreatePixmapCursor, XCreateGlyphCursor - create
7 cursors
8
10 #include <X11/cursorfont.h>
11
12 Cursor XCreateFontCursor(Display *display, unsigned int shape);
13
14 Cursor XCreatePixmapCursor(Display *display, Pixmap source, Pixmap
15 mask, XColor *foreground_color, XColor *background_color,
16 unsigned int x, unsigned int y);
17
18 Cursor XCreateGlyphCursor(Display *display, Font source_font, Font
19 mask_font, unsigned int source_char, unsigned int mask_char,
20 XColor *foreground_color, XColor *background_color);
21
23 background_color
24 Specifies the RGB values for the background of the source.
25
26 display Specifies the connection to the X server.
27
28 foreground_color
29 Specifies the RGB values for the foreground of the source.
30
31 mask Specifies the cursor's source bits to be displayed or None.
32
33 mask_char Specifies the glyph character for the mask.
34
35 mask_font Specifies the font for the mask glyph or None.
36
37 shape Specifies the shape of the cursor.
38
39 source Specifies the shape of the source cursor.
40
41 source_char
42 Specifies the character glyph for the source.
43
44 source_font
45 Specifies the font for the source glyph.
46
47 x
48 y Specify the x and y coordinates, which indicate the hotspot
49 relative to the source's origin.
50
52 X provides a set of standard cursor shapes in a special font named cur‐
53 sor. Applications are encouraged to use this interface for their cur‐
54 sors because the font can be customized for the individual display
55 type. The shape argument specifies which glyph of the standard fonts
56 to use.
57
58 The hotspot comes from the information stored in the cursor font. The
59 initial colors of a cursor are a black foreground and a white back‐
60 ground (see XRecolorCursor).
61
62 XCreateFontCursor can generate BadAlloc and BadValue errors.
63
64 The XCreatePixmapCursor function creates a cursor and returns the cur‐
65 sor ID associated with it. The foreground and background RGB values
66 must be specified using foreground_color and background_color, even if
67 the X server only has a StaticGray or GrayScale screen. The foreground
68 color is used for the pixels set to 1 in the source, and the background
69 color is used for the pixels set to 0. Both source and mask, if speci‐
70 fied, must have depth one (or a BadMatch error results) but can have
71 any root. The mask argument defines the shape of the cursor. The pix‐
72 els set to 1 in the mask define which source pixels are displayed, and
73 the pixels set to 0 define which pixels are ignored. If no mask is
74 given, all pixels of the source are displayed. The mask, if present,
75 must be the same size as the pixmap defined by the source argument, or
76 a BadMatch error results. The hotspot must be a point within the
77 source, or a BadMatch error results.
78
79 The components of the cursor can be transformed arbitrarily to meet
80 display limitations. The pixmaps can be freed immediately if no fur‐
81 ther explicit references to them are to be made. Subsequent drawing in
82 the source or mask pixmap has an undefined effect on the cursor. The X
83 server might or might not make a copy of the pixmap.
84
85 XCreatePixmapCursor can generate BadAlloc and BadPixmap errors.
86
87 The XCreateGlyphCursor function is similar to XCreatePixmapCursor
88 except that the source and mask bitmaps are obtained from the specified
89 font glyphs. The source_char must be a defined glyph in source_font,
90 or a BadValue error results. If mask_font is given, mask_char must be
91 a defined glyph in mask_font, or a BadValue error results. The
92 mask_font and character are optional. The origins of the source_char
93 and mask_char (if defined) glyphs are positioned coincidently and
94 define the hotspot. The source_char and mask_char need not have the
95 same bounding box metrics, and there is no restriction on the placement
96 of the hotspot relative to the bounding boxes. If no mask_char is
97 given, all pixels of the source are displayed. You can free the fonts
98 immediately by calling XFreeFont if no further explicit references to
99 them are to be made.
100
101 For 2-byte matrix fonts, the 16-bit value should be formed with the
102 byte1 member in the most significant byte and the byte2 member in the
103 least significant byte.
104
105 XCreateGlyphCursor can generate BadAlloc, BadFont, and BadValue errors.
106
108 BadAlloc The server failed to allocate the requested resource or
109 server memory.
110
111 BadFont A value for a Font or GContext argument does not name a
112 defined Font.
113
114 BadMatch Some argument or pair of arguments has the correct type and
115 range but fails to match in some other way required by the
116 request.
117
118 BadPixmap A value for a Pixmap argument does not name a defined Pixmap.
119
120 BadValue Some numeric value falls outside the range of values accepted
121 by the request. Unless a specific range is specified for an
122 argument, the full range defined by the argument's type is
123 accepted. Any argument defined as a set of alternatives can
124 generate this error.
125
127 XDefineCursor(3), XLoadFont(3), XRecolorCursor(3)
128 Xlib - C Language X Interface
129
130
131
132X Version 11 libX11 1.3.4 XCreateFontCursor(3)