1XDrawText(3X11)                 XLIB FUNCTIONS                 XDrawText(3X11)
2
3
4

NAME

6       XDrawText, XDrawText16, XTextItem, XTextItem16 - draw polytext text and
7       text drawing structures
8

SYNTAX

10       int XDrawText(Display *display, Drawable d, GC gc, int x, int y, XTex‐
11              tItem *items, int nitems);
12
13       int XDrawText16(Display *display, Drawable d, GC gc, int x, int y,
14              XTextItem16 *items, int nitems);
15

ARGUMENTS

17       d         Specifies the drawable.
18
19       display   Specifies the connection to the X server.
20
21       gc        Specifies the GC.
22
23       items     Specifies an array of text items.
24
25       nitems    Specifies the number of text items in the array.
26
27
28       x
29       y         Specify the x and y coordinates, which are relative to the
30                 origin of the specified drawable and define the origin of the
31                 first character.
32

DESCRIPTION

34       The XDrawText16 function is similar to XDrawText except that it uses
35       2-byte or 16-bit characters.  Both functions allow complex spacing and
36       font shifts between counted strings.
37
38       Each text item is processed in turn.  A font member other than None in
39       an item causes the font to be stored in the GC and used for subsequent
40       text.  A text element delta specifies an additional change in the posi‐
41       tion along the x axis before the string is drawn.  The delta is always
42       added to the character origin and is not dependent on any characteris‐
43       tics of the font.  Each character image, as defined by the font in the
44       GC, is treated as an additional mask for a fill operation on the draw‐
45       able.  The drawable is modified only where the font character has a bit
46       set to 1.  If a text item generates a BadFont error, the previous text
47       items may have been drawn.
48
49       For fonts defined with linear indexing rather than 2-byte matrix index‐
50       ing, each XChar2b structure is interpreted as a 16-bit number with
51       byte1 as the most significant byte.
52
53       Both functions use these GC components: function, plane-mask, fill-
54       style, font, subwindow-mode, clip-x-origin, clip-y-origin, and clip-
55       mask.  They also use these GC mode-dependent components: foreground,
56       background, tile, stipple, tile-stipple-x-origin, and tile-stipple-y-
57       origin.
58
59       XDrawText and XDrawText16 can generate BadDrawable, BadFont, BadGC, and
60       BadMatch errors.
61

STRUCTURES

63       The XTextItem and XTextItem16 structures contain:
64
65       typedef struct {
66            char *chars;             /∗ pointer to string */
67            int nchars;              /∗ number of characters */
68            int delta;               /∗ delta between strings */
69            Font font;               /∗ Font to print it in, None don't change */
70       } XTextItem;
71
72       typedef struct {
73            XChar2b *chars;          /∗ pointer to two-byte characters */
74            int nchars;              /∗ number of characters */
75            int delta;               /∗ delta between strings */
76            Font font;               /∗ font to print it in, None don't change */
77       } XTextItem16;
78
79       If the font member is not None, the font is changed before printing and
80       also is stored in the GC.  If an error was generated during text draw‐
81       ing, the previous items may have been drawn.  The baseline of the char‐
82       acters are drawn starting at the x and y coordinates that you pass in
83       the text drawing functions.
84
85       For example, consider the background rectangle drawn by XDrawIm‐
86       ageString.  If you want the upper-left corner of the background rectan‐
87       gle to be at pixel coordinate (x,y), pass the (x,y + ascent) as the
88       baseline origin coordinates to the text functions.  The ascent is the
89       font ascent, as given in the XFontStruct structure.  If you want the
90       lower-left corner of the background rectangle to be at pixel coordinate
91       (x,y), pass the (x,y - descent + 1) as the baseline origin coordinates
92       to the text functions.  The descent is the font descent, as given in
93       the XFontStruct structure.
94

DIAGNOSTICS

96       BadDrawable
97                 A value for a Drawable argument does not name a defined Win‐
98                 dow or Pixmap.
99
100       BadFont   A value for a Font or GContext argument does not name a
101                 defined Font.
102
103       BadGC     A value for a GContext argument does not name a defined GCon‐
104                 text.
105
106       BadMatch  An InputOnly window is used as a Drawable.
107

SEE ALSO

109       XDrawImageString(3X11), XDrawString(3X11), XLoadFont(3X11)
110       Xlib - C Language X Interface
111
112
113
114X Version 11                     libX11 1.0.3                  XDrawText(3X11)
Impressum