Chapter 13. Examples of I18N
102
Then, is GC not used for specifying a font for internationalized version? Right. This causes to
increase the labor. The original version of TWM use a macro of
FBF
to set up the GC. Fortunately,
font specification is always performed just before the drawing of the texts. I wrote a function
MyFont_ChangeGC()
for substitution.
void
MyFont_ChangeGC(fix_fore, fix_back, fix_font)
unsigned long fix_fore, fix_back;
MyFont *fix_font;
{
Gcv.foreground = fix_fore;
Gcv.background = fix_back;
if (use_fontset) {
XChangeGC(dpy, Scr >NormalGC, GCForeground|GCBackground, &Gcv);
return;
}
Gcv.font = fix_font >font >fid;
XChangeGC(dpy, Scr >NormalGC, GCFont|GCForeground|GCBackground,&Gcv);
}
You may wonder why this is needed. You may think just do as
use_fontset
is false and it will
work well. No, because
fix_font >font
is indefinite.
I had to modify one more part related to GC in
gc.c
.
13.1.7 Geting Size of Texts
TWM calls
XTextWidth()
many times. It returns the width in pixels for a text. The international
ized version of the function is
XmbTextExtent()
and
XwcTextExtent()
, where the difference
between
mb
version and
wc
version is same as
XmbDrawString()
and so on.
I wrote a wrapper, as I did for other functions.
13.1.8 Getting Window Titles
General discussions have finished. The following discussions are specific to window managers.
Window managers have to get the names for window titles from X clients.
XFetchName()
is the
function for this purpose.
Window title names are communicated using property mechanism of X.
XA_STRING
and
XA_COMPOUND_TEXT
are types to be used for this purpose.
XA_STRING
means the text data is in ISO8859 1 encoding
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