| United States-English |
|
|
|
![]() |
Common Desktop Environment: Internationalization Programmer's Guide > Chapter 1 Introduction
to InternationalizationFonts, Font Sets, and Render Tables |
|
All X clients use fonts for drawing text. The basic object used in drawing text is XFontStruct, which identifies the font that contains the images to be drawn. The desktop already supports fonts by way of the XFontStruct data structure defined by Xlib; yet, the encoding of the characters within the font must be known to an internationalized application. To communicate this information, the program expects that all fonts at the server are identified by an X Logical Font Description (XLFD) name. The XLFD name enables users to describe both the base characteristics and the charset (encoding of font glyphs). The term charset is used to denote the encoding of glyphs within the font, while the term code set means the encoding of characters within the locale. The charset for a given font is determined by the CharSetRegistry and CharSetEncoding fields of the XLFD name. Text and symbols are drawn as defined by the codes in the fonts. A font set (for example, an XFontSet data structure defined by Xlib) is a collection of one or more fonts that enables all characters defined for a given locale to be drawn. Internationalized applications may be required to draw text encoded in the code sets of the locale where the value of an encoded character is not identical to the glyph index. Additionally, multiple fonts may be required to render all characters of the locale using one or more fonts whose encodings may be different than the code set of the locale. Since both code sets and charsets may vary from locale to locale, the concept of a font set is introduced through XFontSet. While fonts are identified by their XLFD name, font sets are identified by a list of XLFD names. The list can consist of one or more XLFD names with the exception that only the base characteristics are significant; the encoding of the desired fonts is determined from the locale. Any charsets specified in the XLFD base name list are ignored and users need only concentrate on specifying the base characteristics, such as point size, style, and weight. A font set is said to be locale-sensitive and is used to draw text that is encoded in the code set of the locale. Internationalized applications should use font sets instead of font structs to render text data. Render tables are collections of renditions that specify how text is to be rendered. They are summarized elsewhere in this section. The font specification can be either an X Logical Function Description (XLFD) name or an alias for the XLFD name. For example, the following are valid font specifications for a 14-point font:
OR
The font set specification is a list of names (XLFD names or their aliases) and is sometimes called a base name list. All names are separated by commas, with any blank spaces before or after the comma being ignored. Pattern-matching (wildcard) characters can be specified to help shorten XLFD names. Remember that a font set specification is determined by the locale that is running. For example, the ja_JP Japanese locale defines three fonts (character sets) necessary to display all of its characters; the following identifies the set of Gothic fonts needed.
The preceding two cases can be used with a Japanese locale as long as fonts exist that match the base name list. The base font name list is a list of base font names associated with a font set as defined by the locale. The base font names are in a comma-separated list and are assumed to be characters from the portable character set; otherwise, the result is undefined. Blank space immediately on either side of a separating comma is ignored. Use of XLFD font names permits international applications to obtain the fonts needed for a variety of locales from a single locale-independent base font name. The single base font name specifies a family of fonts whose members are encoded in the various charsets needed by the locales of interest. An XLFD base font name can explicitly name the font's charset needed for the locale. This enables the user to specify an exact font for use with a charset required by a locale, fully controlling the font selection. If a base font name is not an XLFD name, an attempt is made to obtain an XLFD name from the font properties for the font. The following algorithm is used to select the fonts that are used to display text with font sets. For each charset required by the locale, the base font name list is searched for the first of the following cases that names a set of fonts that exist at the server.
For example, assume a locale requires the following charsets:
You can supply a base font name list that explicitly specifies the charsets, ensuring that specific fonts are used if they exist, as shown in the following example:
You can supply a base font name list that omits the charsets, which selects fonts for each required code set, as shown in the following example:
Alternatively, the user can supply a single base font name that selects from all available fonts that meet certain minimum XLFD property requirements, as shown in the following example:
A render table consists of one or more entries called renditions. Each rendition is tagged with a name that is used when drawing a compound string. For internationalized applications, renditions and render tables should be specified in resource files to ensure the independence of application binaries from the different needs of various locales. For detailed information about renditions and render tables, refer to Motif Programmer's Guide. |
|||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||