Chapter 13. Examples of I18N
99
}
if (font >font != NULL)
XFreeFont(dpy, font >font);
if ((font >font = XLoadQueryFont(dpy, font >name)) == NULL)
{
if (Scr >DefaultFont.name) {
deffontname = Scr >DefaultFont.name;
}
if ((font >font = XLoadQueryFont(dpy, deffontname)) == NULL)
{
fprintf (stderr, "%s:
unable to open fonts \"%s\" or \"%s\"\n",
ProgramName, font >name, deffontname);
exit(1);
}
}
font >height = font >font >ascent + font >font >descent;
font >y = font >font >ascent;
font >ascent = font >font >ascent;
font >descent = font >font >descent;
}
This function can be divided into two large parts by
if (use_fontset)
. The part inside the
if
is for internationalized version and other part is for conventional version. Conventional version
is used when
use_fontset
is false, as you can see. This part is almost the same as the original
TWM.
Now let's study the internationalized part of
GetFont()
. It is convenient to compare the inter
nationalized part and conventional part, to study it. The first check and
XFreeFontSet()
is a
replacement of
XFreeFont()
. The next several lines is the automatic font guessing mechanism (the
simplest version), the second item of the whole patch. It only adds ,* to the font query string.
Then the added string is passed into
XCreateFontSet()
, the key function of font preparation.
13.1.4 Automatic Font Guessing
Let's imagine how this ,* works. Assume
ja_JP.eucJP
locale, where EUC JP encoding is used.
In EUC JP encoding, three fonts of
a font with charset (in XLFD meaning) of ISO8859 1 or JISX0201.1976 0,
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