Chapter 13. Examples of I18N
100
  a font with charset of JISX0208.1983 0 or JISX0208.1990 0, and
  a font with charset of JISX0201.1976 0
are used.
1
Again assume that
GetFont
received a string of   adobe helvetica bold r normal * 
120 * * * * * *  as
font >name
. This string is a very likely specification of font. Actually, I got the
example from the default title font for TWM. Now review the behavior of
XLoadQueryFont()
.
Since it always gets at most one font, it can succeed or fail. However, since
XCreateFontSet()
may get multiple fonts, it may success only to get a part of the set of requred fonts. The assumed
calling of
XCreateFontSet()
with the
font >name
in
ja_JP.eucJP
locale goes into just such
a situation. For usual systems, only a font for ISO8859 1 or JISX0201.1976 0 is available.
2
It is
easy to solve this situation. Unlike
XLoadQueryFont()
,
XCreateFontSet()
can take a list of
patterns of fonts with wildcards.
XCreateFontSet()
chooses necessary fonts from the set of
fonts which match the patterns.  *  can match all fonts. This works for character sets for which
the given
font >name
failed to match any fonts.
There were two solutions I imagined.
  Adding  ,*  for all font specifications in the configuration file.
  Adding  ,*  just before calling
XCreateFontSet()
. (the solution I took.)
The first solution may fail because users can rewrite the configuration file. Though it is likely
that a user knows necessary character sets for the encoding (s)he uses, the second way is safer.
And more, recent window managers are coming to support themes where a set of configuration
is packaged and distributed, just as in
http://www.themes.org/
. It is very unlikely that all
developers of these themes know this problem and adds  ,*  for every font specifications. Thus,
window managers which support themes must take the 2nd solution, though TWM does not
support themes.
Which font exactly is choosed for wild cards? It depends on the configuration of X Window
System. I imagine that the first font in the list generated by
xlsfonts
. You may think the choice
of the font should be cleverer. It would be adequate to say that  ,*  mechanism is not less cleverer;
it has entirely no intelligence. It is not clever at all. Yes, though I didn't implement it to TWM, I
also wrote a cleverer guessing mechanism.
3
1
Read
/usr/X11R6/lib/X11/locale/ja/XLC_LOCALE
for detail.
2
In such a case,
XCreateFontSet()
does not fail. Instead, it returns informations on missing fonts.
3
I implemented cleverer mechanism to window managers such as Blackbox, Sawfish, and so on where I think
beauty is important than simplicity. The intended algorithm is:
  Choose a font with similar pixel sizes.
  If availavle, choose a font with similar weight and slant.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

indiana web hosting

 

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