XDrawText, XDrawText16, XTextItem, XTextItem16 − draw polytext text and text drawing structures
int XDrawText(Display *display, Drawable d, GC gc, int x, int y, XTextItem *items, int nitems); | |
int XDrawText16(Display *display, Drawable d, GC gc, int x, int y, XTextItem16 *items, int nitems); |
d |
Specifies the drawable. | ||
display |
Specifies the connection to the X server. | ||
gc |
Specifies the GC. | ||
items |
Specifies an array of text items. | ||
nitems |
Specifies the number of text items in the array. | ||
x |
|||
y |
Specify the x and y coordinates, which are relative to the origin of the specified drawable and define the origin of the first character. |
The XDrawText16 function is similar to XDrawText 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 None 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 character 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 operation on the drawable. The drawable is modified only where the font character has a bit set to 1. If a text item generates a BadFont error, the previous text items may have been drawn.
For fonts defined with linear indexing rather than 2-byte matrix indexing, each XChar2b 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.
XDrawText and XDrawText16 can generate BadDrawable, BadFont, BadGC, and BadMatch errors.
The XTextItem and XTextItem16 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 None, the font is changed before printing and also is stored in the GC. If an error was generated 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 XDrawImageString. 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 XFontStruct 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 XFontStruct structure.
BadDrawable
A value for a Drawable argument does not name a defined Window or Pixmap.
BadFont |
A value for a Font or GContext argument does not name a defined Font. | ||
BadGC |
A value for a GContext argument does not name a defined GContext. | ||
BadMatch |
An InputOnly window is used as a Drawable. |
XDrawImageString(3),
XDrawString(3), XLoadFont(3)
Xlib − C Language X Interface
Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.
Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.
Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.
Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.
The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.
Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.
Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.
Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.