Chapter 7. Output to Display
66
7.2 X Clients
The way to develop X clients can differ drastically dependent on the toolkits to be used. At first,
Xlib style programming is discussed since Xlib is the fundamental for all other toolkits. Then a
few toolkits are discussed.
7.2.1 Xlib programming
X itself is already internationalized. X11R5 has introduced an idea of 'fontset' for internationalized
text output. Thus all what X clients have to do is to use the 'fontset' related functions.
The most important part for internationalization of displaying for X clients is the usage of interna
tionalized XFontSet related functions introduced since X11R5 instead of conventional XFontStruct
related functions.
The main feature of XFontSet is that it can handle multiple fonts at the same time. This is related
to the distinction between coded character set (CCS) and character encoding scheme (CES) which
I wrote at the section of `Basic Terminology' on page
9
. Some encodings in the world use multiple
coded character sets at the same time. This is the reason we have to handle multiple X fonts at the
same time.
3
Another significant feature of XFontSet is that it is locale (LC_CTYPE) sensible. This means that
you have to call
setlocale()
before you use XFontSet related functions. And more, you have
to specify the string you want to draw as a multibyte character or a wide character.
In the conventional
XFontStruct
model, an X client opens a font using
XLoadQueryFont()
,
draw a string using
XDrawString()
, and close the font using
XFreeFont()
. On the other hand,
in the internationalized
XFontSet
model, an X client opens a font using
XCreateFontSet()
,
draw a string using
XmbDrawString()
, and close the font using
XFreeFontSet()
. The follow
ing are a concise list of substitution.
XFontStruct
>
XFontSet
XLoadQueryFont()
>
XCreateFontSet()
both of
XDrawString()
and
XDrawString16
> either of
XmbDrawString()
or
XwcDrawString()
both of
XDrawImageString()
and
XDrawImageString16
> either of
XmbDrawImageString()
or
XwcDrawImageString()
Note that
XFontStruct
is usually used as a pointer, while
XFontSet
itself is a pointer.
3
Though UTF 8 is an encoding with single CCS, the current version of XFree86 (4.0.1) needs multiple fonts to handle
UTF 8.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved