This section describes the following font objects:
Font sets
Fonts
Font lists
Generally, all internationalized programs expecting to draw localized text using Xlib are required to use an XmFontSet() for specifying the locale-dependent fonts. Specific fonts within a font set should be specified using XLFD naming conventions without the charset field specified. The resource name for an XFontset is *fontSet. Refer to "Localized Resources" for a list of font resources.
Applications directly using Xlib to render text (as opposed to using XmString functions or widgets) may take advantage of the string-to-fontSet converter provided by Xt. For example, the following code fragment shows how to obtain a fontset when using Xt and when not using Xt:
/* pardon the double negative... means "If using Xt..." */
#ifndef NO_XT
typedef struct {
XFontSet fontset;
char *foo;
} ApplicationData, *ApplicationData r;
static XtResource my_resources[] = {
{ XtNfontSet, XtCFontSet, XtRFontSet, sizeof (XFontSet),
XtOffset (ApplicationDataPtr, fontset), XtRString,
"*-18-*"}}
#endif /* NO_XT */
...
#ifdef NO_XT
fontset = XCreateFontSet (dpy, "*-18-*", &missing_charsets,
&num_missing_charsets. &default_string);
if (num_missing_charsets > 0) {
(void) fprintf(stderr, "&s: missing charsets.\n",
program_name);
XFreeStringList(missing_charsets);
}
#else
XtGetApplicationResources(toplevel, &data, my_resources,
XtNumber(my_resources), NULL, 0);
fontset = data.fontset;
#endif /* NO_XT */
Internationalized programs should avoid using fonts directly, that is, XFontStruct, unless they are being used for a specific charset and a specific character set. Use of XFontStruct may be limiting if the server you are connecting to does not support the specific charsets needed by a locale. The resource name for an XFontStruct is *font.
All programs using widgets or XmString to draw localized text are required to specify an XFontList name for specifying fonts. A font list is a list of one or more fontsets or fonts, or both. It is used to convey the list of fonts and fontsets a widget should use to render text. For more complicated applications, a font list may specify multiple font sets with each font set being tagged with a name; for example, Bold, Large, Small, and so on. The tags are to be associated with a tag of an XmString segment. A tag may be used to identify a specific font or fontset within a font list.