XDrawText(3X11) AIX (XLIB FUNCTIONS) XDrawText(3X11) NAME XDrawText, XDrawText16, XTextItem, XTextItem16 - draw polytext text and text drawing structures SYNTAX XDrawText(_d_i_s_p_l_a_y, _d, _g_c, _x, _y, _i_t_e_m_s, _n_i_t_e_m_s) Display *_d_i_s_p_l_a_y; Drawable _d; GC _g_c; int _x, _y; XTextItem *_i_t_e_m_s; int _n_i_t_e_m_s; XDrawText16(_d_i_s_p_l_a_y, _d, _g_c, _x, _y, _i_t_e_m_s, _n_i_t_e_m_s) Display *_d_i_s_p_l_a_y; Drawable _d; GC _g_c; int _x, _y; XTextItem16 *_i_t_e_m_s; int _n_i_t_e_m_s; ARGUMENTS _d Specifies the drawable. _d_i_s_p_l_a_y Specifies the connection to the X server. _g_c Specifies the GC. _i_t_e_m_s Specifies an array of text items. _n_i_t_e_m_s Specifies the number of text items in the array. _x _y Specify the x and y coordinates, which are rela- tive to the origin of the specified drawable and define the origin of the first character. DESCRIPTION The _X_D_r_a_w_T_e_x_t_1_6 function is similar to _X_D_r_a_w_T_e_x_t except that it uses 2-byte or 16-bit characters. Both functions allow complex spacing and font shifts between counted strings. Each text item is processed in turn. A font member other than _N_o_n_e in an item causes the font to be stored in the GC and used for subsequent text. A text element delta specifies an additional change in the position along the x axis before the string is drawn. The delta is always added to the char- acter origin and is not dependent on any characteristics of the font. Each character image, as defined by the font in the GC, is treated as an additional mask for a fill opera- tion on the drawable. The drawable is modified only where the font character has a bit set to 1. If a text item gen- erates a _B_a_d_F_o_n_t error, the previous text items may have Rev. Release 5 Page 1 XDrawText(3X11) AIX (XLIB FUNCTIONS) XDrawText(3X11) been drawn. For fonts defined with linear indexing rather than 2-byte matrix indexing, each _X_C_h_a_r_2_b structure is interpreted as a 16-bit number with byte1 as the most-significant byte. Both functions use these GC components: function, plane- mask, fill-style, font, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. They also use these GC mode- dependent components: foreground, background, tile, stipple, tile-stipple-x-origin, and tile-stipple-y-origin. _X_D_r_a_w_T_e_x_t and _X_D_r_a_w_T_e_x_t_1_6 can generate _B_a_d_D_r_a_w_a_b_l_e, _B_a_d_F_o_n_t, _B_a_d_G_C, and _B_a_d_M_a_t_c_h errors. STRUCTURES The _X_T_e_x_t_I_t_e_m and _X_T_e_x_t_I_t_e_m_1_6 structures contain: typedef struct { char *chars; /* pointer to string */ int nchars; /* number of characters */ int delta; /* delta between strings */ Font font; /* Font to print it in, None don't change */ } XTextItem; typedef struct { XChar2b *chars; /* pointer to two-byte characters */ int nchars; /* number of characters */ int delta; /* delta between strings */ Font font; /* font to print it in, None don't change */ } XTextItem16; If the font member is not _N_o_n_e, the font is changed before printing and also is stored in the GC. If an error was gen- erated during text drawing, the previous items may have been drawn. The baseline of the characters are drawn starting at the x and y coordinates that you pass in the text drawing functions. For example, consider the background rectangle drawn by _X_D_r_a_w_I_m_a_g_e_S_t_r_i_n_g. If you want the upper-left corner of the background rectangle to be at pixel coordinate (x,y), pass the (x,y + ascent) as the baseline origin coordinates to the text functions. The ascent is the font ascent, as given in the _X_F_o_n_t_S_t_r_u_c_t structure. If you want the lower-left corner of the background rectangle to be at pixel coordinate (x,y), pass the (x,y - descent + 1) as the baseline origin coordinates to the text functions. The descent is the font descent, as given in the _X_F_o_n_t_S_t_r_u_c_t structure. DIAGNOSTICS _B_a_d_D_r_a_w_a_b_l_e A value for a Drawable argument does not name a Rev. Release 5 Page 2 XDrawText(3X11) AIX (XLIB FUNCTIONS) XDrawText(3X11) defined Window or Pixmap. _B_a_d_F_o_n_t A value for a Font or GContext argument does not name a defined Font. _B_a_d_G_C A value for a GContext argument does not name a defined GContext. _B_a_d_M_a_t_c_h An _I_n_p_u_t_O_n_l_y window is used as a Drawable. SEE ALSO XDrawImageString(3X11), XDrawString(3X11), XLoadFont(3X11) _X_l_i_b - _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e Rev. Release 5 Page 3