Query: xdrawtext16
OS: hpux
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
XDrawText16() XDrawText16() Name XDrawText16 - draw 16-bit polytext strings. Synopsis XDrawText16(display, drawable, gc, x, y, items, nitems) Display *display; Drawable drawable; GC gc; int x, y; XTextItem16 *items; int nitems; Arguments display Specifies a connection to an X server; returned from XOpenDisplay(). drawable Specifies the drawable. gc Specifies the graphics context. x Specify the x and y coordinates of the baseline starting position for the initial string, relative to the origin of the specified y drawable. items Specifies a pointer to an array of text items using two-byte characters. nitems Specifies the number of text items in the array. Description XDrawText16() is capable of drawing multiple strings on the same horizontal line and changing fonts between strings. Each XTextItem struc- ture contains a string, the number of characters in the string, the delta offset from the starting position for the string, and the font. Each text item is processed in turn. The font in each XTextItem is stored in the specified GC and used for subsequent text. If the XTex- tItem16.font is None, the font in the GC is used for drawing and is not changed. Switching between fonts with different drawing directions is permitted. The delta in each XTextItem specifies the change in horizontal position before the string is drawn. The delta is always added to the char- acter origin and is not dependent on the drawing direction of the font. For example, if x = 40, y = 20, and items[0].delta = 8, the string specified by items[0].chars would be drawn starting at x = 48, y = 20. The delta for the second string begins at the rbearing of the last character in the first string. A negative delta would tend to overlay subsequent strings on the end of the previous string. Only the pixels selected in the font are drawn (the background member of the GC is not used to fill the bounding box). In all X releases there is a limit to the number and size of strings that can be drawn in a single XDrawText16() call, that varies accord- ing to the server. To determine how much text you can draw in a single call, you find out your server's maximum request size using XMaxRe- questSize(). Subtract four, and then subtract ((strlen(string)+2)/4) for each string. This is the maximum amount of text you can draw in a single XDrawText16() call. XDrawText16() uses the following elements in the specified GC: function, plane_ mask, fill_style, font, subwindow_mode, clip_x_origin, clip_y_origin, and clip_mask. This function also uses these graphics context mode-dependent components: foreground, background, tile, stipple, ts_x_origin, and ts_y_ origin. Note that the chars member of the XTextItem16 structure is of type XChar2b, rather than of type char as it is in the XTextItem structure. For fonts defined with linear indexing rather than two-byte matrix indexing, the X server will interpret each member of the XChar2b struc- ture as a 16-bit number that has been transmitted most significant byte first. In other words, the byte1 member of the XChar2b structure is taken as the most significant byte. For more information, see Volume One, Chapter 6, Drawing Graphics and Text, and Chapter 5, The Graphics Context. Structures typedef struct { XChar2b *chars; /* 2 byte characters */ int nchars; /* number of characters */ int delta; /* delta between strings */ Font font; /* font to print it in, None don't change */ } XTextItem16; typedef struct { /* normal 16 bit characters are two bytes */ unsigned char byte1; unsigned char byte2; } XChar2b; Errors BadDrawable BadFont BadGC BadMatch See Also XDrawImageString(), XDrawImageString16(), XDrawString(), XDrawString16(), XDrawText(), XQueryTextExtents(), XQueryTextExtents16(), XTextEx- tents(), XTextExtents16(), XTextWidth(), XTextWidth16(). Xlib - Text XDrawText16()